Skip to content

Commit a9c72e1

Browse files
committed
Harden IDE: Surive checkNoLeaks assertion
The problem is that the assertion in checkNoLeaks might be wrong if the widened type is erroneous. This happened during editing.
1 parent 78e80c8 commit a9c72e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
663663
val ptDefined = isFullyDefined(pt, ForceDegree.none)
664664
if (ptDefined && !(avoidingType <:< pt)) avoidingType = pt
665665
val tree1 = ascribeType(tree, avoidingType)
666-
assert(ptDefined || noLeaks(tree1), // `ptDefined` needed because of special case of anonymous classes
666+
assert(ptDefined || noLeaks(tree1) || tree1.tpe.widen.isErroneous,
667+
// `ptDefined` needed because of special case of anonymous classes
667668
i"leak: ${escapingRefs(tree1, localSyms).toList}%, % in $tree1")
668669
tree1
669670
}

0 commit comments

Comments
 (0)