Re: Re: non-exhaustive match warning for abstract type
Som Snytt <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CAPaMnL6Tv1VZ1hjt_bvLZkMBgERZcqX4JHXSM=HdCnmmz43Fbg@mail.gmail.com> |
To paraphrase, this is the one where sealedness doesn't extend to
subclasses, so you want to seal Abs:
scala> :pa
// Entering paste mode (ctrl-D to finish)
object SealedMatch {
sealed trait A
sealed abstract class Abs extends A
object B extends Abs
object C extends Abs
val value: A = ???
value match {
case B =>
case C =>
}
}
// Exiting paste mode, now interpreting.
defined object SealedMatch
On Fri, Feb 6, 2015 at 7:07 PM, Simon Ochsenreither <
[email protected]> wrote:
> Sorry, I meant subclasses of Abs:
>
> val value: A = new Abs {}
>
> --
> You received this message because you are subscribed to the Google Groups
> "scala-language" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.