We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2afc245 commit 28ac0e4Copy full SHA for 28ac0e4
compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1099,6 +1099,9 @@ class Typer extends Namer
1099
pt match {
1100
case SAMType(sam)
1101
if !defn.isFunctionType(pt) && mt <:< sam =>
1102
+ // SAMs of the form C[?] where C is a class cannot be conversion targets.
1103
+ // The resulting class `class $anon extends C[?] {...}` would be illegal,
1104
+ // since type arguments to `C`'s super constructor cannot be constructed.
1105
def isWildcardClassSAM =
1106
!pt.classSymbol.is(Trait) && pt.argInfos.exists(_.isInstanceOf[TypeBounds])
1107
val targetTpe =
tests/pos/i8012.scala
0 commit comments