Skip to content

Commit 3b5f552

Browse files
authored
Merge pull request #6167 from dotty-staging/fix-#6159
Fix #6159: Fix opaque alias
2 parents f62e286 + 4a17b66 commit 3b5f552

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
}
15+
object O2 {
16+
opaque type T[X] = X
17+
18+
def m(a: T[Int]) = 1
19+
def m(a: T[String]) = 2
20+
}

0 commit comments

Comments
 (0)