Skip to content

Conversation

@eric-milles
Copy link
Member

https://issues.apache.org/jira/browse/GROOVY-9712

Note: The parser tests that use TestUtils#doTest are silently swallowing all parser errors since there is no longer comparison against any antlr2 result.

@eric-milles
Copy link
Member Author

From the issue:

Another way of looking at this is that field/property uses the generalized-typename rule and a method's return type uses standard-typename rule. The later requires a capital letter (A-Z) as the first name character. The former has allowances for lowercase names. I'm not sure why this distinction exists in the parser.

generalClassOrInterfaceType
options { baseContext = classOrInterfaceType; }
    :   qualifiedClassName typeArguments?
    ;

standardClassOrInterfaceType
options { baseContext = classOrInterfaceType; }
    :   qualifiedStandardClassName typeArguments?
    ;

// §3.8 Identifiers (must appear after all keywords in the grammar)
CapitalizedIdentifier
: [A-Z] JavaLetterOrDigit*
: JavaLetter {Character.isUpperCase(getInputStream().LA(-1))}? JavaLetterOrDigit*
Copy link
Contributor

Choose a reason for hiding this comment

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

getInputStream().LA(-1) could be simplified as _input.LA(-1)

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM. I'll merge and include this change.

@asfgit asfgit closed this in 3425c45 Sep 9, 2020
return [newAST, null]
}

static void shouldFail(String path, boolean toCheckNewParserOnly = false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll add back in the (String, boolean) variant for binary compatibility

@eric-milles eric-milles deleted the GROOVY-9712 branch October 21, 2020 14:46
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.

3 participants