Expand description
Shape Type System
This module implements type inference, type checking, and type unification for the Shape language, providing static type safety while maintaining ergonomic syntax through type inference.
§Architecture: Storage vs Semantic Types
- SemanticType: What users see in code (
Option<f64>,Result<Table<Row>>) - StorageType: How data is physically stored (NaN sentinels, bitmaps)
This separation allows the type checker to be strict while storage can be optimized for JIT/SIMD performance.
§Module Structure
types/: Core type definitions (Type, TypeVar, TypeScheme, TypeConstraint)unification/: Type unification algorithm (Robinson’s algorithm)solver/: Constraint solvingchecking/: Pattern checking and type checkingenvironment/: Type environments and scopesinference/: Type inference engine
Re-exports§
pub use types::BuiltinTypes;pub use types::Type;pub use types::TypeConstraint;pub use types::TypeScheme;pub use types::TypeVar;pub use types::annotation_to_semantic;pub use types::annotation_to_string;pub use types::semantic_to_annotation;pub use types::substitute;pub use checker::TypeAnalysisMode;pub use checker::TypeCheckResult;pub use checker::TypeChecker;pub use checker::TypeWarning;pub use checker::analyze_program;pub use checker::analyze_program_with_mode;pub use environment::TypeEnvironment;pub use errors::TypeError;pub use errors::TypeErrorWithLocation;pub use errors::TypeResult;pub use inference::PropertyAssignment;pub use inference::PropertyAssignmentCollector;pub use inference::TypeInferenceEngine;pub use semantic::EnumVariant;pub use semantic::FunctionParam;pub use semantic::FunctionSignature;pub use semantic::SemanticType;pub use semantic::TypeVarId;pub use storage::StorageType;pub use typed_value::TypedValue;pub use universal_error::ErrorDetails;pub use universal_error::ErrorLocation;pub use universal_error::UniversalError;
Modules§
- checker
- Type Checker
- checking
- Type Checking Module
- constraints
- Type Constraint Solver
- environment
- Type Environment
- error_
bridge - Error Bridge Module
- errors
- Type System Errors
- exhaustiveness
- Exhaustiveness Checking for Match Expressions
- inference
- Type Inference Engine
- semantic
- Semantic Types
- storage
- Storage Types
- suggestions
- Error Suggestions
- typed_
value - Typed Value
- types
- Type System Core Types
- unification
- Type Unification Module
- universal_
error - Universal Error Type