Skip to content
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

Unnamed pattern cannot be parsed #1037

Closed
ekpdt opened this issue Feb 2, 2024 · 0 comments
Closed

Unnamed pattern cannot be parsed #1037

ekpdt opened this issue Feb 2, 2024 · 0 comments

Comments

@ekpdt
Copy link

ekpdt commented Feb 2, 2024

$ cat > A.java <<'EOF'
public sealed interface A {
  record AA(Long a) implements A {}

  static Long mySwitch(A a) {
    switch (a) {
      case AA(_) -> {
        return 1L;
      }
    }
  }
}
EOF

$ java -jar google-java-format-1.19.2-all-deps.jar -r A.java
A.java:6:13: error: expected token: '_'; generated ) instead

$ javac A.java --enable-preview --release 21 2> /dev/null && echo ok
ok
copybara-service bot pushed a commit that referenced this issue Feb 12, 2024
Fixes #1037

PiperOrigin-RevId: 604505236
copybara-service bot pushed a commit that referenced this issue Feb 12, 2024
Fixes #1037

PiperOrigin-RevId: 604505236
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 a pull request may close this issue.

1 participant