Skip to content

Commit 8d7e012

Browse files
committed
Fix #7107: Avoid assertion that gets invalidated by illegal code
1 parent d589c37 commit 8d7e012

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,8 @@ object Types {
13611361
case tp: TypeRef =>
13621362
if (tp.info.isInstanceOf[TempClassInfo]) {
13631363
tp.recomputeDenot()
1364-
assert(!tp.info.isInstanceOf[TempClassInfo])
1364+
// We usually should have `!tp.info.isInstanceOf[TempClassInfo]` here, but
1365+
// this can be falsified for code with illegal cyclic references. See neg/i7107.scala.
13651366
}
13661367
tp.info.parents
13671368
case tp: TypeProxy =>

tests/neg/i7107.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
trait F[T] { type X }
2+
object Rec extends F[Rec.X] // error: X is not a member of Rec

0 commit comments

Comments
 (0)