From bbce22137fb83b33773b198bf4aaba9417596179 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 20 Jan 2016 10:23:54 +0100 Subject: Fix #1036 Achieved by tweaking from where we get the parameter types of an eta-expansion. --- src/dotty/tools/dotc/typer/Typer.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer') 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) -- cgit v1.2.3