-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Incorrect inexhaustivity warning when leafs are defined in an unrelated sealed trait #15029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On second thought. Maybe this is more sound. I don't know why the code I'm working on was originally organized like this—I think I can merely remove these intermediate traits. Feel free to close this if you agree! But I'll leave it open in case this is interesting. It causes another similar compiler error here (https://scastie.scala-lang.org/2ME3I1HIQuyUAe67T2jziw) |
For example,
|
There is an exhaustiveness issue here since RecordInstances isn't sealed (but the error message wording is a bit confusing: it says |
@smarter @som-snytt Apologies. It actually still fails: https://scastie.scala-lang.org/WwDjucNPS4ekVwn2977OKA Oh. You already realized that 😆 Misunderstood your comment whoops :) |
Also Scala 2 warns. |
That looks like an unrelated bug (missing substitution of RecordInstances.this into Schema), could you open a separate issue for it? |
Oh yeah... Don't know why that didn't trigger fatal warnings for me in Scala 2. The solution for me was to replace these traits with |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.1.1
Minimized code
Here is a Scastie.
The exhaustivity check fails when instances of Schema are defined in a trait.
Expectation
While it is a bit odd to define these instances in a trait, I would still expect this to correctly check exhaustivity. Scala 2 works as expected here.
The text was updated successfully, but these errors were encountered: