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

None of the patterns in the switch expression the matched after hot-reload #55350

Closed
petrnymsa opened this issue Apr 2, 2024 · 2 comments
Closed
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-hot-reload

Comments

@petrnymsa
Copy link

Issue originally discussed on X (Twitter) with @mraleph.

Example project with a reproducible issue is originally stripped down version of our large project. I tried to minimize code to absolute minimum with some files which I believe are interesting and related to this issues.

What is happening?

Project is monorepo based application. Application is in apps folder and there is also core packages containing some "core" domain types.

We have enhanced enum ModuleType in "core" package. This enum describes available module of app (doesn't really matter for issue]. In app there is module_type_extension - a extension on ModuleType with simple switch expression returning some value based on ModuleType's value (for example path to icon).

After hot-reload sometimes issue appears:

None of the patterns in the switch expression the matched input value. See https://github.com/dart-lang/language/issues/3488 for details

but I don't understand why.

Some noticeable things

  • issues is gone if we remove "BlocBuilder" (Flutter_Bloc) from home_page
  • issue is gone if I completely remove apps/patterns_repro/lib/shared/widgets/dialogs/action/action_dialog.dart - this file is not used by home_page and related widgets BUT still somehow affects.

What I suspect: Issues seems to be related somehow to "barell" files and cyclic imports and exports. But my knowledge is falling behind to understand it.

How to repro step by step

  • Run project on Android or iOS (emulator or rea device, should not matter)
  • Change value of height on line 9 in apps/patterns_repro/lib/modules/home/widgets/enabled_modules_view.dart. (Or just anything there to invoke hot reload)
  • Notice that mentioned issue appears

However like I said before

  • Remove action_dialog.dart
  • Uncomment lines 23 - 27 in home_page.dart returning EnabledModulesView directly. Issues seems to be gone no matter how ModyleType type is imported.

Dart and Flutter versions

Flutter 3.19.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 68bfaea224 (12 days ago) • 2024-03-20 15:36:31 -0700
Engine • revision a5c24f538d
Tools • Dart 3.3.2 • DevTools 2.31.1

NOTE: Tested on different machines with Windows and MacOS.

Link to project: https://github.com/petrnymsa/dart-pattern-none-issue

@lrhn lrhn added vm-hot-reload area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Apr 2, 2024
@a-siva
Copy link
Contributor

a-siva commented Apr 3, 2024

@petrnymsa There doesn't seem to be any licensing information associated with the code you provided for reproduction,, would it be possible to extract a reproduction into a simpler test case and post it here or add an open source license to your code that permits us to use the reproduction you have.

@a-siva a-siva added the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Apr 3, 2024
@petrnymsa
Copy link
Author

@petrnymsa There doesn't seem to be any licensing information associated with the code you provided for reproduction,, would it be possible to extract a reproduction into a simpler test case and post it here or add an open source license to your code that permits us to use the reproduction you have.

Added LICENSE - MIT. Code is similar to minimal version from our, private project, but classes are renamed and simplified.

@github-actions github-actions bot removed the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Apr 4, 2024
@rmacnak-google rmacnak-google self-assigned this Apr 4, 2024
copybara-service bot pushed a commit that referenced this issue Apr 10, 2024
…ly running bottom up.

Re-evaluating enum constants from kernel may create new const instances of any type via enhanced enum fields, which conflicts with retaining the canonical bit on old const instances.

TEST=manually with Flutter example from bug
TEST=vm/cc/IsolateReload_EnumWithSet
Bug: #55350
Change-Id: I0ec55d66ec6bb1d6512c4d9bedc6a4244f505c29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361983
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-hot-reload
Projects
None yet
Development

No branches or pull requests

4 participants