better error message for when morphic did not specialize

This commit is contained in:
Folkert 2021-10-03 00:17:15 +02:00
parent fa57ff88a5
commit 3d7b42deba

View file

@ -4109,19 +4109,28 @@ pub fn build_proc<'a, 'ctx, 'env>(
let func_solutions = mod_solutions.func_solutions(func_name).unwrap(); let func_solutions = mod_solutions.func_solutions(func_name).unwrap();
let mut it = func_solutions.specs(); let mut it = func_solutions.specs();
let func_spec = it.next().unwrap(); let evaluator = match it.next() {
debug_assert!( Some(func_spec) => {
it.next().is_none(), debug_assert!(
"we expect only one specialization of this symbol" it.next().is_none(),
); "we expect only one specialization of this symbol"
);
let evaluator = function_value_by_func_spec( function_value_by_func_spec(
env, env,
*func_spec, *func_spec,
symbol, symbol,
top_level.arguments, top_level.arguments,
&top_level.result, &top_level.result,
); )
}
None => {
// morphic did not generate a specialization for this function,
// therefore it must actually be unused.
// An example is our closure callers
panic!("morphic did not specialize {:?}", symbol);
}
};
let ident_string = proc.name.as_str(&env.interns); let ident_string = proc.name.as_str(&env.interns);
let fn_name: String = format!("{}_1", ident_string); let fn_name: String = format!("{}_1", ident_string);