Skip to content

Commit a6dcc2e

Browse files
committed
Rework healing condition
1 parent 1b03476 commit a6dcc2e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,10 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
147147
* `Some(tree)` with the `tree` of the healed type tree for `${implicitly[quoted.Type[T]]}`
148148
*/
149149
private def checkSymLevel(sym: Symbol, tp: Type, pos: SourcePosition)(implicit ctx: Context): Option[Tree] = {
150-
val isThis = tp.isInstanceOf[ThisType]
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)
150+
/** Is a reference to a class but not `this.type` */
151+
def isClassRef = sym.isClass && !tp.isInstanceOf[ThisType]
152+
153+
if (sym.exists && !sym.isStaticOwner && !isClassRef && !levelOK(sym))
158154
tryHeal(sym, tp, pos)
159155
else
160156
None

0 commit comments

Comments
 (0)