Skip to content

Commit 28ac0e4

Browse files
committed
Add explanation in comment
1 parent 2afc245 commit 28ac0e4

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,9 @@ class Typer extends Namer
10991099
pt match {
11001100
case SAMType(sam)
11011101
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.
11021105
def isWildcardClassSAM =
11031106
!pt.classSymbol.is(Trait) && pt.argInfos.exists(_.isInstanceOf[TypeBounds])
11041107
val targetTpe =

tests/pos/i8012.scala

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)