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

Fix enum representationsto show correct (implicit) args, const #3669

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

srawlins
Copy link
Member

@srawlins srawlins commented Feb 22, 2024

When adding support for enhanced enums, I think I overlooked some validation of "old scool" enums-with-implicit-constructors. I discovered this when trying to move all tests to use Dart Language version 3.2.0 (next PR).

Unfortunately, the analyzer's constantInitializer property for such enum values is not really meant for re-constructing what a constant's source was, and it returns code like E() for the constant initializer for E.one given enum E { one, two; }. (It should implicitly use an index of 0, and show E(0); see the de-sugaring examples in the spec.) I filed dart-lang/sdk#54988.

In this code, we also add the word const to enhanced enum values (with an explicit constructor); previously, only old-school enums had the keyword const. So now that's unified.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

lib/src/model/getter_setter_combo.dart Outdated Show resolved Hide resolved
@srawlins srawlins merged commit a16973b into dart-lang:main Feb 22, 2024
9 checks passed
@srawlins srawlins deleted the bump-test-version branch February 22, 2024 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants