Skip to content

Update co19 tests to reflect the changed rule about map pattern matching #1976

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
eernstg opened this issue Mar 30, 2023 · 1 comment
Closed
Assignees

Comments

@eernstg
Copy link
Member

eernstg commented Mar 30, 2023

The language team decided that map pattern matching should be 'loose' rather than 'strict', in the sense that there is no support for the rest element in a map pattern (such as the ... in {"key1": value1, ...}), and map pattern matching will allow key/value pairs to exist even though they are not matched (that is, {"key1": value1} now works in the same way as {"key1": value1, ...} used to work).

The co19 tests need to be updated correspondingly: Map patterns with ... should be a compile-time error, and existing tests using map patterns with ... should be updated to not have that, and they should expect the same behavior as they did before this change (with ... and with the old semantics). Tests about map patterns where ... did not occur should behave the same if a when clause is added where the length is tested. And tests about map patterns where ... did not occur should no longer use length to verify that there are no non-matched key-value pairs (they may still call length in order to verify that there are enough key/value pairs to satisfy the given set of field patterns).

@sgrekhov sgrekhov self-assigned this Mar 30, 2023
sgrekhov added a commit to sgrekhov/co19 that referenced this issue Mar 30, 2023
@sgrekhov
Copy link
Contributor

There are some runtime errors

@sgrekhov sgrekhov reopened this Mar 31, 2023
sgrekhov added a commit to sgrekhov/co19 that referenced this issue Mar 31, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Apr 4, 2023
2023-04-04 [email protected] Fixes dart-lang/co19#1985. Roll failures fixed (dart-lang/co19#1986)
2023-04-04 [email protected] Fixes dart-lang/co19#1983. Typo fixed in type_inference_A22_t01.dart (dart-lang/co19#1984)
2023-04-03 [email protected] Fixes dart-lang/co19#1978. Add processing of HINT.UNREACHABLE_SWITCH_CASE (dart-lang/co19#1982)
2023-04-03 [email protected] dart-lang/co19#1401. Exhaustiveness tests added (dart-lang/co19#1974)
2023-03-31 [email protected] Fixes dart-lang/co19#1976. Runtime errors fixed (dart-lang/co19#1981)
2023-03-31 [email protected] Fixes dart-lang/co19#1976. Update map pattern tests according to the new matching rules (dart-lang/co19#1977)
2023-03-31 [email protected] dart-lang/co19#1401. Additional test for the rest element of a list pattern (dart-lang/co19#1980)

Change-Id: I5be25e8f96d081028d68b5086c33b7432f1c8a66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292883
Commit-Queue: Erik Ernst <[email protected]>
Reviewed-by: Erik Ernst <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants