Fix generation of fallback validator

This must only happen in case all other validator succeed; otherwise
  we might generate invalid validators.
This commit is contained in:
KtorZ
2024-08-24 11:15:56 +02:00
parent 73522296aa
commit 442010d056
4 changed files with 89 additions and 70 deletions

View File

@@ -49,6 +49,8 @@ pub const SCRIPT_PURPOSE_CONSTRUCTORS: &[&str] = &[
SCRIPT_PURPOSE_PROPOSE,
];
pub const VALIDATOR_ELSE: &str = "else";
// ----------------------------------------------------------------------------
// Types

View File

@@ -1575,7 +1575,11 @@ impl<'a> CodeGenerator<'a> {
otherwise: AirTree,
depth: usize,
) -> AirTree {
assert!(tipo.get_generic().is_none());
assert!(
tipo.get_generic().is_none(),
"left-hand side of expect is generic: {}",
tipo.to_pretty(0)
);
// Shouldn't be needed but still here just in case
// this function is called from anywhere else besides assignment
let tipo = &convert_opaque_type(tipo, &self.data_types, true);