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

Generate a shapeless Coproduct instead of a placeholder type #197

Merged
merged 2 commits into from Dec 31, 2019

Conversation

cb372
Copy link
Member

@cb372 cb372 commented Dec 30, 2019

Previously we were generating a made-up type Cop[A :: B :: TNil]. There is code in the Mu sbt plugin to rewrite it to A :+: B :+: CNil using some regex nastiness. We may as well generate a real type in the first place and remove the need for rewriting.

Previously we were generating a made-up type `Cop[A :: B :: TNil]`.
There is code in the Mu sbt plugin to rewrite it to `A :+: B :+: CNil`
using some regex nastiness. We may as well generate a real type in the
first place and remove the need for rewriting.
Copy link
Member

@juanpedromoreno juanpedromoreno left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -103,7 +103,7 @@ class ProtobufProtocolSpec extends Specification with ScalaCheck {
| @_root_.pbdirect.pbIndex(1) name: _root_.java.lang.String,
| @_root_.pbdirect.pbIndex(2) books: _root_.scala.Map[_root_.scala.Long, _root_.java.lang.String],
| @_root_.pbdirect.pbIndex(3) genres: _root_.scala.List[_root_.scala.Option[_root_.com.acme.book.Genre]],
| @_root_.pbdirect.pbIndex(4,5,6,7) payment_method: Cop[_root_.scala.Long :: _root_.scala.Int :: _root_.java.lang.String :: _root_.com.acme.book.Book :: TNil]
| @_root_.pbdirect.pbIndex(4,5,6,7) payment_method: _root_.scala.Long :+: _root_.scala.Int :+: _root_.java.lang.String :+: _root_.com.acme.book.Book :+: CNil
Copy link
Member

Choose a reason for hiding this comment

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

Will we need FQN for :+: as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, there's no reason not to. Same for CNil. That means we can remove some import-generation logic from the sbt plugin as well.

@cb372 cb372 merged commit 07ed9e5 into master Dec 31, 2019
@cb372 cb372 deleted the shapeless-coproduct branch December 31, 2019 10:09
cb372 added a commit that referenced this pull request Jan 2, 2020
Missed this one in #197 🤦
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.

None yet

2 participants