SymbolVersions¶
- class hugr.model.load.SymbolVersions[source]¶
Bases:
objectVersioned bindings for a single root symbol name.
Only extension ops and types have versions. All other symbols are expected to be unversioned, but we cannot differentiate between them and validate the property at this stage of the import.
Methods
Record one version binding for this symbol.
Resolve an unversioned use of this symbol.
Attributes
versions- insert(name: str, version: Version | None, node: Node) None[source]¶
Record one version binding for this symbol.
A single model node can only introduce one version of a symbol. Seeing the same name/version pair twice is therefore a duplicate binding, not another version attached to an existing node.
- resolve_unversioned() Version | None[source]¶
Resolve an unversioned use of this symbol.
If there is an explicit unversioned declaration of a symbol, it is used. If there is no unversioned binding, the latest explicit version declared for the symbol is used instead.
# Example: ```lisp ;; extA has an explicit unversioned import (import extA@1.0) (import extA)
;; extB has only versioned imports (import extB@1.0)
(meta extA 1) ;; Uses the unversioned declaration (meta extB 1) ;; Uses the latest versioned declaration ```