Re: Re: non-exhaustive match warning for abstract type
Jim Newsham <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <[email protected]> |
I see. That's rather peculiar to me. I thought the whole point of sealed
was to prevent subclasses outside of the single source file, in which case
"new Abs() { }" seems to violate that.
In any case, my biggest concern is knowing how to resolve the issue, so
thanks for the suggested fix!
Regards,
Jim
On Friday, February 6, 2015 at 7:03:52 PM UTC-10, som-snytt wrote:
>
> 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] <javascript:>> 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] <javascript:>.
>> 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.