Skip to content
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

Duplicate switch case value in dart:html #51754

Closed
johnniwinther opened this issue Mar 16, 2023 · 3 comments
Closed

Duplicate switch case value in dart:html #51754

johnniwinther opened this issue Mar 16, 2023 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-libraries Issues impacting dart:html, etc., libraries

Comments

@johnniwinther
Copy link
Member

Trying to enable the full exhaustiveness checking flags an "unreachable switch case" warning in dart:html:

output: org-dartlang-sdk:///lib/html/dart2js/html_dart2js.dart:38294:7: Warning: This case is covered by the previous cases.
      case KeyCode.WIN_KEY_LEFT:
      ^

The underlying problem is that KeyCode.WIN_KEY_LEFT and KeyCode.META have the same integer value and the case of KeyCode.META occurs before the case for KeyCode.WIN_KEY_LEFT.

@johnniwinther johnniwinther added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels Mar 16, 2023
@johnniwinther
Copy link
Member Author

cc @sigmundch

@nshahan nshahan added the web-libraries Issues impacting dart:html, etc., libraries label Mar 21, 2023
@nshahan
Copy link
Contributor

nshahan commented Mar 21, 2023

cc @srujzs

@srujzs
Copy link
Contributor

srujzs commented Mar 22, 2023

Seems like the duplicate value was intentional based on https://github.com/google/closure-library/blob/master/closure/goog/events/keycodes.js. Key codes in general are deprecated, so not sure what the status of this code's correctness is. Since META == WIN_KEY_LEFT, I think the right answer is just to remove the second case since it never triggers. https://dart-review.googlesource.com/c/sdk/+/290702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

3 participants