@@ -12,9 +12,9 @@ trait Substituters { this: Context =>
1212 case tp : BoundType =>
1313 if (tp.binder eq from) tp.copyBoundType(to.asInstanceOf [tp.BT ]) else tp
1414 case tp : NamedType =>
15- if (tp.currentSymbol.isStatic) tp
15+ if (tp.currentSymbol.isStatic || (tp.prefix `eq` NoPrefix ) ) tp
1616 else tp.derivedSelect(subst(tp.prefix, from, to, theMap))
17- case _ : ThisType | NoPrefix =>
17+ case _ : ThisType =>
1818 tp
1919 case _ =>
2020 (if (theMap != null ) theMap else new SubstBindingMap (from, to))
@@ -26,9 +26,9 @@ trait Substituters { this: Context =>
2626 case tp : NamedType =>
2727 val sym = tp.symbol
2828 if (sym eq from) return to
29- if (sym.isStatic && ! from.isStatic) tp
29+ if (sym.isStatic && ! from.isStatic || (tp.prefix `eq` NoPrefix ) ) tp
3030 else tp.derivedSelect(subst1(tp.prefix, from, to, theMap))
31- case _ : ThisType | _ : BoundType | NoPrefix =>
31+ case _ : ThisType | _ : BoundType =>
3232 tp
3333 case _ =>
3434 (if (theMap != null ) theMap else new Subst1Map (from, to))
@@ -42,9 +42,9 @@ trait Substituters { this: Context =>
4242 val sym = tp.symbol
4343 if (sym eq from1) return to1
4444 if (sym eq from2) return to2
45- if (sym.isStatic && ! from1.isStatic && ! from2.isStatic) tp
45+ if (sym.isStatic && ! from1.isStatic && ! from2.isStatic || (tp.prefix `eq` NoPrefix ) ) tp
4646 else tp.derivedSelect(subst2(tp.prefix, from1, to1, from2, to2, theMap))
47- case _ : ThisType | _ : BoundType | NoPrefix =>
47+ case _ : ThisType | _ : BoundType =>
4848 tp
4949 case _ =>
5050 (if (theMap != null ) theMap else new Subst2Map (from1, to1, from2, to2))
@@ -63,9 +63,9 @@ trait Substituters { this: Context =>
6363 fs = fs.tail
6464 ts = ts.tail
6565 }
66- if (sym.isStatic && ! existsStatic(from)) tp
66+ if (sym.isStatic && ! existsStatic(from) || (tp.prefix `eq` NoPrefix ) ) tp
6767 else tp.derivedSelect(subst(tp.prefix, from, to, theMap))
68- case _ : ThisType | _ : BoundType | NoPrefix =>
68+ case _ : ThisType | _ : BoundType =>
6969 tp
7070 case _ =>
7171 (if (theMap != null ) theMap else new SubstMap (from, to))
@@ -84,7 +84,7 @@ trait Substituters { this: Context =>
8484 fs = fs.tail
8585 ts = ts.tail
8686 }
87- if (sym.isStatic && ! existsStatic(from)) tp
87+ if (sym.isStatic && ! existsStatic(from) || (tp.prefix `eq` NoPrefix ) ) tp
8888 else {
8989 tp.info match {
9090 case TypeAlias (alias) =>
@@ -94,7 +94,7 @@ trait Substituters { this: Context =>
9494 }
9595 tp.derivedSelect(substDealias(tp.prefix, from, to, theMap))
9696 }
97- case _ : ThisType | _ : BoundType | NoPrefix =>
97+ case _ : ThisType | _ : BoundType =>
9898 tp
9999 case _ =>
100100 (if (theMap != null ) theMap else new SubstDealiasMap (from, to))
@@ -114,7 +114,7 @@ trait Substituters { this: Context =>
114114 fs = fs.tail
115115 ts = ts.tail
116116 }
117- if (sym.isStatic && ! existsStatic(from)) tp
117+ if (sym.isStatic && ! existsStatic(from) || (tp.prefix `eq` NoPrefix ) ) tp
118118 else tp.derivedSelect(substSym(tp.prefix, from, to, theMap))
119119 case tp : ThisType =>
120120 val sym = tp.cls
@@ -126,7 +126,7 @@ trait Substituters { this: Context =>
126126 ts = ts.tail
127127 }
128128 tp
129- case _ : ThisType | _ : BoundType | NoPrefix =>
129+ case _ : ThisType | _ : BoundType =>
130130 tp
131131 case _ =>
132132 (if (theMap != null ) theMap else new SubstSymMap (from, to))
@@ -138,9 +138,9 @@ trait Substituters { this: Context =>
138138 case tp : ThisType =>
139139 if (tp.cls eq from) to else tp
140140 case tp : NamedType =>
141- if (tp.currentSymbol.isStaticOwner) tp
141+ if (tp.currentSymbol.isStaticOwner || (tp.prefix `eq` NoPrefix ) ) tp
142142 else tp.derivedSelect(substThis(tp.prefix, from, to, theMap))
143- case _ : BoundType | NoPrefix =>
143+ case _ : BoundType =>
144144 tp
145145 case _ =>
146146 (if (theMap != null ) theMap else new SubstThisMap (from, to))
@@ -152,9 +152,9 @@ trait Substituters { this: Context =>
152152 case tp @ RecThis (binder) =>
153153 if (binder eq from) to else tp
154154 case tp : NamedType =>
155- if (tp.currentSymbol.isStatic) tp
155+ if (tp.currentSymbol.isStatic || (tp.prefix `eq` NoPrefix ) ) tp
156156 else tp.derivedSelect(substRecThis(tp.prefix, from, to, theMap))
157- case _ : ThisType | _ : BoundType | NoPrefix =>
157+ case _ : ThisType | _ : BoundType =>
158158 tp
159159 case _ =>
160160 (if (theMap != null ) theMap else new SubstRecThisMap (from, to))
@@ -166,9 +166,9 @@ trait Substituters { this: Context =>
166166 case tp : BoundType =>
167167 if (tp == from) to else tp
168168 case tp : NamedType =>
169- if (tp.currentSymbol.isStatic) tp
169+ if (tp.currentSymbol.isStatic || (tp.prefix `eq` NoPrefix ) ) tp
170170 else tp.derivedSelect(substParam(tp.prefix, from, to, theMap))
171- case _ : ThisType | NoPrefix =>
171+ case _ : ThisType =>
172172 tp
173173 case _ =>
174174 (if (theMap != null ) theMap else new SubstParamMap (from, to))
@@ -180,9 +180,9 @@ trait Substituters { this: Context =>
180180 case tp : ParamRef =>
181181 if (tp.binder == from) to(tp.paramNum) else tp
182182 case tp : NamedType =>
183- if (tp.currentSymbol.isStatic) tp
183+ if (tp.currentSymbol.isStatic || (tp.prefix `eq` NoPrefix ) ) tp
184184 else tp.derivedSelect(substParams(tp.prefix, from, to, theMap))
185- case _ : ThisType | NoPrefix =>
185+ case _ : ThisType =>
186186 tp
187187 case _ =>
188188 (if (theMap != null ) theMap else new SubstParamsMap (from, to))
0 commit comments