Skip to content

[Records] CFE doesn't correctly handle ambiguity with on clauses #49980

Closed
@alexmarkov

Description

@alexmarkov

Part of #49713.

According to the spec https://github.com/dart-lang/language/blob/master/accepted/future-releases/records/records-feature-specification.md#ambiguity-with-on-clauses try .. on .. on (a, b) {} should be parsed as try with 2 on clauses.
However, front-end incorrectly parses it as try .. on and a local function.

This causes co19/LanguageFeatures/Records/on_clauses_A01_t01 test failure with RuntimeError.

Kernel AST of this test:

    try {
      throw (42, "Lily was here");
    }
    on core::String catch(no-exception-var) {
      exp::Expect::fail("Unexpected String exception");
    }
    function on(core::int i, core::String n) → Null {
      caught = true;
    }

@johnniwinther

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions