diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 5b233bd98730..a35f1a55582d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -724,7 +724,7 @@ trait ImplicitRunInfo: companions ++= iscopeRefs(t.underlying) end addCompanions - def addPath(pre: Type): Unit = pre.dealias match + def addPath(pre: Type): Unit = pre.dealias.normalized match case pre: ThisType if pre.cls.is(Module) && pre.cls.isStaticOwner => addPath(pre.cls.sourceModule.termRef) case pre: TermRef if !isExcluded(pre.symbol) => @@ -817,7 +817,7 @@ trait ImplicitRunInfo: else AndType.make(apply(lo), apply(hi)) case u => apply(u) - def apply(t: Type) = t.dealias match + def apply(t: Type) = t.dealias.normalized match case t: TypeRef => if t.symbol.isClass || isAnchor(t.symbol) then t else applyToUnderlying(t) case t: TypeVar => apply(t.underlying) diff --git a/tests/pos/i20136/A_1.scala b/tests/pos/i20136/A_1.scala new file mode 100644 index 000000000000..7c8dc3ebbf52 --- /dev/null +++ b/tests/pos/i20136/A_1.scala @@ -0,0 +1,8 @@ +package a + +trait Expr: + type Value +object Expr: + type Of[V] = Expr { type Value = V } + type ExtractValue[E <: Expr] = E match + case Expr.Of[v] => v diff --git a/tests/pos/i20136/B_2.scala b/tests/pos/i20136/B_2.scala new file mode 100644 index 000000000000..54a3da158f89 --- /dev/null +++ b/tests/pos/i20136/B_2.scala @@ -0,0 +1,8 @@ +package a + +trait TC[E <: Expr]: + type Elem = Expr.ExtractValue[E] +class BIExpr extends Expr: + type Value = BigInt +class Foo extends TC[BIExpr]: + val v: Elem = 0