-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change/type aliases #270
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
Merged
Merged
Change/type aliases #270
Conversation
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
Curiously, was missing before, which meant variance was ignored when hash-consing TypeBounds.
Specialize hash consing of type aliases.
Replace all case TypeBounds(lo, hi) if lo eq hi => patterns with case TypeAlias(alias) =>
So far this affects only the calls, both methods are still the same. But their implementation will be changed next.
Generate Type aliases only when original type(s) were aliases. Also, TypeBounds.real never generates an alias.
TypeBounds.real served its purpose: Flushing out all problems with creating TypeBounds.
This was the last bit that tested for the fragile `lo eq hi` condition.
override def variance = 1 | ||
override def toString = "Co" + super.toString | ||
abstract class TypeAlias(val alias: Type, override val variance: Int) extends TypeBounds(alias, alias) { | ||
/** pre: this is a type alias */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always holds
Anyone else wants to have a look at this? |
Going to merge this one now. |
tgodzik
added a commit
to tgodzik/scala3
that referenced
this pull request
Apr 29, 2025
Backport "Regression test for extension nullification, nowarn for different opacities" to 3.3 LTS
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.
Avoid identifying type aliases as TypeBounds where the lower and upper bound are
eq
. Thisis too fragile, in particular it might have false positives for type aliases, which go the other way when
compiling in a second run.
I tried to identify a type alias as a type where the bounds are
=:=
. But this gave CyclicReferenceerrors which seemed very hard to avoid. So the new scheme is different. TypeAliases are explicitly
created.
Review by @DarkDimius