Skip to content

Patterns, parse empty record type annotation #50912

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

Closed
scheglov opened this issue Jan 5, 2023 · 3 comments
Closed

Patterns, parse empty record type annotation #50912

scheglov opened this issue Jan 5, 2023 · 3 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@scheglov
Copy link
Contributor

scheglov commented Jan 5, 2023

See co19/LanguageFeatures/Patterns/parenthesized_A01_t01, code like:

  var (() c) = empty;
@scheglov scheglov added the legacy-area-front-end Legacy: Use area-dart-model instead. label Jan 5, 2023
@scheglov
Copy link
Contributor Author

scheglov commented Jan 6, 2023

Also

String test(Record record) {
  return switch (record) {
    (: final Record case7 as ()) => "case7 = $case7",
    _ => "default"
  };
}

@scheglov
Copy link
Contributor Author

scheglov commented Jan 6, 2023

and

    case (: final () case11?):
      return "case11 = $case11";

@stereotype441
Copy link
Member

I have verified that all the examples in this issue are now correctly parsed. But there was a gap in testing (we didn't have any parser tests of variable patterns whose type was a record pattern). I'll follow up with a CL that tests that scenario.

copybara-service bot pushed a commit that referenced this issue Apr 5, 2023
This already works, but there were no parser tests of it.

Bug: #50912
Change-Id: I2e64b9b4750cf7476df59afd2f9ebc9d66299e40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293580
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

2 participants