Skip to content

Commit b5cff57

Browse files
committed
Put all code in import suggestions under a try-catch
There was a val that escaped before, which caused cyclic references raised during importSuggestions to be reported instead of being ignored.
1 parent 46bfe90 commit b5cff57

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

compiler/src/dotty/tools/dotc/typer/ImportSuggestions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ trait ImportSuggestions:
158158
// Candidates that are already available without explicit import because they
159159
// are already provided by the context (imported or inherited) or because they
160160
// are in the implicit scope of `pt`.
161-
val alreadyAvailableCandidates: Set[Symbol] = {
161+
lazy val alreadyAvailableCandidates: Set[Symbol] = {
162162
val wildProto = wildApprox(pt)
163163
val contextualCandidates = ctx.implicits.eligible(wildProto)
164164
val implicitScopeCandidates = ctx.run.nn.implicitScope(wildProto).eligible

tests/neg/i11994.check

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
-- [E046] Cyclic Error: tests/neg/i11994.scala:3:18 --------------------------------------------------------------------
1+
-- [E008] Not Found Error: tests/neg/i11994.scala:2:28 -----------------------------------------------------------------
2+
2 |implicit def foo[T <: Tuple.meow]: Unit = ??? // error
3+
| ^^^^^^^^^^
4+
| type meow is not a member of object Tuple
5+
-- [E008] Not Found Error: tests/neg/i11994.scala:3:18 -----------------------------------------------------------------
26
3 |given [T <: Tuple.meow]: Unit = ??? // error
3-
| ^
4-
| Cyclic reference involving method given_Unit
5-
|
6-
| The error occurred while trying to compute the signature of given instance given_Unit
7-
| which required to compute the signature of type T
8-
| which required to compute the signature of given instance given_Unit
9-
|
10-
| Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
11-
|
12-
| longer explanation available when compiling with `-explain`
7+
| ^^^^^^^^^^
8+
| type meow is not a member of object Tuple

0 commit comments

Comments
 (0)