Skip to content

Fix go to definition on constructor calls #5240

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
Oct 12, 2018

Conversation

Duhemm
Copy link
Contributor

@Duhemm Duhemm commented Oct 11, 2018

No description provided.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@@ -21,7 +21,11 @@ case class SourceTree(tree: tpd.NameTree, source: SourceFile) {
if (treePos.isZeroExtent || tree.name.toTermName == nme.ERROR)
NoSourcePosition
else {
val nameLength = tree.name.stripModuleClassSuffix.show.toString.length
// Constructors are named `<init>` in the trees, but `this` in the source.
val nameLength = tree.name.stripModuleClassSuffix match {
Copy link
Contributor

Choose a reason for hiding this comment

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

<init> never comes with a module class suffix. So the stripModuleClassSuffix could go in the other branch.

@Duhemm Duhemm merged commit 517754c into scala:master Oct 12, 2018
@Duhemm Duhemm deleted the fix/constructor-fixes branch October 12, 2018 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants