Skip to content

Commit d91d538

Browse files
committed
Drop redundant code
1 parent ba7c362 commit d91d538

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,23 +1673,7 @@ class Namer { typer: Typer =>
16731673
// This case applies if the closure result type contains uninstantiated
16741674
// type variables. In this case, constrain the closure result from below
16751675
// 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
16931677
case _ =>
16941678
}
16951679
WildcardType

0 commit comments

Comments
 (0)