File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -599,10 +599,10 @@ object desugar {
599599 constrVparamss.length > 1 ||
600600 mods.is(Abstract ) ||
601601 restrictedAccess ||
602- isEnumCase && applyResultTpt.isEmpty ) anyRef
602+ isEnumCase) anyRef
603603 else
604604 // 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) (
606606 (vparams, restpe) => Function (vparams map (_.tpt), restpe))
607607 def widenedCreatorExpr =
608608 (creatorExpr /: widenDefs)((rhs, meth) => Apply (Ident (meth.name), rhs :: Nil ))
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ enum E3[-T <: Ordered[T]] {
1919
2020enum E4 {
2121 case C
22+ case C4 (x : Int )
23+ }
24+ object E4 {
25+ val x1 : Int => E4 = C4 // error: found: C4, required: Int => E4
26+ val x2 : Int => E4 = C4 (_) // ok
2227}
2328
2429case class C4 () extends E4 // error: cannot extend enum
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ object Test6 {
105105 case Green extends Color (3 )
106106 case Red extends Color (2 )
107107 case Violet extends Color (Green .x + Red .x)
108+ case RGB (xx : Int ) extends Color (xx)
108109 }
109110}
110111
You can’t perform that action at this time.
0 commit comments