[pigeon] Made using enums in type arguments an error, added workaround#527
Merged
fluttergithubbot merged 2 commits intoflutter:masterfrom Nov 30, 2021
Merged
Conversation
a717e3c to
b9d982e
Compare
stuartmorgan-g
approved these changes
Nov 30, 2021
| * [ci] Started transitioning to a Dart test runner, added windows support. | ||
| * [front-end] Started issuing an error if enums are used in type arguments. | ||
| * [front-end] Passed through all enums, referenced or not so they can be used as | ||
| a work around for direct enum support. |
Collaborator
There was a problem hiding this comment.
Nit: There's now a style guide for CHANGELOGs, so these should follow it (e.g., Starts issuing, Passes through)
| .removeWhere((Class x) => !referencedTypeNames.contains(x.name)); | ||
|
|
||
| final List<Enum> referencedEnums = List<Enum>.from(_enums); | ||
| referencedEnums.removeWhere( |
Collaborator
There was a problem hiding this comment.
Do you want to leave a TODO here to re-add this?
Member
Author
There was a problem hiding this comment.
Not necessarily. Only generating output for referenced types has lead to a lot of bugs. It was necessary when we we were using reflection, now it isn't needed. If we start supporting multiple imports in pigeon files we might have to revisit it again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are a lot of features related to enum's we don't yet support. Issuing an error in the front-end is better than a compilation error later.
As a workaround I started always generating enums in code whether they were referenced or not so users can use their integer values.
issues:
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.