We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b537220 commit 9d46ce1Copy full SHA for 9d46ce1
compiler/src/dotty/tools/dotc/core/Types.scala
@@ -2438,7 +2438,14 @@ object Types {
2438
private[this] var myRef: Type = null
2439
private[this] var computed = false
2440
def ref(implicit ctx: Context): Type = {
2441
- if (computed) assert(myRef != null)
+ if (computed) {
2442
+ if (myRef == null) {
2443
+ // if errors were reported previously handle this by throwing a CyclicReference
2444
+ // instead of crashing immediately. A test case is neg/i6057.scala.
2445
+ assert(ctx.reporter.errorsReported)
2446
+ CyclicReference(NoDenotation)
2447
+ }
2448
2449
else {
2450
computed = true
2451
myRef = refFn(ctx)
0 commit comments