Skip to content

Patterns, parsing record type annotations in pattern #50929

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 7, 2023 · 1 comment
Closed

Patterns, parsing record type annotations in pattern #50929

scheglov opened this issue Jan 7, 2023 · 1 comment
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@scheglov
Copy link
Contributor

scheglov commented Jan 7, 2023

void f() {
  var ((int, {int a}) b) = (0, a: 1);
}

This crashes

  'package:analyzer/src/fasta/ast_builder.dart': Failed assertion: line 4619 pos 12: 'optional(':', colon)': is not true.
  #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
  #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
  #2      AstBuilder.handleMapPatternEntry (package:analyzer/src/fasta/ast_builder.dart:4619:12)
  #3      Parser.parseMapPatternSuffix (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9648:18)
  #4      Parser.parsePrimaryPattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9367:17)
  #5      Parser.parsePattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9277:13)
  #6      Parser.parseParenthesizedPatternOrRecordPattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9727:15)
  #7      Parser.parsePrimaryPattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9394:15)
  #8      Parser.parsePattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9277:13)
  #9      Parser.parseParenthesizedPatternOrRecordPattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9727:15)
  #10     Parser.parsePrimaryPattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9394:15)
  #11     Parser.parsePattern (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9277:13)
  #12     Parser.parsePatternVariableDeclarationStatement (package:_fe_analyzer_shared/src/parser/parser_impl.dart:9897:19)
@stereotype441
Copy link
Member

I've verified that this now works.

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