Repository navigation
Fix extern reference matching - #245
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
Externs are inserted intosymbolsbefore constants/parameters/subobjects/etc, and… · New This introduces a dependency fromanalysis::structureintoanalysis::templating, which can make… · NewExternalready stores bothvar: VariableDeclandspan: ZeroSpan, butlocation()delegates… · NewCollectedSymbolsis now an 8-element tuple, which is hard to read and easy to mis-destructure… · New
What changed in this PR
Updates extern declaration handling so extern symbols participate correctly in reference matching and goto-definition, with a new regression test covering extern lookups.
Changes:
- Add extern declarations as first-class structure objects and include them in symbol collection / collision reporting.
- Wire externs into templating + analysis symbol tables and lookup paths.
- Add a regression test for goto-ref/goto-def around extern function/value declarations.
| File | Description |
|---|---|
| tests/test_files/basic_lookup.dml | Adds a regression case for extern declarations and references. |
| src/analysis/templating/objects.rs | Collects extern declarations into object specs and exposes them as shallow components/symbols. |
| src/analysis/structure/toplevel.rs | Routes parsed externs through StatementSpec instead of a dedicated TopLevel.externs field. |
| src/analysis/structure/objects.rs | Introduces Extern as a distinct structure type and updates object conversion. |
| src/analysis/parsing/structure.rs | Adds ExternContent parse node and simplifies extern parsing. |
| src/analysis/mod.rs | Enables symbol creation/lookup for extern shallow objects. |
| CHANGELOG.md | Documents the extern reference-matching fix. |
Review effort: Lite
35693b1 to
2f494b7
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Extern collection loses conditional-import guards, causing false collision diagnostics between mutually exclusive declarations.
1 open issue
4 resolved since last review
Externs are inserted intosymbolsbefore constants/parameters/subobjects/etc, and…CollectedSymbolsis now an 8-element tuple, which is hard to read and easy to mis-destructure…Externalready stores bothvar: VariableDeclandspan: ZeroSpan, butlocation()delegates… This introduces a dependency fromanalysis::structureintoanalysis::templating, which can make…
Review effort: Balanced
| // Externs are unconditional and unranked by definition | ||
| for extrn in &spec.spec.externs { | ||
| externs.push(extrn.clone()); |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
Extern parsing no longer consumes an optional initializer; if the input contains=(e.g. `extern… · NewExistConditionis collected and threaded intoadd_externsbut then immediately discarded.… · New Preserve import conditions when detecting extern name collisions This comment is misleading as written: externs are effectively spec-guarded here because the loop… · New
Review effort: Lite
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>
In current DML, this cannot happen, in future DML when we have conditional imports this _could_ happen if we conditionally import a file with an extern decl Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
bc6b989 to
093ed60
Compare
TSonono
left a comment
There was a problem hiding this comment.
Tried it, and it seemingly works, thanks for the fix



Fixes issue #236