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

Don't render parens for case objects in union member nodes #1600

Merged
merged 8 commits into from
Sep 30, 2024

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented Sep 28, 2024

Closes #1599

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

@kubukoz kubukoz changed the title Reproduce #1599 Don't render parens for case objects in union member nodes Sep 28, 2024
@@ -426,6 +427,7 @@ private[internals] object TypedNode {
def map[B](f: A => B): AltValueTN[B] = this match {
case ProductAltTN(value) => ProductAltTN(f(value))
case TypeAltTN(value) => TypeAltTN(f(value))
case UnitAltTN => UnitAltTN
Copy link
Member Author

Choose a reason for hiding this comment

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

thought: this is my third implementation of the fix, I think it's the most principled as AltValueTN now more accurately mirrors the UnionMember ADT used on the schema side of things.

@kubukoz kubukoz marked this pull request as ready for review September 28, 2024 15:17
(member.getMemberName(), member.tpe.map(Left(_)))
} else {
(member.getMemberName(), member.tpe.map(Right(_)))
.flatMap { member =>
Copy link
Member Author

Choose a reason for hiding this comment

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

note: this change is no longer necessary, it's merely a refactor. I left it in because the original seemed needlessly duplicative.

@Baccata Baccata merged commit 00f6531 into series/0.18 Sep 30, 2024
9 checks passed
@Baccata Baccata deleted the reproduce-1599 branch September 30, 2024 09:39
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.

Unit members of unions have invalid TypedNode rendering
2 participants