@@ -1673,23 +1673,7 @@ class Namer { typer: Typer =>
1673
1673
// This case applies if the closure result type contains uninstantiated
1674
1674
// type variables. In this case, constrain the closure result from below
1675
1675
// by the parameter-capture-avoiding type of the body.
1676
- val rhsType = typedAheadExpr(mdef.rhs, tpt.tpe).tpe
1677
-
1678
- // The following part is important since otherwise we might instantiate
1679
- // the closure result type with a plain functon type that refers
1680
- // to local parameters. An example where this happens in `dependent-closures.scala`
1681
- // If the code after `val rhsType` is commented out, this file fails pickling tests.
1682
- // AVOIDANCE TODO: Follow up why this happens, and whether there
1683
- // are better ways to achieve this. It would be good if we could get rid of this code.
1684
- // It seems at least partially redundant with the nesting level checking on TypeVar
1685
- // instantiation.
1686
- if ! Config .checkLevels then
1687
- val hygienicType = TypeOps .avoid(rhsType, termParamss.flatten)
1688
- if (! hygienicType.isValueType || ! (hygienicType <:< tpt.tpe))
1689
- report.error(i " return type ${tpt.tpe} of lambda cannot be made hygienic; \n " +
1690
- i " it is not a supertype of the hygienic type $hygienicType" , mdef.srcPos)
1691
- // println(i"lifting $rhsType over $termParamss -> $hygienicType = ${tpt.tpe}")
1692
- // println(TypeComparer.explained { implicit ctx => hygienicType <:< tpt.tpe })
1676
+ typedAheadExpr(mdef.rhs, tpt.tpe).tpe
1693
1677
case _ =>
1694
1678
}
1695
1679
WildcardType
0 commit comments