package wax-lib

  1. Overview
  2. Docs
Libraries for Wax, a Rust-like syntax for WebAssembly

Install

dune-project
 Dependency

Authors

Maintainers

Sources

wax-v0.2.0.tbz
sha256=4361e1324b7754a4c08ab5b505df32061f3ce0cea60443fd0d3699e0fa796b32
sha512=fcc756d2f160ba90a9aa1131f2ab22ed7f45466ccd658c21cf9df6868a6aab0cee7f404719d698a379958802f9820398f2fe0685ecc4dda018ca4f653294e39b

doc/wax-lib.wax/Wax_lang/Typing_suggest/index.html

Module Wax_lang.Typing_suggestSource

The machine-applicable quick-fix suggestions the typer offers for hand-written Wax (redundant type annotations, compound assignment, field punning). Each is a Suggestion diagnostic carrying a source-slice-built Wax_utils.Diagnostic.edit; the type checker calls these when ctx.suggest is set. The block/if result-type suggestions and their driver context_block_typ stay in Typing, which calls suggest_block_result / suggest_if_result here. The Suggestion-emitting Error submodule is internal.

Locate the ': t' annotation between a binding name's end and the boundary after it, from the source (the AST keeps no span for it). Returns the type's own span and the ': t' span to delete, or None when it cannot be isolated.

Sourceval suggest_redundant_annotation : Typing_env.module_context -> name_end:Lexing.position -> boundary:Lexing.position -> unit

Suggest dropping a binding's redundant ': t' annotation that the initializer's inferred type already pins.

Sourceval compound_assignable : Ast.binop -> bool

Whether a binary operator has a compound-assignment form x op= e.

Sourceval suggest_compound_assignment : Typing_env.module_context -> location:Ast.location -> (string, Ast.location) Ast.annotated -> Ast.location Ast.instr -> unit

Suggest rewriting x = x op e as the compound form x op= e.

Sourceval suggest_punning : Typing_env.module_context -> Ast.ident -> Ast.location Ast.instr option -> unit

Suggest the punning shorthand {x} for a field written x: x.

Sourceval suggest_drop_type_name : Typing_env.module_context -> Ast.ident -> unit

Suggest dropping a construction's redundant T| type name.

Sourceval suggest_block_result : Typing_env.module_context -> keyword:string -> Lexing.position -> Lexing.position -> unit

Suggest dropping a block's redundant result type (do t { … } etc.).

Suggest dropping an if-expression's redundant => t result type.