File tree 2 files changed +39
-2
lines changed
compiler/src/dotty/tools/dotc/typer 2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -1473,7 +1473,17 @@ trait Applications extends Compatibility {
1473
1473
}
1474
1474
}
1475
1475
1476
- /** Drop any implicit parameter section */
1476
+ /** Drop any leading type or implicit parameter sections */
1477
+ def stripInferrable (tp : Type )(using Context ): Type = tp match {
1478
+ case mt : MethodType if mt.isImplicitMethod =>
1479
+ stripInferrable(resultTypeApprox(mt))
1480
+ case pt : PolyType =>
1481
+ stripInferrable(pt.resType)
1482
+ case _ =>
1483
+ tp
1484
+ }
1485
+
1486
+ /** Drop any leading implicit parameter sections */
1477
1487
def stripImplicit (tp : Type )(using Context ): Type = tp match {
1478
1488
case mt : MethodType if mt.isImplicitMethod =>
1479
1489
stripImplicit(resultTypeApprox(mt))
@@ -2042,7 +2052,7 @@ trait Applications extends Compatibility {
2042
2052
skip(alt.widen)
2043
2053
2044
2054
def resultIsMethod (tp : Type ): Boolean = tp.widen.stripPoly match
2045
- case tp : MethodType => stripImplicit (tp.resultType).isInstanceOf [MethodType ]
2055
+ case tp : MethodType => stripInferrable (tp.resultType).isInstanceOf [MethodType ]
2046
2056
case _ => false
2047
2057
2048
2058
record(" resolveOverloaded.narrowedApplicable" , candidates.length)
Original file line number Diff line number Diff line change
1
+
2
+ class Foo
3
+
4
+ extension (dfVal : Foo )
5
+ def f0 (step : Int ): Foo = ???
6
+ def f0 : Foo = ???
7
+ val v0 = (new Foo ).f0
8
+
9
+ extension (dfVal : Foo )
10
+ def f1 [T ](step : Int ): Foo = ???
11
+ def f1 : Foo = ???
12
+ val v1 = (new Foo ).f1
13
+
14
+ extension (dfVal : Foo )
15
+ def f2 [T ](step : Int ): Foo = ???
16
+ def f2 [T ]: Foo = ???
17
+ val v2 = (new Foo ).f2
18
+
19
+ extension [A ](dfVal : Foo )
20
+ def f3 [T ](step : Int ): Foo = ???
21
+ def f3 : Foo = ???
22
+ val v3 = (new Foo ).f3
23
+
24
+ extension [A ](dfVal : Foo )
25
+ def f4 [T ](step : Int ): Foo = ???
26
+ def f4 [T ]: Foo = ???
27
+ val v4 = (new Foo ).f4
You can’t perform that action at this time.
0 commit comments