package wax-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4361e1324b7754a4c08ab5b505df32061f3ce0cea60443fd0d3699e0fa796b32
sha512=fcc756d2f160ba90a9aa1131f2ab22ed7f45466ccd658c21cf9df6868a6aab0cee7f404719d698a379958802f9820398f2fe0685ecc4dda018ca4f653294e39b
doc/wax-lib.wax/Wax_lang/Typing_env/index.html
Module Wax_lang.Typing_envSource
The naming/context layer shared by the type checker and its extracted passes (Typing_lint, Typing_suggest): the typed-tree annotation types, the resolved-reference and member-completion sinks, the name tables (Namespace / Tbl), the type and module contexts, the error-free accessor variants the lint/suggest code reads through, and the source-slice utilities the quick fixes build edits from. Its concrete types are re-exported by Typing through type equations, so external consumers keep seeing them as Wax_lang.Typing.reference etc.
The resolved per-node annotation of the typed tree: the storage types a node leaves on the stack, plus its span.
As typed_module_annotation, but before the inference cells are resolved to storage types — the form the editor reads.
type hover_target = | Value_type of Infer.inferred_valtype| Type_def of Ast.subtype(*What a resolved reference summarises for a hover on a name that is not itself an expression: a variable's type, or a referenced type's definition.
*)
type reference = {use : Ast.location;definitions : Ast.location list;hover : hover_target option;
}A resolved name/label reference: a use span, the definition span(s) it binds to (several only under conditional compilation), and an optional hover summary.
Where name/label references are accumulated for the editor; None disables recording (an ordinary compile).
Whether a location is a genuine source span (not a synthesized node's Ast.dummy_loc).
Whether two locations cover the same byte range.
The single inference cell an instruction leaves on the stack, or None if it is not a one-value expression. The error-free counterpart of the typer's expression_type: a lint/suggest site reads it silently and skips otherwise, never emitting the duplicate diagnostic the typer already owns.
The precomputed value type &?none / &none (the nullable / non-nullable bottom reference), built without a type context.
The concrete value type an inference cell stands for on its own, or None when it has none yet. Pure and context-free (its only reference result is the built-in None_ bottom); the typer's ctx-threading standalone_valtype delegates here.
Record a punned struct-literal field's span, for the editor's rename.
val record_members :
(Ast.location * Members.member_receiver) list ref option ->
Ast.location ->
Members.member_receiver ->
unitRecord, at a struct field access, the field's span and the receiver it is on, for member completion.
val record_reference :
?hover:hover_target option ->
resolve_sink ->
Ast.location ->
Ast.location list ->
unitRecord a use -> definition(s) reference (dropping synthesized and self-referential definitions).
The option let-operators: bind through Some / map the payload / run an effect only when Some.
A name table holding one binding per name: a run of the typer is one configuration, so a branch it does not select registers nothing. Only the type is exposed here; the operations live in Typing's Namespace (they emit diagnostics through its Error).
The module's type table: each name to its interned index and subtype.
type type_context = {internal_types : Wax_wasm.Types.t;types : (Wax_wasm.Types.ref_index * Ast.subtype) Tbl.t;features : Wax_utils.Feature.set;mutable subtyping_info_cache : Wax_wasm.Types.subtyping_info option;
}The module-wide type space and its memoised subtyping info (see the field comments in typing_env.ml).
type module_context = {diagnostics : Wax_utils.Diagnostic.context;warn_unused : bool;simplify : bool;suggest : bool;select : Ast.location -> bool;faithful : bool;type_context : type_context;types : (Wax_wasm.Types.ref_index * Ast.subtype) Tbl.t;functions : (Wax_wasm.Types.Id.t * string * bool) option Tbl.t;globals : (bool * Infer.inferred_valtype option) Tbl.t;import_globals : (bool * Infer.inferred_valtype option) Tbl.t;assigned_globals : (string, unit) Hashtbl.t;cast_traps_reported : (int * int, unit) Hashtbl.t;canonical_type_references : (origin * Wax_wasm.Types.Id.t) list ref;origin : origin ref;memories : (int * [ `I32 | `I64 ]) Tbl.t;datas : unit Tbl.t;tables : ([ `I32 | `I64 ] * Ast.reftype) Tbl.t;elems : Ast.reftype Tbl.t;structs_by_fields : (string, Ast.ident option) Hashtbl.t;not_expression_reported : (int * int, unit) Hashtbl.t;mutable locals : (Infer.inferred_valtype option * Ast.location) StringMap.t;mutable initialized_locals : StringSet.t;mutable deferred_uninit : Ast.ident list ref list;missing_holes : (Infer.inferred_type Infer.Cell.t * missing_batch) list ref;unresolved_label : bool ref;read_locals : IntSet.t ref;local_decls : Ast.ident list ref;used_labels : IntSet.t ref;deferred_lints : (unit -> unit) list ref;label_decls : Ast.ident list;assigned_locals : StringSet.t;control_types : (Ast.label option * Infer.inferred_type Infer.Cell.t array) list;return_types : Infer.inferred_type Infer.Cell.t array;resolve_links : resolve_sink;pun_spans : Ast.location list ref option;member_completions : (Ast.location * Members.member_receiver) list ref option;
}The per-module type-checking context: diagnostics and run configuration, the module-wide type and name tables, the per-function state (reset on entry to each function), the run's branch selection, and the editor sinks. See the field comments in typing_env.ml.
The source text a location spans, or None when unavailable / out of range.
The location running from one position to another.
A machine-applicable edit that removes the given span.
s with every comment blanked to spaces (newlines kept), so a delimiter inside a comment is never mistaken for real syntax by the source-scanning suggestions.