mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Push checkmate through load
This commit is contained in:
parent
27dd9d03aa
commit
1282110ef5
14 changed files with 167 additions and 45 deletions
|
@ -331,6 +331,13 @@ fn start_phase<'a>(
|
|||
|
||||
let derived_module = SharedDerivedModule::clone(&state.derived_module);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
let checkmate = if roc_checkmate::is_checkmate_enabled() {
|
||||
Some(roc_checkmate::Collector::new())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
BuildTask::solve_module(
|
||||
module,
|
||||
ident_ids,
|
||||
|
@ -347,6 +354,9 @@ fn start_phase<'a>(
|
|||
declarations,
|
||||
state.cached_types.clone(),
|
||||
derived_module,
|
||||
//
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
)
|
||||
}
|
||||
Phase::FindSpecializations => {
|
||||
|
@ -361,6 +371,9 @@ fn start_phase<'a>(
|
|||
ident_ids,
|
||||
abilities_store,
|
||||
expectations,
|
||||
//
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: _,
|
||||
} = typechecked;
|
||||
|
||||
let mut imported_module_thunks = bumpalo::collections::Vec::new_in(arena);
|
||||
|
@ -567,6 +580,9 @@ enum Msg<'a> {
|
|||
abilities_store: AbilitiesStore,
|
||||
loc_expects: LocExpects,
|
||||
loc_dbgs: LocDbgs,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: Option<roc_checkmate::Collector>,
|
||||
},
|
||||
FinishedAllTypeChecking {
|
||||
solved_subs: Solved<Subs>,
|
||||
|
@ -577,6 +593,9 @@ enum Msg<'a> {
|
|||
dep_idents: IdentIdsByModule,
|
||||
documentation: VecMap<ModuleId, ModuleDocumentation>,
|
||||
abilities_store: AbilitiesStore,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: Option<roc_checkmate::Collector>,
|
||||
},
|
||||
FoundSpecializations {
|
||||
module_id: ModuleId,
|
||||
|
@ -878,6 +897,9 @@ enum BuildTask<'a> {
|
|||
dep_idents: IdentIdsByModule,
|
||||
cached_subs: CachedTypeState,
|
||||
derived_module: SharedDerivedModule,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: Option<roc_checkmate::Collector>,
|
||||
},
|
||||
BuildPendingSpecializations {
|
||||
module_timing: ModuleTiming,
|
||||
|
@ -1393,6 +1415,9 @@ fn state_thread_step<'a>(
|
|||
dep_idents,
|
||||
documentation,
|
||||
abilities_store,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
} => {
|
||||
// We're done! There should be no more messages pending.
|
||||
debug_assert!(msg_rx.is_empty());
|
||||
|
@ -1412,6 +1437,9 @@ fn state_thread_step<'a>(
|
|||
dep_idents,
|
||||
documentation,
|
||||
abilities_store,
|
||||
//
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
);
|
||||
|
||||
Ok(ControlFlow::Break(LoadResult::TypeChecked(typechecked)))
|
||||
|
@ -2387,6 +2415,7 @@ fn update<'a>(
|
|||
abilities_store,
|
||||
loc_expects,
|
||||
loc_dbgs,
|
||||
checkmate,
|
||||
} => {
|
||||
log!("solved types for {:?}", module_id);
|
||||
module_timing.end_time = Instant::now();
|
||||
|
@ -2496,6 +2525,9 @@ fn update<'a>(
|
|||
dep_idents,
|
||||
documentation,
|
||||
abilities_store,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
})
|
||||
.map_err(|_| LoadingProblem::MsgChannelDied)?;
|
||||
|
||||
|
@ -2529,6 +2561,9 @@ fn update<'a>(
|
|||
ident_ids,
|
||||
abilities_store,
|
||||
expectations: opt_expectations,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
};
|
||||
|
||||
state
|
||||
|
@ -3176,6 +3211,8 @@ fn finish(
|
|||
dep_idents: IdentIdsByModule,
|
||||
documentation: VecMap<ModuleId, ModuleDocumentation>,
|
||||
abilities_store: AbilitiesStore,
|
||||
//
|
||||
#[cfg(debug_assertions)] checkmate: Option<roc_checkmate::Collector>,
|
||||
) -> LoadedModule {
|
||||
let module_ids = Arc::try_unwrap(state.arc_modules)
|
||||
.unwrap_or_else(|_| panic!("There were still outstanding Arc references to module_ids"))
|
||||
|
@ -3224,6 +3261,9 @@ fn finish(
|
|||
timings: state.timings,
|
||||
docs_by_module: documentation,
|
||||
abilities_store,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4441,6 +4481,8 @@ impl<'a> BuildTask<'a> {
|
|||
declarations: Declarations,
|
||||
cached_subs: CachedTypeState,
|
||||
derived_module: SharedDerivedModule,
|
||||
|
||||
#[cfg(debug_assertions)] checkmate: Option<roc_checkmate::Collector>,
|
||||
) -> Self {
|
||||
let exposed_by_module = exposed_types.retain_modules(imported_modules.keys());
|
||||
|
||||
|
@ -4463,6 +4505,9 @@ impl<'a> BuildTask<'a> {
|
|||
module_timing,
|
||||
cached_subs,
|
||||
derived_module,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4718,6 +4763,9 @@ struct SolveResult {
|
|||
exposed_vars_by_symbol: Vec<(Symbol, Variable)>,
|
||||
problems: Vec<TypeError>,
|
||||
abilities_store: AbilitiesStore,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: Option<roc_checkmate::Collector>,
|
||||
}
|
||||
|
||||
#[allow(clippy::complexity)]
|
||||
|
@ -4731,6 +4779,8 @@ fn run_solve_solve(
|
|||
var_store: VarStore,
|
||||
module: Module,
|
||||
derived_module: SharedDerivedModule,
|
||||
|
||||
#[cfg(debug_assertions)] checkmate: Option<roc_checkmate::Collector>,
|
||||
) -> SolveResult {
|
||||
let Module {
|
||||
exposed_symbols,
|
||||
|
@ -4782,6 +4832,8 @@ fn run_solve_solve(
|
|||
pending_derives,
|
||||
exposed_by_module: &exposed_for_module.exposed_by_module,
|
||||
derived_module,
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
};
|
||||
|
||||
let solve_output = roc_solve::module::run_solve(
|
||||
|
@ -4824,6 +4876,9 @@ fn run_solve_solve(
|
|||
scope: _,
|
||||
errors,
|
||||
resolved_abilities_store,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
} = solve_output;
|
||||
|
||||
SolveResult {
|
||||
|
@ -4832,6 +4887,9 @@ fn run_solve_solve(
|
|||
exposed_vars_by_symbol,
|
||||
problems: errors,
|
||||
abilities_store: resolved_abilities_store,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4850,6 +4908,8 @@ fn run_solve<'a>(
|
|||
dep_idents: IdentIdsByModule,
|
||||
cached_types: CachedTypeState,
|
||||
derived_module: SharedDerivedModule,
|
||||
|
||||
#[cfg(debug_assertions)] checkmate: Option<roc_checkmate::Collector>,
|
||||
) -> Msg<'a> {
|
||||
let solve_start = Instant::now();
|
||||
|
||||
|
@ -4876,6 +4936,9 @@ fn run_solve<'a>(
|
|||
var_store,
|
||||
module,
|
||||
derived_module,
|
||||
//
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
),
|
||||
Some(TypeState {
|
||||
subs,
|
||||
|
@ -4888,6 +4951,9 @@ fn run_solve<'a>(
|
|||
exposed_vars_by_symbol,
|
||||
problems: vec![],
|
||||
abilities_store: abilities,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate: None,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
@ -4901,6 +4967,9 @@ fn run_solve<'a>(
|
|||
var_store,
|
||||
module,
|
||||
derived_module,
|
||||
//
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
@ -4911,6 +4980,9 @@ fn run_solve<'a>(
|
|||
exposed_vars_by_symbol,
|
||||
problems,
|
||||
abilities_store,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
} = solve_result;
|
||||
|
||||
let exposed_types = roc_solve::module::exposed_types_storage_subs(
|
||||
|
@ -4945,6 +5017,9 @@ fn run_solve<'a>(
|
|||
abilities_store,
|
||||
loc_expects,
|
||||
loc_dbgs,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6160,6 +6235,9 @@ fn run_task<'a>(
|
|||
dep_idents,
|
||||
cached_subs,
|
||||
derived_module,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
} => Ok(run_solve(
|
||||
module,
|
||||
ident_ids,
|
||||
|
@ -6175,6 +6253,9 @@ fn run_task<'a>(
|
|||
dep_idents,
|
||||
cached_subs,
|
||||
derived_module,
|
||||
//
|
||||
#[cfg(debug_assertions)]
|
||||
checkmate,
|
||||
)),
|
||||
BuildPendingSpecializations {
|
||||
module_id,
|
||||
|
|
|
@ -46,6 +46,9 @@ pub struct LoadedModule {
|
|||
pub timings: MutMap<ModuleId, ModuleTiming>,
|
||||
pub docs_by_module: VecMap<ModuleId, ModuleDocumentation>,
|
||||
pub abilities_store: AbilitiesStore,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub checkmate: Option<roc_checkmate::Collector>,
|
||||
}
|
||||
|
||||
impl LoadedModule {
|
||||
|
@ -125,6 +128,9 @@ pub struct TypeCheckedModule<'a> {
|
|||
pub ident_ids: IdentIds,
|
||||
pub abilities_store: AbilitiesStore,
|
||||
pub expectations: Option<Expectations>,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub checkmate: Option<roc_checkmate::Collector>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue