diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index dcf03d4f51c7..865f2ab7eeb2 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -2107,17 +2107,17 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) { } override def gadtBounds(sym: Symbol)(implicit ctx: Context): TypeBounds = { - footprint += sym.typeRef + if (sym.exists) footprint += sym.typeRef super.gadtBounds(sym) } override def gadtAddLowerBound(sym: Symbol, b: Type): Boolean = { - footprint += sym.typeRef + if (sym.exists) footprint += sym.typeRef super.gadtAddLowerBound(sym, b) } override def gadtAddUpperBound(sym: Symbol, b: Type): Boolean = { - footprint += sym.typeRef + if (sym.exists) footprint += sym.typeRef super.gadtAddUpperBound(sym, b) } diff --git a/tests/pos/dep-match.scala b/tests/pos/dep-match.scala new file mode 100644 index 000000000000..60907a8f5207 --- /dev/null +++ b/tests/pos/dep-match.scala @@ -0,0 +1,9 @@ +object Test { + type Foo = Int { type U } + type Bar[T] = T match { + case Unit => Unit + } + inline def baz(foo: Foo): Unit = { + val v: Bar[foo.U] = ??? + } +}