Skip to content

Commit b586d9b

Browse files
committed
Fix #6159: Fix opaque alias
1 parent c059b64 commit b586d9b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,7 @@ object SymDenotations {
10841084
case RefinedType(_, _, TypeBounds(lo, _)) =>
10851085
def extractAlias(tp: Type): Type = tp match {
10861086
case OrType(alias, _) => alias
1087-
case HKTypeLambda(tparams, tp) =>
1088-
HKTypeLambda(tparams.map(_.paramInfo), extractAlias(tp))
1087+
case tp: HKTypeLambda => tp.derivedLambdaType(resType = extractAlias(tp.resType))
10891088
}
10901089
extractAlias(lo)
10911090
}

tests/pos/i6159.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
trait A
2+
trait B extends A
3+
4+
object O {
5+
opaque type T[X <: A] = X
6+
type U = T.U
7+
object T{
8+
type U[X <: A] = X
9+
def t(a: T[B]): T[B] = a
10+
def u(a: U[B]): U[B] = a
11+
}
12+
def t(a: T[B]): T[B] = a
13+
def u(a: T.U[B]): T.U[B] = a
14+
}

0 commit comments

Comments
 (0)