Fix #404: Support parameter substitution in structural types and PolyFunction for Scala 3#585
Open
Emanuelgm1998 wants to merge 4 commits intozio:developfrom
Open
Fix #404: Support parameter substitution in structural types and PolyFunction for Scala 3#585Emanuelgm1998 wants to merge 4 commits intozio:developfrom
Emanuelgm1998 wants to merge 4 commits intozio:developfrom
Conversation
…olyFunction for Scala 3
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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