diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index a55ea1479d5a..e270cd66fdd1 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1084,8 +1084,7 @@ object SymDenotations { case RefinedType(_, _, TypeBounds(lo, _)) => def extractAlias(tp: Type): Type = tp match { case OrType(alias, _) => alias - case HKTypeLambda(tparams, tp) => - HKTypeLambda(tparams.map(_.paramInfo), extractAlias(tp)) + case tp: HKTypeLambda => tp.derivedLambdaType(resType = extractAlias(tp.resType)) } extractAlias(lo) } diff --git a/tests/pos/i6159.scala b/tests/pos/i6159.scala new file mode 100644 index 000000000000..577a497f01a9 --- /dev/null +++ b/tests/pos/i6159.scala @@ -0,0 +1,20 @@ +trait A +trait B extends A + +object O { + opaque type T[X <: A] = X + type U = T.U + object T{ + type U[X <: A] = X + def t(a: T[B]): T[B] = a + def u(a: U[B]): U[B] = a + } + def t(a: T[B]): T[B] = a + def u(a: T.U[B]): T.U[B] = a +} +object O2 { + opaque type T[X] = X + + def m(a: T[Int]) = 1 + def m(a: T[String]) = 2 +} \ No newline at end of file