diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-30 05:18:20 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-30 05:18:20 -0700 |
commit | bf0db36d8bbb0ac7faa0652b98458cfebca8e78a (patch) | |
tree | d3746ffa180541b3b7c6a60c5b1cd3bf272a7c37 /test/files | |
parent | fc14edde4cd0dde064b78b0bde35adbfd561597d (diff) | |
parent | 71581425746e9d3239998569d6f85c710efbf17b (diff) | |
download | scala-bf0db36d8bbb0ac7faa0652b98458cfebca8e78a.tar.gz scala-bf0db36d8bbb0ac7faa0652b98458cfebca8e78a.tar.bz2 scala-bf0db36d8bbb0ac7faa0652b98458cfebca8e78a.zip |
Merge pull request #2428 from hubertp/issue/7291
SI-7291: Don't throw exceptions while encountering diverging expansion.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t696.check | 10 | ||||
-rw-r--r-- | test/files/neg/t696.scala | 7 | ||||
-rw-r--r-- | test/files/run/t7291.check | 2 | ||||
-rw-r--r-- | test/files/run/t7291.scala | 19 |
4 files changed, 32 insertions, 6 deletions
diff --git a/test/files/neg/t696.check b/test/files/neg/t696.check index ac26a864a5..b7bc5cdf98 100644 --- a/test/files/neg/t696.check +++ b/test/files/neg/t696.check @@ -1,5 +1,9 @@ -t696.scala:4: error: diverging implicit expansion for type TypeUtil0.Type[Any] +t696.scala:5: error: diverging implicit expansion for type TypeUtil0.Type[Any] starting with method WithType in object TypeUtil0 - as[Any](null); + as[Any](null) ^ -one error found +t696.scala:6: error: diverging implicit expansion for type TypeUtil0.Type[X] +starting with method WithType in object TypeUtil0 + def foo[X]() = as[X](null) + ^ +two errors found diff --git a/test/files/neg/t696.scala b/test/files/neg/t696.scala index a06a32141a..ca76f7ef6c 100644 --- a/test/files/neg/t696.scala +++ b/test/files/neg/t696.scala @@ -1,6 +1,7 @@ object TypeUtil0 { - trait Type[+T]; + trait Type[+T] implicit def WithType[S,T](implicit tpeS : Type[S], tpeT : Type[T]) : Type[S with T] = null - as[Any](null); - def as[T](x : Any)(implicit tpe : Type[T]) = null; + def as[T](x : Any)(implicit tpe : Type[T]) = null + as[Any](null) + def foo[X]() = as[X](null) } diff --git a/test/files/run/t7291.check b/test/files/run/t7291.check new file mode 100644 index 0000000000..c07ba986a3 --- /dev/null +++ b/test/files/run/t7291.check @@ -0,0 +1,2 @@ +conjure +traversable diff --git a/test/files/run/t7291.scala b/test/files/run/t7291.scala new file mode 100644 index 0000000000..30c4261a81 --- /dev/null +++ b/test/files/run/t7291.scala @@ -0,0 +1,19 @@ +trait Fooable[T] +object Fooable { + implicit def conjure[T]: Fooable[T] = { + println("conjure") + new Fooable[T]{} + } + +} + +object Test { + implicit def traversable[T, Coll[_] <: Traversable[_]](implicit +elem: Fooable[T]): Fooable[Coll[T]] = { + println("traversable") + new Fooable[Coll[T]]{} + } + def main(args: Array[String]) { + implicitly[Fooable[List[Any]]] + } +} |