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

Parse error with instanceof pattern matching using an array #707

Open
murdos opened this issue Dec 19, 2024 · 1 comment
Open

Parse error with instanceof pattern matching using an array #707

murdos opened this issue Dec 19, 2024 · 1 comment

Comments

@murdos
Copy link

murdos commented Dec 19, 2024

Prettier-Java 2.6.5

# Options (if any):
--print-width 80

Input:

public class Foo {
  public void bar() {
    if (!(obj instanceof Project(String otherName, String[] otherContent))) {
      return false;
    }
  }
}

Output:

Sad sad panda, parsing errors detected in line: 3, column: 61!
Expecting --> ')' <-- but found --> 'otherContent' <--!
	->compilationUnit
	->ordinaryCompilationUnit
	->typeDeclaration
	->classDeclaration
	->normalClassDeclaration
	->classBody
	->classBodyDeclaration
	->classMemberDeclaration
	->methodDeclaration
	->methodBody
	->block
	->blockStatements
	->blockStatement
	->statement
	->ifStatement
	->expression
	->conditionalExpression
	->binaryExpression
	->unaryExpression
	->primary
	->primaryPrefix
	->parenthesisExpression
	->expression
	->conditionalExpression
	->binaryExpression
	->pattern
	->recordPattern

Expected behavior:
No parsing error

@clementdessoude
Copy link
Contributor

Hi @murdos ! I think I found the bug, I just want to see if we can optimize the fix made in #708

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

No branches or pull requests

2 participants