Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly dealias tuple types when specializing #18724

Merged
merged 2 commits into from Oct 20, 2023

Conversation

nicolasstucki
Copy link
Contributor

Fixes #18638

@@ -37,15 +37,14 @@ class SpecializeTuples extends MiniPhase:
end transformApply

override def transformSelect(tree: Select)(using Context): Tree = tree match
case Select(qual, nme._1) if isAppliedSpecializableTuple(qual.tpe.widen) =>
Select(qual, nme._1.specializedName(qual.tpe.widen.argInfos.slice(0, 1)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue was that qual.tpe.widen returned U[Int, Int], isAppliedSpecializableTuple detected the tuple type through internal aliasing, but qual.tpe.widen.argInfos used the args of U[Int, Int] instead of the args of its dealiased type Tuple2[Unit, Unit]

@nicolasstucki nicolasstucki marked this pull request as ready for review October 20, 2023 07:21
@dwijnand dwijnand merged commit b2cd869 into scala:main Oct 20, 2023
18 checks passed
@dwijnand dwijnand deleted the fix-18638 branch October 20, 2023 10:47
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
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.

Tuple specialisation doesn't correctly see type
3 participants