-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Better warning for matching values with flexible types in explicit nulls #21577
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
As per my preliminary investigation what i found is this warning was introduced since 3.0.2. So if we look at the Scala compiler 3.0.0, 3.0.1 and 3.0.2 we receive following response from compiler after defining method f with the given signature and body. Also, If we consider this case: |
Adds a more detailed warning message when a wildcard case is unreachable on an non-nullable type to suggest adding a nullable type annotation. Fixes scala#21577
Adds a more detailed warning message when a wildcard case is unreachable on an non-nullable type to suggest adding a nullable type annotation. Fixes scala#21577
…(scala#21577) Adds a more detailed warning message when a wildcard case is only reachable by null under explict nulls flag. Fixes scala#21577
…(scala#21577) Adds a more detailed warning message when a wildcard case is only reachable by null under explict nulls flag. Fixes scala#21577
…(scala#21577) Adds a more detailed warning message when a wildcard case is only reachable by null under explict nulls flag. Fixes scala#21577
…(scala#21577) Adds a more detailed warning message when a wildcard case is only reachable by null under explict nulls flag. Fixes scala#21577
The code is from discussion in Scala 3.5.0 unreachable case which was working with 3.4.2.
Compiler version
Since 3.5 (after the flexible type was introduced)
Minimized example
-Yexplicit-nulls
Output Error/Warning message
Why this Error/Warning was not helpful
Should produce a better warning similar to without explicit nulls:
The text was updated successfully, but these errors were encountered: