Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
ayazhafiz committed Jul 17, 2023
1 parent 54e8d1d commit 8b7823a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
14 changes: 14 additions & 0 deletions crates/compiler/checkmate/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,20 @@
}
}
},
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ErasedLambda"
]
}
}
},
{
"type": "object",
"required": [
Expand Down
1 change: 1 addition & 0 deletions crates/compiler/checkmate/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl AsSchema<Content> for subs::Content {
opt_name,
} => B::Recursive(opt_name.as_schema(subs), structure.as_schema(subs)),
A::LambdaSet(lambda_set) => lambda_set.as_schema(subs),
A::ErasedLambda => B::ErasedLambda(),
A::Structure(flat_type) => flat_type.as_schema(subs),
A::Alias(name, type_vars, real_var, kind) => B::Alias(
name.as_schema(subs),
Expand Down
1 change: 1 addition & 0 deletions crates/compiler/checkmate_schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl_content! {
recursion_var: Option<Variable>,
ambient_function: Variable,
},
ErasedLambda {},
Alias {
name: Symbol,
variables: AliasTypeVariables,
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/late_solve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ pub fn unify(
pools: &mut pools,

#[cfg(debug_assertions)]
checkmate: None,
checkmate: &mut None,
};

compact_lambda_sets_of_vars(&mut env, lambda_sets_to_specialize, &late_phase)
Expand Down
11 changes: 9 additions & 2 deletions crates/compiler/solve/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct SolveEnv<'a> {
pub subs: &'a mut Subs,
pub pools: &'a mut Pools,
#[cfg(debug_assertions)]
pub checkmate: Option<roc_checkmate::Collector>,
pub checkmate: &'a mut Option<roc_checkmate::Collector>,
}

/// Environment necessary for inference.
Expand All @@ -31,6 +31,8 @@ pub struct InferenceEnv<'a> {
pub derived_env: &'a DerivedEnv<'a>,
pub subs: &'a mut Subs,
pub pools: &'a mut Pools,
#[cfg(debug_assertions)]
pub checkmate: Option<roc_checkmate::Collector>,
}

impl<'a> SolveEnv<'a> {
Expand All @@ -42,7 +44,10 @@ impl<'a> SolveEnv<'a> {

/// Retrieves an environment for unification.
pub fn uenv(&mut self) -> UEnv {
UEnv::new(self.subs)
with_checkmate!({
on => UEnv::new(self.subs, self.checkmate.as_mut()),
off => UEnv::new(self.subs),
})
}
}

Expand Down Expand Up @@ -108,6 +113,8 @@ impl<'a> InferenceEnv<'a> {
derived_env: self.derived_env,
subs: self.subs,
pools: self.pools,
#[cfg(debug_assertions)]
checkmate: &mut self.checkmate,
}
}
}
Expand Down

0 comments on commit 8b7823a

Please sign in to comment.