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

Avoid duplicate reference when using synthetic .apply() constructor #564

Open
olafurpg opened this issue Apr 24, 2023 · 0 comments
Open

Comments

@olafurpg
Copy link
Member

To reproduce https://sourcegraph.com/github.com/sourcegraph/scip-java/-/blob/tests/minimized-scala/src/main/scala/minimized/Issue403.scala?L3:12-3:20#tab=references

Observe that there's a reference with no highlighted range

CleanShot 2023-04-24 at 18 14 33@2x

This range is from the synthetic .apply() constructor. We should extend scip-java to ensure that we only emit a single usage in this situation (which is a very common situation). I'm leaning towards making the occurrence always go to the case class constructor since I almost never want to navigate to the companion object in cases like these.

I propose we fix this issue by consolidating the following two occurrences into a single occurrence to the apply() symbol

https://github.com/sourcegraph/scip-java/blob/main/tests/snapshots/src/main/generated/tests/minimized-scala/src/main/scala/minimized/Issue403.scala#L64-L65

One way to implement this fix is to extend the code path where we generate occurrences for synthetics https://github.com/sourcegraph/scip-java/blob/main/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipTextDocument.java#L71

@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants