@@ -1444,14 +1444,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1444
1444
NoType
1445
1445
}
1446
1446
1447
- lazy val calleeIsErased = calleeType.widen match {
1448
- case mt : MethodType if mt.isErasedMethod =>
1449
- val companion = mt.companion.asInstanceOf [ErasedMethodCompanion ]
1450
- params.map(p => companion.isErased(paramIndex(p.name)))
1451
- // companion.isErased
1452
- case _ => params.map(_ => false )
1453
- }
1454
-
1455
1447
pt match {
1456
1448
case pt : TypeVar
1457
1449
if untpd.isFunctionWithUnknownParamType(tree) && ! calleeType.exists =>
@@ -1467,7 +1459,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1467
1459
/** Returns the type and whether the parameter is erased */
1468
1460
def protoFormal (i : Int ): (Type , Boolean ) =
1469
1461
if (protoFormals.length == params.length) (protoFormals(i), isDefinedErased(i))
1470
- else (errorType(WrongNumberOfParameters (protoFormals.length), tree.srcPos), isDefinedErased(i) )
1462
+ else (errorType(WrongNumberOfParameters (protoFormals.length), tree.srcPos), false )
1471
1463
1472
1464
/** Is `formal` a product type which is elementwise compatible with `params`? */
1473
1465
def ptIsCorrectProduct (formal : Type ) =
@@ -1504,23 +1496,21 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1504
1496
val inferredParams : List [untpd.ValDef ] =
1505
1497
for ((param, i) <- params.zipWithIndex) yield
1506
1498
val (formal, isErased) = protoFormal(i)
1507
- val ( param0, isErased1) =
1508
- if (! param.tpt.isEmpty) ( param, false )
1499
+ val param0 =
1500
+ if (! param.tpt.isEmpty) param
1509
1501
else
1510
1502
val knownFormal = isFullyDefined(formal, ForceDegree .failBottom)
1511
- val (paramType, isErased1) =
1512
- if knownFormal then (formal, false )
1513
- else
1514
- val tpe = inferredFromTarget(param, formal, calleeType, paramIndex)
1515
- .orElse(errorType(AnonymousFunctionMissingParamType (param, tree, formal), param.srcPos))
1516
- (tpe, calleeIsErased(i))
1503
+ val paramType =
1504
+ if knownFormal then formal
1505
+ else inferredFromTarget(param, formal, calleeType, paramIndex)
1506
+ .orElse(errorType(AnonymousFunctionMissingParamType (param, tree, formal), param.srcPos))
1517
1507
val paramTpt = untpd.TypedSplice (
1518
1508
(if knownFormal then InferredTypeTree () else untpd.TypeTree ())
1519
1509
.withType(paramType.translateFromRepeated(toArray = false ))
1520
1510
.withSpan(param.span.endPos)
1521
1511
)
1522
- ( cpy.ValDef (param)(tpt = paramTpt), isErased1 )
1523
- if isErased || isErased1 then param0.withAddedFlags(Flags .Erased ) else param0
1512
+ cpy.ValDef (param)(tpt = paramTpt)
1513
+ if isErased then param0.withAddedFlags(Flags .Erased ) else param0
1524
1514
desugared = desugar.makeClosure(inferredParams, fnBody, resultTpt, isContextual, tree.span)
1525
1515
1526
1516
typed(desugared, pt)
0 commit comments