Skip to content

Commit aa4fd6d

Browse files
committed
Update TreeChecker to ignore erased functions
Just like poly functions, erased functions stay structural until erasure.
1 parent 46edcbd commit aa4fd6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,12 @@ class TreeChecker extends Phase with SymTransformer {
392392

393393
// Polymorphic apply methods stay structural until Erasure
394394
val isPolyFunctionApply = (tree.name eq nme.apply) && tree.qualifier.typeOpt.derivesFrom(defn.PolyFunctionClass)
395+
// Erased functions stay structural until Erasure
396+
val isErasedFunctionApply = (tree.name eq nme.apply) && tree.qualifier.typeOpt.derivesFrom(defn.ErasedFunctionClass)
395397
// Outer selects are pickled specially so don't require a symbol
396398
val isOuterSelect = tree.name.is(OuterSelectName)
397399
val isPrimitiveArrayOp = ctx.erasedTypes && nme.isPrimitiveName(tree.name)
398-
if !(tree.isType || isPolyFunctionApply || isOuterSelect || isPrimitiveArrayOp) then
400+
if !(tree.isType || isPolyFunctionApply || isErasedFunctionApply || isOuterSelect || isPrimitiveArrayOp) then
399401
val denot = tree.denot
400402
assert(denot.exists, i"Selection $tree with type $tpe does not have a denotation")
401403
assert(denot.symbol.exists, i"Denotation $denot of selection $tree with type $tpe does not have a symbol, qualifier type = ${tree.qualifier.typeOpt}")

0 commit comments

Comments
 (0)