diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-31 16:43:56 +0700 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-31 16:43:56 +0700 |
commit | 328ded4d8f8e5c82a053253c26da7042ca657d65 (patch) | |
tree | 36ec85af9ef34cfbef241ea29d0daecd9887129b | |
parent | 39c27b6a8aaa2c7303db54011082246ada06c0a0 (diff) | |
download | dotty-328ded4d8f8e5c82a053253c26da7042ca657d65.tar.gz dotty-328ded4d8f8e5c82a053253c26da7042ca657d65.tar.bz2 dotty-328ded4d8f8e5c82a053253c26da7042ca657d65.zip |
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.
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/ElimByName.scala | 3 |
1 files changed, 2 insertions, 1 deletions
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) => |