@@ -1650,11 +1650,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1650
1650
// If the expected type is a polymorphic function with the same number of
1651
1651
// type and value parameters, then infer the types of value parameters from the expected type.
1652
1652
val inferredVParams = pt match
1653
- case RefinedType (parent, nme.apply, poly @ PolyType (_, mt : MethodType ))
1654
- if (parent.typeSymbol eq defn.PolyFunctionClass )
1655
- && tparams.lengthCompare(poly.paramNames) == 0
1656
- && vparams.lengthCompare(mt.paramNames) == 0
1657
- =>
1653
+ case PolyFunctionOf (poly @ PolyType (_, mt : MethodType ))
1654
+ if tparams.lengthCompare(poly.paramNames) == 0 && vparams.lengthCompare(mt.paramNames) == 0 =>
1658
1655
vparams.zipWithConserve(mt.paramInfos): (vparam, formal) =>
1659
1656
// Unlike in typedFunctionValue, `formal` cannot be a TypeBounds since
1660
1657
// it must be a valid method parameter type.
@@ -1669,7 +1666,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1669
1666
vparams
1670
1667
1671
1668
val resultTpt = pt.dealias match
1672
- case RefinedType (parent, nme.apply, poly @ PolyType (_, mt : MethodType )) if parent.classSymbol eq defn. PolyFunctionClass =>
1669
+ case PolyFunctionOf ( poly @ PolyType (_, mt : MethodType )) =>
1673
1670
untpd.InLambdaTypeTree (isResult = true , (tsyms, vsyms) =>
1674
1671
mt.resultType.substParams(mt, vsyms.map(_.termRef)).substParams(poly, tsyms.map(_.typeRef)))
1675
1672
case _ => untpd.TypeTree ()
0 commit comments