File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -599,10 +599,10 @@ object desugar {
599
599
constrVparamss.length > 1 ||
600
600
mods.is(Abstract ) ||
601
601
restrictedAccess ||
602
- isEnumCase && applyResultTpt.isEmpty ) anyRef
602
+ isEnumCase) anyRef
603
603
else
604
604
// todo: also use anyRef if constructor has a dependent method type (or rule that out)!
605
- (constrVparamss :\ ( if (isEnumCase) applyResultTpt else classTypeRef) ) (
605
+ (constrVparamss :\ classTypeRef) (
606
606
(vparams, restpe) => Function (vparams map (_.tpt), restpe))
607
607
def widenedCreatorExpr =
608
608
(creatorExpr /: widenDefs)((rhs, meth) => Apply (Ident (meth.name), rhs :: Nil ))
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ enum E3[-T <: Ordered[T]] {
19
19
20
20
enum E4 {
21
21
case C
22
+ case C4 (x : Int )
23
+ val x3 : Int => E4 = C4 (_)
24
+ }
25
+ object E4 {
26
+ val x1 : Int => E4 = C4 // error: found: C4, required: Int => E4
27
+ val x2 : Int => E4 = C4 (_) // ok
22
28
}
23
29
24
30
case class C4 () extends E4 // error: cannot extend enum
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ object Test6 {
105
105
case Green extends Color (3 )
106
106
case Red extends Color (2 )
107
107
case Violet extends Color (Green .x + Red .x)
108
+ case RGB (xx : Int ) extends Color (xx)
108
109
}
109
110
}
110
111
You can’t perform that action at this time.
0 commit comments