[scala] Fix scala text bounds#2021
Merged
Merged
Conversation
Generated by 🚫 Danger |
jsotuyod
reviewed
Sep 17, 2019
| } | ||
|
|
||
| @Override | ||
| public void testingOnlySetEndLine(int i) { |
Member
There was a problem hiding this comment.
we need to get rid of these methods from the interface for 7.0.0 -_-
jsotuyod
approved these changes
Sep 17, 2019
oowekyala
added a commit
that referenced
this pull request
Sep 18, 2019
oowekyala
added a commit
to oowekyala/pmd
that referenced
this pull request
Jan 28, 2020
Javacc nodes now use this convention, and since this PR updates the test module to take implicit nodes into account, the scala module needs to be ported too. Refs pmd#2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working on pmd/pmd-designer#26 I noticed the text coordinates for scala nodes were off by one. This is because PMD's end column is inclusive. This is undesirable for many reasons but we're stuck with it until 7.0.0. For example, with inclusive column bound, it's impossible to represent an empty region without making the end column strictly smaller than the start column, which is very weird. For example, a zero-length node at the very beginning of a line has (start,end)-columns (1,0).
The Scala AST has a lot of zero-length nodes, because they're implicit, so I added an
isImplicitmethod toScalaNode.Apex also has implicit nodes, but the Jorje parser doesn't use empty text regions for those (since its tree is "semantic", it doesn't reflect correctly the source file...). An apex version of
isImplicitcould be written asLocations.isReal(node.getLoc()).This PR also contains some cleanups for the scala parser.
Also, Scala node constructors are public, which we should restrict. I think that is appropriate for 6.19.0.