File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -434,7 +434,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
434434 def widenOK =
435435 (tp2.widenSingletons eq tp2)
436436 && (tp1.widenSingletons ne tp1)
437- && recur(tp1.widenSingletons, tp2)
437+ && inFrozenGadt { recur(tp1.widenSingletons, tp2) }
438438
439439 def joinOK = tp2.dealiasKeepRefiningAnnots match {
440440 case tp2 : AppliedType if ! tp2.tycon.typeSymbol.isClass =>
Original file line number Diff line number Diff line change 1+ object A {
2+ sealed trait Expr [+ T ]
3+ final case class FooExpr () extends Expr [1 | 2 ]
4+
5+ object Test {
6+ def foo [T ](x : Expr [T ]): T = x match {
7+ case x : FooExpr =>
8+ 3 // error
9+ }
10+
11+ val x : 1 | 2 = foo(FooExpr ())
12+ }
13+ }
14+
15+ object B {
16+ trait C
17+ trait D extends C
18+ trait E extends C
19+ trait F extends C
20+ trait G extends C
21+
22+ sealed trait Expr [+ T ]
23+ final case class FooExpr [+ S >: (D & E ) | F ]() extends Expr [S ]
24+
25+ object Test {
26+ def foo [T ](x : Expr [T ]): T = x match {
27+ case x : FooExpr [(D & E ) | F ] =>
28+ new D with E
29+ }
30+
31+ val x : (D & E ) | F = foo(FooExpr [(D & E ) | F ]())
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments