Skip to content

Commit 739dec3

Browse files
committed
Revive original test
Make another test to exercise the original large search behavior
1 parent 4fb5b17 commit 739dec3

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class CompilationTests {
183183
compileFile("tests/neg-custom-args/feature-shadowing.scala", defaultOptions.and("-Xfatal-warnings", "-feature")),
184184
compileDir("tests/neg-custom-args/hidden-type-errors", defaultOptions.and("-explain")),
185185
compileFile("tests/neg-custom-args/i13026.scala", defaultOptions.and("-print-lines")),
186+
compileFile("tests/neg-custom-args/i13838.scala", defaultOptions.and("-Ximplicit-search-limit", "1000")),
186187
).checkExpectedErrors()
187188
}
188189

tests/neg-custom-args/i13838.check

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- Error: tests/neg-custom-args/i13838.scala:10:5 ----------------------------------------------------------------------
2+
10 | foo // error
3+
| ^
4+
|no implicit argument of type Order[X] was found for parameter x$1 of method foo in object FooT
5+
|
6+
|where: X is a type variable
7+
|.
8+
|I found:
9+
|
10+
| FooT.OrderFFooA[F, A](FooT.OrderFFooA[F, A](/* missing */summon[Order[F[Foo[A]]]]))
11+
|
12+
|But given instance OrderFFooA in object FooT produces a diverging implicit search when trying to match type Order[F[Foo[A]]].
13+
-- [E168] Type Warning: tests/neg-custom-args/i13838.scala:10:5 --------------------------------------------------------
14+
10 | foo // error
15+
| ^
16+
| Implicit search problem too large.
17+
| an implicit search was terminated with failure after trying 1000 expressions.
18+
| The root candidate for the search was:
19+
|
20+
| given instance OrderFFooA in object FooT for Order[Any]}
21+
|
22+
| You can change the behavior by setting the `-Ximplicit-search-limit` value.
23+
| Smaller values cause the search to fail faster.
24+
| Larger values might make a very large search problem succeed.
25+
26+
longer explanation available when compiling with `-explain`

tests/neg/i13838.scala renamed to tests/neg-custom-args/i13838.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ object Foo:
55
given [A: Eq]: Eq[Foo[A]] = ???
66

77
object FooT:
8-
def liftF[F[_], A](fa: F[A]): F[Foo[A]] = map(fa)(???) // error
8+
9+
def foo[X](using Order[X]): Unit = ???
10+
foo // error
911

1012
def map[F[_], A](ffa: F[Foo[A]])(f: A): Nothing = ???
1113

0 commit comments

Comments
 (0)