Skip to content
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
wants to merge 128 commits into from

Conversation

OlivierBlanvillain
Copy link
Contributor

@OlivierBlanvillain OlivierBlanvillain commented Jul 18, 2018

This PR follows #4671. It implements parts of the type normalization. Pattern matching is still missing and will come as a 3rd PR.

gsps and others added 30 commits June 13, 2018 16:51
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.
The commented parts are copy pasted from the AppliedTermRef PR
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.
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.
@gsps
Copy link
Contributor

gsps commented Aug 28, 2018

test performance please

@dottybot
Copy link
Member

performance test scheduled: 4 job(s) in queue, 1 running.

@dottybot
Copy link
Member

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants