You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sealedtraitPretty { self: Color=> }
sealedtraitDull { self: Color=> }
enumColor {
casePinkextendsColorwithPrettycaseVioletextendsColourwithPrettycaseRedextendsColorwithDull
}
defdescribe(c: Colour) = c match {
caseColour.Pink|Colour.Violet=>"Pretty!"caseColour.Red=>"Dull!"
}
defdescribePartial(c: Colour) = c match { // error: would fail on case RedcaseColour.Pink|Colour.Violet=>"Pretty!"
}
defdescribePretty(c: Pretty) = c match {
caseColour.Pink|Colour.Violet=>"Pretty!"caseColour.Red=>"Pretty!"// error: Red not instance of Pretty
}
defdescribePrettyPartial(c: Pretty) = c match { // error: would fail on case VioletcaseColour.Pink=>"Pretty!"
}
defdescribeDull(c: Dull) = c match {
caseColour.Pink=>"Dull!"// error: Pink not instance of DullcaseColour.Red=>"Dull!"
}
from scala/scala3#8203
The text was updated successfully, but these errors were encountered: