Skip to content

Fix #404: Support parameter substitution in structural types and PolyFunction for Scala 3#585

Open
Emanuelgm1998 wants to merge 4 commits intozio:developfrom
Emanuelgm1998:develop
Open

Fix #404: Support parameter substitution in structural types and PolyFunction for Scala 3#585
Emanuelgm1998 wants to merge 4 commits intozio:developfrom
Emanuelgm1998:develop

Conversation

@Emanuelgm1998
Copy link
Copy Markdown

@Emanuelgm1998 Emanuelgm1998 commented Apr 7, 2026

Problem
TagMacro on Scala 3 failed to correctly substitute type parameters in two cases:
Structural refinement types — when a type like { type T = Int } was part of a combined tag, the resolved type members were computed but never passed to refinedTag, causing incorrect tags to be generated.
PolyFunction types — the macro was attempting to transform native Scala 3 polymorphic function types (scala.PolyFunction), which Scala 3 already handles correctly, causing the tag shape to be altered incorrectly.
Solution
Added a guard for scala.PolyFunction in the AppliedType match case, so native polymorphic function types are passed directly to createTag without transformation.
Fixed the Refinement case to pass resolvedTypeMemberLtts as a map to refinedTag instead of Map.empty, ensuring resolved type members are included in the generated tag.
Tests
All 209 tests passing locally on Scala 3 (JVM).
Scala 2 (2.11, 2.12, 2.13) builds unaffected.
should basic support for polymorphic function types ✅
should can resolve parameters in structural types ✅
should other type members' bounds are not malformed when resolving parameters in structural types ✅

/claim #404

@Emanuelgm1998
Copy link
Copy Markdown
Author

Hi @neko-kai and @pshirshov,

I’ve attached a short video showing all tests passing as requested. This should confirm that the issues with parameter substitution in structural types and PolyFunction for Scala 3 are now resolved.

Whenever you have a moment, it’d be great to get your final review. Thanks a lot!

Screen_Recording_20260407_235600_Chrome.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant