Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix goto-def on exported forwarders #19494

Merged
merged 8 commits into from
Jan 31, 2024
Merged

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jan 19, 2024

No description provided.

@dwijnand dwijnand linked an issue Jan 19, 2024 that may be closed by this pull request
@dwijnand dwijnand changed the title Presentation compilers and exports Presentation compiler and exports Jan 19, 2024
Given:

    class Foo(name: String, age: Int)
    case class Person(name: String)

Is the Foo constructor symbol synthetic?  Being the primary
constructor, sourceSymbol considers it should be substituted for the Foo
class symbol.

Similarly, the Person apply method symbol is replaced by the class
symbol for Person (via the Person module class).

Doing so leads the presentation compiler to show details about the
class, rather than the constructor or the apply method intially
targeted.
@dwijnand dwijnand changed the title Presentation compiler and exports Fix goto-def on exported forwarders Jan 22, 2024
@dwijnand dwijnand marked this pull request as ready for review January 22, 2024 10:14
@dwijnand dwijnand requested a review from odersky January 22, 2024 10:14
@dwijnand
Copy link
Member Author

@odersky let me know if you can spot a better way to do this, or any tweaks in how I do it.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

This is awesome! Thanks! Probably Martin is still needed to review, but from my side it looks good!

@tgodzik tgodzik added backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools labels Jan 29, 2024
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

compiler/src/dotty/tools/dotc/core/Symbols.scala Outdated Show resolved Hide resolved
@odersky odersky assigned dwijnand and unassigned odersky Jan 30, 2024
Tested by giving exportTerm0 and exportTerm1 difference filenames,
resulting in different locations and breakage.
@dwijnand dwijnand merged commit 409d13a into scala:main Jan 31, 2024
19 checks passed
@dwijnand dwijnand deleted the export-completions branch January 31, 2024 16:00
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
@tgodzik tgodzik removed the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label May 8, 2024
WojciechMazur added a commit that referenced this pull request Jul 1, 2024
Backports #19494 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No way to find the original symbol for exported symbols
4 participants