File tree 2 files changed +18
-1
lines changed
src/dotty/tools/dotc/typer
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1460,7 +1460,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1460
1460
}
1461
1461
case wtp : MethodType if ! pt.isInstanceOf [SingletonType ] =>
1462
1462
val arity =
1463
- if (defn.isFunctionType(pt)) defn.functionArity(pt)
1463
+ if (defn.isFunctionType(pt))
1464
+ if (! isFullyDefined(pt, ForceDegree .none) && isFullyDefined(wtp, ForceDegree .none))
1465
+ // if method type is fully defined, but expected type is not,
1466
+ // prioritize method parameter types as parameter types of the eta-expanded closure
1467
+ 0
1468
+ else defn.functionArity(pt)
1464
1469
else if (pt eq AnyFunctionProto ) wtp.paramTypes.length
1465
1470
else - 1
1466
1471
if (arity >= 0 && ! tree.symbol.isConstructor)
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def second [sA, sB <: sA](foo : sA, bar : sB): sB = bar
3
+ def third [A , B >: A ](foo : A , bar : B ): B = bar
4
+ def expectString (s : String ) = s
5
+
6
+ def test = {
7
+ val x = second(Set .empty[String ], Set .empty)
8
+ x map expectString
9
+ second(Set .empty[String ], Set .empty) map expectString
10
+ third(Set .empty[String ], Set .empty) map expectString
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments