aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
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)