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

Added isEnum field to SealedTrait #332

Merged
merged 2 commits into from
Aug 10, 2021
Merged

Added isEnum field to SealedTrait #332

merged 2 commits into from
Aug 10, 2021

Conversation

Pask423
Copy link
Contributor

@Pask423 Pask423 commented Aug 7, 2021

closes #319

@ghost ghost requested a review from adamw August 9, 2021 04:52
@KacperFKorban KacperFKorban self-requested a review August 9, 2021 07:43
Copy link
Collaborator

@KacperFKorban KacperFKorban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for contributing 😃

I left a comment with some requested changes.

@@ -61,7 +61,8 @@ case class SealedTrait[Typeclass[_], Type]
(typeInfo: TypeInfo,
subtypes: IArray[SealedTrait.Subtype[Typeclass, Type, _]],
annotations: IArray[Any],
typeAnnotations: IArray[Any]) extends Serializable:
typeAnnotations: IArray[Any],
isEnum: Boolean = false) extends Serializable:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SealedTrait name can be misleading, it can represent both the sealed hierarchies of sealed traits as well as enums. To implement this issue, a small macro would be needed similar to isObject here:

def isObject[T: Type](using Quotes): Expr[Boolean] =

All flags in Quotes API can be found here.
This macro should be used in magnolia.scala when creating SealedTrait instances.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for help

@adamw adamw merged commit 74138f8 into softwaremill:scala3 Aug 10, 2021
@adamw
Copy link
Member

adamw commented Aug 10, 2021

Thanks!

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.

Scala 3 enums
3 participants