Skip to content

Fix/type seqliteral #261

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 4 commits into from
Dec 4, 2014
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 3, 2014

Fixed typing of SeqLiterals. Review by @DarkDimius

Avoid to create ArrayTypes after erase.

Note that the *extractor* does not recognize JavaArrayTypes as
ArrayTypes. Doing so would create an infinite loop in sigName.
Generally, we do not want to ppaper over the difference when analysing
types.
When hash-consing TypeBounds, RefinedTypes and NamedTypes, we
now check the argument types with `eq`, where before it was `==`.
This is necessary for TypeBounds, because it makes a difference
whether a TypeBound has `eq` parts (then it is a type alias) or not.
So we cannot merge type aliases with non-aliases.

The symptom of the problem was when compiling Patterns.scala twice with
the new SeqLiterals phase (next commit) enabled. On second run, we encountered
an ArrayType[>: String <: String], even if we only created an ArrayType[String].
This was a consequence of the two types being identified by uniques.

Todo: Change the system so that type aliases are recognized more robustly.
But the present change seems to be useful anyway because it speeds up
uniques hashing. I verified that the stricter condition on uniques creates less
than 1% more types than before. So the speedup of hashing looks worthwhile.
Replaces SeqLiterals by JavaSeqLiterals, because the latter's
(array-)type is preserved after erasure.
DarkDimius added a commit that referenced this pull request Dec 4, 2014
@DarkDimius DarkDimius merged commit 86eb1bb into scala:master Dec 4, 2014
@DarkDimius
Copy link
Contributor

@odersky thanks for a good fix. Works great!

tgodzik added a commit to tgodzik/scala3 that referenced this pull request Apr 29, 2025
Backport "Constructor companion gets privateWithin" 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