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§
- Type
Checker - Type checker for mq programs
- Type
Checker Options - Options for configuring the type checker behavior
- TypeEnv
- Type environment mapping symbol IDs to their inferred type schemes
Enums§
- Type
Error - Type checking errors
Type Aliases§
- Result
- Result type for type checking operations