File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1653,7 +1653,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1653
1653
case SearchSuccess (inferred, _, _) =>
1654
1654
adapt(inferred, pt)
1655
1655
case failure : SearchFailure =>
1656
- if (pt.isInstanceOf [ProtoType ] && ! failure.isInstanceOf [AmbiguousImplicits ]) tree
1656
+ if (
1657
+ pt.isInstanceOf [ProtoType ] && ! failure.isInstanceOf [AmbiguousImplicits ] ||
1658
+ tree.tpe.<:< (pt)(ctx.addMode(Mode .GADTflexible ))
1659
+ ) tree
1657
1660
else err.typeMismatch(tree, pt, failure)
1658
1661
}
1659
1662
}
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments