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 04b0e85 commit 64a71f6Copy full SHA for 64a71f6
src/dotty/tools/dotc/typer/Typer.scala
@@ -1605,7 +1605,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1605
}
1606
tree
1607
1608
- else if (tree.tpe <:< pt) tree
+ else if (tree.tpe.<:<(pt)(ctx.addMode(Mode.GADTflexible))) tree
1609
else if (wtp.isInstanceOf[MethodType]) missingArgs
1610
else {
1611
typr.println(i"adapt to subtype ${tree.tpe} !<:< $pt")
tests/pos/i1307.scala
@@ -0,0 +1,7 @@
1
+class Term[A]
2
+class Number(val n: Int) extends Term[Int]
3
+object Test {
4
+ def f[B](t: Term[B]): B = t match {
5
+ case y: Number => y.n
6
+ }
7
+}
0 commit comments