aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-12-31 16:43:56 +0700
committerMartin Odersky <odersky@gmail.com>2016-12-31 16:43:56 +0700
commit328ded4d8f8e5c82a053253c26da7042ca657d65 (patch)
tree36ec85af9ef34cfbef241ea29d0daecd9887129b /compiler/src/dotty/tools/dotc/transform
parent39c27b6a8aaa2c7303db54011082246ada06c0a0 (diff)
downloaddotty-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.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ElimByName.scala3
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) =>