Skip to content

Commit e0cce9a

Browse files
committed
lookupRefined: check for AliasingBounds instead of TypeBounds with equal bounds
It turns out that the problematic cases fixed in the previous commit only occurs because we create type aliases with info of type MatchAlias instead of TypeAlias if their rhs is an applied match type (Namer#TypeDefCompleter#typeSig calls `toBounds` on the rhs which does `if (self.isMatch) MatchAlias(self)`). I'm not sure if there is a good reason for that (and if so, do we need to be careful to avoid loops when dealiasing MatchAlias?) or if we should change the logic in Namer to return a TypeAlias instead.
1 parent be9c8be commit e0cce9a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1548,8 +1548,8 @@ object Types {
15481548
@tailrec def loop(pre: Type): Type = pre.stripTypeVar match {
15491549
case pre: RefinedType =>
15501550
pre.refinedInfo match {
1551-
case TypeBounds(lo, hi) if lo eq hi =>
1552-
if (pre.refinedName ne name) loop(pre.parent) else lo
1551+
case tp: AliasingBounds =>
1552+
if (pre.refinedName ne name) loop(pre.parent) else tp.alias
15531553
case _ =>
15541554
loop(pre.parent)
15551555
}

0 commit comments

Comments
 (0)