-
Notifications
You must be signed in to change notification settings - Fork 23
transientDefault warning #751
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?
transientDefault warning #751
Conversation
0258539 to
deb5dbb
Compare
| def isTransientDefault(param: ApplyParam): Boolean = | ||
| param.defaultValue.nonEmpty && hasAnnotation(param.sym, TransientDefaultAnnotType) | ||
|
|
||
| def isTransientDefault(param: ApplyParam, warnIfDefaultNotProvided: Boolean = false): Boolean = |
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.
Prefer overloading to avoid binary compatibility problems
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.
done
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 compile-time validation for the @transientDefault annotation to ensure it is only used on parameters that have default values. Previously, the annotation would silently have no effect when applied to parameters without defaults.
Key Changes:
- Added compile-time warning/error when
@transientDefaultis used without a default value - Refactored the
isTransientDefaultmethod to support optional validation - Added test coverage for both valid and invalid usage of
@transientDefault
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| GenCodecMacros.scala | Refactored isTransientDefault to validate that @transientDefault has a default value and emit an error when missing |
| NotUsedTransientDefault.scala | Added test suite to verify compile-time validation of @transientDefault annotation usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@transientDefault should not compile when default value was not provided