Skip to content

Commit 2eef00a

Browse files
committed
Try to figure out erasedness from the parameter's types as well
1 parent 5b0d52b commit 2eef00a

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
@@ -1506,7 +1506,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
15061506
for ((param, i) <- params.zipWithIndex) yield
15071507
if (!param.tpt.isEmpty) param
15081508
else
1509-
val (formal, isErased) = protoFormal(i)
1509+
val (formal, isProtoErased) = protoFormal(i)
15101510
val knownFormal = isFullyDefined(formal, ForceDegree.failBottom)
15111511
val paramType =
15121512
if knownFormal then formal
@@ -1517,6 +1517,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
15171517
.withType(paramType.translateFromRepeated(toArray = false))
15181518
.withSpan(param.span.endPos)
15191519
)
1520+
val isErased = isProtoErased || paramType.hasAnnotation(defn.ErasedParamAnnot)
15201521
val param1 = if isErased then param.withAddedFlags(Flags.Erased) else param
15211522
cpy.ValDef(param1)(tpt = paramTpt)
15221523
desugared = desugar.makeClosure(inferredParams, fnBody, resultTpt, isContextual, tree.span)

0 commit comments

Comments
 (0)