Skip to content

Commit 9bf1915

Browse files
authored
Merge pull request #3119 from dotty-staging/implicit-divergence-test
Add test for implicit divergence
2 parents 3ef4f9b + 784e249 commit 9bf1915

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/neg/implicitDivergenc.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object Test {
2+
class C[T]
3+
implicit def fGen[T](implicit ev: T): C[T] = ???
4+
implicit def fString(implicit ev: C[Int]): C[String] = ???
5+
implicit def fInt: C[Int] = ???
6+
7+
implicitly[C[String]]
8+
implicitly[C[C[String]]]
9+
implicitly[C[C[C[String]]]]
10+
implicitly[C[C[C[C[String]]]]]
11+
implicitly[C[C[C[C[C[String]]]]]]
12+
implicitly[C[C[C[C[C[C[String]]]]]]] // error: no implicit argument found (because of divergence)
13+
}

0 commit comments

Comments
 (0)