-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:nullabilityarea:private optionsIssues tied to -Y private/internal compiler settings.Issues tied to -Y private/internal compiler settings.area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesgood first issuePerfect for someone who wants to get started contributingPerfect for someone who wants to get started contributingitype:enhancement
Milestone
Description
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
def f(s: String) =
val s2 = s.trim()
s2 match
case s3: String => println(1)
case _ => println(2)
Output Error/Warning message
-- [E030] Match case Unreachable Warning: Stest.scala:1026:7 -------------------
1026 | case _ => println(2)
| ^
| Unreachable case
1 warning found
Why this Error/Warning was not helpful
Should produce a better warning similar to without explicit nulls:
-- [E121] Pattern Match Warning: Stest.scala:1026:7 ----------------------------
1026 | case _ => println(2)
| ^
|Unreachable case except for null (if this is intentional, consider writing case null => instead).
1 warning found
Metadata
Metadata
Assignees
Labels
area:nullabilityarea:private optionsIssues tied to -Y private/internal compiler settings.Issues tied to -Y private/internal compiler settings.area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesgood first issuePerfect for someone who wants to get started contributingPerfect for someone who wants to get started contributingitype:enhancement