File tree 4 files changed +16
-2
lines changed
compiler/src/dotty/tools/dotc/transform
4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,21 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
153
153
/** Is a reference to a class but not `this.type` */
154
154
def isClassRef = sym.isClass && ! tp.isInstanceOf [ThisType ]
155
155
156
- if (! sym.exists || levelOK(sym))
156
+ /** Is this a static path or a type porjection with a static prefix */
157
+ def isStaticPathOK (tp1 : Type ): Boolean =
158
+ tp1.stripTypeVar match
159
+ case tp1 : TypeRef => tp1.symbol.is(Package ) || isStaticPathOK(tp1.prefix)
160
+ case tp1 : TermRef =>
161
+ def isStaticTermPathOK (sym : Symbol ): Boolean =
162
+ (sym.is(Module ) && sym.isStatic) ||
163
+ (sym.isStableMember && isStaticTermPathOK(sym.owner))
164
+ isStaticTermPathOK(tp1.symbol)
165
+ case tp1 : ThisType => tp1.cls.isStaticOwner
166
+ case tp1 : AppliedType => isStaticPathOK(tp1.tycon)
167
+ case tp1 : SkolemType => isStaticPathOK(tp1.info)
168
+ case _ => false
169
+
170
+ if (! sym.exists || levelOK(sym) || isStaticPathOK(tp))
157
171
None
158
172
else if (! sym.isStaticOwner && ! isClassRef)
159
173
tryHeal(sym, tp, pos)
@@ -180,7 +194,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
180
194
sym.isClass // reference to this in inline methods
181
195
)
182
196
case None =>
183
- ! sym.is(Param ) || levelOK(sym.owner)
197
+ sym.is(Package ) || sym.owner.isStaticOwner || levelOK(sym.owner)
184
198
}
185
199
186
200
/** Try to heal phase-inconsistent reference to type `T` using a local type definition.
File renamed without changes.
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments