File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -1099,10 +1099,10 @@ class Typer extends Namer
1099
1099
pt match {
1100
1100
case SAMType (sam)
1101
1101
if ! defn.isFunctionType(pt) && mt <:< sam =>
1102
+ def isWildcardClassSAM =
1103
+ ! pt.classSymbol.is(Trait ) && pt.argInfos.exists(_.isInstanceOf [TypeBounds ])
1102
1104
val targetTpe =
1103
- if isFullyDefined(pt, ForceDegree .all)
1104
- && ! pt.argInfos.exists(_.isInstanceOf [TypeBounds ])
1105
- then
1105
+ if isFullyDefined(pt, ForceDegree .all) && ! isWildcardClassSAM then
1106
1106
pt
1107
1107
else if pt.isRef(defn.PartialFunctionClass ) then
1108
1108
// Replace the underspecified expected type by one based on the closure method type
Original file line number Diff line number Diff line change
1
+
2
+
3
+ @ FunctionalInterface
4
+ abstract class Q [A ] {
5
+ def apply (a : A ): Int
6
+ }
7
+
8
+ trait T [A ]
9
+
10
+ class C extends Q [? ] // error: Type argument must be fully defined
11
+ class D extends T [? ] // error: Type argument must be fully defined
12
+
13
+ object O {
14
+ def m (i : Int ): Int = i
15
+ val x : Q [_] = m // error: result type of lambda is an underspecified SAM type Q[?]
16
+ }
You can’t perform that action at this time.
0 commit comments