@@ -119,12 +119,26 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
119
119
// Replace it with a properly encoded type splice. This is the normal for expected for type splices.
120
120
tp.prefix.select(tpnme.splice)
121
121
case tp : NamedType =>
122
- checkSymLevel(tp.symbol, tp, pos) match {
123
- case Some (tpRef) => tpRef.tpe
124
- case _ =>
125
- if (tp.symbol.is(Param )) tp
126
- else mapOver(tp)
122
+ /** Is this a static path or a type porjection with a static prefix */
123
+ def isStaticPathOK (tp1 : Type ): Boolean = tp1 match {
124
+ case tp1 : TypeRef => tp1.symbol.is(Package ) || isStaticPathOK(tp1.prefix)
125
+ case tp1 : TermRef => tp1.symbol.isStaticOwner || isStaticPathOK(tp1.prefix)
126
+ case tp1 : ThisType => tp1.tref.symbol.is(Package ) || tp1.tref.symbol.is(Module )
127
+ case tp1 : AppliedType => isStaticPathOK(tp1.tycon)
128
+ case _ : SkolemType => true
129
+ case _ => false
127
130
}
131
+
132
+ if (isStaticPathOK(tp))
133
+ if (tp.symbol.is(Param )) tp
134
+ else mapOver(tp)
135
+ else
136
+ checkSymLevel(tp.symbol, tp, pos) match {
137
+ case Some (tpRef) => tpRef.tpe
138
+ case _ =>
139
+ if (tp.symbol.is(Param )) tp
140
+ else mapOver(tp)
141
+ }
128
142
case tp : ThisType =>
129
143
assert(checkSymLevel(tp.cls, tp, pos).isEmpty)
130
144
mapOver(tp)
@@ -171,7 +185,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
171
185
sym.isClass // reference to this in inline methods
172
186
)
173
187
case None =>
174
- ! sym.is(Param ) || levelOK(sym.owner)
188
+ sym.is(Package ) || sym.owner.isStaticOwner || levelOK(sym.owner)
175
189
}
176
190
177
191
/** Try to heal phase-inconsistent reference to type `T` using a local type definition.
0 commit comments