Skip to content

Parse error with instanceof pattern matching using an array #707

@murdos

Description

@murdos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions