Skip to main content

Crate mq_check

Crate mq_check 

Source
Expand description

Type inference engine for mq language using Hindley-Milner type inference.

This crate provides static type checking and type inference capabilities for mq. It implements a Hindley-Milner style type inference algorithm with support for:

  • Automatic type inference (no type annotations required)
  • Polymorphic functions (generics)
  • Type constraints and unification
  • Integration with mq-hir for symbol and scope information
  • Error location reporting with source spans

§Error Location Reporting

Type errors include location information (line and column numbers) extracted from the HIR symbols. This information is converted to miette::SourceSpan for diagnostic display. The span information helps users identify exactly where type errors occur in their source code.

Example error output:

Error: Type mismatch: expected number, found string
  Span: SourceSpan { offset: 42, length: 6 }

Modules§

builtin
Builtin function type signatures for the mq type system.
constraint
Constraint generation for type inference.
infer
Type inference context and engine.
narrowing
Type narrowing analysis and resolution for mq’s type checker.
types
Type representations for the mq type system.
unify
Unification algorithm for type inference.

Structs§

TypeChecker
Type checker for mq programs
TypeCheckerOptions
Options for configuring the type checker behavior
TypeEnv
Type environment mapping symbol IDs to their inferred type schemes

Enums§

TypeError
Type checking errors

Type Aliases§

Result
Result type for type checking operations