Skip to content

Reachability warnings could be better worded #4300

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

Closed
smarter opened this issue Apr 11, 2018 · 0 comments
Closed

Reachability warnings could be better worded #4300

smarter opened this issue Apr 11, 2018 · 0 comments
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc exp:novice help wanted

Comments

@smarter
Copy link
Member

smarter commented Apr 11, 2018

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.

@smarter smarter added area:reporting Error reporting including formatting, implicit suggestions, etc exp:novice labels Apr 11, 2018
zoltanelek added a commit to zoltanelek/dotty that referenced this issue May 21, 2018
…ning

  - Used when isInstanceOf is called inside a match case
  - The new message is "this case will always be taken because the scrutinee has type `<type>`"
  - Highlights the position of `x: Int` instead of `x`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc exp:novice help wanted
Projects
None yet
Development

No branches or pull requests

2 participants