Skip to content

Conversation

@Jay-Lokhande
Copy link
Contributor

@Jay-Lokhande Jay-Lokhande commented May 28, 2025

Refactor transform method to extension method update implicit class name to avoid conflicts

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • Updated dynamic module to match generated-code behaviour
  • Added documentation
  • Updated changelog

… update implicit class name to avoid conflicts
… update implicit class name to avoid conflicts
@CLAassistant
Copy link

CLAassistant commented May 28, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@kubukoz kubukoz left a 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.

@Baccata
Copy link
Contributor

Baccata commented Jun 3, 2025

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 transform.

@kubukoz
Copy link
Member

kubukoz commented Jun 3, 2025

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.

@Jay-Lokhande
Copy link
Contributor Author

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

@kubukoz
Copy link
Member

kubukoz commented Jun 11, 2025

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 transform too.

@Baccata
Copy link
Contributor

Baccata commented Jun 11, 2025

? I think I'd be OK with a static transform too

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 Ops that need generating for providing a method-like DX

@kubukoz
Copy link
Member

kubukoz commented Jun 11, 2025

alright, let's do that then. @Jay-Lokhande, do you want to make these changes?

@Jay-Lokhande
Copy link
Contributor Author

alright, let's do that then. @Jay-Lokhande, do you want to make these changes?

Yes!

@kubukoz
Copy link
Member

kubukoz commented Jun 23, 2025

@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.

@kubukoz
Copy link
Member

kubukoz commented Jul 4, 2025

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
@Jay-Lokhande
Copy link
Contributor Author

@kubukoz PR added extension methods is now ready for review....

@Jay-Lokhande Jay-Lokhande marked this pull request as ready for review December 25, 2025 17:19
@Jay-Lokhande Jay-Lokhande requested a review from kubukoz December 26, 2025 08:21
@kubukoz
Copy link
Member

kubukoz commented Dec 28, 2025

added a changelog, will merge on green

@kubukoz kubukoz merged commit bd253a5 into disneystreaming:series/0.19 Dec 28, 2025
10 checks passed
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.

4 participants