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

Add mkAttributedRef specialized for SingleType #994

Merged
merged 4 commits into from
Mar 28, 2020

Conversation

joroKr21
Copy link
Collaborator

References to singleton types should refer to the getter if possible.
Fixes an issue where we would try to reference a non-existing field.

References to singleton types should refer to the getter if possible.
Fixes an issue where we would try to reference a non-existing field.
@joroKr21 joroKr21 added the Bug label Mar 27, 2020
@joroKr21 joroKr21 added this to the shapeless-2.4.0 milestone Mar 27, 2020
@joroKr21 joroKr21 requested a review from milessabin March 27, 2020 19:40
@joroKr21 joroKr21 self-assigned this Mar 27, 2020
Copy link
Owner

@milessabin milessabin left a comment

Choose a reason for hiding this comment

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

Nice one!

@@ -1017,7 +1021,7 @@ class GenericMacros(val c: whitebox.Context) extends CaseClassMacros {
}

def mkProductGeneric(tpe: Type): Tree = {
val repr = mkHListTypTree(fieldsOf(tpe).map(_._2))
val repr = mkHListTpe(fieldsOf(tpe).map(_._2))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now mkHListTypTree is not used in shapeless anymore.
But it might be wise to keep it because people might be using it in their own macros.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm fine removing it for 2.4.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok it turns out there is a lot of dead code already 😄

case _ =>
cq"_: $tpe0 => $index"
}

val coproduct = objectRef[Coproduct.type]
val ctors = ctorsOf(tpe)
val repr = mkCoproductTypTree(ctors)
val repr = mkCoproductTpe(ctors)
Copy link
Collaborator Author

@joroKr21 joroKr21 Mar 27, 2020

Choose a reason for hiding this comment

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

Now mkCoproductTypTree is not used in shapeless anymore.
But it might be wise to keep it because people might be using it in their own macros.

Copy link
Owner

Choose a reason for hiding this comment

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

Ditto.

@joroKr21 joroKr21 merged commit c2bf3c6 into milessabin:master Mar 28, 2020
@joroKr21 joroKr21 deleted the mk-singleton-ref branch March 28, 2020 00:46
@milessabin
Copy link
Owner

Latest nightly was green ... we're good to go 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants