aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-01-20 10:23:54 +0100
committerMartin Odersky <odersky@gmail.com>2016-01-20 10:24:01 +0100
commitbbce22137fb83b33773b198bf4aaba9417596179 (patch)
tree69d2206f5dbc62d6fa0261abe8d88d2b9de528ce /src/dotty/tools/dotc/typer
parent1aa8fbb56e95d7aea04b338d3edf7d53077b804a (diff)
downloaddotty-bbce22137fb83b33773b198bf4aaba9417596179.tar.gz
dotty-bbce22137fb83b33773b198bf4aaba9417596179.tar.bz2
dotty-bbce22137fb83b33773b198bf4aaba9417596179.zip
Fix #1036
Achieved by tweaking from where we get the parameter types of an eta-expansion.
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 008eab0fd..b1e4bb48a 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1460,7 +1460,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
case wtp: MethodType if !pt.isInstanceOf[SingletonType] =>
val arity =
- if (defn.isFunctionType(pt)) defn.functionArity(pt)
+ if (defn.isFunctionType(pt))
+ if (!isFullyDefined(pt, ForceDegree.none) && isFullyDefined(wtp, ForceDegree.none))
+ // if method type is fully defined, but expected type is not,
+ // prioritize method parameter types as parameter types of the eta-expanded closure
+ 0
+ else defn.functionArity(pt)
else if (pt eq AnyFunctionProto) wtp.paramTypes.length
else -1
if (arity >= 0 && !tree.symbol.isConstructor)