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
I found when working on other issue that variables in for-each loops are not scoped correctly, for example:
class Test {
void func() {
// correctly highlighted in for loop
for (int i = 0; i < 10; i++) {
// do something
}
// incorrectly highlighted and scoped in for-each loop
for (int i : elements) {
// do something
}
// incorrectly highlighted and scoped in for-each loop
for (HashMap<String, String> map : elementsFunc()) {
// do something
}
}
}
Before patch:
After patch:
I simply extended the list of characters that terminate variable patterns and added : as such. Added test to cover this scenario.
Requirements
Description of the Change
I found when working on other issue that variables in for-each loops are not scoped correctly, for example:
Before patch:
After patch:
I simply extended the list of characters that terminate variable patterns and added
:
as such. Added test to cover this scenario.Alternate Designs
None were considered.
Benefits
Fixes variable highlighting in for-each loops.
Possible Drawbacks
Should not be any.
Applicable Issues
None