Fix issue 20411 - Don't suggest a variable as spelling fix while resolving its own initializer - #23760
Draft
usefahmed07 wants to merge 1 commit into
Draft
Fix issue 20411 - Don't suggest a variable as spelling fix while resolving its own initializer#23760usefahmed07 wants to merge 1 commit into
usefahmed07 wants to merge 1 commit into
Conversation
Contributor
Author
|
@thewilsonator The CI failures seem unrelated to this PR. I get the same errors on a clean I tested the fix and the new regression test ( |
Contributor
|
If you think the CI is unrelated, rebase or force-push to retrigger it. |
The previous check (decl.isVarDeclaration() && decl.inuse) was too broad: dsym.inuse is also set while resolving a variable's explicit type (e.g. 'Foo foo;'), not just while resolving its own initializer. That caused fail_compilation/dip22b.d to lose its expected suggestion. Use sc.varDecl instead (already used for issue 24051), which is only set while the variable's own initializer expression is being resolved, and mark it during initializer-type inference too so the original issue (const almostSimilar = AlmostSimilar;) stays fixed without affecting explicit-type resolution. Fixes dlang#20411
usefahmed07
force-pushed
the
fix/20411-var-self-suggestion
branch
from
September 2, 2026 05:43
5d6482a to
f5d340b
Compare
Contributor
Author
|
@thewilsonator Rebased and pushed. CI still fails with the same unrelated druntime |
Contributor
Author
|
@thewilsonator i think #23102 it has a connection about this PR take a look |
usefahmed07
marked this pull request as draft
September 8, 2026 15:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20411