Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Dec 10, 2014

Avoid identifying type aliases as TypeBounds where the lower and upper bound are eq. This
is 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 CyclicReference
errors which seemed very hard to avoid. So the new scheme is different. TypeAliases are explicitly
created.

Review by @DarkDimius

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

always holds

@odersky
Copy link
Contributor Author

odersky commented Dec 16, 2014

Anyone else wants to have a look at this?

@odersky
Copy link
Contributor Author

odersky commented Dec 17, 2014

Going to merge this one now.

odersky added a commit that referenced this pull request Dec 17, 2014
@odersky odersky merged commit 3a68e50 into scala:master Dec 17, 2014
@allanrenucci allanrenucci deleted the change/type-aliases branch December 14, 2017 16:58
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants