Skip to content

Commit 1b03476

Browse files
committed
Refactor type healing conditions
1 parent a8993cc commit 1b03476

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala

+7-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,13 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
148148
*/
149149
private def checkSymLevel(sym: Symbol, tp: Type, pos: SourcePosition)(implicit ctx: Context): Option[Tree] = {
150150
val isThis = tp.isInstanceOf[ThisType]
151-
if (!isThis && !sym.is(Param) && sym.maybeOwner.isType)
152-
None
153-
else if (sym.exists && !sym.isStaticOwner && !levelOK(sym))
151+
val shouldTryHealable = {
152+
// TODO move logic to levelOK
153+
tp.isInstanceOf[ThisType] ||
154+
sym.is(Param) ||
155+
!sym.maybeOwner.isType
156+
}
157+
if (sym.exists && !sym.isStaticOwner && !levelOK(sym) && shouldTryHealable)
154158
tryHeal(sym, tp, pos)
155159
else
156160
None

0 commit comments

Comments
 (0)