Skip to content

[Scala3] [bugfix] BundlePhase: skip cloning by-name Bundle params#5372

Merged
adkian-sifive merged 1 commit into
mainfrom
adkian-sifive/scala3-bundlephase-byname-update
May 20, 2026
Merged

[Scala3] [bugfix] BundlePhase: skip cloning by-name Bundle params#5372
adkian-sifive merged 1 commit into
mainfrom
adkian-sifive/scala3-bundlephase-byname-update

Conversation

@adkian-sifive

@adkian-sifive adkian-sifive commented May 20, 2026

Copy link
Copy Markdown
Member

Summary

Fix bug in BundlePhase which was incorrectly cloning by-name constructor parameters by adding special handling parameters. This matches the Scala 2 plugin which uses sym.tpe <:< dataTpe that correctly skips cloning by-name params. Move DataEqualitySpec that was failing because of this

Release Notes

Fix bug in Scala 3 BundlePhase in handling by-name parameters in Bundles

Development notes

  • AI tool(s) used: Claude Code + Claude Opus 4.7

Move DataEqualitySpec that was blocked on this
@adkian-sifive adkian-sifive added the Scala 3 Changes related to upgrading to Scala 3 label May 20, 2026
Comment on lines +106 to +111
// Skip cloning for by-name params: ExprType(T).baseClasses includes
// T's parents, so isData would return true for a by-name Data,
// but the by-name accessor returns the underlying value, which the
// constructor expects as a Function0 (after ElimByName). Cloning would
// try to feed a Data where a Function0 is expected.
val isByName = paramSym.info.isInstanceOf[ExprType]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

An .isInstanceOf check feels like a weird way to check for this, is there no better way? Some method or utility function call?

A nit, so see if there's a better way but feel free to merge if not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Claude thinks this is the cleanest..

@adkian-sifive adkian-sifive merged commit f3fe748 into main May 20, 2026
30 of 31 checks passed
@adkian-sifive adkian-sifive deleted the adkian-sifive/scala3-bundlephase-byname-update branch May 20, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scala 3 Changes related to upgrading to Scala 3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants