File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -633,8 +633,6 @@ object TypeOps:
633633 * returned. Otherwise, `NoType` is returned.
634634 */
635635 def refineUsingParent (parent : Type , child : Symbol )(using Context ): Type = {
636- if (child.isTerm && child.is(Case , butNot = Module )) return child.termRef // enum vals always match
637-
638636 // <local child> is a place holder from Scalac, it is hopeless to instantiate it.
639637 //
640638 // Quote from scalac (from nsc/symtab/classfile/Pickler.scala):
Original file line number Diff line number Diff line change 1+ enum Bool :
2+ case True
3+ case False
4+
5+ import Bool ._
6+
7+ enum SBool [B <: Bool ]:
8+ case STrue extends SBool [True .type ]
9+ case SFalse extends SBool [False .type ]
10+
11+ import SBool ._
12+
13+ def f (b : SBool [True .type ]): Unit = b match
14+ case STrue => ()
Original file line number Diff line number Diff line change 1+ class Test {
2+ case object X ; type X = X .type
3+ case object Y ; type Y = Y .type
4+
5+ type XorY = X | Y
6+
7+ val testee1 : XorY = X
8+ testee1 match {
9+ case value : XorY => println(value)
10+ }
11+
12+ val testee2 : Tuple1 [XorY ] = Tuple1 (X )
13+ testee2 match {
14+ case Tuple1 (value : XorY ) => println(value)
15+ }
16+
17+ type IntOrString = Int | String
18+
19+ val testee3 : Tuple1 [IntOrString ] = Tuple1 (42 )
20+ testee3 match {
21+ case Tuple1 (value : IntOrString ) => println(value)
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments