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

Fix tokenising for generic arrays #110

Merged
merged 1 commit into from Oct 4, 2017

Conversation

Projects
None yet
2 participants
@sadikovi
Member

sadikovi commented Sep 17, 2017

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

This pull request fixes issue with tokenising generics array. Example of code is below:

class A<T> {
  private B<T>[] arr;
}

The reason why it was broken is variable pattern that now considers either generic declaration or primitive array ([] to be precise). The solution is combining those pattern into a chain rather than OR.

Before this patch:
before

After:
after

Alternate Designs

Only one approach was considered - modifying variables pattern to handle such highlighting. Note that this is not very common in Java to use generics array like this, but is still worth fixing.

Benefits

Fixes broken highlight. Works with my generics patch and does not break tests in master + in that patch.

Possible Drawbacks

Might break other untested corner cases.

Applicable Issues

None

@sadikovi

This comment has been minimized.

Show comment
Hide comment
@sadikovi

sadikovi Sep 17, 2017

Member

@50Wliu please review. Let me know if this solution could potentially break other cases.

Member

sadikovi commented Sep 17, 2017

@50Wliu please review. Let me know if this solution could potentially break other cases.

@sadikovi

This comment has been minimized.

Show comment
Hide comment
@sadikovi

sadikovi Oct 4, 2017

Member

@50Wliu Could you have a look at this PR? Thanks!

Member

sadikovi commented Oct 4, 2017

@50Wliu Could you have a look at this PR? Thanks!

@50Wliu

This comment has been minimized.

Show comment
Hide comment
@50Wliu

50Wliu Oct 4, 2017

Member

Whoops, I didn't get a notification for this PR for some reason!

Member

50Wliu commented Oct 4, 2017

Whoops, I didn't get a notification for this PR for some reason!

@50Wliu 50Wliu merged commit 299c283 into atom:master Oct 4, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sadikovi sadikovi deleted the sadikovi:fix-generic-array branch Oct 4, 2017

@sadikovi

This comment has been minimized.

Show comment
Hide comment
@sadikovi

sadikovi Oct 4, 2017

Member

@50Wliu Thanks for merging!

Member

sadikovi commented Oct 4, 2017

@50Wliu Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment