Skip to content

Fixes #24056 Dealias value class types in structural access - #25907

Merged
odersky merged 1 commit into
scala:mainfrom
soronpo:fix-i24056-value-class-alias-structural
May 4, 2026
Merged

odersky merged 1 commit into
scala:mainfrom
soronpo:fix-i24056-value-class-alias-structural

Conversation

@soronpo

@soronpo soronpo commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

When a structural refinement member has a type that is a type alias for a generic derived value class, the boxing wrapper in maybeBoxingCast synthesized a New on the alias, which provided only the alias' partial type arguments to the underlying class constructor and failed with "Not enough type arguments".

Dealias the widened type before constructing the New so the underlying value class receives its full type argument list.

Fixes #24056

How much have you relied on LLM-based tools in this contribution?

Extensively, but this is a single line change.

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

@soronpo
soronpo marked this pull request as ready for review April 22, 2026 18:21
When a structural refinement member has a type that is a type alias for a
generic derived value class, the boxing wrapper in `maybeBoxingCast` synthesized
a `New` on the alias, which provided only the alias' partial type arguments to
the underlying class constructor and failed with "Not enough type arguments".

Dealias the widened type before constructing the `New` so the underlying value
class receives its full type argument list.

Fixes scala#24056
@soronpo
soronpo force-pushed the fix-i24056-value-class-alias-structural branch from 43f748b to cb5bf4f Compare April 22, 2026 18:32

@odersky odersky left a comment

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.

This looks uncontroversial.

@odersky
odersky merged commit b461f9d into scala:main May 4, 2026
45 checks passed
@WojciechMazur WojciechMazur added this to the 3.9.0 milestone May 26, 2026
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.

Type aliasing of value class inside class refinement failure

5 participants