Fix: Change type map length assert to check for greater than equals instead of equals to argument length
This commit is contained in:
parent
d01766d735
commit
baa6917af5
|
@ -951,7 +951,7 @@ impl<'a> CodeGenerator<'a> {
|
||||||
type_map.insert(index, field_type);
|
type_map.insert(index, field_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(type_map.len() == arguments.len());
|
assert!(type_map.len() >= arguments.len());
|
||||||
|
|
||||||
let fields = arguments
|
let fields = arguments
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -5342,3 +5342,34 @@ fn opaque_value_in_test() {
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn expect_none() {
|
||||||
|
let src = r#"
|
||||||
|
test exp_none() {
|
||||||
|
let x = None
|
||||||
|
expect None = x
|
||||||
|
True
|
||||||
|
|
||||||
|
}
|
||||||
|
"#;
|
||||||
|
|
||||||
|
assert_uplc(
|
||||||
|
src,
|
||||||
|
Term::equals_integer()
|
||||||
|
.apply(Term::integer(1.into()))
|
||||||
|
.apply(Term::var(CONSTR_INDEX_EXPOSER).apply(Term::var("x")))
|
||||||
|
.delayed_if_else(
|
||||||
|
Term::bool(true),
|
||||||
|
Term::Error.trace(Term::string("Expected on incorrect constructor variant.")),
|
||||||
|
)
|
||||||
|
.lambda("x")
|
||||||
|
.apply(Term::Constant(
|
||||||
|
Constant::Data(Data::constr(1, vec![])).into(),
|
||||||
|
))
|
||||||
|
.constr_get_field()
|
||||||
|
.constr_index_exposer()
|
||||||
|
.constr_fields_exposer(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue