You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# typed: trueclassA;endclassB1if !(self < A)raiseendvariable=T.unsafe("hello")unlessvariable.nil?puts("this is also dead")endendclassB2if !(self < A)raiseendunlessT.unsafe("hello").nil?puts("this is also dead")endend
Observed output
editor.rb:8: This code is unreachable https://srb.help/7006
8 | variable = T.unsafe("hello")
9 |
10 | unless variable.nil?
editor.rb:4: This condition was always truthy (T::Boolean)
4 | if !(self < A)
^^^^^^^^^^^
Got T::Boolean originating from:
editor.rb:4:
4 | if !(self < A)
^^^^^^^^^^^
editor.rb:19: This code is unreachable https://srb.help/7006
19 | unless T.unsafe("hello").nil?
^^^^^^^^^^^^^^^^^^^^^^
editor.rb:15: This condition was always truthy (T::Boolean)
15 | if !(self < A)
^^^^^^^^^^^
Got T::Boolean originating from:
editor.rb:15:
15 | if !(self < A)
^^^^^^^^^^^
Errors: 2
Expected behavior
In #4483, we made some changes to both tweak the error location for "This code is unreachable" errors so that it would span all the dead code in a dead block from the first dead instruction to the end of the block. That doesn't quite go far enough: it would be nice to have the error expand all the way to any downstream blocks.
This particular error code powers Sorbet's support for the LSP "Unnecessary" diagnostic tag, which instructs LSP clients to dim or gray out the unnecessary code if they wish. Since the error diagnostic stops short of highlighting all the dead code, the IDE won't highlight all the dead code.
The text was updated successfully, but these errors were encountered:
jez
added
enhancement
New feature or surprising current feature
IDE
Relating to Sorbet's LSP server or VS Code extension
labels
Feb 28, 2024
Input
→ View on sorbet.run
Observed output
Expected behavior
In #4483, we made some changes to both tweak the error location for "This code is unreachable" errors so that it would span all the dead code in a dead block from the first dead instruction to the end of the block. That doesn't quite go far enough: it would be nice to have the error expand all the way to any downstream blocks.
This particular error code powers Sorbet's support for the LSP "Unnecessary" diagnostic tag, which instructs LSP clients to dim or gray out the unnecessary code if they wish. Since the error diagnostic stops short of highlighting all the dead code, the IDE won't highlight all the dead code.
The text was updated successfully, but these errors were encountered: