Skip to content

Analyzer: case labels need some constraints checked #3528

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
DartBot opened this issue Jun 11, 2012 · 3 comments
Closed

Analyzer: case labels need some constraints checked #3528

DartBot opened this issue Jun 11, 2012 · 3 comments
Assignees
Labels
legacy-area-analyzer Use area-devexp instead.
Milestone

Comments

@DartBot
Copy link

DartBot commented Jun 11, 2012

This issue was originally filed by [email protected]


main() {
  var x = 1;
  try {
    switch(x) {
      case 0:
      case 2:
      case "false": // should error here
    }
  } catch(var e) {}
}

Given a switch statement of the form
 * switch (e) { label11 … label1j1 case e1: s1 … labeln1 ..labelnjn case en: sn default: sn+1}
 * or the form switch (e) { label11 … label1j1 case e1: s1 … labeln1 ..labelnjn case en: sn},
 * it is a compile-time error if the expressions ek are not compile-time constants,
 * of type int or String, for all 1 <= k <= n.

See tests:
  co19/Language/11_Statements/08_Switch_A05_t01.dart
  co19/Language/11_Statements/08_Switch_A05_t02.dart
  co19/Language/11_Statements/08_Switch_A06_t01.dart
  co19/Language/11_Statements/08_Switch_A06_t02.dart
   ... and friends

@scheglov
Copy link
Contributor

Set owner to @scheglov.
Added Accepted label.

@scheglov
Copy link
Contributor

@scheglov
Copy link
Contributor

@DartBot DartBot added Type-Defect legacy-area-analyzer Use area-devexp instead. labels Jun 12, 2012
@DartBot DartBot added this to the M1 milestone Jun 12, 2012
copybara-service bot pushed a commit that referenced this issue Oct 4, 2022
Changes:
```
> git log --format="%C(auto) %h %s" ec35d46..28a2503
 https://dart.googlesource.com/pub.git/+/28a2503d Bump analyzer from 4.7.0 to 5.1.0 (#3582)
 https://dart.googlesource.com/pub.git/+/8dba9574 Crc32c checksum validation and retry of archive downloads (#3546)
 https://dart.googlesource.com/pub.git/+/27da43ec Allow `dart pub add` with existing package, update constraint instead of adding (#3570)
 https://dart.googlesource.com/pub.git/+/2e9338e5  Do resolution before publishing. (#3565)
 https://dart.googlesource.com/pub.git/+/0a487534 Migrate removed command `pub` to `dart pub` in docs & messages (#3506)
 https://dart.googlesource.com/pub.git/+/e2720c27 Fail gracefully when run inside the pub-cache (#3471)
 https://dart.googlesource.com/pub.git/+/a76c1933 Upgrade `package:tar` to 0.5.6 (#3540)
 https://dart.googlesource.com/pub.git/+/c065e559 Remove unnecessary nullability (#3547)
 https://dart.googlesource.com/pub.git/+/8e306f33 Use pub.dev in writing (#3528)
 https://dart.googlesource.com/pub.git/+/08d71024 Use unicode (if available) when drawing file-lists (#3541)
 https://dart.googlesource.com/pub.git/+/a0ca4226 Don't be conservative in upgrade --major-versions without specific pa… (#3539)
 https://dart.googlesource.com/pub.git/+/a59d890e Show file size (#3509)
 https://dart.googlesource.com/pub.git/+/b0ba5cc6 Avoid packageGraph (and therefore getExecutableForCommand) depending on the lock-file (#3533)

```

Diff: https://dart.googlesource.com/pub.git/+/ec35d46261b610e558dfd0d8525ca3fc8387b4b7~..28a2503d7f4806e6854e3ed0d783f065abfd1b5f/
Change-Id: Ia366f75da16982fb9588a0d7aa18e109daea8f8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262346
Reviewed-by: Jonas Jensen <[email protected]>
Commit-Queue: Sigurd Meldgaard <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

2 participants