Skip to content

Reachability warnings could be better worded #4300

@smarter

Description

@smarter
scala> def foo(a: Int) = a match { case x: Int => x } 
1 |def foo(a: Int) = a match { case x: Int => x }
  |                                 ^
  |this will always yield true, since `class Int` is a subclass of `class Int`

The reason given is a tautology, It would make more sense to say something like "this case will always be taken because the scrutinee `a` has type Int".
Also, the highlighted position is the position of x, but it would be more intuitive to highlight the position of x: Int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions