-
Notifications
You must be signed in to change notification settings - Fork 152
Support value enum entries with default parameter values and/or multiple parameter lists #448
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
base: master
Are you sure you want to change the base?
Conversation
2983aaf to
640e049
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #448 +/- ##
=======================================
Coverage 85.71% 85.71%
=======================================
Files 63 63
Lines 511 511
Branches 34 34
=======================================
Hits 438 438
Misses 73 73 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for value enum entries with default parameter values and/or multiple parameter lists, addressing issues #318 and #447.
- Refactored macro implementations for both Scala 2 and Scala 3 to preserve parameter list structure instead of flattening
- Added recursive helper functions to properly traverse nested constructor applications
- Added test coverage for both new features (multiple parameter lists and default parameters)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
macros/src/main/scala-3/enumeratum/ValueEnumMacros.scala |
Updated valueParamIndexOf to return 2D indices for parameter lists; added getConstructorTypeAndArguments to recursively handle multiple parameter lists and default parameters via Block nodes |
macros/src/main/scala-2/enumeratum/ValueEnumMacros.scala |
Added getConstructorTypeAndArguments helper; updated findConstructorParamsLists to preserve parameter list structure instead of flattening |
macros/compat/src/main/scala-2.13/enumeratum/ContextUtils.scala |
Removed obsolete constructorsToParamNamesPF function that was flattening parameter lists |
macros/compat/src/main/scala-2.12/enumeratum/ContextUtils.scala |
Removed obsolete constructorsToParamNamesPF function that was flattening parameter lists |
enumeratum-core/src/test/scala/enumeratum/values/ValueEnumSpec.scala |
Added test cases for multiple parameter lists and default parameters; minor syntax cleanup |
enumeratum-core/src/test/scala/enumeratum/values/IntTransformation.scala |
Test fixture demonstrating value enums with multiple parameter lists |
enumeratum-core/src/test/scala/enumeratum/values/Creature.scala |
Test fixture demonstrating value enums with default parameter values |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lloydmeta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Will merge once I have time to release.
Fixes #318 and #447