-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Generalize RefTypes #3087
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
Generalize RefTypes #3087
Conversation
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Added" instead of "Add")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
48231de
to
0b4b689
Compare
test performance please |
performance test scheduled: 1 job(s) in queue. |
performance test failed: [check /data/workspace/bench/logs/pull-3087-09-13-14.05.out for more information] |
test performance please |
performance test scheduled: 1 job(s) in queue, 1 running. |
@odersky I just checked the logs, compiling of dotty project succeeds, but compilation of the scala-library project throws exception. |
@lihaoyi Oh, the scala-library in the benchmarks is not the same as the one from the submodule? I think that would make more sense. |
performance test failed: [check /data/workspace/bench/logs/pull-3087-09-13-16.55.out for more information] |
@smarter Exactly, it's not the same scala-library in the Dotty repo. It's intentionally made to be not the same, as the Dotty scala-library is growing, and we want a subset of stdlib that could be compiled since last october. |
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3087 to see the changes. Benchmarks is based on merge(s) with master |
AppliedType will be used for all type applications, higher-kinded or not. That is, eventually, it will replace HKApply and also the encodings of type applications as refined types. This commit introduces AppliedType and adapts baseType computations to take it into account. AppliedType is not yet constructed anywhere, however.
So far, everything up to parents is adapted to new scheme. Parents is half done; needs more work once we change layour of ClassInfo.
Simplifies usage and removes some obscure code in Types
Systematically introduce handlers for AppliedTypes where there was a handler for HKApply.
Also, change asSeenFrom to use it for arguments
withfixedSym -> apply It's just apply with a different designator apply(Type, Symbol) -> withSym This one contains special cases.
Make nonMemberTermRef redundant by marking local dummies and import symbols as Fresh (i.e. they are non-members).
Also - rename Fresh flag to NonMember - update criterion for phases where refs are symbolic. This used to be just before erasure (at resolveSuper) but then other phases were inserted after resolveSuper and the test became outdated. It's more robust now.
- drop withSym - rename withSymAndName to another apply - streamline select methods
To do this, we needed a more robust version of Symbol#signature.
Also, drop signature parameter in TermRef.withSigAndDenot
Also, drop signature parameter in TermRef.withSigAndDenot
The exception previously made for Scala2 innner classes causes the benchmark library project to fail with in the tree type map FullParameterization when called from LinkScala2Impl. It's not necessary to make the special case there because the Scalq2Unpickler will create anyway symbolic references to such inner classes.
import Names._ | ||
|
||
/** Defines a common superclass of Name and Symbol and its Term/Type variants | ||
* Designators are used in reference type to identity what is referred to. |
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.
typo: identity -> identify
Here _lifting_ a type `S` means replacing all references to abstract types | ||
in covariant positions of `S` by their upper bound, and to replacing | ||
all refinement types in in covariant positions of `S` by their parent. | ||
The purpose if lifte |
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.
Sentence wasn't finished.
a458730
to
4241475
Compare
It allows us to drop the additional name field in most cases and the methods become easier to discover.
@@ -1921,7 +1919,10 @@ object Types { | |||
* the public name. | |||
*/ | |||
def shadowed(implicit ctx: Context): NamedType = | |||
NamedType(prefix, designatorName.derived(ShadowedName)) | |||
designator match { | |||
case designator: Symbol => this |
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.
Is this case ever reached? It doesn't really seem to make sense.
} | ||
else if (tpe.hasFixedSym) { | ||
assert(tpe.symbol.isClass && tpe.symbol.is(Flags.Scala2x), tpe.symbol.showLocated) | ||
writeByte(TYPEREF) // should be changed to a new entry that keeps track of prefix, symbol & owner |
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.
Is this still a TODO?
Withdrawn in favor of #3147 |
Based on #3061.
The aim of this PR is to eliminate the various subtypes of TermRef and TypeRef and replace them by generalizing Name Name/Signature and Symbol to a new concept of
Designator
.The expected benefits of doing this are: