8322532: JShell : Unnamed variable issue

Reviewed-by: asotona
This commit is contained in:
Jan Lahoda 2024-01-05 11:34:03 +00:00
parent 78623c95f2
commit f0cfd361bd
2 changed files with 8 additions and 2 deletions

View File

@ -190,7 +190,7 @@ class CompletenessAnalyzer {
EOF(TokenKind.EOF, 0), //
ERROR(TokenKind.ERROR, XERRO), //
IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM), //
UNDERSCORE(TokenKind.UNDERSCORE, XDECL1), // _
UNDERSCORE(TokenKind.UNDERSCORE, XDECL1|XEXPR), // _
CLASS(TokenKind.CLASS, XEXPR|XDECL1|XBRACESNEEDED), // class decl (MAPPED: DOTCLASS)
MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1), // @
IMPORT(TokenKind.IMPORT, XDECL1|XSTART), // import -- consider declaration

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431
* @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431 8322532
* @summary Tests for EvaluationState.variables
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
@ -621,4 +621,10 @@ public class VariablesTest extends KullaTesting {
assertEval("var obj = new Object() { public static final String msg = \"hello\"; };");
}
public void underscoreAsLambdaParameter() { //JDK-8322532
assertAnalyze("Func f = _ -> 0; int i;",
"Func f = _ -> 0;",
" int i;", true);
}
}