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

Add ClassSignature.self (fix #1568) #1617

Merged
merged 6 commits into from
Jun 21, 2018
Merged

Conversation

xeno-by
Copy link
Member

@xeno-by xeno-by commented Jun 21, 2018

Based on top of #1616 to separate large-scale and non-large-scale changes to SemanticDB. This PR was surprisingly easy to implement.

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

Two minor comments, otherwise looks great!

@@ -810,8 +810,7 @@ example.Example.main().(args) => param args: Array[String]
example.Example.x(). => val method x: ClassTag[Int]
ClassTag => scala.reflect.ClassTag#
Int => scala.Int#
local0 => selfparam self: Example
Example => example.Example.
local0 => selfparam self: <?>
Copy link
Member

Choose a reason for hiding this comment

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

Why is this <?> now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because previously we were saving synthetic self-type assigned to selfparams by scalac. In this PR, I found a way to separate the synthetic part from what's actually written in the source code. Now, selfparams without explicit type information have no signature.

class C2 extends B { self: B =>
}

class C3 extends B { self: B with Int =>
Copy link
Member

Choose a reason for hiding this comment

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

Can we test that the name of the symbol is kept even when it's not self? For example, class A { hello => }?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. The name is not kept in signatures though (because ScalaSignatures don't have the capacity to save it), only in occurrences.

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks for the explanation!

@xeno-by xeno-by merged commit 9648fab into scalameta:master Jun 21, 2018
@xeno-by xeno-by deleted the topic/self branch June 21, 2018 13:07
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