-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:bug
Milestone
Description
Compiler version
v3.7.3
Minimized code
//> using scala 3.7.3
case class Foo(arg: Any)
val f = Foo(1)
val Foo(x: Int) = f //warning
Output
pattern's type Int is more specialized than the right hand side expression's type Any
If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
which may result in a MatchError at runtime.
This patch can be rewritten automatically under -rewrite -source 3.2-migration.
Expectation
Warning should be:
pattern's type Int is more specialized than the right hand side expression's type Any
If the narrowing is intentional, this can be communicated by adding `.runtimeChecked` after the expression,
which may result in a MatchError at runtime.
This patch can be rewritten automatically under -rewrite -source 3.8-migration.
Also need to check if .runtimeChecked
patch can be automatically rewritten as suggested above
He-Pin
Metadata
Metadata
Assignees
Labels
area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:bug