-
Notifications
You must be signed in to change notification settings - Fork 89
Refactor transform method to extension method #1735
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 transform method to extension method #1735
Conversation
… update implicit class name to avoid conflicts
… update implicit class name to avoid conflicts
kubukoz
left a comment
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.
Thanks, the generated code looks alright.
I see 2.12 (at least) is failing to compile its tests, I'm guessing it has something to do with the implicit conversion not being picked up because the type of F doesn't infer nicely... feel free to attempt to resolve it somehow, we'll see if this is even possible on all the Scala versions.
modules/bootstrapped/src/generated/smithy4s/example/product/ExampleService.scala
Outdated
Show resolved
Hide resolved
|
I think the failure is probably due to implicit scope on 2.12. I wonder whether maybe we should just forsake it and document a unique static method that would replace the current |
|
maybe... but I would try this first: @Jay-Lokhande lets have a separate implicit class for each method, that way you can make the receiver (the "self" value that the extension is called on) the right kind and hopefully help 2.12's inference. You'll also need to update any cross-compiled tests with 2.12 to use the appropriate variant. |
yes sure I will try this approach |
|
Looks like we should be good now, with no source-level breakage. For some reason the three implicit classes don't clash on 2.13/3.x, and the mono/bifunctor-specialized ones get picked up on 2.12 too. Time to make a decision - @Baccata are we rolling with this? I think I'd be OK with a static |
I'd rather we did that, to be honest. Transform is not something that's being called often enough to warrant the complexity of the |
|
alright, let's do that then. @Jay-Lokhande, do you want to make these changes? |
…ransform-extension # Conflicts: # modules/bootstrapped/test/src/smithy4s/TransformationSpec.scala
Yes! |
|
@Baccata it looks like it's the same problem as with the extension... so it's just a matter of preference. The extension at least didn't require code changes for users. |
|
My vote is to keep the extension functions, in a future version that drops 2.12 support we can simplify to just have one extension for all. Getting this merged at least solves a real problem, I'd like to get it finalized |
# Conflicts: # modules/bootstrapped/src/generated/smithy4s/example/ObjectService.scala # modules/bootstrapped/src/generated/smithy4s/example/PizzaAdminService.scala
|
@kubukoz PR added extension methods is now ready for review.... |
|
added a changelog, will merge on green |
Refactor transform method to extension method update implicit class name to avoid conflicts
PR Checklist (not all items are relevant to all PRs)