Skip to content

fix: handle analysis of decls more correctly#3190

Closed
neoto wants to merge 1 commit into
zigtools:masterfrom
neoto:ref-analysis
Closed

fix: handle analysis of decls more correctly#3190
neoto wants to merge 1 commit into
zigtools:masterfrom
neoto:ref-analysis

Conversation

@neoto

@neoto neoto commented May 2, 2026

Copy link
Copy Markdown
Contributor

Handles references to aliased decls more correctly by distinguishing between containers and runtime types. Compared to
#3189 which special cases renames, this should address the root cause, fixing both renaming and highlighting symbols. I also added regression tests that fail without the changes on this branch.

Closes #3184

Handles references to aliased decls more correctly by distinguishing
between containers and runtime types. Compared to
zigtools#3189 which special cases renames,
this _should_ address the root cause, fixing both renaming and
highlighting symbols. I also added regression tests that fail without
the changes on this branch.

Closes zigtools#3184
@Techatrix

Copy link
Copy Markdown
Member

I prefer the behavior provided by #3189 over this solution. Because of alises, renaming should not necessarily behave identical to references. Consider this example:

const S = struct {
    fn foo() void {}
};
comptime {
    const foo = S.foo;
    foo();
}

Works as expected:

  1. Renaming foo() should not rename fn foo and S.foo

Doesn't work as expected:

  1. Asking for references on foo() should also provide fn foo and S.foo
  2. Asking for references on fn foo should also provide const foo or foo()
  3. Renaming fn foo should also rename const foo or foo()

The preferred behavior of the second item could be debated but 3 & 4 I feel more confident about.

@Techatrix Techatrix closed this May 12, 2026
@neoto neoto deleted the ref-analysis branch May 12, 2026 12:01
@neoto

neoto commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

Aight. That still leaves highlighting borked, which that PR doesn't fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename symbol renames the value instead of the constant binding

2 participants