diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-18 19:52:07 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-11 08:24:35 +0200 |
commit | 67e0313c046f0cfea7dab8ef6e6c6136d12e61f1 (patch) | |
tree | bad77ed35d74330a8a8b7cfe06adbf9de2cfe135 /src/dotty/tools/dotc/typer | |
parent | 8f18250f4fe494e0b6314fc2cb8e501753e79064 (diff) | |
download | dotty-67e0313c046f0cfea7dab8ef6e6c6136d12e61f1.tar.gz dotty-67e0313c046f0cfea7dab8ef6e6c6136d12e61f1.tar.bz2 dotty-67e0313c046f0cfea7dab8ef6e6c6136d12e61f1.zip |
Take environment into account when typing a closure.
Environment parameters do not count in th eresult type.
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index e35dd6c92..5604a607c 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -285,7 +285,9 @@ trait TypeAssigner { tree.withType(thenp.tpe | elsep.tpe) def assignType(tree: untpd.Closure, meth: Tree, target: Tree)(implicit ctx: Context) = - tree.withType(if (target.isEmpty) meth.tpe.widen.toFunctionType else target.tpe) + tree.withType( + if (target.isEmpty) meth.tpe.widen.toFunctionType(tree.env.length) + else target.tpe) def assignType(tree: untpd.CaseDef, body: Tree)(implicit ctx: Context) = tree.withType(body.tpe) diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 9c1110dd1..ebd33a6ff 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1273,7 +1273,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if defn.isFunctionType(wtp) && !defn.isFunctionType(pt) => pt match { case SAMType(meth) - if wtp <:< meth.info.toFunctionType => + if wtp <:< meth.info.toFunctionType() => // was ... && isFullyDefined(pt, ForceDegree.noBottom) // but this prevents case blocks from implementing polymorphic partial functions, // since we do not know the result parameter a priori. Have to wait until the |