Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix #19789: Merge same TypeParamRef in orDominator #20090

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

noti0na1
Copy link
Member

@noti0na1 noti0na1 commented Apr 4, 2024

Fix #19789

Merge refined or applied types if they share the same TypeParamRef as tycon in orDominator.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

I think this can be optimized by adding a first clause

 if tp1 eq tp2 then tp1

Also, instead of comparing TypeParamRefs directly we could just do it like this:

case tp1: TypeParamRef if tp1 == tp2 => tp1

Note the first test might still need the second, since hash-consing is not 100% assured (e.g. we might get copies after a table overflow). So exploiting hash consing should always be an optimization only.

@odersky odersky assigned noti0na1 and unassigned odersky Apr 7, 2024
@odersky odersky merged commit 9b3495a into scala:main Apr 10, 2024
19 checks passed
@odersky odersky deleted the fix-19789 branch April 10, 2024 20:48
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur added a commit that referenced this pull request Jul 5, 2024
…21056)

Backports #20090 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AssertionError: Failure to join alternatives
3 participants