@@ -3,17 +3,17 @@ package dotty.tools.dotc.qualified_types
3
3
import scala .util .hashing .MurmurHash3 as hashing
4
4
5
5
import dotty .tools .dotc .ast .tpd .{closureDef , Apply , Block , DefDef , Ident , Literal , New , Select , Tree , TreeOps , TypeApply , Typed , TypeTree }
6
- import dotty .tools .dotc .core .Contexts .Context
6
+ import dotty .tools .dotc .core .Contexts .{ ctx , Context }
7
7
import dotty .tools .dotc .core .Decorators .i
8
8
import dotty .tools .dotc .core .Symbols .Symbol
9
- import dotty .tools .dotc .core .Types .{MethodType , TermRef , Type , TypeVar }
9
+ import dotty .tools .dotc .core .Types .{MethodType , NamedType , TermRef , Type , TypeVar }
10
10
import dotty .tools .dotc .core .Symbols .defn
11
11
12
12
import dotty .tools .dotc .reporting .trace
13
13
import dotty .tools .dotc .config .Printers
14
14
15
15
private abstract class QualifierComparer :
16
- private def typeIso (tp1 : Type , tp2 : Type ) =
16
+ protected def typeIso (tp1 : Type , tp2 : Type ) =
17
17
val tp1stripped = stripPermanentTypeVar(tp1)
18
18
val tp2stripped = stripPermanentTypeVar(tp2)
19
19
tp1stripped.equals(tp2stripped)
@@ -91,6 +91,16 @@ private[qualified_types] object QualifierStructuralComparer extends QualifierCom
91
91
override def hashCode : Int = hash(tree)
92
92
93
93
private [qualified_types] final class QualifierAlphaComparer (using Context ) extends QualifierComparer :
94
+ override protected def typeIso (tp1 : Type , tp2 : Type ): Boolean =
95
+ def normalizeType (tp : Type ): Type =
96
+ tp match
97
+ case tp : TypeVar if tp.isPermanentlyInstantiated => tp.permanentInst
98
+ case tp : NamedType =>
99
+ if tp.symbol.isStatic then tp.symbol.termRef
100
+ else normalizeType(tp.prefix).select(tp.symbol)
101
+ case tp => tp
102
+ super .typeIso(normalizeType(tp1), normalizeType(tp2))
103
+
94
104
override def iso (tree1 : Tree , tree2 : Tree ): Boolean =
95
105
trace(i " iso $tree1 ; $tree2" ):
96
106
(tree1, tree2) match
0 commit comments