Skip to content

Support use syntax in TIv2 - #4845

Open
rw1nkler wants to merge 5 commits into
google:mainfrom
antmicro:102999-use-syntax
Open

rw1nkler wants to merge 5 commits into
google:mainfrom
antmicro:102999-use-syntax

Conversation

@rw1nkler

Copy link
Copy Markdown
Contributor

This PR adds support for use support in TIv2, and makes it operational with bytecode interpreter that relies on TIv1 data structures.

What's included:

  • Resolution of use-bound constants, functions, structs, and type aliases, used directly or reached via ColonRef on a whole-module use subject, including nested module paths
  • Spawning use-imported procs and proc aliases
  • Constexpr propagation for use-imported constants, so they work as parametric defaults
  • A fix for an IR-conversion crash on whole-module use of a module named std

Implementation details:

  • Shared ImportData helpers (ResolveUseImportedTarget, GetUseImportedModuleInfo) let the typechecker and bytecode emitter resolve a use-bound name consistently
  • ColonRef resolution now distinguishes a whole-module use subject from a use-bound value
  • The parser binds a use-bound proc's bare name plus .config/.next/.init keys to the same entry. Since all four resolve to the same proc, the identifier's suffix is the only signal for which member was meant. This suffix lookup runs independently at typecheck time and at bytecode-emission time.

This PR also re-enables the use-syntax end-to-end DSLX tests that were previously disabled pending TIv2 support.

@richmckeever richmckeever self-assigned this Aug 25, 2026
Resolves use-bound constants, functions, structs, and type aliases,
directly or via ColonRef on a whole-module use subject.

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Extends use-bound name resolution to procs and proc aliases, at both
the typecheck and bytecode-emission layers.

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Lets them be used as parametric defaults and bitwidth expressions,
not just directly.

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
A free variable naming the module itself, not one of its members,
was incorrectly assumed to always resolve to a constant.

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Covers use-syntax mechanics and per-entity-kind resolution; re-enables
the use-syntax e2e DSLX tests disabled pending TIv2 support.

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
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.

2 participants