Fix bool soft-casting.
While the ledger doesn't allow deserializing negative constr value, they are still possible at the machine level. So, we better make sure that we don't make assumptions regarding this.
This commit is contained in:
parent
9610237616
commit
ea8003af8f
|
@ -597,12 +597,18 @@ impl Term<Name> {
|
||||||
Term::less_than_equals_integer()
|
Term::less_than_equals_integer()
|
||||||
.apply(Term::integer(2.into()))
|
.apply(Term::integer(2.into()))
|
||||||
.apply(Term::fst_pair().apply(pair.clone()))
|
.apply(Term::fst_pair().apply(pair.clone()))
|
||||||
|
.if_then_else(
|
||||||
|
otherwise.clone(),
|
||||||
|
Term::less_than_integer()
|
||||||
|
.apply(Term::fst_pair().apply(pair.clone()))
|
||||||
|
.apply(Term::integer(0.into()))
|
||||||
.if_then_else(
|
.if_then_else(
|
||||||
otherwise.clone(),
|
otherwise.clone(),
|
||||||
callback(
|
callback(
|
||||||
Term::equals_integer()
|
Term::equals_integer()
|
||||||
.apply(Term::fst_pair().apply(pair))
|
.apply(Term::integer(1.into()))
|
||||||
.apply(Term::integer(1.into())),
|
.apply(Term::fst_pair().apply(pair)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
otherwise.clone(),
|
otherwise.clone(),
|
||||||
|
|
Loading…
Reference in New Issue