Skip to content

fix: escape reserved enum member names and spell out numeric property names#99

Merged
t-unit merged 1 commit intomainfrom
fix-enum-and-numeric-name-normalization
Apr 14, 2026
Merged

fix: escape reserved enum member names and spell out numeric property names#99
t-unit merged 1 commit intomainfrom
fix-enum-and-numeric-name-normalization

Conversation

@t-unit
Copy link
Copy Markdown
Owner

@t-unit t-unit commented Apr 13, 2026

Summary

  • Enum values that normalize to index or values now get a $ prefix to avoid conflicts with Dart's built-in Enum.index and Enum.values (fixes 7 compile errors in the Cloudflare spec)
  • normalizeSingle now spells out purely numeric property names (e.g. 600sixHundred) regardless of the preserveNumbers flag, matching the existing enum value behavior

Test plan

  • New tests for index, INDEX, Index$index
  • New tests for values, VALUES$values
  • Compound words like reindex, indexing, INDEX_TYPE pass through unescaped
  • normalizeSingle('index') remains index (valid for class properties)
  • Numeric property name tests for spelled-out conversion
  • All 37 name_utils tests pass

… names

Enum values named `index` or `values` now get a `$` prefix to avoid
conflicts with Dart's built-in Enum.index and Enum.values. This only
applies to enum values — class properties named `index` remain valid.

Also fixes normalizeSingle to spell out purely numeric property names
(e.g. `600` → `sixHundred`) regardless of the preserveNumbers flag,
matching the existing behavior for enum values.
@t-unit t-unit merged commit 10f83da into main Apr 14, 2026
9 checks passed
@t-unit t-unit deleted the fix-enum-and-numeric-name-normalization branch April 14, 2026 05:47
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (dd881e6) to head (98ad409).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@    Coverage Diff     @@
##   main   #99   +/-   ##
==========================
==========================
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant