Skip to content

Failures on Patterns parsing: improve error recovery for switch expressions. #1983

Closed
@stereotype441

Description

@stereotype441

There are new test failures on Patterns parsing: improve error recovery for switch expressions..

The tests

co19/LanguageFeatures/Patterns/type_inference_A22_t01 MissingCompileTimeError (expected Pass)

are failing on configurations

analyzer-asserts-linux
cfe-strong-linux
cfe-weak-linux

What's happening is that while parsing this code:

String test2() {
  num x = 0;
  return switch (x) {
    var y as INT => "int",
//           ^^^
// [analyzer] unspecified
// [cfe] unspecified
    final z as "String" => "String",
//             ^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
    _ => "default";
  };
}

the improved parser error recovery is allowing _ => "default"; to be parsed (previously it was skipped). So the analyzer reports:

static error failures:
- Unexpected error at line 52, column 7, length 2: HINT.UNREACHABLE_SWITCH_CASE

- Unexpected error at line 52, column 19, length 1: SYNTACTIC_ERROR.EXPECTED_TOKEN

And the CFE reports:

static error failures:
- Unexpected error at line 52, column 19: Expected '}' before this.

Metadata

Metadata

Assignees

Labels

bad-testReport tests in need of updates. When closed, the tests should be considered good

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions