-
Notifications
You must be signed in to change notification settings - Fork 28
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
#1401. [Patterns] Switch expression tests #1633
#1401. [Patterns] Switch expression tests #1633
Conversation
Expect.equals("logical-or-2", test(1)); | ||
Expect.equals("logical-and-1", test(14)); | ||
Expect.equals("logical-and-2", test(13)); | ||
Expect.equals("relational-1", test(24)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the body of the test
procedure, I don't think the case of relational-1
will ever match.
"one" => 1, | ||
"two" => 2, | ||
_ => 0 | ||
}++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the ++
operator can be used here because the operand is not assignable. Similarly to the --
below.
import "../../Utils/expect.dart"; | ||
|
||
int test1(String s) => | ||
++switch (s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in another test, it seems that the application of ++
and --
in this test should result in a compile-time error because the operant isn't assignable.
@chloestefantsova I changed the tests according your notes. Please rereview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
2023-01-07 [email protected] Update test for `CONTINUE_LABEL_INVALID` (dart-lang/co19#1685) 2023-01-06 [email protected] Fixes dart-lang/co19#1653. Typos fixed in some patterns tests (dart-lang/co19#1667) 2023-01-06 [email protected] Fixes dart-lang/co19#1645. Fix typo in constant_A03_t02.dart test (dart-lang/co19#1649) 2023-01-06 [email protected] Fixes dart-lang/co19#1654. Replace || and && by | and & in negative tests (dart-lang/co19#1668) 2023-01-06 [email protected] Fixes dart-lang/co19#1655. Fix using of wrong type in list_A01_t04.dart (dart-lang/co19#1669) 2023-01-06 [email protected] Fixes dart-lang/co19#1656. Fix a typo in list_A02_t01.dart (dart-lang/co19#1670) 2023-01-06 [email protected] Fixes dart-lang/co19#1657. Don't try to test null-check pattern in irrefutable context (dart-lang/co19#1671) 2023-01-06 [email protected] Fixes dart-lang/co19#1658. Fix typos in list_A05_t06.dart (dart-lang/co19#1672) 2023-01-06 [email protected] Fixes dart-lang/co19#1659. Fix typo in logical_or_A02_t01.dart (dart-lang/co19#1673) 2023-01-06 [email protected] Fixes dart-lang/co19#1660. Fix missed compile-time error in logical_or_A04_t03.dart (dart-lang/co19#1674) 2023-01-06 [email protected] Fixes dart-lang/co19#1661. Fix logical_or_A05_t02.dart. Add missed constant (dart-lang/co19#1675) 2023-01-06 [email protected] Fixes dart-lang/co19#1662. Fix errors in map_A01_t04.dart (dart-lang/co19#1676) 2023-01-06 [email protected] Fixes dart-lang/co19#1663. map_A08_t01.dart. Don't use constants in irrefutable context (dart-lang/co19#1677) 2023-01-06 [email protected] Fixes dart-lang/co19#1664. Fix object pattern with parenthesized subpattern (dart-lang/co19#1678) 2023-01-06 [email protected] Fixes dart-lang/co19#1665. object_A06_t01.dart. Add records experimental flag (dart-lang/co19#1679) 2023-01-06 [email protected] Fixes dart-lang/co19#1666. pattern_assignment_A01_t01.dart. Use dynamic instead of Record class (dart-lang/co19#1680) 2023-01-05 [email protected] dart-lang/co19#1401. [Patterns] Switch expression tests (dart-lang/co19#1633) 2023-01-05 [email protected] Fixes dart-lang/co19#1644. Use constant object expression in relational pattern tests (dart-lang/co19#1648) 2023-01-05 [email protected] Fixes dart-lang/co19#1646. Fix typo in constant_A03_t05.dart test (dart-lang/co19#1650) 2023-01-05 [email protected] Fixes dart-lang/co19#1647. Fix typos in variable names in variable_A02_t05.dart test (dart-lang/co19#1651) 2023-01-04 [email protected] Fixes dart-lang/co19#1628. [Patterns] Type argument added to fix map pattern tests (dart-lang/co19#1638) 2023-01-04 [email protected] Fixes dart-lang/co19#1629. [Patterns] Fix logical_and_A03_t02.dart test (dart-lang/co19#1639) 2023-01-04 [email protected] Fixes dart-lang/co19#1634. Fix typo in Records/metadata_annotations_A01_t04.dart (dart-lang/co19#1640) 2023-01-04 [email protected] Fixes dart-lang/co19#1635. Fix typos in object pattern tests (dart-lang/co19#1641) 2023-01-04 [email protected] Fixes dart-lang/co19#1636. Missed `records` experimental flag added to some patterns tests (dart-lang/co19#1642) 2023-01-04 [email protected] Fixes dart-lang/co19#1637. Missed 'const' keywords added to some patterns tests (dart-lang/co19#1643) 2023-01-03 [email protected] Fixes dart-lang/co19#1629. [Patterns] Fix logical_and_A01_t02.dart test (dart-lang/co19#1631) 2023-01-03 [email protected] dart-lang/co19#1627. [Patterns] Typos in constant pattern tests fixed (dart-lang/co19#1630) 2023-01-03 [email protected] Fixes dart-lang/co19#1628. [Patterns] Type argument added to fix list pattern tests (dart-lang/co19#1632) 2022-12-30 [email protected] dart-lang/co19#1401. [Patterns] Switch statement tests (dart-lang/co19#1624) 2022-12-30 [email protected] Fixes dart-lang/co19#1625. Records experimental flag added (dart-lang/co19#1626) 2022-12-28 [email protected] dart-lang/co19#1401. [Patterns] More wildcards tests added (dart-lang/co19#1549) 2022-12-28 [email protected] Fixes dart-lang/co19#1620. Small fixes in patterns tests (dart-lang/co19#1623) 2022-12-28 [email protected] dart-lang/co19#1401. [Patterns] Pattern assignment tests (dart-lang/co19#1617) 2022-12-27 [email protected] Fixes dart-lang/co19#1619. Typos in records tests fixed (dart-lang/co19#1622) 2022-12-27 [email protected] Fixes dart-lang/co19#1618. Map pattern tests fixed, new one added (dart-lang/co19#1621) Change-Id: I3e8f23d1d842e77481ea2edb2027689a0135afdd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278511 Reviewed-by: Alexander Thomas <[email protected]> Commit-Queue: Alexander Thomas <[email protected]>
No description provided.