Skip to content

Improvements to symbol resolutions#189

Merged
JonatanWaern merged 36 commits intomainfrom
support-prov-explicit-method-decls
Feb 26, 2026
Merged

Improvements to symbol resolutions#189
JonatanWaern merged 36 commits intomainfrom
support-prov-explicit-method-decls

Conversation

@JonatanWaern
Copy link
Contributor

@JonatanWaern JonatanWaern commented Jan 19, 2026

Drastically improves semantical analysis of methods, supporting various things
that were previously broken.

Also makes an attempt at formalizing he behavior of the various goto-modes and
ensuring, or at least documenting, when these do not work as expected.

  • Report ambiguous overrides
  • Refactor ReferenceMatches
  • Change debug level of some prints
  • Rework symbol methodology for methods
  • Rework how fp-based symbol lookup works
  • Rework how abstract methods and template methods work
  • Clarify and ensure behavior of goto- operations

@JonatanWaern
Copy link
Contributor Author

@TSonono @lwaern-intel @mandolaerik Have a peek over the addition to USAGE.md to see if these are useful semantics for symbol lookups, and if something is unclear or needs to be specified further. (you can ignore the TODOS for now, hopefully I can resolve those)

@JonatanWaern JonatanWaern marked this pull request as ready for review January 26, 2026 09:31
@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch 2 times, most recently from 9cd6ea3 to 74b7ed7 Compare January 30, 2026 13:39
@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch from 4b63018 to e5178c2 Compare February 6, 2026 15:22
@JonatanWaern
Copy link
Contributor Author

@copilot

Copy link

Copilot AI commented Feb 9, 2026

@JonatanWaern I've opened a new pull request, #192, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves semantic analysis and symbol resolution, especially around method overrides/default calls, and formalizes/document goto-* behaviors.

Changes:

  • Reworked method/trait symbol modeling (abstract vs concrete, default-call tracking, override resolution).
  • Introduced a dedicated semantic lookup module to centralize goto-definition/declaration/implementation/references behavior.
  • Improved reference/symbol bookkeeping (template instantiations, in each provenance) and lowered log noise (debug → trace).

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/span/mod.rs Tightens span containment checks to ensure file matches when testing positions.
src/server/mod.rs Reduces log verbosity for message handling by moving several debug logs to trace.
src/file_management.rs Reduces log verbosity for path resolution output by moving debug to trace.
src/analysis/templating/traits.rs Major trait/method refactor: separates abstract vs concrete methods, adds default-call references, updates override/ambiguity handling.
src/analysis/templating/topology.rs Improves dependency diagnostics (in-each missing template reporting and clearer import mapping log).
src/analysis/templating/objects.rs Tracks in each locations used by composite objects; reworks method override sorting/default-call modeling to match new method ref shape.
src/analysis/templating/methods.rs Refactors DMLMethodRef into a struct, adds DefaultCallReference, and extends override validation (shared/default semantics).
src/analysis/symbols.rs Extends symbol source modeling for per-object method symbols; changes implementations collection to a set; adds compact debug info.
src/analysis/structure/objects.rs Adds InEach.loc and marks empty-body methods as abstract via MaybeAbstract.
src/analysis/scope.rs Reduces log verbosity during reference lookup traversal (debug → trace) and clarifies one debug message.
src/analysis/reference.rs Refactors Reference into { variant, extra_info } to carry additional metadata (e.g., instantiation markers).
src/analysis/provisionals.rs Adds provisional flag parsing for explicit_method_decls plus a unit test.
src/analysis/parsing/structure.rs Adds parsing support for an optional colon token in methods; marks template instantiation references.
src/analysis/parsing/parser.rs Reduces parse-context log verbosity (debug → trace).
src/analysis/mod.rs Large semantic lookup/symbol binding changes: per-parent method symbol indexing, reference matching redesign, method implementation binding, template instantiation implementations.
src/actions/semantic_lookup.rs New module centralizing semantic symbol/reference lookup and goto-* behaviors with limitation reporting.
src/actions/requests.rs Switches goto-* requests to use the new semantic lookup APIs, removing duplicated lookup logic.
src/actions/mod.rs Exposes the new semantic_lookup module and lowers wait-state logs (debug → trace).
src/actions/hover.rs Lowers hover logging verbosity (debug → trace).
src/actions/analysis_storage.rs Removes unused lookup helpers and lowers storage logs (debug → trace) in a few places.
src/actions/analysis_queue.rs Lowers queue logging verbosity (debug → trace) and tweaks one linter failure log level.
USAGE.md Adds documentation clarifying goto-* semantics by symbol kind.
CHANGELOG.md Documents new behavior around ambiguous default calls, instantiations, and object/template implementations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch 2 times, most recently from d5023cc to ddeea49 Compare February 9, 2026 11:10
@JonatanWaern JonatanWaern requested a review from Copilot February 9, 2026 11:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch from ddeea49 to 431fa2e Compare February 9, 2026 12:03
@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch from 2d4ffaf to 008c675 Compare February 16, 2026 12:35
@JonatanWaern JonatanWaern requested a review from Copilot February 20, 2026 13:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +655 to +659
span: *span,
description: format!(
"No template; '{}'",
missing_template_name),
related: vec![],
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The diagnostic text "No template; '{}'" reads like it has an accidental semicolon and is a bit unclear. Consider changing it to something like "No template named '{}'" (or similar), since this is user-facing.

Copilot uses AI. Check for mistakes.
## 0.9.15
- Added support for line length and breaking rules regarding line-breaks after opening parentheses, method output arguments, conditional expressions and binary operands.
- Added support for indendation rule indent_continuation_line.
- Added support for indendation rule indent\_continuation\_line.
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

Spelling: indendation should be indentation.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Willfix in different PR

// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

use std::hash::Hash; appears unused in this module. Please remove it to avoid unused-import warnings (and potential CI failures if warnings are treated as errors).

Suggested change
use std::hash::Hash;

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Curious but correct. I think the 'Hash' name is included by default?

@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch from 27223ab to 3606d50 Compare February 23, 2026 09:24
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Allows better control of what is _semantically_ matched and what messages
are reported to the user

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Ditch the structural lookup, just iterate over all symbols and grab the ones
that match

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
- Previously, goto-x at the start of a name would not work, while
goto-x at the end or middle of it would.
- If there is no definition for a lookup, fall-back to declaration

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
This can happen when methods are ambigiously overridden or overridden
in a diamond shape.
we will correctly search the entire hierarchy until we find the
method from whence the reference came, but we will also search
through adjacent hierarchies, so reaching the bottom of those
is not actually an unexpected error

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Values in the decl_map can be duplicated when two diamond inheritance occurs. So the prior assumption does not hold (and we do not need it)

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
@JonatanWaern JonatanWaern force-pushed the support-prov-explicit-method-decls branch from 3606d50 to 095be61 Compare February 24, 2026 10:01
Previously, we used the context-chain as the authorative
hierarchical location of the lookup, this does not hold
in general (breaks for templates and in-eachs).

New approach uses context-chain to find the object from within
the reference is made, and then parent-links to search parent
scopes

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@TSonono TSonono left a comment

Choose a reason for hiding this comment

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

I've tested the implementation in my daily work, and appreciate the improvements!

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
@JonatanWaern JonatanWaern merged commit bad38b1 into main Feb 26, 2026
4 checks passed
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.

4 participants