Skip to content

Commit d78b8c0

Browse files
authored
Merge pull request #6431 from milessabin/topic/dep-match
Check for symbol existence when working with GADT bounds in TypeComparer
2 parents 85a53dd + 0b57c1d commit d78b8c0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -2158,17 +2158,17 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
21582158
}
21592159

21602160
override def gadtBounds(sym: Symbol)(implicit ctx: Context): TypeBounds = {
2161-
footprint += sym.typeRef
2161+
if (sym.exists) footprint += sym.typeRef
21622162
super.gadtBounds(sym)
21632163
}
21642164

21652165
override def gadtAddLowerBound(sym: Symbol, b: Type): Boolean = {
2166-
footprint += sym.typeRef
2166+
if (sym.exists) footprint += sym.typeRef
21672167
super.gadtAddLowerBound(sym, b)
21682168
}
21692169

21702170
override def gadtAddUpperBound(sym: Symbol, b: Type): Boolean = {
2171-
footprint += sym.typeRef
2171+
if (sym.exists) footprint += sym.typeRef
21722172
super.gadtAddUpperBound(sym, b)
21732173
}
21742174

tests/pos/dep-match.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
object Test {
2+
type Foo = Int { type U }
3+
type Bar[T] = T match {
4+
case Unit => Unit
5+
}
6+
inline def baz(foo: Foo): Unit = {
7+
val v: Bar[foo.U] = ???
8+
}
9+
}

0 commit comments

Comments
 (0)