Skip to content

Commit

Permalink
Fix some more tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Nov 8, 2023
1 parent c362ae3 commit 6c07fc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3234,6 +3234,9 @@ public void testBug399781() {
};
String usLevel = this.complianceLevel < ClassFileConstants.JDK9 ? "WARNING" : "ERROR";
String errorMessage = this.complianceLevel < ClassFileConstants.JDK9 ? "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" : "\'_\' is a keyword from source level 9 onwards, cannot be used as identifier\n";
if (this.complianceLevel >= ClassFileConstants.JDK21) {
errorMessage = "Unnamed Patterns and Variables is a preview feature and disabled by default. Use --enable-preview to enable\n";
}
String expectedProblemLog =
"----------\n" +
"1. " + usLevel +" in X.java (at line 2)\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4232,6 +4232,7 @@ && isIndirectlyInsideFieldInitialization()) { // enum initializers indeed need m
case TokenNamesuper: // e.g. super[.]fred()
this.invocationType = SUPER_RECEIVER;
break;
case TokenNameUNDERSCORE:
case TokenNameIdentifier: // e.g. bar[.]fred()
if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_BETWEEN_NEW_AND_LEFT_BRACKET) {
if (this.identifierPtr != prevIdentifierPtr) { // if identifier has been consumed, e.g. this.x[.]fred()
Expand All @@ -4246,6 +4247,7 @@ && isIndirectlyInsideFieldInitialization()) { // enum initializers indeed need m
case TokenNameCOLON_COLON:
this.inReferenceExpression = true;
break;
case TokenNameUNDERSCORE:
case TokenNameIdentifier:
if (this.inReferenceExpression)
break;
Expand Down Expand Up @@ -4317,6 +4319,7 @@ && isInsideSwitch() && checkYieldKeyword()) {
this.qualifier = this.expressionPtr; // remenber the last expression so that arguments are correctly computed
}
switch (previous) {
case TokenNameUNDERSCORE:
case TokenNameIdentifier: // e.g. fred[(]) or foo.fred[(])
if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SELECTOR) {
int info = 0;
Expand Down Expand Up @@ -4436,6 +4439,7 @@ && isInsideSwitch() && checkYieldKeyword()) {
pushOnElementStack(K_BETWEEN_LEFT_AND_RIGHT_BRACKET);
} else {
switch (previous) {
case TokenNameUNDERSCORE:
case TokenNameIdentifier:
case TokenNameboolean:
case TokenNamebyte:
Expand Down

0 comments on commit 6c07fc4

Please sign in to comment.