Get the kind as a qualified identifier.
Equations
- StrataDDM.qualIdentKind stx = match stx.getKind with | (Lean.Name.anonymous.str dialect).str name => some { dialect := dialect, name := name } | x => none
Instances For
This expands type aliases appearing at the head of the term so the head is in a normal form.
Attempt to interpret e as a n-ary function, and
return the type of the arguments along with the return type if possible,
or error (args, r) where args is an array with size args.size < n and r
is the resulting type.
Equations
- tctx.applyNArgs e n = StrataDDM.Elab.TypingContext.applyNArgs.aux✝ tctx n #[] e
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- dialects : DialectMap
- openDialectSet : Std.HashSet DialectName
- typeOrCatDeclMap : TypeOrCatDeclMap
Map for looking up types and categories by name.
- metadataDeclMap : MetadataDeclMap
Map for looking up metadata by name.
- syntaxElabs : SyntaxElabMap
Syntax elaboration functions.
- inputContext : Parser.InputContext
- globalContext : GlobalContext
- missingImport : Bool
Flag to indicate we are missing an import (silences some warnings)
- typecheck : Bool
When false, type inference and unification are skipped during elaboration.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
Instances For
- qid : QualifiedIdent → MaybeQualifiedIdent
- name : String → MaybeQualifiedIdent
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
This translate a possibly qualified identifier into a declaration in an open dialect.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- StrataDDM.Elab.asTypeInfo tree = match tree.info with | StrataDDM.Elab.Info.ofTypeInfo info => pure info | x => do StrataDDM.Elab.logError tree.info.loc "Expected type." pure default
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
This expands type aliases appearing at the head of the term so the root is in a normal for,.
N.B. This expects that macros have already been expanded in e.
This checks that two types itype and rtype are equivalent.
In this context, itype refers to a type inferred from an operator argument
at position stx and rtype refers to a type inferred or specifed by a previous
argument.
This compares the inferred type against the expected type for an argument to check if the argument value is well-typed and determine if additional type variables can be automatically inferred.
isTypePreturns true if the argument at the given index is a type.argLevelrefers to the index of the argument inargsexpectedTypeis the type of the argument for the operation/expression. Bound variables in it may refer to args inargsless thanargIndex.tctxis the typing context forinferredType.exprSyntaxis the syntax of the expression/operator this is for. Used for positions in error reporting.inferredTypeis the type inferred from bottom up type inference. Bound variables in it may refere to bound variables intctx.argsis the current arguments. These may be refined by unifyTypes and the new arguments are returned.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
This collects the results of applying a function f to the bindings added to the
resulting context of tree after the initial number of bindings given by
initialScope.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- StrataDDM.Elab.elabArgIndex initialScope trees none f = pure #[]
- StrataDDM.Elab.elabArgIndex initialScope trees (some idx) f = StrataDDM.Elab.collectNewBindingsM initialScope trees[idx.toLevel] f
Instances For
Parse TypeApp and TypeParen expressions to get Init.TypeExpr into head-format form.
Equations
- One or more equations did not get rendered due to their size.
- StrataDDM.Elab.flattenTypeApp arg args = (arg, args)
Instances For
Equations
- StrataDDM.Elab.logInternalError loc msg = StrataDDM.Elab.logError loc msg
Instances For
Evaluate the tree as a type expression.
Evaluate the tree as a type expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluate the tree as a type expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct a binding from a binding spec and the arguments to an operation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a type expression and a natural number, this returns a
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns the type of e in typing context tctx.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a tree from operations with category Init.TypeExpr, build a tree with the type or category
successfully translated.
Return the arguments to the given syntax declaration.
This should alway succeeed, but captures an internal error if an invariant check fails.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The kind of elaboration to perform for an argument in runSyntaxElaborator.
Unlike ArgDeclKind, this distinguishes pre-types (which need macro expansion)
from already-resolved type expressions.
- preType (tp : PreType) : ElabArgKind
- typeExpr (tp : TypeExpr) : ElabArgKind
- cat (k : SyntaxCat) : ElabArgKind
Instances For
Equations
Instances For
Equations
Instances For
Elaborate a single argument based on its ElabArgKind.
Returns the updated trees vector with the result placed at argIdx.
Elaborate all syntax arguments for an operation according to the
SyntaxElaborator's ordering. Iterates over se.argElaborators, computes
the typing context for each argument (handling datatype scopes for
recursive types), and delegates to elabSyntaxArg for the actual
elaboration. Returns the elaborated Tree vector and the result
TypingContext.
Two-phase elaboration for operations annotated with @[preRegisterTypes] or
@[preRegisterFunctions].
- Phase 1: Resolve the scope argument, extract children, and fold
extractInfoover them to pre-register names in theGlobalContext. - Phase 2: Fully elaborate all args with the updated context.
label is used in error messages to identify the caller.
For @[preRegisterTypes]: pre-registers type-level bindings so mutual type references
resolve. Known deviation: typeParams args are elaborated twice — once in Phase 1
(against tctx0) to extract param names, and again in Phase 2 (against the per-child
context). Phase 1 typeParams trees cannot be reused because collectNewBindingsM
requires tree.info.inputCtx.bindings.size ≥ initialScope, which fails when the
Phase 1 context is smaller than the Phase 2 per-child context.
For @[preRegisterFunctions]: pre-registers expression-level bindings (function
signatures) so mutual calls resolve.
Phase 1 helper for a single child function in a mutual recursive block.
Partially elaborates the child's name, bindings, and return type to extract the function signature, then pre-registers it as an expression-level binding in the GlobalContext. This makes all sibling function names (including self) available when elaborating bodies in Phase 2.
Phase 1 helper for a single child operation in a mutual block.
Partially elaborates the child's name and typeParams args to extract
the type name and parameter names, then pre-registers the type in the
TypingContext's GlobalContext via preRegisterType. Returns the
updated TypingContext with the new type registered.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.