Skip to content

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