Fix edge case with traces off and usage of softcast and hardcast on the same type

This commit is contained in:
microproofs 2024-09-19 22:29:13 -04:00
parent 83ac723a50
commit 18e79db4b2
No known key found for this signature in database
GPG Key ID: 14F93C84DE6AFD17
1 changed files with 8 additions and 1 deletions

View File

@ -2233,7 +2233,14 @@ impl<'a> CodeGenerator<'a> {
IndexMap::new() IndexMap::new()
}; };
let data_type_name = format!("__expect_{}_{}", data_type.name, data_type_variant); let data_type_name = if otherwise.is_some() {
format!(
"__expect_{}_{}_otherwise",
data_type.name, data_type_variant
)
} else {
format!("__expect_{}_{}", data_type.name, data_type_variant)
};
let function = self.code_gen_functions.get(&data_type_name); let function = self.code_gen_functions.get(&data_type_name);
// mutate code_gen_funcs and defined_data_types in this if branch // mutate code_gen_funcs and defined_data_types in this if branch