From 328ded4d8f8e5c82a053253c26da7042ca657d65 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 31 Dec 2016 16:43:56 +0700 Subject: Fix #1732: Special treatment for bottom type by-name args If a by-name arg has a bottom type, we need to create a closure with the result type of the formal parameter, or else specialization with FunctionalInterfaces will fail. --- compiler/src/dotty/tools/dotc/transform/ElimByName.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/src/dotty') diff --git a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala index 71ced3175..2814baf1e 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala @@ -71,7 +71,8 @@ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransform def transformArg(arg: Tree, formal: Type): Tree = formal.dealias match { case formalExpr: ExprType => - val argType = arg.tpe.widenIfUnstable + var argType = arg.tpe.widenIfUnstable + if (defn.isBottomType(argType)) argType = formal.widenExpr val argFun = arg match { case Apply(Select(qual, nme.apply), Nil) if qual.tpe.derivesFrom(defn.FunctionClass(0)) && isPureExpr(qual) => -- cgit v1.2.3