mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
27 lines
914 B
Rust
27 lines
914 B
Rust
use crate::expected::{Expected, PExpected};
|
|
use roc_collections::all::SendMap;
|
|
use roc_module::symbol::Symbol;
|
|
use roc_region::all::{Located, Region};
|
|
use roc_types::subs::Variable;
|
|
use roc_types::types::{Category, PatternCategory, Type};
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub enum Constraint {
|
|
Eq(Type, Expected<Type>, Category, Region),
|
|
Store(Type, Variable, &'static str, u32),
|
|
Lookup(Symbol, Expected<Type>, Region),
|
|
Pattern(Region, PatternCategory, Type, PExpected<Type>),
|
|
True, // Used for things that always unify, e.g. blanks and runtime errors
|
|
SaveTheEnvironment,
|
|
Let(Box<LetConstraint>),
|
|
And(Vec<Constraint>),
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub struct LetConstraint {
|
|
pub rigid_vars: Vec<Variable>,
|
|
pub flex_vars: Vec<Variable>,
|
|
pub def_types: SendMap<Symbol, Located<Type>>,
|
|
pub defs_constraint: Constraint,
|
|
pub ret_constraint: Constraint,
|
|
}
|