diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/bug696.check | 3 | ||||
-rw-r--r-- | test/files/neg/divergent-implicit.check | 17 | ||||
-rw-r--r-- | test/files/neg/divergent-implicit.scala | 16 | ||||
-rwxr-xr-x | test/files/run/existentials.scala | 2 |
4 files changed, 36 insertions, 2 deletions
diff --git a/test/files/neg/bug696.check b/test/files/neg/bug696.check index 7d9d2687b0..623c95f62c 100644 --- a/test/files/neg/bug696.check +++ b/test/files/neg/bug696.check @@ -1,4 +1,5 @@ -bug696.scala:4: error: no implicit argument matching parameter type TypeUtil0.Type[Any] was found. +bug696.scala:4: error: diverging implicit expansion for type TypeUtil0.Type[Any] +starting with method WithType in object TypeUtil0 as[Any](null); ^ one error found diff --git a/test/files/neg/divergent-implicit.check b/test/files/neg/divergent-implicit.check new file mode 100644 index 0000000000..8d57f92716 --- /dev/null +++ b/test/files/neg/divergent-implicit.check @@ -0,0 +1,17 @@ +divergent-implicit.scala:4: error: diverging implicit expansion for type (Int) => B +starting with method cast in object Test1 + val x1: String = 1 + ^ +divergent-implicit.scala:5: error: diverging implicit expansion for type (Int) => String +starting with method cast in object Test1 + val x2: String = cast[Int, String](1) + ^ +divergent-implicit.scala:14: error: diverging implicit expansion for type (Test2.Baz) => Test2.Bar +starting with method baz2bar in object Test2 + val x: Bar = new Foo + ^ +divergent-implicit.scala:15: error: diverging implicit expansion for type (Test2.Foo) => Test2.Bar +starting with method foo2bar in object Test2 + val y: Bar = new Baz + ^ +four errors found diff --git a/test/files/neg/divergent-implicit.scala b/test/files/neg/divergent-implicit.scala new file mode 100644 index 0000000000..4a356d54f7 --- /dev/null +++ b/test/files/neg/divergent-implicit.scala @@ -0,0 +1,16 @@ +object Test1 { + implicit def cast[A, B](x: A)(implicit c: A => B): B = c(x) + + val x1: String = 1 + val x2: String = cast[Int, String](1) +} +object Test2 { + class Foo + class Bar + class Baz + implicit def foo2bar(x: Foo)(implicit baz2bar: Baz => Bar): Bar = baz2bar(new Baz) + implicit def baz2bar(x: Baz)(implicit foo2bar: Foo => Bar): Bar = foo2bar(new Foo) + + val x: Bar = new Foo + val y: Bar = new Baz +} diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala index 9dc9855a75..42711df5f2 100755 --- a/test/files/run/existentials.scala +++ b/test/files/run/existentials.scala @@ -62,7 +62,7 @@ object Test extends Application { case _ => } - def fooW(x : Counter[_] { def name : String }) = x match { + def fooW(x : Counter[T] { def name : String } forSome { type T }) = x match { case ctr: Counter[t] => val c = ctr.newCounter println(ctr.name+" "+ctr.get(ctr.inc(ctr.inc(c)))) |