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

Multiple members pattern in switch expression not fully supported #665

Open
NolwennD opened this issue Apr 30, 2024 · 0 comments · May be fixed by #666
Open

Multiple members pattern in switch expression not fully supported #665

NolwennD opened this issue Apr 30, 2024 · 0 comments · May be fixed by #666

Comments

@NolwennD
Copy link

Prettier-Java 3.2.5

Input:

public sealed interface SadPanda {

  default String cry() {
    return switch(this) {
      case A _, B _, C _ -> "A lot";
    };
  }

  record A() implements SadPanda {}
  record B() implements SadPanda {}
  record C() implements SadPanda {}
}

Output:

npx prettier src/main/java/SadPanda.java 
[error] src/main/java/SadPanda.java: Error: Sad sad panda, parsing errors detected in line: 6, column: 19!
[error] Expecting --> '->' <-- but found --> '_' <--!
[error]         ->compilationUnit
[error]         ->ordinaryCompilationUnit
[error]         ->typeDeclaration
[error]         ->interfaceDeclaration
[error]         ->normalInterfaceDeclaration
[error]         ->interfaceBody
[error]         ->interfaceMemberDeclaration
[error]         ->interfaceMethodDeclaration
[error]         ->methodBody
[error]         ->block
[error]         ->blockStatements
[error]         ->blockStatement
[error]         ->statement
[error]         ->statementWithoutTrailingSubstatement
[error]         ->returnStatement
[error]         ->expression
[error]         ->ternaryExpression
[error]         ->binaryExpression
[error]         ->unaryExpression
[error]         ->primary
[error]         ->primaryPrefix
[error]         ->switchStatement
[error]         ->switchBlock
[error]         ->switchRule

Expected behavior:

@jtkiesel jtkiesel linked a pull request May 1, 2024 that will close this issue
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