File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -695,14 +695,12 @@ object SpaceEngine {
695695
696696 extension (tp : Type )
697697 def isDecomposableToChildren (using Context ): Boolean =
698- val sym = tp.typeSymbol // e.g. Foo[List[Int]] = type Foo (i19275)
699698 val cls = tp.classSymbol // e.g. Foo[List[Int]] = class List
700699 tp.hasSimpleKind // can't decompose higher-kinded types
701700 && cls.is(Sealed )
702701 && cls.isOneOf(AbstractOrTrait ) // ignore sealed non-abstract classes
703702 && ! cls.hasAnonymousChild // can't name anonymous classes as counter-examples
704703 && cls.children.nonEmpty // can't decompose without children
705- && ! sym.isOpaqueAlias // can't instantiate subclasses to conform to an opaque type (i19275)
706704
707705 val ListOfNoType = List (NoType )
708706 val ListOfTypNoType = ListOfNoType .map(Typ (_, decomposed = true ))
Original file line number Diff line number Diff line change 1+ opaque type R [T ] <: T = T
2+
3+ object Test {
4+ enum E :
5+ case A (a : Int )
6+
7+ val v : R [E ] = ???
8+ v match
9+ case E .A (_) =>
10+ }
11+
12+ sealed trait Foo
13+
14+ case class FooA () extends Foo
15+ case class FooB () extends Foo
16+
17+ object O {
18+ opaque type OpaqueFoo <: Foo = Foo
19+ def fooB (): OpaqueFoo = FooB ()
20+ }
21+
22+ @ main def main =
23+ val p : O .OpaqueFoo = O .fooB()
24+
25+ p match
26+ case _ : FooA => println(" fooA" )
27+ case _ : FooB => println(" fooB" )
You can’t perform that action at this time.
0 commit comments