Skip to content

IDE: Fix crash on malformed input #5151

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

Merged
merged 1 commit into from
Sep 24, 2018
Merged

Conversation

smarter
Copy link
Member

@smarter smarter commented Sep 24, 2018

When converting a dotty position into an lsp4j position, we need to
carefully handle NoPosition to avoid assertion errors on methods like
Position#start. To be safe, this commit now always checks if
Position#exists is true before doing the conversion. This fixes a crash
demonstrated by the added test.

When converting a dotty position into an lsp4j position, we need to
carefully handle NoPosition to avoid assertion errors on methods like
Position#start. To be safe, this commit now always checks if
Position#exists is true before doing the conversion. This fixes a crash
demonstrated by the added test.
@smarter smarter added this to the 0.10 Tech Preview milestone Sep 24, 2018
Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern with this change is that it will silence some bugs with positions (i.e. a position is expected but we get NoPosition).

Otherwise LGTM

@smarter
Copy link
Member Author

smarter commented Sep 24, 2018

In general, it's hard to know if we're missing a position because of a bug or because the input is just very weird. It seems best to not assume too much and be conservative.

@smarter smarter merged commit a4b60c4 into scala:master Sep 24, 2018
@allanrenucci allanrenucci deleted the fix-nopos branch September 24, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants