Aladdin - Scala Bugtracking
[#900] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Martin fixed 2007-01-17 19:33:03.0
subject trying implicits instead of widening
code
trait Foo {
        type bar
        val x : bar
        def break(): x.type
}
what happened
lamppc31:/localhome/buraq/svn/scala> ./build/quick/bin/scalac -d /tmp /tmp/escape.scala
/tmp/escape.scala:4: error: ambiguous implicit value:
 both method any2stringadd in object Predef of type (scala.Any)scala.runtime.StringAdd
 and method any2ArrowAssoc in object Predef of type [a](a)scala.Predef.ArrowAssoc[a]
 are possible conversion functions from Foo.this.x.type to java.lang.Object
        def break(): x.type
                     ^
one error found
what expected
  1. x is not an implicit value!
  2. this should type check fine (erase to bound Any i.e. later Object)
[back to overview]
Changes of this bug report
Burak  edited on  2007-01-17 19:33:11.0
Martin  edited on  2007-01-23 19:36:18.0
You now get a longer, and hopefully vlearer error message:
bug900.scala:4: error: type mismatch;
 found   : Foo.this.x.type (with underlying type Foo.this.bar)
 required: java.lang.Object
Implicit conversions are not applicable because of ambiguous implicit values:
 both method any2stringadd in object Predef of type (scala.Any)scala.runtime.StringAdd
 and method any2ArrowAssoc in object Predef of type [a](a)scala.Predef.ArrowAssoc[a]
 are possible conversion functions from Foo.this.x.type to java.lang.Object
        def break(): x.type
                     ^
one error found