Skip to content

Fix #5279: Be more careful where we create symbolic refs from named ones #5287

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 2 commits into from
Nov 1, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 18, 2018

No description provided.

@odersky odersky force-pushed the fix-#5279 branch 3 times, most recently from 6ec2a91 to 7cf7582 Compare October 18, 2018 11:16
Be more where we create symbolic refs from named ones.
Leave name designators as they are. It makes a difference
for the info of the reference.
@odersky
Copy link
Contributor Author

odersky commented Oct 18, 2018

test performance please

@dottybot
Copy link
Member

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

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/5287/ to see the changes.

Benchmarks is based on merging with master (d5b885d)

@odersky
Copy link
Contributor Author

odersky commented Oct 22, 2018

This is now part of #5300. Anyone care to review it independently?

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

The following code fails to compile:

trait BB {
  val a: Any
}

trait TT { self: { type T = Int } & BB { val a: T } =>
  type T
  def lift(x: Int): T = a
}

Error message:

-- [E007] Type Mismatch Error: tests/pos/i5279.scala:7:24 ----------------------
7 |  def lift(x: Int): T = a
  |                        ^
  |                        found:    TT.this.T(TT.this.a)
  |                        required: TT.this.T
  |
one error found

/** Hook that can be called from creation methods in TermRef and TypeRef */
def validated(implicit ctx: Context): this.type = {
this
}
Copy link
Contributor

Choose a reason for hiding this comment

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

validated is not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I do use if occasionally for debugging, and decided to leave it in for others to use as well if needed.

adapted
else this
result.setDenot(denot)
result.asInstanceOf[ThisType]
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess adapted.eq(this) is a performance tweak, semantically we can drop it without changing the result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exact.

@odersky
Copy link
Contributor Author

odersky commented Oct 26, 2018

The following code fails to compile: ...

This looks like another instance of the double vision problem described in #5300.

@odersky odersky merged commit 6421ba6 into scala:master Nov 1, 2018
@allanrenucci allanrenucci deleted the fix-#5279 branch November 1, 2018 16:47
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