-
Notifications
You must be signed in to change notification settings - Fork 533
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
Add support to extract all variable or type annotations (issue #1051) #1058
Conversation
That looks binary compatible - it could make it into a 2.3 release |
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!
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.
@pgrandjean thank you, the implementation looks great 👍
I am only missing tests for all annotations of sealed traits
Also added tests for sealed trait, although there are no type annotations for sealed traits. |
branch |
Hmm it's technically possible: case class Ann(s: String) extends StaticAnnotation
sealed trait Foo
case object Bar extends Foo @Ann("as") But the current implementation doesn't find them and I wonder if it makes any sense. |
I'm trying to pull that thread but I encountered an annoying issue - |
You're right. I don't know why I was convinced of the opposite. Sorry for that.
|
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.
@pgrandjean that looks good to me already. Sorry to keep expanding the scope but I'm wondering if we should make something like this work, which seems to me like a more compelling use case for type annotations:
final case class validated(id: String) extends StaticAnnotation
type PosInt = Int @validated("positive")
type Email = String @validated("email")
final case class User(email: Email, age: PosInt)
I tried it but it seems that .dealias
sometimes preserves annotations and sometimes loses them. Anyway I'm happy to merge this as is, just suggesting what we could do next.
@joroKr21 I think it is possible to achieve this without |
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.
One last thing 🙏
Thank you @pgrandjean for your work and patience and congratulations on your first merge to shapeless! 🥳 |
Thank you @joroKr21 ! |
@pgrandjean wow I completely forgot about #925, sorry! GitHub lied to me and told me you're a first time contributor - it even asked me to approve your CI run 🙈 I will try to backport them to the 2.3 branch soon, I think there will be no issues 🤞 |
Following issue #1051, adding support to extract all variable or type annotations from case classes.
Closes #1051