-
Notifications
You must be signed in to change notification settings - Fork 34
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
Refactor the @service
macro
#887
Conversation
Codecov Report
@@ Coverage Diff @@
## master #887 +/- ##
=======================================
Coverage 86.28% 86.28%
=======================================
Files 57 57
Lines 824 824
Branches 5 5
=======================================
Hits 711 711
Misses 113 113 Continue to review full report at Codecov.
|
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.
Feels less clunky 👍
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.
👌
q""" | ||
def $name(input: $reqType): $wrappedRespType = | ||
${clientCallMethodFor("unary")} | ||
""" |
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.
Seems like the four options here are identical, except the clientMethodName
, maybe we can simplify the pattern matching to get that information and leave the rest outside just once?
Split the monolithic macro implementation into a few files.
Note: to help the compiler out with the path-dependent types arising from use of
Context
, the helper classes must be of the formand when you instantiate the helper, you need to give it the
Context
instance's singleton type:Ideally I'd like the
Operation
,RPCMethod
andHttpOperation
classes to be in separate files, but I started to hit the limits of scalac's path-dependent types support so I had to group them together.Potentially a few more utility methods could be moved to the
TreeHelpers
class, but this refactoring is a good start.Also tidied up the HTTP-related macro code:
val httpOperations
for-comprehensionF[_]
(the macro would have failed if the user decided to name their type paramG[_]
)Fixes #874, fixes #844