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

[REVERTED] Completion bugfix: Matcher should be able to match on name exactly #10148

Merged
merged 3 commits into from May 25, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Sep 20, 2022

Previously, we would get completion candidates that would by filter by a wrong name if it was an alias (name of the type that was liased). Now, we find dealiased candidates later on, so no need to add the alias info.

The problem appeared since we use the name matcher to fuzzy match on the input string. If the name that we match on is wrong then the results will also be wrong.

Follow up from https://github.com/scala/scala/pull/9754/files

@SethTisue if it's a sensible change I could also revert the rest of the changes from the other PR. Or do you think we should keep it as is?

@SethTisue
Copy link
Member

@jxnu-liguobin opinion here?

@jxnu-liguobin
Copy link
Member

@jxnu-liguobin opinion here?

For my part, due to the usage of the alias, it may be easily or already confirmed by the user, so it is OK to not show the alias.

@tgodzik
Copy link
Contributor Author

tgodzik commented Sep 23, 2022

@jxnu-liguobin opinion here?

For my part, due to the usage of the alias, it may be easily or already confirmed by the user, so it is OK to not show the alias.

Actually this PR should not change the behaviour of the REPL, I just moved the functionality further down the chain, since it makes it complicated to filter out the initial members with the current approach.

@SethTisue SethTisue added the prio:blocker release blocker (used only by core team, only near release time) label Sep 23, 2022
@kubukoz
Copy link

kubukoz commented Oct 6, 2022

hey, is there anything blocking this PR? It seems like we're waiting for it to get 2.13.10 which would fix a bincompat issue: scala/bug#12650

@tgodzik
Copy link
Contributor Author

tgodzik commented Oct 6, 2022

Och, I had no idea this was a blocker 😨 Should I remove alias: Option[String] = None that was added in the other PR since it's no longer used?

@kubukoz
Copy link

kubukoz commented Oct 6, 2022

@SethTisue
Copy link
Member

SethTisue commented Oct 8, 2022

I have been waffling about what to do about this PR: merge it? or merge a full reversion of #9754? or leave things alone until 2.13.11?

(I apologize for waffling privately rather than speaking up here sooner.)

On the one hand, this PR certainly seems safe, and it corrects a known regression in 2.13.9.

But on the other hand, tooling authors were able to work around the regression, and they will equally be able to work around it in 2.13.10, if we postpone any further changes.

Plus, there was some awkward timing and I unexpectedly ended up short on time to properly devote to this.

I've got to make some choice since it's now very pressing to get 2.13.10 out the door, so the decision is: let's leave this alone for now and do something for 2.13.11.

@SethTisue SethTisue modified the milestones: 2.13.10, 2.13.11 Oct 8, 2022
@tgodzik
Copy link
Contributor Author

tgodzik commented Oct 10, 2022

I work around the issue in 2.13.10, let me know if I need to do anything to push this forward 😄

Previously, we would get completion candidates that would by filter by a wrong name if it was an alias (name of the type that was liased). Now, we find dealiased candidates later on, so no need to add the alias info.
@SethTisue SethTisue added prio:hi high priority (used only by core team, only near release time) and removed prio:blocker release blocker (used only by core team, only near release time) labels May 25, 2023
@SethTisue
Copy link
Member

SethTisue commented May 25, 2023

I added commits based on the review feedback from Lukas.

The lack of any test coverage in-repo worries me a bit, though this is reassuring:

Actually this PR should not change the behaviour of the REPL, I just moved the functionality further down the chain

Perhaps there is sufficient test coverage in downstream repos (Metals?) and I shouldn't be worried 🤷

@SethTisue SethTisue enabled auto-merge May 25, 2023 20:37
@SethTisue SethTisue merged commit 263eb47 into scala:2.13.x May 25, 2023
2 of 4 checks passed
@SethTisue SethTisue removed the prio:hi high priority (used only by core team, only near release time) label May 25, 2023
@tgodzik tgodzik deleted the correct-by-name branch May 26, 2023 14:00
@SethTisue
Copy link
Member

@tgodzik is this Metals test failure in the community build an expected consequence of this?

https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/4504/artifact/logs/metals-build.log

[metals] [info] tests.pc.CompletionIssueSuite.issue-749_2.13.11-bin-fd209dc started
[metals] [error] ==> X tests.pc.CompletionIssueSuite.issue-749_2.13.11-bin-fd209dc  0.04s munit.ComparisonFailException: /home/jenkins/workspace/scala-2.13.x-jdk11-integrate-community-build/target-0.9.20/project-builds/metals-d7c35065e6e279bc7b1afed6954ae07d362a6c3e/tests/cross/src/test/scala/tests/pc/CompletionIssueSuite.scala:38
[metals] [error] 37:
[metals] [error] 38:  check(
[metals] [error] 39:    "issue-749".tag(IgnoreScala3),
[metals] [error] diff assertion failed
[metals] [error] => Obtained
[metals] [error] "+(other: String): String"
[metals] [error] => Diff (- obtained, + expected)
[metals] [error] -+(other: String): String
[metals] [error] +Self[+T] = Main.this.stream.Self
[metals] [error]     at munit.Assertions.failComparison(Assertions.scala:274)

@tgodzik
Copy link
Contributor Author

tgodzik commented May 27, 2023

Not expected at all. We will need to dig in what's happening :/

This test wasn't really impacted previously, so I don't fully understand what is happening.

@SethTisue SethTisue changed the title bugfix: Matcher should be able to match on name exactly Completion bugfix: Matcher should be able to match on name exactly May 28, 2023
@SethTisue
Copy link
Member

SethTisue commented May 31, 2023

I'm going to revert this for 2.13.11. I invite you to submit a revised PR for 2.13.12.

I can run the community build on the revised PR prior to merge, and/or I can help you to do it yourself locally if you want a faster feedback cycle on making coordinated changes in the two repos.

@SethTisue SethTisue changed the title Completion bugfix: Matcher should be able to match on name exactly [REVERTED] Completion bugfix: Matcher should be able to match on name exactly May 31, 2023
SethTisue added a commit to SethTisue/scala that referenced this pull request May 31, 2023
to be revisited after 2.13.11
@SethTisue SethTisue added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
6 participants