-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Normalize TypeOf types (second step towards typed transparent methods) #4806
Closed
OlivierBlanvillain
wants to merge
128
commits into
scala:master
from
dotty-staging:add-transparent-6
Closed
Normalize TypeOf types (second step towards typed transparent methods) #4806
OlivierBlanvillain
wants to merge
128
commits into
scala:master
from
dotty-staging:add-transparent-6
Conversation
This file contains 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
Disable stability check on SingletonTypeTree for now. Introduce TypeOf only to suspend type checking of top-level TypeApply, Apply, If and Match AST nodes.
The reason why we need to ba a proper subtype of AnnotatedType and not simply instanciate it is because we a custom equality. For instance we want to disregard the differance between Ident and TypedTrees since the later replaces the former during typing.
AnnotatedType uses precise equivalance of Trees, whereas TypeOf is only concerned with certain top level trees.
Also, restore the invariant that the type of the TypeOf tree is the TypeOf type itself. Here is an example showing what would go wrong if we didn't do that. Suppose we have def f(x: Int) = x def g(x: Int) = 2 * x def h(f: Int => Int) = f(1) h(g): { 2 * 1 } Given a type map substituting f for g in f(1), the underlying type should be substituted to the result type of g(1), that is, 2 * 1.
We now effectively -Xprint-types for trees within TypeOf. Instead, we show the underlying type for the top-level tree. Also added toString in TypeOf.
…ght be out of date)
In the new scheme, we never touch a TypeOf tree's type and ensure this by assigning that tree NoType. This currently induces additional tree copies which could be removed at a later point. In the process we also fixed bugs in TreeCopier, which would sometimes not go through TypeAssigner when it should have.
...of outers. Hopefully this worksarounds all the issues related to
OlivierBlanvillain
force-pushed
the
add-transparent-6
branch
from
August 24, 2018 11:29
6ad54bf
to
4fa9403
Compare
Adds a mechanism by which types are only ever normalized once. Also adds a global fuel for type normalization.
So we fixed it
test performance please |
performance test scheduled: 4 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4806/ to see the changes. Benchmarks is based on merging with master (1d24eaa) |
Also let Any_== and Any_!= go through the constant folder. Unable the manually desugared subset of the dependent-patterns test.
cuz "An implementation is missing"...
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.
This PR follows #4671. It implements parts of the type normalization. Pattern matching is still missing and will come as a 3rd PR.