Skip to content

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

Open
soronpo wants to merge 1 commit intoscala:mainfrom
soronpo:fix-i24056-value-class-alias-structural
Open

Fixes #24056 Dealias value class types in structural access#25907
soronpo wants to merge 1 commit intoscala:mainfrom
soronpo:fix-i24056-value-class-alias-structural

Conversation

@soronpo
Copy link
Copy Markdown
Contributor

@soronpo soronpo commented Apr 22, 2026

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

2 participants