From df28f5f0082b1a4295941653e68303bb3ddbce60 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 10:50:21 +0800 Subject: [PATCH 01/65] Collapse aliased optional projections after SSA --- crates/compiler/src/compiler.rs | 4 +++ .../passes/src/ssa_const_propagation/ast.rs | 28 +++++++++++++------ .../passes/src/ssa_const_propagation/mod.rs | 7 +++-- .../src/ssa_const_propagation/program.rs | 17 ++++------- .../src/ssa_const_propagation/visitor.rs | 27 +++++++++++++++--- .../composite_alias_field_forwarding.out | 18 ++++++++++++ .../nested_composite_forwarding.out | 4 +-- .../composite_alias_field_forwarding.leo | 15 ++++++++++ .../nested_composite_forwarding.leo | 9 ++---- 9 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out create mode 100644 tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index aab50b428b5..3e6fa2ba363 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -454,6 +454,10 @@ impl Compiler { self.do_pass::(SsaFormingInput { rename_defs: false })?; + // Final SSA can introduce simple aliases around composites. Rerun SRA + // before CSE/DCE so those aliases do not hide atom-valued fields. + self.do_pass::(())?; + self.do_pass::(())?; self.do_pass::(())?; diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index c9afc9065fb..fb042946b8a 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -70,13 +70,18 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { if let Expression::Path(path) = &input.inner && let Some(name) = path.try_local_symbol() - && let Some(fields) = self.atom_fielded_composites.get(&name) - && let Some(atom) = fields.get(&input.name.name) { + let name = self.resolve_composite_alias(name); + let Some(fields) = self.atom_fielded_composites.get(&name) else { + return (input.into(), None); + }; + let Some(atom) = fields.get(&input.name.name).cloned() else { + return (input.into(), None); + }; self.changed = true; // Recompute the atom's Value so downstream folding sees the forwarded // constant (literals evaluate directly; paths look up tracked constants). - let opt_value = match atom { + let opt_value = match &atom { Expression::Literal(lit) => { let ty = self.state.type_table.get(&lit.id()); const_eval::literal_to_value(lit, &ty).ok() @@ -87,7 +92,7 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { // which restricts to `Path`/`Literal`. _ => unreachable!("atom_fielded_composites fields must be Path or Literal"), }; - return (atom.clone(), opt_value); + return (atom, opt_value); } (input.into(), None) @@ -532,11 +537,9 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { } /* Statements */ - /// Reconstruct a definition statement. If the RHS evaluates to a constant, track it - /// in the constants map for propagation. Additionally, when the RHS is a composite - /// literal whose fields are all atoms (paths or literals), record the field-to-atom - /// mapping so that subsequent `x.field` accesses can be forwarded without - /// rematerializing the struct. + /// Reconstruct a definition statement and update the local SSA facts used + /// for later rewrites: constants, atom-fielded composites, and simple + /// aliases of atom-fielded composites. fn reconstruct_definition(&mut self, mut input: DefinitionStatement) -> (Statement, Self::AdditionalOutput) { // Reconstruct the RHS expression first. let (new_value, opt_value) = self.reconstruct_expression(input.value, &()); @@ -573,6 +576,13 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { } } + if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) + && let Some(alias) = path.try_local_symbol().map(|name| self.resolve_composite_alias(name)) + && self.atom_fielded_composites.contains_key(&alias) + { + self.aliases.insert(identifier.name, alias); + } + input.value = new_value; (input.into(), None) diff --git a/crates/passes/src/ssa_const_propagation/mod.rs b/crates/passes/src/ssa_const_propagation/mod.rs index cff552f7f56..02b0b5cea78 100644 --- a/crates/passes/src/ssa_const_propagation/mod.rs +++ b/crates/passes/src/ssa_const_propagation/mod.rs @@ -17,8 +17,10 @@ //! The SSA Const Propagation pass propagates constant values through the program. //! This pass runs after SSA formation, so each variable has a unique name. //! -//! The pass tracks variables that are assigned literal values and replaces -//! uses of those variables with their constant values. +//! The pass tracks variables assigned literal values and replaces uses of those +//! variables with their constant values. It also forwards short-lived atom-only +//! aggregate fields, including through simple SSA aliases, so later cleanup can +//! erase temporary composite materialization. use crate::Pass; @@ -50,6 +52,7 @@ impl Pass for SsaConstPropagation { program: Symbol::intern(""), constants: Default::default(), atom_fielded_composites: Default::default(), + aliases: Default::default(), changed: false, }; diff --git a/crates/passes/src/ssa_const_propagation/program.rs b/crates/passes/src/ssa_const_propagation/program.rs index 6f2bd2e9b37..72a10d61986 100644 --- a/crates/passes/src/ssa_const_propagation/program.rs +++ b/crates/passes/src/ssa_const_propagation/program.rs @@ -54,25 +54,20 @@ impl UnitReconstructor for SsaConstPropagationVisitor<'_> { } fn reconstruct_function(&mut self, mut input: Function) -> Function { - // Reset the per-function maps. - // In SSA form, each function has its own scope, so we can clear the maps. - self.constants.clear(); - self.atom_fielded_composites.clear(); + // In SSA form, each function has its own scope, so analysis facts are local. + self.clear_tracked_values(); // Traverse the function body. input.block = self.reconstruct_block(input.block).0; - self.constants.clear(); - self.atom_fielded_composites.clear(); + self.clear_tracked_values(); input } fn reconstruct_constructor(&mut self, mut input: Constructor) -> Constructor { - // Reset the per-constructor maps. - self.constants.clear(); - self.atom_fielded_composites.clear(); + // Constructors also have their own SSA scope. + self.clear_tracked_values(); // Traverse the constructor body. input.block = self.reconstruct_block(input.block).0; - self.constants.clear(); - self.atom_fielded_composites.clear(); + self.clear_tracked_values(); input } } diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index b481068cdaf..9fcda3f74e0 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -35,6 +35,8 @@ pub struct SsaConstPropagationVisitor<'a> { /// Used to forward `x.field` to the stored atom without rematerializing /// the enclosing struct — effectively scalarizing short-lived aggregates. pub atom_fielded_composites: IndexMap>, + /// Maps local variables that are simple aliases of atom-fielded composites. + pub aliases: IndexMap, /// Have we actually modified the program at all? pub changed: bool, } @@ -42,7 +44,7 @@ pub struct SsaConstPropagationVisitor<'a> { /// An "atom" is an expression simple enough to substitute for another use-site /// without re-running arbitrary effects or duplicating work. Post-SSA, paths /// and literals are the only expression shapes that round-trip freely. -pub fn is_atom(expr: &Expression) -> bool { +pub(super) fn is_atom(expr: &Expression) -> bool { matches!(expr, Expression::Path(_) | Expression::Literal(_)) } @@ -53,7 +55,7 @@ fn parse_literal_value(s: &str) -> Option { } /// Check if a literal represents the zero/identity value for addition. -pub fn is_zero_literal(lit: &Literal) -> bool { +pub(super) fn is_zero_literal(lit: &Literal) -> bool { match &lit.variant { LiteralVariant::Integer(_, s) | LiteralVariant::Field(s) @@ -66,7 +68,7 @@ pub fn is_zero_literal(lit: &Literal) -> bool { } /// Check if a literal represents the one/identity value for multiplication. -pub fn is_one_literal(lit: &Literal) -> bool { +pub(super) fn is_one_literal(lit: &Literal) -> bool { match &lit.variant { LiteralVariant::Integer(_, s) | LiteralVariant::Field(s) @@ -79,7 +81,7 @@ pub fn is_one_literal(lit: &Literal) -> bool { /// Check if two expressions refer to the same SSA variable. /// In SSA form, each variable name is unique, so name equality implies value equality. -pub fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { +pub(super) fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { match (a, b) { (Expression::Path(pa), Expression::Path(pb)) => { let sa = pa.try_local_symbol(); @@ -91,6 +93,23 @@ pub fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { } impl SsaConstPropagationVisitor<'_> { + /// Clear analysis state that is only valid within one SSA function body. + pub(super) fn clear_tracked_values(&mut self) { + self.constants.clear(); + self.atom_fielded_composites.clear(); + self.aliases.clear(); + } + + pub(super) fn resolve_composite_alias(&self, mut name: Symbol) -> Symbol { + while let Some(alias) = self.aliases.get(&name).copied() { + if alias == name { + break; + } + name = alias; + } + name + } + /// Emit a `StaticAnalyzerError`. pub fn emit_err(&self, err: Formatted) { self.state.handler.emit_err(err); diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out new file mode 100644 index 00000000000..61f3ab573f4 --- /dev/null +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -0,0 +1,18 @@ +program test.aleo { + @noupgrade + async constructor() { + } + struct Pair { + a: u32, + b: u32, + } + fn alias_field(p$$0: u32, q$$1: u32) -> u32 { + let s$#2 = test.aleo::Pair { a: p$$0, b: q$$1 }; + let alias$#3 = s$#2; + let $var$4 = p$$0; + let $var$5 = q$$1; + let $var$6 = $var$4 + $var$5; + return $var$6; + } +} + diff --git a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out index 8d63439a6b8..e9a4c4f4fc7 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out @@ -13,8 +13,8 @@ program test.aleo { let i$#1 = test.aleo::Inner { v: 42u32 }; let o$#2 = test.aleo::Outer { inner: i$#1 }; let $var$3 = i$#1; - let $var$4 = $var$3.v; - return $var$4; + let $var$4 = 42u32; + return 42u32; } } diff --git a/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo b/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo new file mode 100644 index 00000000000..82f3e69762f --- /dev/null +++ b/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo @@ -0,0 +1,15 @@ +struct Pair { + a: u32, + b: u32, +} + +program test.aleo { + @noupgrade + constructor() {} + + fn alias_field(p: u32, q: u32) -> u32 { + let s: Pair = Pair { a: p, b: q }; + let alias: Pair = s; + return alias.a + alias.b; + } +} diff --git a/tests/tests/passes/ssa_const_propagation/nested_composite_forwarding.leo b/tests/tests/passes/ssa_const_propagation/nested_composite_forwarding.leo index 9254f25e016..eca35448296 100644 --- a/tests/tests/passes/ssa_const_propagation/nested_composite_forwarding.leo +++ b/tests/tests/passes/ssa_const_propagation/nested_composite_forwarding.leo @@ -10,12 +10,9 @@ program test.aleo { @noupgrade constructor() {} // Nested composites: SSA lowers `o.inner.v` into a pair of accesses - // (`$t = o.inner; $t.v`). The first access forwards to the tracked - // atom for `o.inner` (`Path(i)`), but the second access sits on the - // alias `$t` rather than on `i`, and alias-to-composite propagation - // is intentionally out of scope for this pass — so the second hop - // remains a member access and is left for DCE + later iterations to - // collapse. This test pins down the current single-hop behavior. + // (`$t = o.inner; $t.v`). The first access forwards to `Path(i)`, then + // simple alias forwarding lets the second access see through `$t` and + // forward `i.v`. fn main() -> u32 { let i: Inner = Inner { v: 42u32 }; let o: Outer = Outer { inner: i }; From 4c88dabcc36ed71994232ad30e5fd3d22f563c0d Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 13:01:25 +0800 Subject: [PATCH 02/65] Clean SSA const propagation snapshot EOF --- .../ssa_const_propagation/composite_alias_field_forwarding.out | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index 61f3ab573f4..d76e95f663f 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,4 +15,3 @@ program test.aleo { return $var$6; } } - From 9a51b2c854b03de259e94ef3f9a6c0a313cdcb96 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 13:15:13 +0800 Subject: [PATCH 03/65] Add vector unwrap_or compiler regression --- .../storage/vector_get_unwrap_or_minimal.out | 29 +++++++++++++++++++ .../storage/vector_get_unwrap_or_minimal.leo | 14 +++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out create mode 100644 tests/tests/compiler/storage/vector_get_unwrap_or_minimal.leo diff --git a/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out b/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out new file mode 100644 index 00000000000..52297d5e9b4 --- /dev/null +++ b/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out @@ -0,0 +1,29 @@ +program test.aleo; + +mapping result: + key as boolean.public; + value as u8.public; + +mapping data__: + key as u32.public; + value as u8.public; + +mapping data__len__: + key as boolean.public; + value as u32.public; + +function read_one: + input r0 as u32.private; + async read_one r0 into r1; + output r1 as test.aleo/read_one.future; + +finalize read_one: + input r0 as u32.public; + get.or_use data__len__[false] 0u32 into r1; + lt r0 r1 into r2; + get.or_use data__[r0] 0u8 into r3; + ternary r2 r3 0u8 into r4; + set r4 into result[false]; + +constructor: + assert.eq edition 0u16; diff --git a/tests/tests/compiler/storage/vector_get_unwrap_or_minimal.leo b/tests/tests/compiler/storage/vector_get_unwrap_or_minimal.leo new file mode 100644 index 00000000000..1c02bc64e92 --- /dev/null +++ b/tests/tests/compiler/storage/vector_get_unwrap_or_minimal.leo @@ -0,0 +1,14 @@ +program test.aleo { + storage data: [u8]; + mapping result: bool => u8; + + fn read_one(idx: u32) -> Final { + return final { + let value: u8 = data.get(idx).unwrap_or(0u8); + Mapping::set(result, false, value); + }; + } + + @noupgrade + constructor() {} +} From 50e7eecc4e49c29529e981997000d572f5631d3c Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 12:42:59 +0800 Subject: [PATCH 04/65] Absorb redundant SSA ternaries --- .../passes/src/ssa_const_propagation/ast.rs | 53 ++++++++++++++++++- .../passes/src/ssa_const_propagation/mod.rs | 5 +- .../src/ssa_const_propagation/visitor.rs | 12 +++++ .../nested_ternary_absorption.out | 26 +++++++++ .../nested_ternary_absorption.leo | 24 +++++++++ 5 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out create mode 100644 tests/tests/passes/ssa_const_propagation/nested_ternary_absorption.leo diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index fb042946b8a..8ed58adbe82 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, + visitor::{TrackedTernary, is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -439,6 +439,44 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { return (if_true, if_true_value); } + // Redundant nested selection after SSA: + // tmp = cond ? a : b + // out = cond ? tmp : b + // can be rewritten to `out = cond ? a : b`. The dropped inner + // branch is still evaluated by the outer ternary, and tracked + // ternaries are atom-only, so this does not discard fallible work. + if let Expression::Path(path) = &if_true + && let Some(name) = path.try_local_symbol() + && let Some(tracked) = self.ternaries.get(&name) + && same_ssa_atom(&cond, &tracked.condition) + && same_ssa_atom(&if_false, &tracked.if_false) + { + self.changed = true; + return ( + TernaryExpression { condition: cond, if_true: tracked.if_true.clone(), if_false, ..input } + .into(), + None, + ); + } + + // Symmetric case: + // tmp = cond ? a : b + // out = cond ? a : tmp + // can be rewritten to `out = cond ? a : b`. + if let Expression::Path(path) = &if_false + && let Some(name) = path.try_local_symbol() + && let Some(tracked) = self.ternaries.get(&name) + && same_ssa_atom(&cond, &tracked.condition) + && same_ssa_atom(&if_true, &tracked.if_true) + { + self.changed = true; + return ( + TernaryExpression { condition: cond, if_true, if_false: tracked.if_false.clone(), ..input } + .into(), + None, + ); + } + (TernaryExpression { condition: cond, if_true, if_false, ..input }.into(), None) } } @@ -574,6 +612,19 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { if all_atoms { self.atom_fielded_composites.insert(identifier.name, fields); } + } else if let (DefinitionPlace::Single(identifier), Expression::Ternary(ternary)) = (&input.place, &new_value) + && is_atom(&ternary.condition) + && is_atom(&ternary.if_true) + && is_atom(&ternary.if_false) + { + self.ternaries.insert( + identifier.name, + TrackedTernary { + condition: ternary.condition.clone(), + if_true: ternary.if_true.clone(), + if_false: ternary.if_false.clone(), + }, + ); } if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) diff --git a/crates/passes/src/ssa_const_propagation/mod.rs b/crates/passes/src/ssa_const_propagation/mod.rs index 02b0b5cea78..531074ecaa3 100644 --- a/crates/passes/src/ssa_const_propagation/mod.rs +++ b/crates/passes/src/ssa_const_propagation/mod.rs @@ -19,8 +19,8 @@ //! //! The pass tracks variables assigned literal values and replaces uses of those //! variables with their constant values. It also forwards short-lived atom-only -//! aggregate fields, including through simple SSA aliases, so later cleanup can -//! erase temporary composite materialization. +//! aggregate fields, including through simple SSA aliases, and atom-only +//! ternaries that can be forwarded safely. use crate::Pass; @@ -53,6 +53,7 @@ impl Pass for SsaConstPropagation { constants: Default::default(), atom_fielded_composites: Default::default(), aliases: Default::default(), + ternaries: Default::default(), changed: false, }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 9fcda3f74e0..1cc0fa5f8a3 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -37,10 +37,20 @@ pub struct SsaConstPropagationVisitor<'a> { pub atom_fielded_composites: IndexMap>, /// Maps local variables that are simple aliases of atom-fielded composites. pub aliases: IndexMap, + /// Maps local variables bound to atom-only ternaries so later redundant + /// ternaries over the same condition can be absorbed. + pub ternaries: IndexMap, /// Have we actually modified the program at all? pub changed: bool, } +#[derive(Clone)] +pub struct TrackedTernary { + pub condition: Expression, + pub if_true: Expression, + pub if_false: Expression, +} + /// An "atom" is an expression simple enough to substitute for another use-site /// without re-running arbitrary effects or duplicating work. Post-SSA, paths /// and literals are the only expression shapes that round-trip freely. @@ -88,6 +98,7 @@ pub(super) fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { let sb = pb.try_local_symbol(); sa == sb && sa.is_some() } + (Expression::Literal(a), Expression::Literal(b)) => a.variant == b.variant, _ => false, } } @@ -98,6 +109,7 @@ impl SsaConstPropagationVisitor<'_> { self.constants.clear(); self.atom_fielded_composites.clear(); self.aliases.clear(); + self.ternaries.clear(); } pub(super) fn resolve_composite_alias(&self, mut name: Symbol) -> Symbol { diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out new file mode 100644 index 00000000000..126d90b2d54 --- /dev/null +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -0,0 +1,26 @@ +program test.aleo { + @noupgrade + async constructor() { + } + fn absorb_true_branch(cond$$0: bool, a$$1: u8, b$$2: u8) -> u8 { + let tmp$#3 = cond$$0 ? a$$1 : b$$2; + let $var$4 = cond$$0 ? a$$1 : b$$2; + return $var$4; + } + fn absorb_false_branch(cond$$5: bool, a$$6: u8, b$$7: u8) -> u8 { + let tmp$#8 = cond$$5 ? a$$6 : b$$7; + let $var$9 = cond$$5 ? a$$6 : b$$7; + return $var$9; + } + fn keep_different_false(cond$$10: bool, a$$11: u8, b$$12: u8, c$$13: u8) -> u8 { + let tmp$#14 = cond$$10 ? a$$11 : b$$12; + let $var$15 = cond$$10 ? tmp$#14 : c$$13; + return $var$15; + } + fn keep_different_condition(cond$$16: bool, other$$17: bool, a$$18: u8, b$$19: u8) -> u8 { + let tmp$#20 = cond$$16 ? a$$18 : b$$19; + let $var$21 = other$$17 ? tmp$#20 : b$$19; + return $var$21; + } +} + diff --git a/tests/tests/passes/ssa_const_propagation/nested_ternary_absorption.leo b/tests/tests/passes/ssa_const_propagation/nested_ternary_absorption.leo new file mode 100644 index 00000000000..70610fff893 --- /dev/null +++ b/tests/tests/passes/ssa_const_propagation/nested_ternary_absorption.leo @@ -0,0 +1,24 @@ +program test.aleo { + @noupgrade + constructor() {} + + fn absorb_true_branch(cond: bool, a: u8, b: u8) -> u8 { + let tmp: u8 = cond ? a : b; + return cond ? tmp : b; + } + + fn absorb_false_branch(cond: bool, a: u8, b: u8) -> u8 { + let tmp: u8 = cond ? a : b; + return cond ? a : tmp; + } + + fn keep_different_false(cond: bool, a: u8, b: u8, c: u8) -> u8 { + let tmp: u8 = cond ? a : b; + return cond ? tmp : c; + } + + fn keep_different_condition(cond: bool, other: bool, a: u8, b: u8) -> u8 { + let tmp: u8 = cond ? a : b; + return other ? tmp : b; + } +} From d40359f6718f21d3b4a4ed79a796a47025c45f66 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 13:01:25 +0800 Subject: [PATCH 05/65] Clean ternary absorption snapshot EOF --- .../passes/ssa_const_propagation/nested_ternary_absorption.out | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 126d90b2d54..01698b2727e 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,4 +23,3 @@ program test.aleo { return $var$21; } } - From e3573d82df22957c89976091d2d78cad7ea77109 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 13:50:47 +0800 Subject: [PATCH 06/65] Limit late SSA const propagation to aliases --- crates/compiler/src/compiler.rs | 9 +++++---- crates/passes/src/ssa_const_propagation/ast.rs | 7 +++++-- crates/passes/src/ssa_const_propagation/mod.rs | 15 +++++++++++++-- .../passes/src/ssa_const_propagation/visitor.rs | 2 ++ crates/passes/src/test_passes.rs | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index 3e6fa2ba363..c2dcd1c7342 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -450,13 +450,14 @@ impl Compiler { // Flattening may produce ternary expressions not in SSA form. self.do_pass::(SsaFormingInput { rename_defs: false })?; - self.do_pass::(())?; + self.do_pass::(SsaConstPropagationInput::default())?; self.do_pass::(SsaFormingInput { rename_defs: false })?; - // Final SSA can introduce simple aliases around composites. Rerun SRA - // before CSE/DCE so those aliases do not hide atom-valued fields. - self.do_pass::(())?; + // Final SSA can introduce simple aliases around composites. Rerun only + // alias forwarding before CSE/DCE so those aliases do not hide + // atom-valued fields. + self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; self.do_pass::(())?; diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 8ed58adbe82..bcb18ba9cb5 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -69,9 +69,12 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { input.inner = inner; if let Expression::Path(path) = &input.inner - && let Some(name) = path.try_local_symbol() + && let Some(original_name) = path.try_local_symbol() { - let name = self.resolve_composite_alias(name); + let name = self.resolve_composite_alias(original_name); + if !self.forward_direct_composites && name == original_name { + return (input.into(), None); + } let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); }; diff --git a/crates/passes/src/ssa_const_propagation/mod.rs b/crates/passes/src/ssa_const_propagation/mod.rs index 531074ecaa3..286964c91e1 100644 --- a/crates/passes/src/ssa_const_propagation/mod.rs +++ b/crates/passes/src/ssa_const_propagation/mod.rs @@ -37,13 +37,23 @@ pub use visitor::SsaConstPropagationVisitor; pub struct SsaConstPropagation; +pub struct SsaConstPropagationInput { + pub forward_direct_composites: bool, +} + +impl Default for SsaConstPropagationInput { + fn default() -> Self { + Self { forward_direct_composites: true } + } +} + impl Pass for SsaConstPropagation { - type Input = (); + type Input = SsaConstPropagationInput; type Output = (); const NAME: &str = "SsaConstPropagation"; - fn do_pass(_input: Self::Input, state: &mut crate::CompilerState) -> Result { + fn do_pass(input: Self::Input, state: &mut crate::CompilerState) -> Result { // Run the pass in a loop until no changes are made. for _ in 0..1024 { let ast = std::mem::take(&mut state.ast); @@ -53,6 +63,7 @@ impl Pass for SsaConstPropagation { constants: Default::default(), atom_fielded_composites: Default::default(), aliases: Default::default(), + forward_direct_composites: input.forward_direct_composites, ternaries: Default::default(), changed: false, }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 1cc0fa5f8a3..93567876dc8 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -37,6 +37,8 @@ pub struct SsaConstPropagationVisitor<'a> { pub atom_fielded_composites: IndexMap>, /// Maps local variables that are simple aliases of atom-fielded composites. pub aliases: IndexMap, + /// Whether direct `x.field` accesses can be forwarded, or only accesses through aliases. + pub forward_direct_composites: bool, /// Maps local variables bound to atom-only ternaries so later redundant /// ternaries over the same condition can be absorbed. pub ternaries: IndexMap, diff --git a/crates/passes/src/test_passes.rs b/crates/passes/src/test_passes.rs index 640d86cb88f..ac93766f0f6 100644 --- a/crates/passes/src/test_passes.rs +++ b/crates/passes/src/test_passes.rs @@ -229,7 +229,7 @@ macro_rules! compiler_passes { (TypeChecking, (TypeCheckingInput::new(NetworkName::TestnetV0))), (Disambiguate, ()), (SsaForming, (SsaFormingInput { rename_defs: true })), - (SsaConstPropagation, ()), + (SsaConstPropagation, (SsaConstPropagationInput::default())), ]), (disambiguate_runner, [ (GlobalVarsCollection, ()), From 8558a555104f1164affebe8b04dda6403be1d734 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 13:58:34 +0800 Subject: [PATCH 07/65] Keep compiler SSA aggregate forwarding alias-only --- crates/compiler/src/compiler.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index c2dcd1c7342..0f227887310 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -450,7 +450,10 @@ impl Compiler { // Flattening may produce ternary expressions not in SSA form. self.do_pass::(SsaFormingInput { rename_defs: false })?; - self.do_pass::(SsaConstPropagationInput::default())?; + // Avoid broad direct aggregate scalarization here; CSE expects some + // materialized aggregates to remain. The issue this pass fixes is the + // narrower case where final SSA introduces aliases around those values. + self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; self.do_pass::(SsaFormingInput { rename_defs: false })?; From df3379c9d3ddb5d72db3d5873e36ec13ca578db4 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 14:08:31 +0800 Subject: [PATCH 08/65] Restrict late SSA alias projection to optionals --- crates/passes/src/ssa_const_propagation/ast.rs | 8 +++++--- crates/passes/src/ssa_const_propagation/visitor.rs | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index bcb18ba9cb5..aac123c9ef6 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{TrackedTernary, is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, + visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_field, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -72,8 +72,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && let Some(original_name) = path.try_local_symbol() { let name = self.resolve_composite_alias(original_name); - if !self.forward_direct_composites && name == original_name { - return (input.into(), None); + if !self.forward_direct_composites { + if name == original_name || !is_optional_field(input.name.name) { + return (input.into(), None); + } } let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 93567876dc8..b3d84327fb9 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -105,6 +105,10 @@ pub(super) fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { } } +pub(super) fn is_optional_field(name: Symbol) -> bool { + name == Symbol::intern("is_some") || name == Symbol::intern("val") +} + impl SsaConstPropagationVisitor<'_> { /// Clear analysis state that is only valid within one SSA function body. pub(super) fn clear_tracked_values(&mut self) { From 6061de5eab0e41e749357e20891fa7ed94e5efff Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 14:17:07 +0800 Subject: [PATCH 09/65] Format SSA ternary tracking updates --- .../passes/src/ssa_const_propagation/ast.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index aac123c9ef6..983b920c43c 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -72,10 +72,8 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && let Some(original_name) = path.try_local_symbol() { let name = self.resolve_composite_alias(original_name); - if !self.forward_direct_composites { - if name == original_name || !is_optional_field(input.name.name) { - return (input.into(), None); - } + if !self.forward_direct_composites && (name == original_name || !is_optional_field(input.name.name)) { + return (input.into(), None); } let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); @@ -622,14 +620,11 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && is_atom(&ternary.if_true) && is_atom(&ternary.if_false) { - self.ternaries.insert( - identifier.name, - TrackedTernary { - condition: ternary.condition.clone(), - if_true: ternary.if_true.clone(), - if_false: ternary.if_false.clone(), - }, - ); + self.ternaries.insert(identifier.name, TrackedTernary { + condition: ternary.condition.clone(), + if_true: ternary.if_true.clone(), + if_false: ternary.if_false.clone(), + }); } if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) From 98580d618a1b274d766b1275197406f05eabcc80 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 14:26:43 +0800 Subject: [PATCH 10/65] Clean dead aggregates before CSE --- crates/compiler/src/compiler.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index 0f227887310..eda4d3ba63e 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -462,6 +462,8 @@ impl Compiler { // atom-valued fields. self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; + self.do_pass::(())?; + self.do_pass::(())?; self.do_pass::(())?; From 28910c8dbddd8a85fc99604f248e4439dfef140f Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 14:34:38 +0800 Subject: [PATCH 11/65] Keep CSE conservative on unsupported expressions --- .../common_subexpression_elimination/ast.rs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/crates/passes/src/common_subexpression_elimination/ast.rs b/crates/passes/src/common_subexpression_elimination/ast.rs index 4b491183b69..e08fc4dc72f 100644 --- a/crates/passes/src/common_subexpression_elimination/ast.rs +++ b/crates/passes/src/common_subexpression_elimination/ast.rs @@ -25,7 +25,9 @@ impl AstReconstructor for CommonSubexpressionEliminatingVisitor<'_> { fn reconstruct_expression(&mut self, input: Expression, _additional: &()) -> (Expression, Self::AdditionalOutput) { // We simply forward every expression to `try_expr` rather than using the individual reconstruct // functions from the `AstReconstructor` trait. - (self.try_expr(input, None).expect("CSE Error: Error reconstructing expression").0, Default::default()) + let original = input.clone(); + let expression = self.try_expr(input, None).map(|(expression, _)| expression).unwrap_or(original); + (expression, Default::default()) } fn reconstruct_block(&mut self, mut block: Block) -> (Block, Self::AdditionalOutput) { @@ -38,23 +40,24 @@ impl AstReconstructor for CommonSubexpressionEliminatingVisitor<'_> { fn reconstruct_definition(&mut self, mut input: DefinitionStatement) -> (Statement, Self::AdditionalOutput) { match input.place { DefinitionPlace::Single(place) => { - let (value, definition_not_needed) = self - .try_expr(input.value, Some(place.name)) - .expect("CSE Error: Error reconstructing single definition"); - - if definition_not_needed { - // We don't need this definition - everywhere its variable is referred to, we'll map it to some other - // Path. - (Statement::dummy(), Default::default()) + let original = input.value.clone(); + if let Some((value, definition_not_needed)) = self.try_expr(input.value, Some(place.name)) { + if definition_not_needed { + // We don't need this definition - everywhere its variable is referred to, we'll map it to some other + // Path. + (Statement::dummy(), Default::default()) + } else { + input.value = value; + (input.into(), Default::default()) + } } else { - input.value = value; + input.value = original; (input.into(), Default::default()) } } DefinitionPlace::Multiple(_) => { - let (value, _) = - self.try_expr(input.value, None).expect("CSE Error: Error reconstructing multiple definitions"); - input.value = value; + let original = input.value.clone(); + input.value = self.try_expr(input.value, None).map(|(expression, _)| expression).unwrap_or(original); (input.into(), Default::default()) } } From 9b1af7c220981385473c7a045ed10fba4434d43e Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 16:11:25 +0800 Subject: [PATCH 12/65] Restore direct SSA const propagation --- crates/compiler/src/compiler.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index eda4d3ba63e..b0b5a09c2b0 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -450,10 +450,7 @@ impl Compiler { // Flattening may produce ternary expressions not in SSA form. self.do_pass::(SsaFormingInput { rename_defs: false })?; - // Avoid broad direct aggregate scalarization here; CSE expects some - // materialized aggregates to remain. The issue this pass fixes is the - // narrower case where final SSA introduces aliases around those values. - self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; + self.do_pass::(SsaConstPropagationInput::default())?; self.do_pass::(SsaFormingInput { rename_defs: false })?; From 8786f1eeb9c12921c91689bc30bc288ecd3472ee Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 16:25:46 +0800 Subject: [PATCH 13/65] Forward all late SSA composite aliases --- crates/passes/src/ssa_const_propagation/ast.rs | 4 ++-- crates/passes/src/ssa_const_propagation/visitor.rs | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 983b920c43c..3fb9cf30e2b 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_field, is_zero_literal, same_ssa_atom}, + visitor::{TrackedTernary, is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -72,7 +72,7 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && let Some(original_name) = path.try_local_symbol() { let name = self.resolve_composite_alias(original_name); - if !self.forward_direct_composites && (name == original_name || !is_optional_field(input.name.name)) { + if !self.forward_direct_composites && name == original_name { return (input.into(), None); } let Some(fields) = self.atom_fielded_composites.get(&name) else { diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index b3d84327fb9..93567876dc8 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -105,10 +105,6 @@ pub(super) fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { } } -pub(super) fn is_optional_field(name: Symbol) -> bool { - name == Symbol::intern("is_some") || name == Symbol::intern("val") -} - impl SsaConstPropagationVisitor<'_> { /// Clear analysis state that is only valid within one SSA function body. pub(super) fn clear_tracked_values(&mut self) { From 54c390dcb0223da63e4a4d527a90159615216c29 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 16:36:29 +0800 Subject: [PATCH 14/65] Keep SSA aggregate forwarding alias-only --- crates/compiler/src/compiler.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index b0b5a09c2b0..eda4d3ba63e 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -450,7 +450,10 @@ impl Compiler { // Flattening may produce ternary expressions not in SSA form. self.do_pass::(SsaFormingInput { rename_defs: false })?; - self.do_pass::(SsaConstPropagationInput::default())?; + // Avoid broad direct aggregate scalarization here; CSE expects some + // materialized aggregates to remain. The issue this pass fixes is the + // narrower case where final SSA introduces aliases around those values. + self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; self.do_pass::(SsaFormingInput { rename_defs: false })?; From a8f5cd5b4bf5c09432e3b3635bd17cbf617505b6 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 16:47:05 +0800 Subject: [PATCH 15/65] Keep late SSA alias forwarding narrow --- crates/passes/src/ssa_const_propagation/ast.rs | 4 ++-- crates/passes/src/ssa_const_propagation/visitor.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 3fb9cf30e2b..983b920c43c 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{TrackedTernary, is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, + visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_field, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -72,7 +72,7 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && let Some(original_name) = path.try_local_symbol() { let name = self.resolve_composite_alias(original_name); - if !self.forward_direct_composites && name == original_name { + if !self.forward_direct_composites && (name == original_name || !is_optional_field(input.name.name)) { return (input.into(), None); } let Some(fields) = self.atom_fielded_composites.get(&name) else { diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 93567876dc8..b3d84327fb9 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -105,6 +105,10 @@ pub(super) fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { } } +pub(super) fn is_optional_field(name: Symbol) -> bool { + name == Symbol::intern("is_some") || name == Symbol::intern("val") +} + impl SsaConstPropagationVisitor<'_> { /// Clear analysis state that is only valid within one SSA function body. pub(super) fn clear_tracked_values(&mut self) { From ad25d677c87ce893d6236e6936fe18deb18866c1 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 16:56:22 +0800 Subject: [PATCH 16/65] Run CSE before final DCE --- crates/compiler/src/compiler.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index eda4d3ba63e..0f227887310 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -462,8 +462,6 @@ impl Compiler { // atom-valued fields. self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; - self.do_pass::(())?; - self.do_pass::(())?; self.do_pass::(())?; From 2436d8c526cc9c5959446f9a7ab3b26af8c0dd94 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 17:07:03 +0800 Subject: [PATCH 17/65] Avoid late SSA const-prop in compiler --- crates/compiler/src/compiler.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index 0f227887310..8caaaa99c7d 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -457,11 +457,6 @@ impl Compiler { self.do_pass::(SsaFormingInput { rename_defs: false })?; - // Final SSA can introduce simple aliases around composites. Rerun only - // alias forwarding before CSE/DCE so those aliases do not hide - // atom-valued fields. - self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; - self.do_pass::(())?; self.do_pass::(())?; From 9d2bb3cbd0ab379ebb64ecdc8b22e504ca6d19d9 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 17:14:50 +0800 Subject: [PATCH 18/65] Use default SSA const propagation in compiler --- crates/compiler/src/compiler.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index 8caaaa99c7d..4fffc0695e2 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -450,10 +450,7 @@ impl Compiler { // Flattening may produce ternary expressions not in SSA form. self.do_pass::(SsaFormingInput { rename_defs: false })?; - // Avoid broad direct aggregate scalarization here; CSE expects some - // materialized aggregates to remain. The issue this pass fixes is the - // narrower case where final SSA introduces aliases around those values. - self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; + self.do_pass::(SsaConstPropagationInput::default())?; self.do_pass::(SsaFormingInput { rename_defs: false })?; From 21b234a0ead840f04861a5afa9a6bbb297dc3347 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 17:24:21 +0800 Subject: [PATCH 19/65] Limit SSA alias field forwarding --- crates/passes/src/ssa_const_propagation/ast.rs | 6 +++++- .../composite_alias_field_forwarding.out | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 983b920c43c..e132a24a2ec 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -72,7 +72,11 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && let Some(original_name) = path.try_local_symbol() { let name = self.resolve_composite_alias(original_name); - if !self.forward_direct_composites && (name == original_name || !is_optional_field(input.name.name)) { + let through_alias = name != original_name; + if through_alias && !is_optional_field(input.name.name) { + return (input.into(), None); + } + if !self.forward_direct_composites && !through_alias { return (input.into(), None); } let Some(fields) = self.atom_fielded_composites.get(&name) else { diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index d76e95f663f..9a2b50030bb 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -9,8 +9,8 @@ program test.aleo { fn alias_field(p$$0: u32, q$$1: u32) -> u32 { let s$#2 = test.aleo::Pair { a: p$$0, b: q$$1 }; let alias$#3 = s$#2; - let $var$4 = p$$0; - let $var$5 = q$$1; + let $var$4 = alias$#3.a; + let $var$5 = alias$#3.b; let $var$6 = $var$4 + $var$5; return $var$6; } From f484c313f319853543376d7a3152883c51f0375c Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 17:33:30 +0800 Subject: [PATCH 20/65] Disable implicit SSA alias field rewrites --- crates/passes/src/ssa_const_propagation/ast.rs | 10 +++------- crates/passes/src/ssa_const_propagation/visitor.rs | 4 ---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index e132a24a2ec..752675c6f81 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_field, is_zero_literal, same_ssa_atom}, + visitor::{TrackedTernary, is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -71,14 +71,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { if let Expression::Path(path) = &input.inner && let Some(original_name) = path.try_local_symbol() { - let name = self.resolve_composite_alias(original_name); - let through_alias = name != original_name; - if through_alias && !is_optional_field(input.name.name) { - return (input.into(), None); - } - if !self.forward_direct_composites && !through_alias { + if !self.forward_direct_composites { return (input.into(), None); } + let name = original_name; let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index b3d84327fb9..93567876dc8 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -105,10 +105,6 @@ pub(super) fn same_ssa_atom(a: &Expression, b: &Expression) -> bool { } } -pub(super) fn is_optional_field(name: Symbol) -> bool { - name == Symbol::intern("is_some") || name == Symbol::intern("val") -} - impl SsaConstPropagationVisitor<'_> { /// Clear analysis state that is only valid within one SSA function body. pub(super) fn clear_tracked_values(&mut self) { From 0d5a835cae6d465a65ae4b2f13aa291f0cc36ef9 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 17:47:39 +0800 Subject: [PATCH 21/65] Track optional wrapper casts in SSA const prop --- .../passes/src/ssa_const_propagation/ast.rs | 25 ++++++++++++++----- .../passes/src/ssa_const_propagation/mod.rs | 4 +-- .../src/ssa_const_propagation/visitor.rs | 8 ++++++ .../nested_composite_forwarding.out | 5 ++-- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 752675c6f81..30910f1ca21 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{TrackedTernary, is_atom, is_one_literal, is_zero_literal, same_ssa_atom}, + visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_wrapper_type, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -615,16 +615,29 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { if all_atoms { self.atom_fielded_composites.insert(identifier.name, fields); } + } else if let (DefinitionPlace::Single(identifier), Expression::Cast(cast)) = (&input.place, &new_value) + && is_optional_wrapper_type(&cast.type_) + && let Expression::Tuple(tuple) = &cast.expression + && let [is_some, val] = tuple.elements.as_slice() + && is_atom(is_some) + && is_atom(val) + { + let fields = + IndexMap::from([(Symbol::intern("is_some"), is_some.clone()), (Symbol::intern("val"), val.clone())]); + self.atom_fielded_composites.insert(identifier.name, fields); } else if let (DefinitionPlace::Single(identifier), Expression::Ternary(ternary)) = (&input.place, &new_value) && is_atom(&ternary.condition) && is_atom(&ternary.if_true) && is_atom(&ternary.if_false) { - self.ternaries.insert(identifier.name, TrackedTernary { - condition: ternary.condition.clone(), - if_true: ternary.if_true.clone(), - if_false: ternary.if_false.clone(), - }); + self.ternaries.insert( + identifier.name, + TrackedTernary { + condition: ternary.condition.clone(), + if_true: ternary.if_true.clone(), + if_false: ternary.if_false.clone(), + }, + ); } if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) diff --git a/crates/passes/src/ssa_const_propagation/mod.rs b/crates/passes/src/ssa_const_propagation/mod.rs index 286964c91e1..943a5e1577d 100644 --- a/crates/passes/src/ssa_const_propagation/mod.rs +++ b/crates/passes/src/ssa_const_propagation/mod.rs @@ -19,8 +19,8 @@ //! //! The pass tracks variables assigned literal values and replaces uses of those //! variables with their constant values. It also forwards short-lived atom-only -//! aggregate fields, including through simple SSA aliases, and atom-only -//! ternaries that can be forwarded safely. +//! aggregate fields, optional wrapper fields, and atom-only ternaries that can +//! be forwarded safely. use crate::Pass; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 93567876dc8..2b43311ac6d 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -60,6 +60,14 @@ pub(super) fn is_atom(expr: &Expression) -> bool { matches!(expr, Expression::Path(_) | Expression::Literal(_)) } +pub(super) fn is_optional_wrapper_type(ty: &leo_ast::Type) -> bool { + matches!( + ty, + leo_ast::Type::Composite(composite) + if composite.path.identifier().name.to_string().starts_with("Optional__") + ) +} + /// Parse a numeric literal string, handling underscores and radix prefixes (0x, 0o, 0b). fn parse_literal_value(s: &str) -> Option { let clean = s.replace('_', ""); diff --git a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out index e9a4c4f4fc7..88ec5e59f43 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out @@ -13,8 +13,7 @@ program test.aleo { let i$#1 = test.aleo::Inner { v: 42u32 }; let o$#2 = test.aleo::Outer { inner: i$#1 }; let $var$3 = i$#1; - let $var$4 = 42u32; - return 42u32; + let $var$4 = $var$3.v; + return $var$4; } } - From 4534cad7316794874006f585ca17610e19d497aa Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 17:57:16 +0800 Subject: [PATCH 22/65] Match optional wrapper SSA snapshots --- crates/passes/src/ssa_const_propagation/ast.rs | 13 +++++-------- crates/passes/src/ssa_const_propagation/visitor.rs | 2 +- .../composite_alias_field_forwarding.out | 1 + .../nested_composite_forwarding.out | 1 + 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 30910f1ca21..2671d18eeb0 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -630,14 +630,11 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && is_atom(&ternary.if_true) && is_atom(&ternary.if_false) { - self.ternaries.insert( - identifier.name, - TrackedTernary { - condition: ternary.condition.clone(), - if_true: ternary.if_true.clone(), - if_false: ternary.if_false.clone(), - }, - ); + self.ternaries.insert(identifier.name, TrackedTernary { + condition: ternary.condition.clone(), + if_true: ternary.if_true.clone(), + if_false: ternary.if_false.clone(), + }); } if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 2b43311ac6d..a8a79f68b82 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -64,7 +64,7 @@ pub(super) fn is_optional_wrapper_type(ty: &leo_ast::Type) -> bool { matches!( ty, leo_ast::Type::Composite(composite) - if composite.path.identifier().name.to_string().starts_with("Optional__") + if composite.path.identifier().name.to_string().ends_with('?') ) } diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index 9a2b50030bb..25c7d85ae8b 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,3 +15,4 @@ program test.aleo { return $var$6; } } + diff --git a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out index 88ec5e59f43..8d63439a6b8 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out @@ -17,3 +17,4 @@ program test.aleo { return $var$4; } } + From b9c780b604b254b7181e7675bf5f9ac4570be246 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:07:27 +0800 Subject: [PATCH 23/65] Forward optional wrapper aliases only --- crates/passes/src/ssa_const_propagation/ast.rs | 10 ++++++++-- crates/passes/src/ssa_const_propagation/visitor.rs | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 2671d18eeb0..503515c7cc9 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,7 +18,10 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_wrapper_type, is_zero_literal, same_ssa_atom}, + visitor::{ + TrackedTernary, is_atom, is_one_literal, is_optional_field, is_optional_wrapper_type, is_zero_literal, + same_ssa_atom, + }, }; use leo_ast::{ @@ -74,7 +77,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { if !self.forward_direct_composites { return (input.into(), None); } - let name = original_name; + let name = self.resolve_composite_alias(original_name); + if name != original_name && !is_optional_field(input.name.name) { + return (input.into(), None); + } let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index a8a79f68b82..369dd47efdc 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -68,6 +68,10 @@ pub(super) fn is_optional_wrapper_type(ty: &leo_ast::Type) -> bool { ) } +pub(super) fn is_optional_field(name: Symbol) -> bool { + name == Symbol::intern("is_some") || name == Symbol::intern("val") +} + /// Parse a numeric literal string, handling underscores and radix prefixes (0x, 0o, 0b). fn parse_literal_value(s: &str) -> Option { let clean = s.replace('_', ""); From ede244604995e52919411831537a1dc54a2e1e40 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:14:05 +0800 Subject: [PATCH 24/65] Match SSA const prop import style --- crates/passes/src/ssa_const_propagation/ast.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 503515c7cc9..abf862ee3e4 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -19,7 +19,12 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, visitor::{ - TrackedTernary, is_atom, is_one_literal, is_optional_field, is_optional_wrapper_type, is_zero_literal, + TrackedTernary, + is_atom, + is_one_literal, + is_optional_field, + is_optional_wrapper_type, + is_zero_literal, same_ssa_atom, }, }; From c1e4ae6881c19a53562ec92ed4f10ee119338059 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:23:39 +0800 Subject: [PATCH 25/65] Update ternary absorption expectations --- .../cei/blind_storage_read_in_helper.out | 5 +- .../cei/class2_storage_stale_read_warn.out | 7 +- ...3_external_storage_read_after_run_warn.out | 12 +- .../compiler/examples/fibonacci.out | 266 +++++----- .../compiler/examples/ntzseals.out | 133 +++-- .../libraries/aleo_stub_struct_in_storage.out | 5 +- .../deep_nested_lib_struct_in_storage.out | 5 +- .../libraries/leo_stub_struct_in_storage.out | 5 +- ...nd_program_both_use_primitive_optional.out | 8 +- .../lib_nested_struct_in_storage.out | 5 +- .../libraries/lib_struct_in_storage.out | 5 +- .../lib_struct_optional_local_binding.out | 6 +- ...b_submodule_optional_wrapper_placement.out | 10 +- .../lib_submodule_struct_in_storage.out | 9 +- .../nested_lib_struct_in_storage.out | 5 +- .../compiler/option/all_types.out | 100 +--- tests/expectations/compiler/option/b28961.out | 125 +---- .../compiler/option/implicit_wrapping.out | 80 ++- .../compiler/option/in_modules.out | 187 +++---- .../compiler/option/unwrap_or_deep.out | 129 ++--- .../compiler/storage/aggregates.out | 354 ++++++------- .../compiler/storage/counter_storage.out | 20 +- .../compiler/storage/external_storage.out | 497 +++++++++--------- .../storage/external_storage_multi_deps.out | 89 ++-- .../compiler/storage/long_names.out | 5 +- .../compiler/storage/primitives.out | 102 ++-- .../expectations/compiler/storage/signed.out | 102 ++-- .../compiler/storage/unsigned.out | 102 ++-- .../storage/vector_get_unwrap_or_minimal.out | 7 +- .../view/view_uses_storage_and_vector.out | 10 +- .../expectations/execution/complex_vector.out | 224 ++++---- .../execution/counter_storage.out | 20 +- .../execution/dynamic_call_future.out | 7 +- .../dynamic_call_future_with_extra_args.out | 7 +- 34 files changed, 1185 insertions(+), 1468 deletions(-) diff --git a/tests/expectations/compiler/cei/blind_storage_read_in_helper.out b/tests/expectations/compiler/cei/blind_storage_read_in_helper.out index 5d38f99ad5d..26ac382cc77 100644 --- a/tests/expectations/compiler/cei/blind_storage_read_in_helper.out +++ b/tests/expectations/compiler/cei/blind_storage_read_in_helper.out @@ -52,9 +52,8 @@ finalize do_work: contains counter__[false] into r1; get.or_use counter__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - cast r1 r3 into r4 as Optional__JzunLORyB8U; - ternary r4.is_some r4.val 0u32 into r5; - set r5 into balances[0u32]; + ternary r1 r3 0u32 into r4; + set r4 into balances[0u32]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out b/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out index a5709a1836f..cdf49341f12 100644 --- a/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out +++ b/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out @@ -48,11 +48,10 @@ finalize do_work: contains counter__[false] into r2; get.or_use counter__[false] 0u32 into r3; ternary r2 r3 0u32 into r4; - cast r2 r4 into r5 as Optional__JzunLORyB8U; - ternary r5.is_some r5.val 0u32 into r6; + ternary r2 r4 0u32 into r5; await r0; - add r6 r1 into r7; - set r7 into counter__[false]; + add r5 r1 into r6; + set r6 into counter__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out b/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out index 85e3e9edf8d..3bf8272278c 100644 --- a/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out +++ b/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out @@ -34,10 +34,9 @@ finalize bump: contains dep_counter__[false] into r0; get.or_use dep_counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - ternary r3.is_some r3.val 0u32 into r4; - add r4 1u32 into r5; - set r5 into dep_counter__[false]; + ternary r0 r2 0u32 into r3; + add r3 1u32 into r4; + set r4 into dep_counter__[false]; constructor: assert.eq edition 0u16; @@ -64,9 +63,8 @@ finalize do_work: contains dep.aleo/dep_counter__[false] into r1; get.or_use dep.aleo/dep_counter__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - cast r1 r3 into r4 as Optional__JzunLORyB8U; - ternary r4.is_some r4.val 0u32 into r5; - set r5 into my_counter__[false]; + ternary r1 r3 0u32 into r4; + set r4 into my_counter__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/examples/fibonacci.out b/tests/expectations/compiler/examples/fibonacci.out index f612032b074..0101efad298 100644 --- a/tests/expectations/compiler/examples/fibonacci.out +++ b/tests/expectations/compiler/examples/fibonacci.out @@ -76,141 +76,137 @@ function fibonacci: and r70 1u8 into r71; is.eq r71 0u8 into r72; ternary r72 0u128 1u128 into r73; - ternary r72 1u128 1u128 into r74; - ternary r2 r73 0u128 into r75; - ternary r2 r74 1u128 into r76; - ternary r2 1u8 0u8 into r77; - ternary r2 r6 r0 into r78; - gt r78 0u8 into r79; - mul r76 r76 into r80; - mul r75 r75 into r81; - add r80 r81 into r82; - mul 2u128 r76 into r83; - sub r83 r75 into r84; - mul r75 r84 into r85; - shl 1u8 r77 into r86; - and r70 r86 into r87; - is.eq r87 0u8 into r88; - add r85 r82 into r89; - ternary r88 r85 r82 into r90; - ternary r88 r82 r89 into r91; - add r77 1u8 into r92; - shr r78 1u8 into r93; - ternary r79 r90 r75 into r94; - ternary r79 r91 r76 into r95; - ternary r79 r92 r77 into r96; - ternary r79 r93 r78 into r97; - gt r97 0u8 into r98; - mul r95 r95 into r99; - mul r94 r94 into r100; - add r99 r100 into r101; - mul 2u128 r95 into r102; - sub r102 r94 into r103; - mul r94 r103 into r104; - shl 1u8 r96 into r105; - and r70 r105 into r106; - is.eq r106 0u8 into r107; - add r104 r101 into r108; - ternary r107 r104 r101 into r109; - ternary r107 r101 r108 into r110; - add r96 1u8 into r111; - shr r97 1u8 into r112; - ternary r98 r109 r94 into r113; - ternary r98 r110 r95 into r114; - ternary r98 r111 r96 into r115; - ternary r98 r112 r97 into r116; - gt r116 0u8 into r117; - mul r114 r114 into r118; - mul r113 r113 into r119; - add r118 r119 into r120; - mul 2u128 r114 into r121; - sub r121 r113 into r122; - mul r113 r122 into r123; - shl 1u8 r115 into r124; - and r70 r124 into r125; - is.eq r125 0u8 into r126; - add r123 r120 into r127; - ternary r126 r123 r120 into r128; - ternary r126 r120 r127 into r129; - add r115 1u8 into r130; - shr r116 1u8 into r131; - ternary r117 r128 r113 into r132; - ternary r117 r129 r114 into r133; - ternary r117 r130 r115 into r134; - ternary r117 r131 r116 into r135; - gt r135 0u8 into r136; - mul r133 r133 into r137; - mul r132 r132 into r138; - add r137 r138 into r139; - mul 2u128 r133 into r140; - sub r140 r132 into r141; - mul r132 r141 into r142; - shl 1u8 r134 into r143; - and r70 r143 into r144; - is.eq r144 0u8 into r145; - add r142 r139 into r146; - ternary r145 r142 r139 into r147; - ternary r145 r139 r146 into r148; - add r134 1u8 into r149; - shr r135 1u8 into r150; - ternary r136 r147 r132 into r151; - ternary r136 r148 r133 into r152; - ternary r136 r149 r134 into r153; - ternary r136 r150 r135 into r154; - gt r154 0u8 into r155; - mul r152 r152 into r156; - mul r151 r151 into r157; - add r156 r157 into r158; - mul 2u128 r152 into r159; - sub r159 r151 into r160; - mul r151 r160 into r161; - shl 1u8 r153 into r162; - and r70 r162 into r163; - is.eq r163 0u8 into r164; - add r161 r158 into r165; - ternary r164 r161 r158 into r166; - ternary r164 r158 r165 into r167; - add r153 1u8 into r168; - shr r154 1u8 into r169; - ternary r155 r166 r151 into r170; - ternary r155 r167 r152 into r171; - ternary r155 r168 r153 into r172; - ternary r155 r169 r154 into r173; - gt r173 0u8 into r174; - mul r171 r171 into r175; - mul r170 r170 into r176; - add r175 r176 into r177; - mul 2u128 r171 into r178; - sub r178 r170 into r179; - mul r170 r179 into r180; - shl 1u8 r172 into r181; - and r70 r181 into r182; - is.eq r182 0u8 into r183; - add r180 r177 into r184; - ternary r183 r180 r177 into r185; - ternary r183 r177 r184 into r186; - add r172 1u8 into r187; - shr r173 1u8 into r188; - ternary r174 r185 r170 into r189; - ternary r174 r186 r171 into r190; - ternary r174 r187 r172 into r191; - ternary r174 r188 r173 into r192; - gt r192 0u8 into r193; - mul r190 r190 into r194; - mul r189 r189 into r195; - add r194 r195 into r196; - mul 2u128 r190 into r197; - sub r197 r189 into r198; - mul r189 r198 into r199; - shl 1u8 r191 into r200; - and r70 r200 into r201; - is.eq r201 0u8 into r202; - add r199 r196 into r203; - ternary r202 r199 r196 into r204; - add r191 1u8 into r205; - shr r192 1u8 into r206; - ternary r193 r204 r189 into r207; - output r207 as u128.private; + ternary r2 r73 0u128 into r74; + ternary r2 1u8 0u8 into r75; + ternary r2 r6 r0 into r76; + gt r76 0u8 into r77; + mul r74 r74 into r78; + add 1u128 r78 into r79; + sub 2u128 r74 into r80; + mul r74 r80 into r81; + shl 1u8 r75 into r82; + and r70 r82 into r83; + is.eq r83 0u8 into r84; + add r81 r79 into r85; + ternary r84 r81 r79 into r86; + ternary r84 r79 r85 into r87; + add r75 1u8 into r88; + shr r76 1u8 into r89; + ternary r77 r86 r74 into r90; + ternary r77 r87 1u128 into r91; + ternary r77 r88 r75 into r92; + ternary r77 r89 r76 into r93; + gt r93 0u8 into r94; + mul r91 r91 into r95; + mul r90 r90 into r96; + add r95 r96 into r97; + mul 2u128 r91 into r98; + sub r98 r90 into r99; + mul r90 r99 into r100; + shl 1u8 r92 into r101; + and r70 r101 into r102; + is.eq r102 0u8 into r103; + add r100 r97 into r104; + ternary r103 r100 r97 into r105; + ternary r103 r97 r104 into r106; + add r92 1u8 into r107; + shr r93 1u8 into r108; + ternary r94 r105 r90 into r109; + ternary r94 r106 r91 into r110; + ternary r94 r107 r92 into r111; + ternary r94 r108 r93 into r112; + gt r112 0u8 into r113; + mul r110 r110 into r114; + mul r109 r109 into r115; + add r114 r115 into r116; + mul 2u128 r110 into r117; + sub r117 r109 into r118; + mul r109 r118 into r119; + shl 1u8 r111 into r120; + and r70 r120 into r121; + is.eq r121 0u8 into r122; + add r119 r116 into r123; + ternary r122 r119 r116 into r124; + ternary r122 r116 r123 into r125; + add r111 1u8 into r126; + shr r112 1u8 into r127; + ternary r113 r124 r109 into r128; + ternary r113 r125 r110 into r129; + ternary r113 r126 r111 into r130; + ternary r113 r127 r112 into r131; + gt r131 0u8 into r132; + mul r129 r129 into r133; + mul r128 r128 into r134; + add r133 r134 into r135; + mul 2u128 r129 into r136; + sub r136 r128 into r137; + mul r128 r137 into r138; + shl 1u8 r130 into r139; + and r70 r139 into r140; + is.eq r140 0u8 into r141; + add r138 r135 into r142; + ternary r141 r138 r135 into r143; + ternary r141 r135 r142 into r144; + add r130 1u8 into r145; + shr r131 1u8 into r146; + ternary r132 r143 r128 into r147; + ternary r132 r144 r129 into r148; + ternary r132 r145 r130 into r149; + ternary r132 r146 r131 into r150; + gt r150 0u8 into r151; + mul r148 r148 into r152; + mul r147 r147 into r153; + add r152 r153 into r154; + mul 2u128 r148 into r155; + sub r155 r147 into r156; + mul r147 r156 into r157; + shl 1u8 r149 into r158; + and r70 r158 into r159; + is.eq r159 0u8 into r160; + add r157 r154 into r161; + ternary r160 r157 r154 into r162; + ternary r160 r154 r161 into r163; + add r149 1u8 into r164; + shr r150 1u8 into r165; + ternary r151 r162 r147 into r166; + ternary r151 r163 r148 into r167; + ternary r151 r164 r149 into r168; + ternary r151 r165 r150 into r169; + gt r169 0u8 into r170; + mul r167 r167 into r171; + mul r166 r166 into r172; + add r171 r172 into r173; + mul 2u128 r167 into r174; + sub r174 r166 into r175; + mul r166 r175 into r176; + shl 1u8 r168 into r177; + and r70 r177 into r178; + is.eq r178 0u8 into r179; + add r176 r173 into r180; + ternary r179 r176 r173 into r181; + ternary r179 r173 r180 into r182; + add r168 1u8 into r183; + shr r169 1u8 into r184; + ternary r170 r181 r166 into r185; + ternary r170 r182 r167 into r186; + ternary r170 r183 r168 into r187; + ternary r170 r184 r169 into r188; + gt r188 0u8 into r189; + mul r186 r186 into r190; + mul r185 r185 into r191; + add r190 r191 into r192; + mul 2u128 r186 into r193; + sub r193 r185 into r194; + mul r185 r194 into r195; + shl 1u8 r187 into r196; + and r70 r196 into r197; + is.eq r197 0u8 into r198; + add r195 r192 into r199; + ternary r198 r195 r192 into r200; + add r187 1u8 into r201; + shr r188 1u8 into r202; + ternary r189 r200 r185 into r203; + output r203 as u128.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/examples/ntzseals.out b/tests/expectations/compiler/examples/ntzseals.out index b8a471e640d..e95ac1a384b 100644 --- a/tests/expectations/compiler/examples/ntzseals.out +++ b/tests/expectations/compiler/examples/ntzseals.out @@ -254,75 +254,70 @@ function main: is.eq r4 62u32 into r250; and r247 r249 into r251; and r251 r250 into r252; - not r250 into r253; - is.eq r4 63u32 into r254; - and r251 r253 into r255; - and r255 r254 into r256; - ternary r256 0u8 0u8 into r257; - ternary r252 16u8 r257 into r258; - ternary r248 17u8 r258 into r259; - ternary r244 28u8 r259 into r260; - ternary r240 18u8 r260 into r261; - ternary r236 22u8 r261 into r262; - ternary r232 0u8 r262 into r263; - ternary r228 29u8 r263 into r264; - ternary r224 19u8 r264 into r265; - ternary r220 0u8 r265 into r266; - ternary r216 23u8 r266 into r267; - ternary r212 0u8 r267 into r268; - ternary r208 0u8 r268 into r269; - ternary r204 0u8 r269 into r270; - ternary r200 0u8 r270 into r271; - ternary r196 30u8 r271 into r272; - ternary r192 26u8 r272 into r273; - ternary r188 20u8 r273 into r274; - ternary r184 0u8 r274 into r275; - ternary r180 0u8 r275 into r276; - ternary r176 24u8 r276 into r277; - ternary r172 0u8 r277 into r278; - ternary r168 0u8 r278 into r279; - ternary r164 9u8 r279 into r280; - ternary r160 0u8 r280 into r281; - ternary r156 0u8 r281 into r282; - ternary r152 0u8 r282 into r283; - ternary r148 0u8 r283 into r284; - ternary r144 0u8 r284 into r285; - ternary r140 5u8 r285 into r286; - ternary r136 11u8 r286 into r287; - ternary r132 31u8 r287 into r288; - ternary r128 15u8 r288 into r289; - ternary r124 27u8 r289 into r290; - ternary r120 21u8 r290 into r291; - ternary r116 0u8 r291 into r292; - ternary r112 0u8 r292 into r293; - ternary r108 0u8 r293 into r294; - ternary r104 0u8 r294 into r295; - ternary r100 0u8 r295 into r296; - ternary r96 25u8 r296 into r297; - ternary r92 0u8 r297 into r298; - ternary r88 0u8 r298 into r299; - ternary r84 8u8 r299 into r300; - ternary r80 0u8 r300 into r301; - ternary r76 0u8 r301 into r302; - ternary r72 4u8 r302 into r303; - ternary r68 10u8 r303 into r304; - ternary r64 14u8 r304 into r305; - ternary r60 0u8 r305 into r306; - ternary r56 0u8 r306 into r307; - ternary r52 0u8 r307 into r308; - ternary r48 0u8 r308 into r309; - ternary r44 7u8 r309 into r310; - ternary r40 0u8 r310 into r311; - ternary r36 3u8 r311 into r312; - ternary r32 13u8 r312 into r313; - ternary r28 0u8 r313 into r314; - ternary r24 6u8 r314 into r315; - ternary r20 2u8 r315 into r316; - ternary r16 12u8 r316 into r317; - ternary r12 1u8 r317 into r318; - ternary r8 0u8 r318 into r319; - ternary r5 32u8 r319 into r320; - output r320 as u8.private; + ternary r252 16u8 0u8 into r253; + ternary r248 17u8 r253 into r254; + ternary r244 28u8 r254 into r255; + ternary r240 18u8 r255 into r256; + ternary r236 22u8 r256 into r257; + ternary r232 0u8 r257 into r258; + ternary r228 29u8 r258 into r259; + ternary r224 19u8 r259 into r260; + ternary r220 0u8 r260 into r261; + ternary r216 23u8 r261 into r262; + ternary r212 0u8 r262 into r263; + ternary r208 0u8 r263 into r264; + ternary r204 0u8 r264 into r265; + ternary r200 0u8 r265 into r266; + ternary r196 30u8 r266 into r267; + ternary r192 26u8 r267 into r268; + ternary r188 20u8 r268 into r269; + ternary r184 0u8 r269 into r270; + ternary r180 0u8 r270 into r271; + ternary r176 24u8 r271 into r272; + ternary r172 0u8 r272 into r273; + ternary r168 0u8 r273 into r274; + ternary r164 9u8 r274 into r275; + ternary r160 0u8 r275 into r276; + ternary r156 0u8 r276 into r277; + ternary r152 0u8 r277 into r278; + ternary r148 0u8 r278 into r279; + ternary r144 0u8 r279 into r280; + ternary r140 5u8 r280 into r281; + ternary r136 11u8 r281 into r282; + ternary r132 31u8 r282 into r283; + ternary r128 15u8 r283 into r284; + ternary r124 27u8 r284 into r285; + ternary r120 21u8 r285 into r286; + ternary r116 0u8 r286 into r287; + ternary r112 0u8 r287 into r288; + ternary r108 0u8 r288 into r289; + ternary r104 0u8 r289 into r290; + ternary r100 0u8 r290 into r291; + ternary r96 25u8 r291 into r292; + ternary r92 0u8 r292 into r293; + ternary r88 0u8 r293 into r294; + ternary r84 8u8 r294 into r295; + ternary r80 0u8 r295 into r296; + ternary r76 0u8 r296 into r297; + ternary r72 4u8 r297 into r298; + ternary r68 10u8 r298 into r299; + ternary r64 14u8 r299 into r300; + ternary r60 0u8 r300 into r301; + ternary r56 0u8 r301 into r302; + ternary r52 0u8 r302 into r303; + ternary r48 0u8 r303 into r304; + ternary r44 7u8 r304 into r305; + ternary r40 0u8 r305 into r306; + ternary r36 3u8 r306 into r307; + ternary r32 13u8 r307 into r308; + ternary r28 0u8 r308 into r309; + ternary r24 6u8 r309 into r310; + ternary r20 2u8 r310 into r311; + ternary r16 12u8 r311 into r312; + ternary r12 1u8 r312 into r313; + ternary r8 0u8 r313 into r314; + ternary r5 32u8 r314 into r315; + output r315 as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out b/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out index 0a4d78bc321..6a43ae6f00a 100644 --- a/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out @@ -21,9 +21,8 @@ finalize peek: ternary r0 r2.x r3.x into r4; ternary r0 r2.y r3.y into r5; cast r4 r5 into r6 as base.aleo/Data; - cast r0 r6 into r7 as Optional__99uEaDA8ual; - assert.eq r7.is_some true; - assert.eq r7.val.x r7.val.x; + assert.eq r0 true; + assert.eq r6.x r6.x; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out b/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out index 95433aefe52..e56cfc09e65 100644 --- a/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out @@ -38,9 +38,8 @@ finalize make: cast r9 r10 into r11 as Core__6z1xuJtF5OT; ternary r0 r4.extra r7.extra into r12; cast r11 r12 into r13 as Capsule__CKJ9uYgKLhI; - cast r0 r13 into r14 as Optional__9frvj8law46; - assert.eq r14.is_some true; - assert.eq r14.val.c.a.n r14.val.c.a.n; + assert.eq r0 true; + assert.eq r13.c.a.n r13.c.a.n; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out b/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out index 3bb4a84d9f1..500a0b9729d 100644 --- a/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out @@ -36,9 +36,8 @@ finalize peek: ternary r0 r2.x r3.x into r4; ternary r0 r2.y r3.y into r5; cast r4 r5 into r6 as base.aleo/Data; - cast r0 r6 into r7 as Optional__99uEaDA8ual; - assert.eq r7.is_some true; - assert.eq r7.val.x r7.val.x; + assert.eq r0 true; + assert.eq r6.x r6.x; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_and_program_both_use_primitive_optional.out b/tests/expectations/compiler/libraries/lib_and_program_both_use_primitive_optional.out index cb0766425a4..1f911ef2321 100644 --- a/tests/expectations/compiler/libraries/lib_and_program_both_use_primitive_optional.out +++ b/tests/expectations/compiler/libraries/lib_and_program_both_use_primitive_optional.out @@ -10,12 +10,8 @@ struct Optional__5pP29m2ClNT: function compute: input r0 as u32.private; - cast false 0u32 into r1 as Optional__JzunLORyB8U; - ternary r1.is_some r1.val r0 into r2; - cast false 0u32 into r3 as Optional__5pP29m2ClNT; - ternary r3.is_some r3.val r2 into r4; - mul r4 2u32 into r5; - output r5 as u32.private; + mul r0 2u32 into r1; + output r1 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out b/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out index 4c1e638f946..0866149cabd 100644 --- a/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out @@ -34,9 +34,8 @@ finalize pick: ternary r0 r3.size_x r5.size_x into r9; ternary r0 r3.size_y r5.size_y into r10; cast r8 r9 r10 into r11 as Rect__2UBYikAziAq; - cast r0 r11 into r12 as Optional__93SfMrvy3aW; - assert.eq r12.is_some true; - assert.eq r12.val.top_left.x r12.val.top_left.x; + assert.eq r0 true; + assert.eq r11.top_left.x r11.top_left.x; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_struct_in_storage.out b/tests/expectations/compiler/libraries/lib_struct_in_storage.out index 9531a89d04e..1dfcb3053ab 100644 --- a/tests/expectations/compiler/libraries/lib_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/lib_struct_in_storage.out @@ -30,9 +30,8 @@ finalize unwrap_info: ternary r0 r2.supply r3.supply into r7; ternary r0 r2.max_supply r3.max_supply into r8; cast r4 r5 r6 r7 r8 into r9 as TokenInfo__CxbbwT70PGX; - cast r0 r9 into r10 as Optional__An66AtVsP75; - assert.eq r10.is_some true; - assert.eq r10.val.decimals 8u8; + assert.eq r0 true; + assert.eq r9.decimals 8u8; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out b/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out index d4134dba4dd..95cb473c9b7 100644 --- a/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out +++ b/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out @@ -11,11 +11,7 @@ struct Optional__7G49nMxvEkY: function maybe_origin: input r0 as boolean.private; cast 0u32 0u32 into r1 as Point__7VbTm7beYPk; - cast false r1 into r2 as Optional__7G49nMxvEkY; - ternary r2.is_some r2.val.x 0u32 into r3; - ternary r2.is_some r2.val.y 0u32 into r4; - cast r3 r4 into r5 as Point__7VbTm7beYPk; - output r5.x as u32.private; + output r1.x as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out b/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out index 499de29a239..88436be8db6 100644 --- a/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out +++ b/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out @@ -9,12 +9,10 @@ struct Thing__3u5BloN95qc: function compute: input r0 as u32.private; - cast false 0u32 into r1 as Optional__ERfM1j1qbAs; - ternary r1.is_some r1.val r0 into r2; - cast true r2 into r3 as Optional__ERfM1j1qbAs; - cast r3 into r4 as Thing__3u5BloN95qc; - ternary r4.v.is_some r4.v.val 0u32 into r5; - output r5 as u32.private; + cast true r0 into r1 as Optional__ERfM1j1qbAs; + cast r1 into r2 as Thing__3u5BloN95qc; + ternary r2.v.is_some r2.v.val 0u32 into r3; + output r3 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out b/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out index 1ef5d5eee0d..df62324b93f 100644 --- a/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out @@ -24,11 +24,10 @@ finalize area: ternary r0 r2.width r3.width into r4; ternary r0 r2.height r3.height into r5; cast r4 r5 into r6 as Rect__ANLpT5iOmJt; - cast r0 r6 into r7 as Optional__6BCOGVZlT0d; - assert.eq r7.is_some true; - mul r7.val.width r7.val.height into r8; - mul r7.val.width r7.val.height into r9; - assert.eq r8 r9; + assert.eq r0 true; + mul r6.width r6.height into r7; + mul r6.width r6.height into r8; + assert.eq r7 r8; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out b/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out index a1ec10b1c5d..31b408ab897 100644 --- a/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out @@ -36,9 +36,8 @@ finalize measure: ternary r0 r4.bottom_right.y r7.bottom_right.y into r12; cast r11 r12 into r13 as Point__7VbTm7beYPk; cast r10 r13 into r14 as Rect__yHB5zqEAd9; - cast r0 r14 into r15 as Optional__93SfMrvy3aW; - assert.eq r15.is_some true; - assert.eq r15.val.top_left.x r15.val.top_left.x; + assert.eq r0 true; + assert.eq r14.top_left.x r14.top_left.x; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/all_types.out b/tests/expectations/compiler/option/all_types.out index 4dda2519944..143ef881b7c 100644 --- a/tests/expectations/compiler/option/all_types.out +++ b/tests/expectations/compiler/option/all_types.out @@ -114,12 +114,8 @@ struct Optional__CnAbS95OdiL: val as SigStruct; function optional_basic_primitives: - cast true 10u32 into r0 as Optional__JzunLORyB8U; - cast false 0u32 into r1 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - ternary r1.is_some r1.val 42u32 into r2; - add r0.val r2 into r3; - output r3 as u32.private; + assert.eq true true; + output 52u32 as u32.private; function array_of_optionals: cast true 1u8 into r0 as Optional__3aph2JMPtnA; @@ -137,21 +133,15 @@ function optional_array: cast true 1u8 into r0 as Optional__3aph2JMPtnA; cast false 0u8 into r1 as Optional__3aph2JMPtnA; cast r0 r1 into r2 as [Optional__3aph2JMPtnA; 2u32]; - cast true r2 into r3 as Optional__IDMgCsLwlJZ; - assert.eq r3.is_some true; - ternary r3.val[0u32].is_some r3.val[0u32].val 10u8 into r4; - output r4 as u8.private; + ternary r2[0u32].is_some r2[0u32].val 10u8 into r3; + output r3 as u8.private; function optional_struct_field: - cast false 0u16 into r0 as Optional__H2QyNyZ20sa; - ternary r0.is_some r0.val 123u16 into r1; - output r1 as u16.private; + output 123u16 as u16.private; function optional_struct: cast 5u8 into r0 as MyStruct; - cast true r0 into r1 as Optional__D1ZVwkVAP8R; - assert.eq r1.is_some true; - output r1.val.x as u8.private; + output r0.x as u8.private; function array_of_optional_structs: cast 10u8 into r0 as Foo; @@ -183,73 +173,41 @@ function nested_optional_structs: cast r9 r16 into r17 as [Optional__90gnFMeDKTp; 2u32]; cast true r17 into r18 as Optional__4aWy0bP6UHu; cast r18 into r19 as Container; - cast true r19 into r20 as Optional__CrW6ZMYLUhu; - assert.eq r20.is_some true; - assert.eq r20.val.wrappers.is_some true; - assert.eq r20.val.wrappers.val[0u32].is_some true; - assert.eq r20.val.wrappers.val[0u32].val.arr.is_some true; - assert.eq r20.val.wrappers.val[0u32].val.arr.val[0u32].is_some true; - assert.eq r20.val.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some true; - output r20.val.wrappers.val[0u32].val.arr.val[0u32].val.val.val as u8.private; + assert.eq r19.wrappers.is_some true; + assert.eq r19.wrappers.val[0u32].is_some true; + assert.eq r19.wrappers.val[0u32].val.arr.is_some true; + assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].is_some true; + assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some true; + output r19.wrappers.val[0u32].val.arr.val[0u32].val.val.val as u8.private; function tuples_with_optional_elements: - cast true 200u32 into r0 as Optional__JzunLORyB8U; - cast false 0u32 into r1 as Optional__JzunLORyB8U; - ternary r0.is_some r0.val 0u32 into r2; - add 100u32 r2 into r3; - add r3 300u32 into r4; - ternary r1.is_some r1.val 50u32 into r5; - add r4 r5 into r6; - output r6 as u32.private; + output 650u32 as u32.private; function optional_misc_primitive_types: - cast true 0group into r0 as Optional__9SsWRr2WG5s; - cast true 1field into r1 as Optional__7o6su2Uhzht; - cast true 2scalar into r2 as Optional__9y0TjJOC4Nk; - assert.eq r0.is_some true; - assert.eq r2.is_some true; - ternary r1.is_some r1.val 2field into r3; - output r0.val as group.private; - output r3 as field.private; - output r2.val as scalar.private; + assert.eq true true; + output 0group as group.private; + output 1field as field.private; + output 2scalar as scalar.private; function optional_address_allowed: cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r0 as Optional__6wU7KHJhSvv; - cast true aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r1 as Optional__6wU7KHJhSvv; - ternary r0.is_some r0.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r2; - ternary r1.is_some r1.val r2 into r3; - cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r4 as Optional__6wU7KHJhSvv; - ternary r4.is_some r4.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r5; - cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r6 as Optional__6wU7KHJhSvv; - cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta r6 into r7 as AddrStruct; - cast true r7 into r8 as Optional__AJzmwrlBPM0; - assert.eq r8.is_some true; - cast true aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r9 as Optional__6wU7KHJhSvv; - cast r9 into r10 as InnerAddr; - assert.eq r10.val.is_some true; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta r0 into r1 as AddrStruct; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r2 as address; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r3 as address; + output aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta as address.private; + output r2 as address.private; + output r1.a as address.private; output r3 as address.private; - output r5 as address.private; - output r8.val.a as address.private; - output r10.val.val as address.private; function optional_signature: cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r0 as Optional__I4L6GJTpfLe; - cast true sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r1 as Optional__I4L6GJTpfLe; - ternary r0.is_some r0.val sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r2; - ternary r1.is_some r1.val r2 into r3; - cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r4 as Optional__I4L6GJTpfLe; - ternary r4.is_some r4.val sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r5; - cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r6 as Optional__I4L6GJTpfLe; - cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj r6 into r7 as SigStruct; - cast true r7 into r8 as Optional__CnAbS95OdiL; - assert.eq r8.is_some true; - cast true sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r9 as Optional__I4L6GJTpfLe; - cast r9 into r10 as InnerSig; - assert.eq r10.val.is_some true; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj r0 into r1 as SigStruct; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r2 as signature; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r3 as signature; + output sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj as signature.private; + output r2 as signature.private; + output r1.a as signature.private; output r3 as signature.private; - output r5 as signature.private; - output r8.val.a as signature.private; - output r10.val.val as signature.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/b28961.out b/tests/expectations/compiler/option/b28961.out index c835b59e5ad..34c20e21378 100644 --- a/tests/expectations/compiler/option/b28961.out +++ b/tests/expectations/compiler/option/b28961.out @@ -23,37 +23,16 @@ struct Wrap: val as Optional__JzunLORyB8U; function assign_optional_from_unwrap: - cast true 5u32 into r0 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - cast true r0.val into r1 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - add r0.val 7u32 into r2; - cast true r2 into r3 as Optional__JzunLORyB8U; - ternary r0.is_some r0.val 0u32 into r4; - cast true r4 into r5 as Optional__JzunLORyB8U; - assert.eq r1.is_some true; - assert.eq r3.is_some true; - assert.eq r5.is_some true; - add r1.val r3.val into r6; - add r6 r5.val into r7; - output r7 as u32.private; + assert.eq true true; + output 22u32 as u32.private; function unwrap_inside_expression: - cast true 9u32 into r0 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - mul r0.val 2u32 into r1; - add r1 3u32 into r2; - output r2 as u32.private; + assert.eq true true; + output 21u32 as u32.private; function nested_expression_unwraps: - cast true 4u32 into r0 as Optional__JzunLORyB8U; - cast true 6u32 into r1 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - assert.eq r1.is_some true; - assert.eq r0.is_some true; - mul r1.val r0.val into r2; - add r0.val r2 into r3; - output r3 as u32.private; + assert.eq true true; + output 28u32 as u32.private; function unwrap_in_arrays: cast true 1u32 into r0 as Optional__JzunLORyB8U; @@ -71,95 +50,49 @@ function optional_array_handling: cast true 7u32 into r0 as Optional__JzunLORyB8U; cast false 0u32 into r1 as Optional__JzunLORyB8U; cast r0 r1 into r2 as [Optional__JzunLORyB8U; 2u32]; - cast true r2 into r3 as Optional__KLO2TLUX4k3; - assert.eq r3.is_some true; - assert.eq r3.val[0u32].is_some true; - output r3.val[0u32].val as u32.private; + assert.eq r2[0u32].is_some true; + output r2[0u32].val as u32.private; function optional_struct_field_expr: cast 11u32 into r0 as S; - cast true r0 into r1 as Optional__9bKza3QPqox; - assert.eq r1.is_some true; - add r1.val.x 5u32 into r2; - output r2 as u32.private; + add r0.x 5u32 into r1; + output r1 as u32.private; function optional_struct_unwrap_assign: cast 30u32 into r0 as S; - cast true r0 into r1 as Optional__9bKza3QPqox; - assert.eq r1.is_some true; - add r1.val.x 12u32 into r2; - cast true r2 into r3 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - output r3.val as u32.private; + add r0.x 12u32 into r1; + output r1 as u32.private; function nested_struct_array_mix: cast true 1u32 into r0 as Optional__JzunLORyB8U; cast false 0u32 into r1 as Optional__JzunLORyB8U; cast r0 r1 into r2 as [Optional__JzunLORyB8U; 2u32]; - cast true r2 into r3 as Optional__KLO2TLUX4k3; - assert.eq r3.is_some true; - ternary r3.val[0u32].is_some r3.val[0u32].val 0u32 into r4; - ternary r3.val[1u32].is_some r3.val[1u32].val 20u32 into r5; - add r4 r5 into r6; - output r6 as u32.private; + ternary r2[0u32].is_some r2[0u32].val 0u32 into r3; + ternary r2[1u32].is_some r2[1u32].val 20u32 into r4; + add r3 r4 into r5; + output r5 as u32.private; function tuple_optional_fields: - cast true 4u32 into r0 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - add r0.val 9u32 into r1; - output r1 as u32.private; + assert.eq true true; + output 13u32 as u32.private; function optionals_in_function_context: - cast true 6u32 into r0 as Optional__JzunLORyB8U; - cast false 0u32 into r1 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - add r0.val 2u32 into r2; - ternary r1.is_some r1.val 4u32 into r3; - mul r2 r3 into r4; - output r4 as u32.private; + assert.eq true true; + output 32u32 as u32.private; function stress_compound_unwrap: - cast true 2u32 into r0 as Optional__JzunLORyB8U; - cast true 3u32 into r1 as Optional__JzunLORyB8U; - cast false 0u32 into r2 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - assert.eq r1.is_some true; - assert.eq r0.is_some true; - assert.eq r1.is_some true; - assert.eq r0.is_some true; - assert.eq r1.is_some true; - add r0.val r1.val into r3; - mul r0.val r1.val into r4; - add r3 r4 into r5; - ternary r2.is_some r2.val 7u32 into r6; - add r5 r6 into r7; - add r0.val r1.val into r8; - add r7 r8 into r9; - output r9 as u32.private; + assert.eq true true; + output 23u32 as u32.private; function ternary_optional_cases: - cast true 10u32 into r0 as Optional__JzunLORyB8U; + cast false 0u32 into r0 as Optional__JzunLORyB8U; + assert.eq false true; cast false 0u32 into r1 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - assert.eq r0.is_some true; - add r0.val 5u32 into r2; - cast true r2 into r3 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - mul r3.val 2u32 into r4; - assert.eq r1.is_some true; - assert.eq r0.is_some true; - cast false 0u32 into r5 as Optional__JzunLORyB8U; - is.neq r1 r5 into r6; - add r0.val 1u32 into r7; - ternary r6 r1.val r7 into r8; - cast true r8 into r9 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - assert.eq r9.is_some true; - add r0.val r3.val into r10; - add r10 r4 into r11; - add r11 r8 into r12; - add r12 r9.val into r13; - output r13 as u32.private; + is.neq r0 r1 into r2; + ternary r2 0u32 11u32 into r3; + add 55u32 r3 into r4; + add r4 r3 into r5; + output r5 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/implicit_wrapping.out b/tests/expectations/compiler/option/implicit_wrapping.out index 33752f9d62d..95f1b16e9b9 100644 --- a/tests/expectations/compiler/option/implicit_wrapping.out +++ b/tests/expectations/compiler/option/implicit_wrapping.out @@ -23,26 +23,21 @@ struct Optional__8r9D5P05auT: val as [Wrapper; 3u32]; function basic_implicit_return: - cast true 5u8 into r0 as Optional__3aph2JMPtnA; - assert.eq r0.is_some true; - output r0.val as u8.private; + assert.eq true true; + output 5u8 as u8.private; function basic_implicit_argument: - cast true 42u8 into r0 as Optional__3aph2JMPtnA; - ternary r0.is_some r0.val 100u8 into r1; - output r1 as u8.private; + output 42u8 as u8.private; function basic_implicit_ternary: input r0 as boolean.private; ternary r0 10u8 0u8 into r1; - cast r0 r1 into r2 as Optional__3aph2JMPtnA; - assert.eq r2.is_some true; - output r2.val as u8.private; + assert.eq r0 true; + output r1 as u8.private; function basic_implicit_reassignment: - cast true 99u8 into r0 as Optional__3aph2JMPtnA; - assert.eq r0.is_some true; - output r0.val as u8.private; + assert.eq true true; + output 99u8 as u8.private; function complex_implicit_return: cast true 8u8 into r0 as Optional__3aph2JMPtnA; @@ -53,14 +48,12 @@ function complex_implicit_return: cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; cast r6 into r7 as Wrapper; - cast true r7 into r8 as Optional__90gnFMeDKTp; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - assert.eq r8.val.arr[0u32].val.x.is_some true; - assert.eq r8.val.arr[1u32].is_some true; - assert.eq r8.val.arr[1u32].val.x.is_some true; - cast r8.val.arr[0u32].val.x.val r8.val.arr[1u32].val.x.val into r9 as [u8; 2u32]; - output r9 as [u8; 2u32].private; + assert.eq r7.arr[0u32].is_some true; + assert.eq r7.arr[0u32].val.x.is_some true; + assert.eq r7.arr[1u32].is_some true; + assert.eq r7.arr[1u32].val.x.is_some true; + cast r7.arr[0u32].val.x.val r7.arr[1u32].val.x.val into r8 as [u8; 2u32]; + output r8 as [u8; 2u32].private; function complex_implicit_argument: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -71,11 +64,9 @@ function complex_implicit_argument: cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; cast r6 into r7 as Wrapper; - cast true r7 into r8 as Optional__90gnFMeDKTp; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - ternary r8.val.arr[0u32].val.x.is_some r8.val.arr[0u32].val.x.val 0u8 into r9; - output r9 as u8.private; + assert.eq r7.arr[0u32].is_some true; + ternary r7.arr[0u32].val.x.is_some r7.arr[0u32].val.x.val 0u8 into r8; + output r8 as u8.private; function complex_implicit_ternary: input r0 as boolean.private; @@ -106,14 +97,13 @@ function complex_implicit_ternary: cast r24 r23 into r25 as Optional__DH9PtMwOkLt; cast r19 r25 into r26 as [Optional__DH9PtMwOkLt; 2u32]; cast r26 into r27 as Wrapper; - cast r0 r27 into r28 as Optional__90gnFMeDKTp; - assert.eq r28.is_some true; - assert.eq r28.val.arr[0u32].is_some true; - assert.eq r28.val.arr[0u32].val.x.is_some true; - assert.eq r28.val.arr[1u32].is_some true; - assert.eq r28.val.arr[1u32].val.x.is_some true; - cast r28.val.arr[0u32].val.x.val r28.val.arr[1u32].val.x.val into r29 as [u8; 2u32]; - output r29 as [u8; 2u32].private; + assert.eq r0 true; + assert.eq r27.arr[0u32].is_some true; + assert.eq r27.arr[0u32].val.x.is_some true; + assert.eq r27.arr[1u32].is_some true; + assert.eq r27.arr[1u32].val.x.is_some true; + cast r27.arr[0u32].val.x.val r27.arr[1u32].val.x.val into r28 as [u8; 2u32]; + output r28 as [u8; 2u32].private; function complex_implicit_reassignment: cast true 7u8 into r0 as Optional__3aph2JMPtnA; @@ -124,11 +114,9 @@ function complex_implicit_reassignment: cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; cast r6 into r7 as Wrapper; - cast true r7 into r8 as Optional__90gnFMeDKTp; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - assert.eq r8.val.arr[0u32].val.x.is_some true; - output r8.val.arr[0u32].val.x.val as u8.private; + assert.eq r7.arr[0u32].is_some true; + assert.eq r7.arr[0u32].val.x.is_some true; + output r7.arr[0u32].val.x.val as u8.private; function complex_array_wrapping: cast true 1u8 into r0 as Optional__3aph2JMPtnA; @@ -156,11 +144,9 @@ function complex_array_wrapping: cast r18 r21 into r22 as [Optional__DH9PtMwOkLt; 2u32]; cast r22 into r23 as Wrapper; cast r7 r15 r23 into r24 as [Wrapper; 3u32]; - cast true r24 into r25 as Optional__8r9D5P05auT; - assert.eq r25.is_some true; - assert.eq r25.val[0u32].arr[0u32].is_some true; - assert.eq r25.val[0u32].arr[0u32].val.x.is_some true; - output r25.val[0u32].arr[0u32].val.x.val as u8.private; + assert.eq r24[0u32].arr[0u32].is_some true; + assert.eq r24[0u32].arr[0u32].val.x.is_some true; + output r24[0u32].arr[0u32].val.x.val as u8.private; function complex_array_access: cast true 10u8 into r0 as Optional__3aph2JMPtnA; @@ -188,11 +174,9 @@ function complex_array_access: cast r18 r21 into r22 as [Optional__DH9PtMwOkLt; 2u32]; cast r22 into r23 as Wrapper; cast r7 r15 r23 into r24 as [Wrapper; 3u32]; - cast true r24 into r25 as Optional__8r9D5P05auT; - assert.eq r25.is_some true; - assert.eq r25.val[1u32].arr[0u32].is_some true; - assert.eq r25.val[1u32].arr[0u32].val.x.is_some true; - output r25.val[1u32].arr[0u32].val.x.val as u8.private; + assert.eq r24[1u32].arr[0u32].is_some true; + assert.eq r24[1u32].arr[0u32].val.x.is_some true; + output r24[1u32].arr[0u32].val.x.val as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/in_modules.out b/tests/expectations/compiler/option/in_modules.out index fe6a90e104e..cec6584297b 100644 --- a/tests/expectations/compiler/option/in_modules.out +++ b/tests/expectations/compiler/option/in_modules.out @@ -23,26 +23,21 @@ struct Optional__JhjheGVkhvE: val as [Wrapper__6VZ6TvN0ax; 3u32]; function basic_implicit_return: - cast true 5u8 into r0 as Optional__3aph2JMPtnA; - assert.eq r0.is_some true; - output r0.val as u8.private; + assert.eq true true; + output 5u8 as u8.private; function basic_implicit_argument: - cast true 42u8 into r0 as Optional__3aph2JMPtnA; - ternary r0.is_some r0.val 100u8 into r1; - output r1 as u8.private; + output 42u8 as u8.private; function basic_implicit_ternary: input r0 as boolean.private; ternary r0 10u8 0u8 into r1; - cast r0 r1 into r2 as Optional__3aph2JMPtnA; - assert.eq r2.is_some true; - output r2.val as u8.private; + assert.eq r0 true; + output r1 as u8.private; function basic_implicit_reassignment: - cast true 99u8 into r0 as Optional__3aph2JMPtnA; - assert.eq r0.is_some true; - output r0.val as u8.private; + assert.eq true true; + output 99u8 as u8.private; function complex_implicit_return: cast true 8u8 into r0 as Optional__3aph2JMPtnA; @@ -53,19 +48,16 @@ function complex_implicit_return: cast false r4 into r5 as Optional__4x5ZWv8vmos; cast r2 r5 into r6 as [Optional__4x5ZWv8vmos; 2u32]; cast r6 into r7 as Wrapper__6VZ6TvN0ax; - cast true r7 into r8 as Optional__7J0YWbeOZxr; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - cast false 0u8 into r9 as Optional__3aph2JMPtnA; - ternary r8.val.arr[1u32].is_some r8.val.arr[1u32].val.x.is_some r9.is_some into r10; - ternary r8.val.arr[1u32].is_some r8.val.arr[1u32].val.x.val r9.val into r11; - cast r10 r11 into r12 as Optional__3aph2JMPtnA; - cast r12 into r13 as Foo__JLzIT8VEyGW; - cast r8.val.arr[0u32].val.x r13.x into r14 as [Optional__3aph2JMPtnA; 2u32]; - assert.eq r14[0u32].is_some true; - ternary r14[1u32].is_some r14[1u32].val 0u8 into r15; - cast r14[0u32].val r15 into r16 as [u8; 2u32]; - output r16 as [u8; 2u32].private; + assert.eq r7.arr[0u32].is_some true; + ternary r7.arr[1u32].is_some r7.arr[1u32].val.x.is_some false into r8; + ternary r7.arr[1u32].is_some r7.arr[1u32].val.x.val 0u8 into r9; + cast r8 r9 into r10 as Optional__3aph2JMPtnA; + cast r10 into r11 as Foo__JLzIT8VEyGW; + cast r7.arr[0u32].val.x r11.x into r12 as [Optional__3aph2JMPtnA; 2u32]; + assert.eq r12[0u32].is_some true; + ternary r12[1u32].is_some r12[1u32].val 0u8 into r13; + cast r12[0u32].val r13 into r14 as [u8; 2u32]; + output r14 as [u8; 2u32].private; function complex_implicit_argument: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -76,11 +68,9 @@ function complex_implicit_argument: cast false r4 into r5 as Optional__4x5ZWv8vmos; cast r2 r5 into r6 as [Optional__4x5ZWv8vmos; 2u32]; cast r6 into r7 as Wrapper__6VZ6TvN0ax; - cast true r7 into r8 as Optional__7J0YWbeOZxr; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - ternary r8.val.arr[0u32].val.x.is_some r8.val.arr[0u32].val.x.val 0u8 into r9; - output r9 as u8.private; + assert.eq r7.arr[0u32].is_some true; + ternary r7.arr[0u32].val.x.is_some r7.arr[0u32].val.x.val 0u8 into r8; + output r8 as u8.private; function complex_implicit_ternary: input r0 as boolean.private; @@ -111,19 +101,17 @@ function complex_implicit_ternary: cast r24 r23 into r25 as Optional__4x5ZWv8vmos; cast r19 r25 into r26 as [Optional__4x5ZWv8vmos; 2u32]; cast r26 into r27 as Wrapper__6VZ6TvN0ax; - cast r0 r27 into r28 as Optional__7J0YWbeOZxr; - assert.eq r28.is_some true; - assert.eq r28.val.arr[0u32].is_some true; - cast false 0u8 into r29 as Optional__3aph2JMPtnA; - ternary r28.val.arr[1u32].is_some r28.val.arr[1u32].val.x.is_some r29.is_some into r30; - ternary r28.val.arr[1u32].is_some r28.val.arr[1u32].val.x.val r29.val into r31; - cast r30 r31 into r32 as Optional__3aph2JMPtnA; - cast r32 into r33 as Foo__JLzIT8VEyGW; - cast r28.val.arr[0u32].val.x r33.x into r34 as [Optional__3aph2JMPtnA; 2u32]; - ternary r34[0u32].is_some r34[0u32].val 0u8 into r35; - ternary r34[1u32].is_some r34[1u32].val 0u8 into r36; - cast r35 r36 into r37 as [u8; 2u32]; - output r37 as [u8; 2u32].private; + assert.eq r0 true; + assert.eq r27.arr[0u32].is_some true; + ternary r27.arr[1u32].is_some r27.arr[1u32].val.x.is_some false into r28; + ternary r27.arr[1u32].is_some r27.arr[1u32].val.x.val 0u8 into r29; + cast r28 r29 into r30 as Optional__3aph2JMPtnA; + cast r30 into r31 as Foo__JLzIT8VEyGW; + cast r27.arr[0u32].val.x r31.x into r32 as [Optional__3aph2JMPtnA; 2u32]; + ternary r32[0u32].is_some r32[0u32].val 0u8 into r33; + ternary r32[1u32].is_some r32[1u32].val 0u8 into r34; + cast r33 r34 into r35 as [u8; 2u32]; + output r35 as [u8; 2u32].private; function complex_implicit_reassignment: cast true 7u8 into r0 as Optional__3aph2JMPtnA; @@ -134,11 +122,9 @@ function complex_implicit_reassignment: cast false r4 into r5 as Optional__4x5ZWv8vmos; cast r2 r5 into r6 as [Optional__4x5ZWv8vmos; 2u32]; cast r6 into r7 as Wrapper__6VZ6TvN0ax; - cast true r7 into r8 as Optional__7J0YWbeOZxr; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - assert.eq r8.val.arr[0u32].val.x.is_some true; - output r8.val.arr[0u32].val.x.val as u8.private; + assert.eq r7.arr[0u32].is_some true; + assert.eq r7.arr[0u32].val.x.is_some true; + output r7.arr[0u32].val.x.val as u8.private; function complex_array_wrapping: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -147,36 +133,31 @@ function complex_array_wrapping: cast r2 r2 into r3 as [Optional__4x5ZWv8vmos; 2u32]; cast r3 into r4 as Wrapper__6VZ6TvN0ax; cast r4 r4 r4 into r5 as [Wrapper__6VZ6TvN0ax; 3u32]; - cast false r5 into r6 as Optional__JhjheGVkhvE; - assert.eq r6.is_some true; - assert.eq r6.val[0u32].arr[0u32].is_some true; - assert.eq r6.val[2u32].arr[0u32].is_some true; - cast false 0u8 into r7 as Optional__3aph2JMPtnA; - ternary r6.val[0u32].arr[1u32].is_some r6.val[0u32].arr[1u32].val.x.is_some r7.is_some into r8; - ternary r6.val[0u32].arr[1u32].is_some r6.val[0u32].arr[1u32].val.x.val r7.val into r9; - cast r8 r9 into r10 as Optional__3aph2JMPtnA; - cast r10 into r11 as Foo__JLzIT8VEyGW; - cast r6.val[0u32].arr[0u32].val.x r11.x into r12 as [Optional__3aph2JMPtnA; 2u32]; - cast false 0u8 into r13 as Optional__3aph2JMPtnA; - ternary r6.val[1u32].arr[0u32].is_some r6.val[1u32].arr[0u32].val.x.is_some r13.is_some into r14; - ternary r6.val[1u32].arr[0u32].is_some r6.val[1u32].arr[0u32].val.x.val r13.val into r15; - cast r14 r15 into r16 as Optional__3aph2JMPtnA; - cast r16 into r17 as Foo__JLzIT8VEyGW; - cast false 0u8 into r18 as Optional__3aph2JMPtnA; - ternary r6.val[1u32].arr[1u32].is_some r6.val[1u32].arr[1u32].val.x.is_some r18.is_some into r19; - ternary r6.val[1u32].arr[1u32].is_some r6.val[1u32].arr[1u32].val.x.val r18.val into r20; - cast r19 r20 into r21 as Optional__3aph2JMPtnA; - cast r21 into r22 as Foo__JLzIT8VEyGW; - cast r17.x r22.x into r23 as [Optional__3aph2JMPtnA; 2u32]; - cast false 0u8 into r24 as Optional__3aph2JMPtnA; - ternary r6.val[2u32].arr[1u32].is_some r6.val[2u32].arr[1u32].val.x.is_some r24.is_some into r25; - ternary r6.val[2u32].arr[1u32].is_some r6.val[2u32].arr[1u32].val.x.val r24.val into r26; - cast r25 r26 into r27 as Optional__3aph2JMPtnA; - cast r27 into r28 as Foo__JLzIT8VEyGW; - cast r6.val[2u32].arr[0u32].val.x r28.x into r29 as [Optional__3aph2JMPtnA; 2u32]; - cast r12 r23 r29 into r30 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; - ternary r30[0u32][0u32].is_some r30[0u32][0u32].val 0u8 into r31; - output r31 as u8.private; + assert.eq false true; + assert.eq r5[0u32].arr[0u32].is_some true; + assert.eq r5[2u32].arr[0u32].is_some true; + ternary r5[0u32].arr[1u32].is_some r5[0u32].arr[1u32].val.x.is_some false into r6; + ternary r5[0u32].arr[1u32].is_some r5[0u32].arr[1u32].val.x.val 0u8 into r7; + cast r6 r7 into r8 as Optional__3aph2JMPtnA; + cast r8 into r9 as Foo__JLzIT8VEyGW; + cast r5[0u32].arr[0u32].val.x r9.x into r10 as [Optional__3aph2JMPtnA; 2u32]; + ternary r5[1u32].arr[0u32].is_some r5[1u32].arr[0u32].val.x.is_some false into r11; + ternary r5[1u32].arr[0u32].is_some r5[1u32].arr[0u32].val.x.val 0u8 into r12; + cast r11 r12 into r13 as Optional__3aph2JMPtnA; + cast r13 into r14 as Foo__JLzIT8VEyGW; + ternary r5[1u32].arr[1u32].is_some r5[1u32].arr[1u32].val.x.is_some false into r15; + ternary r5[1u32].arr[1u32].is_some r5[1u32].arr[1u32].val.x.val 0u8 into r16; + cast r15 r16 into r17 as Optional__3aph2JMPtnA; + cast r17 into r18 as Foo__JLzIT8VEyGW; + cast r14.x r18.x into r19 as [Optional__3aph2JMPtnA; 2u32]; + ternary r5[2u32].arr[1u32].is_some r5[2u32].arr[1u32].val.x.is_some false into r20; + ternary r5[2u32].arr[1u32].is_some r5[2u32].arr[1u32].val.x.val 0u8 into r21; + cast r20 r21 into r22 as Optional__3aph2JMPtnA; + cast r22 into r23 as Foo__JLzIT8VEyGW; + cast r5[2u32].arr[0u32].val.x r23.x into r24 as [Optional__3aph2JMPtnA; 2u32]; + cast r10 r19 r24 into r25 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; + ternary r25[0u32][0u32].is_some r25[0u32][0u32].val 0u8 into r26; + output r26 as u8.private; function complex_array_access: cast true 10u8 into r0 as Optional__3aph2JMPtnA; @@ -204,36 +185,30 @@ function complex_array_access: cast r18 r21 into r22 as [Optional__4x5ZWv8vmos; 2u32]; cast r22 into r23 as Wrapper__6VZ6TvN0ax; cast r7 r15 r23 into r24 as [Wrapper__6VZ6TvN0ax; 3u32]; - cast true r24 into r25 as Optional__JhjheGVkhvE; - assert.eq r25.is_some true; - assert.eq r25.val[0u32].arr[0u32].is_some true; - assert.eq r25.val[1u32].arr[0u32].is_some true; - cast false 0u8 into r26 as Optional__3aph2JMPtnA; - ternary r25.val[0u32].arr[1u32].is_some r25.val[0u32].arr[1u32].val.x.is_some r26.is_some into r27; - ternary r25.val[0u32].arr[1u32].is_some r25.val[0u32].arr[1u32].val.x.val r26.val into r28; - cast r27 r28 into r29 as Optional__3aph2JMPtnA; - cast r29 into r30 as Foo__JLzIT8VEyGW; - cast r25.val[0u32].arr[0u32].val.x r30.x into r31 as [Optional__3aph2JMPtnA; 2u32]; - cast false 0u8 into r32 as Optional__3aph2JMPtnA; - ternary r25.val[1u32].arr[1u32].is_some r25.val[1u32].arr[1u32].val.x.is_some r32.is_some into r33; - ternary r25.val[1u32].arr[1u32].is_some r25.val[1u32].arr[1u32].val.x.val r32.val into r34; - cast r33 r34 into r35 as Optional__3aph2JMPtnA; - cast r35 into r36 as Foo__JLzIT8VEyGW; - cast r25.val[1u32].arr[0u32].val.x r36.x into r37 as [Optional__3aph2JMPtnA; 2u32]; - cast false 0u8 into r38 as Optional__3aph2JMPtnA; - ternary r25.val[2u32].arr[0u32].is_some r25.val[2u32].arr[0u32].val.x.is_some r38.is_some into r39; - ternary r25.val[2u32].arr[0u32].is_some r25.val[2u32].arr[0u32].val.x.val r38.val into r40; + assert.eq r24[0u32].arr[0u32].is_some true; + assert.eq r24[1u32].arr[0u32].is_some true; + ternary r24[0u32].arr[1u32].is_some r24[0u32].arr[1u32].val.x.is_some false into r25; + ternary r24[0u32].arr[1u32].is_some r24[0u32].arr[1u32].val.x.val 0u8 into r26; + cast r25 r26 into r27 as Optional__3aph2JMPtnA; + cast r27 into r28 as Foo__JLzIT8VEyGW; + cast r24[0u32].arr[0u32].val.x r28.x into r29 as [Optional__3aph2JMPtnA; 2u32]; + ternary r24[1u32].arr[1u32].is_some r24[1u32].arr[1u32].val.x.is_some false into r30; + ternary r24[1u32].arr[1u32].is_some r24[1u32].arr[1u32].val.x.val 0u8 into r31; + cast r30 r31 into r32 as Optional__3aph2JMPtnA; + cast r32 into r33 as Foo__JLzIT8VEyGW; + cast r24[1u32].arr[0u32].val.x r33.x into r34 as [Optional__3aph2JMPtnA; 2u32]; + ternary r24[2u32].arr[0u32].is_some r24[2u32].arr[0u32].val.x.is_some false into r35; + ternary r24[2u32].arr[0u32].is_some r24[2u32].arr[0u32].val.x.val 0u8 into r36; + cast r35 r36 into r37 as Optional__3aph2JMPtnA; + cast r37 into r38 as Foo__JLzIT8VEyGW; + ternary r24[2u32].arr[1u32].is_some r24[2u32].arr[1u32].val.x.is_some false into r39; + ternary r24[2u32].arr[1u32].is_some r24[2u32].arr[1u32].val.x.val 0u8 into r40; cast r39 r40 into r41 as Optional__3aph2JMPtnA; cast r41 into r42 as Foo__JLzIT8VEyGW; - cast false 0u8 into r43 as Optional__3aph2JMPtnA; - ternary r25.val[2u32].arr[1u32].is_some r25.val[2u32].arr[1u32].val.x.is_some r43.is_some into r44; - ternary r25.val[2u32].arr[1u32].is_some r25.val[2u32].arr[1u32].val.x.val r43.val into r45; - cast r44 r45 into r46 as Optional__3aph2JMPtnA; - cast r46 into r47 as Foo__JLzIT8VEyGW; - cast r42.x r47.x into r48 as [Optional__3aph2JMPtnA; 2u32]; - cast r31 r37 r48 into r49 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; - assert.eq r49[1u32][0u32].is_some true; - output r49[1u32][0u32].val as u8.private; + cast r38.x r42.x into r43 as [Optional__3aph2JMPtnA; 2u32]; + cast r29 r34 r43 into r44 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; + assert.eq r44[1u32][0u32].is_some true; + output r44[1u32][0u32].val as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/unwrap_or_deep.out b/tests/expectations/compiler/option/unwrap_or_deep.out index 0c761cbf60a..ab5187bb6a9 100644 --- a/tests/expectations/compiler/option/unwrap_or_deep.out +++ b/tests/expectations/compiler/option/unwrap_or_deep.out @@ -47,79 +47,62 @@ function unwrap_or_deep: cast r6 into r7 as [Optional__90gnFMeDKTp; 1u32]; cast true r7 into r8 as Optional__BetGHuxYwx2; cast r8 into r9 as Container; - cast true r9 into r10 as Optional__CrW6ZMYLUhu; - cast true 55u8 into r11 as Optional__3aph2JMPtnA; - cast r11 into r12 as Inner; - cast true r12 into r13 as Optional__AqOs5VODSRH; - cast r13 into r14 as [Optional__AqOs5VODSRH; 1u32]; - cast true r14 into r15 as Optional__FVD6sPKEWr0; - cast r15 into r16 as Wrapper; - cast true r16 into r17 as Optional__90gnFMeDKTp; - cast r17 into r18 as [Optional__90gnFMeDKTp; 1u32]; - cast true r18 into r19 as Optional__BetGHuxYwx2; - ternary r10.is_some r10.val.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some r19.val[0u32].val.arr.val[0u32].val.val.is_some into r20; - ternary r10.is_some r10.val.wrappers.val[0u32].val.arr.val[0u32].val.val.val r19.val[0u32].val.arr.val[0u32].val.val.val into r21; - cast r20 r21 into r22 as Optional__3aph2JMPtnA; - cast r22 into r23 as Inner; - ternary r10.is_some r10.val.wrappers.val[0u32].val.arr.val[0u32].is_some r19.val[0u32].val.arr.val[0u32].is_some into r24; - cast r24 r23 into r25 as Optional__AqOs5VODSRH; - cast r25 into r26 as [Optional__AqOs5VODSRH; 1u32]; - ternary r10.is_some r10.val.wrappers.val[0u32].val.arr.is_some r19.val[0u32].val.arr.is_some into r27; - cast r27 r26 into r28 as Optional__FVD6sPKEWr0; - cast r28 into r29 as Wrapper; - ternary r10.is_some r10.val.wrappers.val[0u32].is_some r19.val[0u32].is_some into r30; - cast r30 r29 into r31 as Optional__90gnFMeDKTp; - cast r31 into r32 as [Optional__90gnFMeDKTp; 1u32]; - ternary r10.is_some r10.val.wrappers.is_some r19.is_some into r33; - cast r33 r32 into r34 as Optional__BetGHuxYwx2; - cast r34 into r35 as Container; - cast true r12 into r36 as Optional__AqOs5VODSRH; - cast r36 into r37 as [Optional__AqOs5VODSRH; 1u32]; - cast true r37 into r38 as Optional__FVD6sPKEWr0; - cast r38 into r39 as Wrapper; - cast true r39 into r40 as Optional__90gnFMeDKTp; - cast r40 into r41 as [Optional__90gnFMeDKTp; 1u32]; - ternary r35.wrappers.is_some r35.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some r41[0u32].val.arr.val[0u32].val.val.is_some into r42; - ternary r35.wrappers.is_some r35.wrappers.val[0u32].val.arr.val[0u32].val.val.val r41[0u32].val.arr.val[0u32].val.val.val into r43; - cast r42 r43 into r44 as Optional__3aph2JMPtnA; - cast r44 into r45 as Inner; - ternary r35.wrappers.is_some r35.wrappers.val[0u32].val.arr.val[0u32].is_some r41[0u32].val.arr.val[0u32].is_some into r46; - cast r46 r45 into r47 as Optional__AqOs5VODSRH; - cast r47 into r48 as [Optional__AqOs5VODSRH; 1u32]; - ternary r35.wrappers.is_some r35.wrappers.val[0u32].val.arr.is_some r41[0u32].val.arr.is_some into r49; - cast r49 r48 into r50 as Optional__FVD6sPKEWr0; - cast r50 into r51 as Wrapper; - ternary r35.wrappers.is_some r35.wrappers.val[0u32].is_some r41[0u32].is_some into r52; - cast r52 r51 into r53 as Optional__90gnFMeDKTp; - cast r53 into r54 as [Optional__90gnFMeDKTp; 1u32]; - cast true r12 into r55 as Optional__AqOs5VODSRH; - cast r55 into r56 as [Optional__AqOs5VODSRH; 1u32]; - cast true r56 into r57 as Optional__FVD6sPKEWr0; - ternary r54[0u32].is_some r54[0u32].val.arr.val[0u32].val.val.is_some r57.val[0u32].val.val.is_some into r58; - ternary r54[0u32].is_some r54[0u32].val.arr.val[0u32].val.val.val r57.val[0u32].val.val.val into r59; - cast r58 r59 into r60 as Optional__3aph2JMPtnA; - cast r60 into r61 as Inner; - ternary r54[0u32].is_some r54[0u32].val.arr.val[0u32].is_some r57.val[0u32].is_some into r62; - cast r62 r61 into r63 as Optional__AqOs5VODSRH; - cast r63 into r64 as [Optional__AqOs5VODSRH; 1u32]; - ternary r54[0u32].is_some r54[0u32].val.arr.is_some r57.is_some into r65; - cast r65 r64 into r66 as Optional__FVD6sPKEWr0; - cast r66 into r67 as Wrapper; - cast true r12 into r68 as Optional__AqOs5VODSRH; - cast r68 into r69 as [Optional__AqOs5VODSRH; 1u32]; - ternary r67.arr.is_some r67.arr.val[0u32].val.val.is_some r69[0u32].val.val.is_some into r70; - ternary r67.arr.is_some r67.arr.val[0u32].val.val.val r69[0u32].val.val.val into r71; - cast r70 r71 into r72 as Optional__3aph2JMPtnA; - cast r72 into r73 as Inner; - ternary r67.arr.is_some r67.arr.val[0u32].is_some r69[0u32].is_some into r74; - cast r74 r73 into r75 as Optional__AqOs5VODSRH; - cast r75 into r76 as [Optional__AqOs5VODSRH; 1u32]; - ternary r76[0u32].is_some r76[0u32].val.val.is_some r11.is_some into r77; - ternary r76[0u32].is_some r76[0u32].val.val.val r11.val into r78; - cast r77 r78 into r79 as Optional__3aph2JMPtnA; - cast r79 into r80 as Inner; - ternary r80.val.is_some r80.val.val 99u8 into r81; - output r81 as u8.private; + cast true 55u8 into r10 as Optional__3aph2JMPtnA; + cast r10 into r11 as Inner; + cast r9.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some r9.wrappers.val[0u32].val.arr.val[0u32].val.val.val into r12 as Optional__3aph2JMPtnA; + cast r12 into r13 as Inner; + cast r9.wrappers.val[0u32].val.arr.val[0u32].is_some r13 into r14 as Optional__AqOs5VODSRH; + cast r14 into r15 as [Optional__AqOs5VODSRH; 1u32]; + cast r9.wrappers.val[0u32].val.arr.is_some r15 into r16 as Optional__FVD6sPKEWr0; + cast r16 into r17 as Wrapper; + cast r9.wrappers.val[0u32].is_some r17 into r18 as Optional__90gnFMeDKTp; + cast r18 into r19 as [Optional__90gnFMeDKTp; 1u32]; + cast r9.wrappers.is_some r19 into r20 as Optional__BetGHuxYwx2; + cast r20 into r21 as Container; + cast true r11 into r22 as Optional__AqOs5VODSRH; + cast r22 into r23 as [Optional__AqOs5VODSRH; 1u32]; + cast true r23 into r24 as Optional__FVD6sPKEWr0; + cast r24 into r25 as Wrapper; + cast true r25 into r26 as Optional__90gnFMeDKTp; + cast r26 into r27 as [Optional__90gnFMeDKTp; 1u32]; + ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some r27[0u32].val.arr.val[0u32].val.val.is_some into r28; + ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.val[0u32].val.val.val r27[0u32].val.arr.val[0u32].val.val.val into r29; + cast r28 r29 into r30 as Optional__3aph2JMPtnA; + cast r30 into r31 as Inner; + ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.val[0u32].is_some r27[0u32].val.arr.val[0u32].is_some into r32; + cast r32 r31 into r33 as Optional__AqOs5VODSRH; + cast r33 into r34 as [Optional__AqOs5VODSRH; 1u32]; + ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.is_some r27[0u32].val.arr.is_some into r35; + cast r35 r34 into r36 as Optional__FVD6sPKEWr0; + cast r36 into r37 as Wrapper; + ternary r21.wrappers.is_some r21.wrappers.val[0u32].is_some r27[0u32].is_some into r38; + cast r38 r37 into r39 as Optional__90gnFMeDKTp; + cast r39 into r40 as [Optional__90gnFMeDKTp; 1u32]; + cast true r11 into r41 as Optional__AqOs5VODSRH; + cast r41 into r42 as [Optional__AqOs5VODSRH; 1u32]; + ternary r40[0u32].is_some r40[0u32].val.arr.val[0u32].val.val.is_some r42[0u32].val.val.is_some into r43; + ternary r40[0u32].is_some r40[0u32].val.arr.val[0u32].val.val.val r42[0u32].val.val.val into r44; + cast r43 r44 into r45 as Optional__3aph2JMPtnA; + cast r45 into r46 as Inner; + ternary r40[0u32].is_some r40[0u32].val.arr.val[0u32].is_some r42[0u32].is_some into r47; + cast r47 r46 into r48 as Optional__AqOs5VODSRH; + cast r48 into r49 as [Optional__AqOs5VODSRH; 1u32]; + ternary r40[0u32].is_some r40[0u32].val.arr.is_some true into r50; + cast r50 r49 into r51 as Optional__FVD6sPKEWr0; + cast r51 into r52 as Wrapper; + cast true r11 into r53 as Optional__AqOs5VODSRH; + cast r53 into r54 as [Optional__AqOs5VODSRH; 1u32]; + ternary r52.arr.is_some r52.arr.val[0u32].val.val.is_some r54[0u32].val.val.is_some into r55; + ternary r52.arr.is_some r52.arr.val[0u32].val.val.val r54[0u32].val.val.val into r56; + cast r55 r56 into r57 as Optional__3aph2JMPtnA; + cast r57 into r58 as Inner; + ternary r52.arr.is_some r52.arr.val[0u32].is_some r54[0u32].is_some into r59; + cast r59 r58 into r60 as Optional__AqOs5VODSRH; + cast r60 into r61 as [Optional__AqOs5VODSRH; 1u32]; + ternary r61[0u32].is_some r61[0u32].val.val.is_some true into r62; + ternary r61[0u32].is_some r61[0u32].val.val.val 55u8 into r63; + ternary r62 r63 99u8 into r64; + output r64 as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/aggregates.out b/tests/expectations/compiler/storage/aggregates.out index 6bf2aaa773c..97af6471ff1 100644 --- a/tests/expectations/compiler/storage/aggregates.out +++ b/tests/expectations/compiler/storage/aggregates.out @@ -103,87 +103,81 @@ finalize check1: ternary r0 r2.x r3.x into r4; ternary r0 r2.y r3.y into r5; cast r4 r5 into r6 as Point; - cast r0 r6 into r7 as Optional__7G49nMxvEkY; - assert.eq r7.is_some true; - is.eq r7.val.x 1field into r8; + assert.eq r0 true; + is.eq r6.x 1field into r7; + assert.eq r7 true; + is.eq r6.y 2field into r8; assert.eq r8 true; - is.eq r7.val.y 2field into r9; + contains points__[false] into r9; + cast 0field 0field into r10 as Point; + cast r10 r10 into r11 as [Point; 2u32]; + get.or_use points__[false] r11 into r12; + cast 0field 0field into r13 as Point; + cast r13 r13 into r14 as [Point; 2u32]; + ternary r9 r12[0u32].x r14[0u32].x into r15; + ternary r9 r12[0u32].y r14[0u32].y into r16; + cast r15 r16 into r17 as Point; + ternary r9 r12[1u32].x r14[1u32].x into r18; + ternary r9 r12[1u32].y r14[1u32].y into r19; + cast r18 r19 into r20 as Point; + cast r17 r20 into r21 as [Point; 2u32]; assert.eq r9 true; - contains points__[false] into r10; - cast 0field 0field into r11 as Point; - cast r11 r11 into r12 as [Point; 2u32]; - get.or_use points__[false] r12 into r13; - cast 0field 0field into r14 as Point; - cast r14 r14 into r15 as [Point; 2u32]; - ternary r10 r13[0u32].x r15[0u32].x into r16; - ternary r10 r13[0u32].y r15[0u32].y into r17; - cast r16 r17 into r18 as Point; - ternary r10 r13[1u32].x r15[1u32].x into r19; - ternary r10 r13[1u32].y r15[1u32].y into r20; - cast r19 r20 into r21 as Point; - cast r18 r21 into r22 as [Point; 2u32]; - cast r10 r22 into r23 as Optional__CIFHV93i7jy; - assert.eq r23.is_some true; - is.eq r23.val[0u32].x 10field into r24; + is.eq r21[0u32].x 10field into r22; + assert.eq r22 true; + is.eq r21[1u32].y 40field into r23; + assert.eq r23 true; + contains stats__[false] into r24; + cast 0u32 0u32 0u32 into r25 as [u32; 3u32]; + cast r25 false into r26 as Stats; + get.or_use stats__[false] r26 into r27; + cast r25 false into r28 as Stats; + ternary r24 r27.values[0u32] r28.values[0u32] into r29; + ternary r24 r27.values[1u32] r28.values[1u32] into r30; + ternary r24 r27.values[2u32] r28.values[2u32] into r31; + cast r29 r30 r31 into r32 as [u32; 3u32]; + ternary r24 r27.active r28.active into r33; + cast r32 r33 into r34 as Stats; assert.eq r24 true; - is.eq r23.val[1u32].y 40field into r25; - assert.eq r25 true; - contains stats__[false] into r26; - cast 0u32 0u32 0u32 into r27 as [u32; 3u32]; - cast r27 false into r28 as Stats; - get.or_use stats__[false] r28 into r29; - cast r27 false into r30 as Stats; - ternary r26 r29.values[0u32] r30.values[0u32] into r31; - ternary r26 r29.values[1u32] r30.values[1u32] into r32; - ternary r26 r29.values[2u32] r30.values[2u32] into r33; - cast r31 r32 r33 into r34 as [u32; 3u32]; - ternary r26 r29.active r30.active into r35; - cast r34 r35 into r36 as Stats; - cast r26 r36 into r37 as Optional__Lq45m8HPNtd; - assert.eq r37.is_some true; - is.eq r37.val.values[1u32] 10u32 into r38; - assert.eq r38 true; - is.eq r37.val.active true into r39; - assert.eq r39 true; - contains arr_u32__[false] into r40; - get.or_use arr_u32__[false] r27 into r41; - ternary r40 r41[0u32] r27[0u32] into r42; - ternary r40 r41[1u32] r27[1u32] into r43; - ternary r40 r41[2u32] r27[2u32] into r44; - cast r42 r43 r44 into r45 as [u32; 3u32]; - cast r40 r45 into r46 as Optional__44OvQX0aUQS; - assert.eq r46.is_some true; - is.eq r46.val[2u32] 9u32 into r47; - assert.eq r47 true; - contains arr_bool__[false] into r48; - cast false false into r49 as [boolean; 2u32]; - get.or_use arr_bool__[false] r49 into r50; - ternary r48 r50[0u32] r49[0u32] into r51; - ternary r48 r50[1u32] r49[1u32] into r52; - cast r51 r52 into r53 as [boolean; 2u32]; - cast r48 r53 into r54 as Optional__1QRp3ZHeoMr; - assert.eq r54.is_some true; - is.eq r54.val[0u32] true into r55; - assert.eq r55 true; - is.eq r54.val[1u32] false into r56; - assert.eq r56 true; - contains nested__[false] into r57; - cast 0u8 0u8 into r58 as [u8; 2u32]; - cast r58 r58 into r59 as [[u8; 2u32]; 2u32]; - get.or_use nested__[false] r59 into r60; - ternary r57 r60[0u32][0u32] r59[0u32][0u32] into r61; - ternary r57 r60[0u32][1u32] r59[0u32][1u32] into r62; - cast r61 r62 into r63 as [u8; 2u32]; - ternary r57 r60[1u32][0u32] r59[1u32][0u32] into r64; - ternary r57 r60[1u32][1u32] r59[1u32][1u32] into r65; - cast r64 r65 into r66 as [u8; 2u32]; - cast r63 r66 into r67 as [[u8; 2u32]; 2u32]; - cast r57 r67 into r68 as Optional__BYnjU42CUEm; - assert.eq r68.is_some true; - is.eq r68.val[0u32][1u32] 2u8 into r69; - assert.eq r69 true; - is.eq r68.val[1u32][0u32] 3u8 into r70; - assert.eq r70 true; + is.eq r34.values[1u32] 10u32 into r35; + assert.eq r35 true; + is.eq r34.active true into r36; + assert.eq r36 true; + contains arr_u32__[false] into r37; + get.or_use arr_u32__[false] r25 into r38; + ternary r37 r38[0u32] r25[0u32] into r39; + ternary r37 r38[1u32] r25[1u32] into r40; + ternary r37 r38[2u32] r25[2u32] into r41; + cast r39 r40 r41 into r42 as [u32; 3u32]; + assert.eq r37 true; + is.eq r42[2u32] 9u32 into r43; + assert.eq r43 true; + contains arr_bool__[false] into r44; + cast false false into r45 as [boolean; 2u32]; + get.or_use arr_bool__[false] r45 into r46; + ternary r44 r46[0u32] r45[0u32] into r47; + ternary r44 r46[1u32] r45[1u32] into r48; + cast r47 r48 into r49 as [boolean; 2u32]; + assert.eq r44 true; + is.eq r49[0u32] true into r50; + assert.eq r50 true; + is.eq r49[1u32] false into r51; + assert.eq r51 true; + contains nested__[false] into r52; + cast 0u8 0u8 into r53 as [u8; 2u32]; + cast r53 r53 into r54 as [[u8; 2u32]; 2u32]; + get.or_use nested__[false] r54 into r55; + ternary r52 r55[0u32][0u32] r54[0u32][0u32] into r56; + ternary r52 r55[0u32][1u32] r54[0u32][1u32] into r57; + cast r56 r57 into r58 as [u8; 2u32]; + ternary r52 r55[1u32][0u32] r54[1u32][0u32] into r59; + ternary r52 r55[1u32][1u32] r54[1u32][1u32] into r60; + cast r59 r60 into r61 as [u8; 2u32]; + cast r58 r61 into r62 as [[u8; 2u32]; 2u32]; + assert.eq r52 true; + is.eq r62[0u32][1u32] 2u8 into r63; + assert.eq r63 true; + is.eq r62[1u32][0u32] 3u8 into r64; + assert.eq r64 true; function check2: async check2 into r0; @@ -197,112 +191,106 @@ finalize check2: ternary r0 r2.x r3.x into r4; ternary r0 r2.y r3.y into r5; cast r4 r5 into r6 as Point; - cast r0 r6 into r7 as Optional__7G49nMxvEkY; - ternary r7.is_some r7.val.x 0field into r8; - ternary r7.is_some r7.val.y 0field into r9; - cast r8 r9 into r10 as Point; - is.eq r10.x 1field into r11; + ternary r0 r6.x 0field into r7; + ternary r0 r6.y 0field into r8; + cast r7 r8 into r9 as Point; + is.eq r9.x 1field into r10; + assert.eq r10 true; + is.eq r9.y 2field into r11; assert.eq r11 true; - is.eq r10.y 2field into r12; - assert.eq r12 true; - contains points__[false] into r13; - cast 0field 0field into r14 as Point; - cast r14 r14 into r15 as [Point; 2u32]; - get.or_use points__[false] r15 into r16; - cast 0field 0field into r17 as Point; - cast r17 r17 into r18 as [Point; 2u32]; - ternary r13 r16[0u32].x r18[0u32].x into r19; - ternary r13 r16[0u32].y r18[0u32].y into r20; - cast r19 r20 into r21 as Point; - ternary r13 r16[1u32].x r18[1u32].x into r22; - ternary r13 r16[1u32].y r18[1u32].y into r23; - cast r22 r23 into r24 as Point; - cast r21 r24 into r25 as [Point; 2u32]; - cast r13 r25 into r26 as Optional__CIFHV93i7jy; - cast 0field 0field into r27 as Point; - cast 0field 0field into r28 as Point; - cast r27 r28 into r29 as [Point; 2u32]; - ternary r26.is_some r26.val[0u32].x r29[0u32].x into r30; - ternary r26.is_some r26.val[0u32].y r29[0u32].y into r31; - cast r30 r31 into r32 as Point; - ternary r26.is_some r26.val[1u32].x r29[1u32].x into r33; - ternary r26.is_some r26.val[1u32].y r29[1u32].y into r34; - cast r33 r34 into r35 as Point; - cast r32 r35 into r36 as [Point; 2u32]; - is.eq r36[0u32].x 10field into r37; - assert.eq r37 true; - is.eq r36[1u32].y 40field into r38; - assert.eq r38 true; - contains stats__[false] into r39; - cast 0u32 0u32 0u32 into r40 as [u32; 3u32]; - cast r40 false into r41 as Stats; - get.or_use stats__[false] r41 into r42; - cast r40 false into r43 as Stats; - ternary r39 r42.values[0u32] r43.values[0u32] into r44; - ternary r39 r42.values[1u32] r43.values[1u32] into r45; - ternary r39 r42.values[2u32] r43.values[2u32] into r46; - cast r44 r45 r46 into r47 as [u32; 3u32]; - ternary r39 r42.active r43.active into r48; - cast r47 r48 into r49 as Stats; - cast r39 r49 into r50 as Optional__Lq45m8HPNtd; - cast 0u32 0u32 0u32 into r51 as [u32; 3u32]; - cast r51 false into r52 as Stats; - ternary r50.is_some r50.val.values[0u32] r52.values[0u32] into r53; - ternary r50.is_some r50.val.values[1u32] r52.values[1u32] into r54; - ternary r50.is_some r50.val.values[2u32] r52.values[2u32] into r55; - cast r53 r54 r55 into r56 as [u32; 3u32]; - ternary r50.is_some r50.val.active r52.active into r57; - cast r56 r57 into r58 as Stats; - is.eq r58.values[2u32] 15u32 into r59; - assert.eq r59 true; - is.eq r58.active true into r60; - assert.eq r60 true; - contains arr_u32__[false] into r61; - get.or_use arr_u32__[false] r40 into r62; - ternary r61 r62[0u32] r40[0u32] into r63; - ternary r61 r62[1u32] r40[1u32] into r64; - ternary r61 r62[2u32] r40[2u32] into r65; - cast r63 r64 r65 into r66 as [u32; 3u32]; - cast r61 r66 into r67 as Optional__44OvQX0aUQS; - ternary r67.is_some r67.val[0u32] 0u32 into r68; - ternary r67.is_some r67.val[1u32] 0u32 into r69; - ternary r67.is_some r67.val[2u32] 0u32 into r70; - cast r68 r69 r70 into r71 as [u32; 3u32]; - is.eq r71[1u32] 8u32 into r72; - assert.eq r72 true; - contains arr_bool__[false] into r73; - cast false false into r74 as [boolean; 2u32]; - get.or_use arr_bool__[false] r74 into r75; - ternary r73 r75[0u32] r74[0u32] into r76; - ternary r73 r75[1u32] r74[1u32] into r77; - cast r76 r77 into r78 as [boolean; 2u32]; - cast r73 r78 into r79 as Optional__1QRp3ZHeoMr; - ternary r79.is_some r79.val[0u32] false into r80; - ternary r79.is_some r79.val[1u32] false into r81; - cast r80 r81 into r82 as [boolean; 2u32]; - is.eq r82[0u32] true into r83; - assert.eq r83 true; - contains nested__[false] into r84; - cast 0u8 0u8 into r85 as [u8; 2u32]; - cast r85 r85 into r86 as [[u8; 2u32]; 2u32]; - get.or_use nested__[false] r86 into r87; - ternary r84 r87[0u32][0u32] r86[0u32][0u32] into r88; - ternary r84 r87[0u32][1u32] r86[0u32][1u32] into r89; - cast r88 r89 into r90 as [u8; 2u32]; - ternary r84 r87[1u32][0u32] r86[1u32][0u32] into r91; - ternary r84 r87[1u32][1u32] r86[1u32][1u32] into r92; - cast r91 r92 into r93 as [u8; 2u32]; - cast r90 r93 into r94 as [[u8; 2u32]; 2u32]; - cast r84 r94 into r95 as Optional__BYnjU42CUEm; - ternary r95.is_some r95.val[0u32][0u32] 0u8 into r96; - ternary r95.is_some r95.val[0u32][1u32] 0u8 into r97; - cast r96 r97 into r98 as [u8; 2u32]; - ternary r95.is_some r95.val[1u32][0u32] 0u8 into r99; - ternary r95.is_some r95.val[1u32][1u32] 0u8 into r100; - cast r99 r100 into r101 as [u8; 2u32]; - cast r98 r101 into r102 as [[u8; 2u32]; 2u32]; - is.eq r102[1u32][1u32] 4u8 into r103; - assert.eq r103 true; + contains points__[false] into r12; + cast 0field 0field into r13 as Point; + cast r13 r13 into r14 as [Point; 2u32]; + get.or_use points__[false] r14 into r15; + cast 0field 0field into r16 as Point; + cast r16 r16 into r17 as [Point; 2u32]; + ternary r12 r15[0u32].x r17[0u32].x into r18; + ternary r12 r15[0u32].y r17[0u32].y into r19; + cast r18 r19 into r20 as Point; + ternary r12 r15[1u32].x r17[1u32].x into r21; + ternary r12 r15[1u32].y r17[1u32].y into r22; + cast r21 r22 into r23 as Point; + cast r20 r23 into r24 as [Point; 2u32]; + cast 0field 0field into r25 as Point; + cast 0field 0field into r26 as Point; + cast r25 r26 into r27 as [Point; 2u32]; + ternary r12 r24[0u32].x r27[0u32].x into r28; + ternary r12 r24[0u32].y r27[0u32].y into r29; + cast r28 r29 into r30 as Point; + ternary r12 r24[1u32].x r27[1u32].x into r31; + ternary r12 r24[1u32].y r27[1u32].y into r32; + cast r31 r32 into r33 as Point; + cast r30 r33 into r34 as [Point; 2u32]; + is.eq r34[0u32].x 10field into r35; + assert.eq r35 true; + is.eq r34[1u32].y 40field into r36; + assert.eq r36 true; + contains stats__[false] into r37; + cast 0u32 0u32 0u32 into r38 as [u32; 3u32]; + cast r38 false into r39 as Stats; + get.or_use stats__[false] r39 into r40; + cast r38 false into r41 as Stats; + ternary r37 r40.values[0u32] r41.values[0u32] into r42; + ternary r37 r40.values[1u32] r41.values[1u32] into r43; + ternary r37 r40.values[2u32] r41.values[2u32] into r44; + cast r42 r43 r44 into r45 as [u32; 3u32]; + ternary r37 r40.active r41.active into r46; + cast r45 r46 into r47 as Stats; + cast 0u32 0u32 0u32 into r48 as [u32; 3u32]; + cast r48 false into r49 as Stats; + ternary r37 r47.values[0u32] r49.values[0u32] into r50; + ternary r37 r47.values[1u32] r49.values[1u32] into r51; + ternary r37 r47.values[2u32] r49.values[2u32] into r52; + cast r50 r51 r52 into r53 as [u32; 3u32]; + ternary r37 r47.active r49.active into r54; + cast r53 r54 into r55 as Stats; + is.eq r55.values[2u32] 15u32 into r56; + assert.eq r56 true; + is.eq r55.active true into r57; + assert.eq r57 true; + contains arr_u32__[false] into r58; + get.or_use arr_u32__[false] r38 into r59; + ternary r58 r59[0u32] r38[0u32] into r60; + ternary r58 r59[1u32] r38[1u32] into r61; + ternary r58 r59[2u32] r38[2u32] into r62; + cast r60 r61 r62 into r63 as [u32; 3u32]; + ternary r58 r63[0u32] 0u32 into r64; + ternary r58 r63[1u32] 0u32 into r65; + ternary r58 r63[2u32] 0u32 into r66; + cast r64 r65 r66 into r67 as [u32; 3u32]; + is.eq r67[1u32] 8u32 into r68; + assert.eq r68 true; + contains arr_bool__[false] into r69; + cast false false into r70 as [boolean; 2u32]; + get.or_use arr_bool__[false] r70 into r71; + ternary r69 r71[0u32] r70[0u32] into r72; + ternary r69 r71[1u32] r70[1u32] into r73; + cast r72 r73 into r74 as [boolean; 2u32]; + ternary r69 r74[0u32] false into r75; + ternary r69 r74[1u32] false into r76; + cast r75 r76 into r77 as [boolean; 2u32]; + is.eq r77[0u32] true into r78; + assert.eq r78 true; + contains nested__[false] into r79; + cast 0u8 0u8 into r80 as [u8; 2u32]; + cast r80 r80 into r81 as [[u8; 2u32]; 2u32]; + get.or_use nested__[false] r81 into r82; + ternary r79 r82[0u32][0u32] r81[0u32][0u32] into r83; + ternary r79 r82[0u32][1u32] r81[0u32][1u32] into r84; + cast r83 r84 into r85 as [u8; 2u32]; + ternary r79 r82[1u32][0u32] r81[1u32][0u32] into r86; + ternary r79 r82[1u32][1u32] r81[1u32][1u32] into r87; + cast r86 r87 into r88 as [u8; 2u32]; + cast r85 r88 into r89 as [[u8; 2u32]; 2u32]; + ternary r79 r89[0u32][0u32] 0u8 into r90; + ternary r79 r89[0u32][1u32] 0u8 into r91; + cast r90 r91 into r92 as [u8; 2u32]; + ternary r79 r89[1u32][0u32] 0u8 into r93; + ternary r79 r89[1u32][1u32] 0u8 into r94; + cast r93 r94 into r95 as [u8; 2u32]; + cast r92 r95 into r96 as [[u8; 2u32]; 2u32]; + is.eq r96[1u32][1u32] 4u8 into r97; + assert.eq r97 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/counter_storage.out b/tests/expectations/compiler/storage/counter_storage.out index 42ed7e822b2..c6d14a36ca6 100644 --- a/tests/expectations/compiler/storage/counter_storage.out +++ b/tests/expectations/compiler/storage/counter_storage.out @@ -23,17 +23,15 @@ finalize increment: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - ternary r3.is_some r3.val 0u32 into r4; - add r4 1u32 into r5; - set r5 into counter__[false]; - contains counter__[false] into r6; - get.or_use counter__[false] 0u32 into r7; - ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - assert.eq r9.is_some true; - is.eq r9.val r5 into r10; - assert.eq r10 true; + ternary r0 r2 0u32 into r3; + add r3 1u32 into r4; + set r4 into counter__[false]; + contains counter__[false] into r5; + get.or_use counter__[false] 0u32 into r6; + ternary r5 r6 0u32 into r7; + assert.eq r5 true; + is.eq r7 r4 into r8; + assert.eq r8 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/external_storage.out b/tests/expectations/compiler/storage/external_storage.out index 2f50e8f9823..a500874a66d 100644 --- a/tests/expectations/compiler/storage/external_storage.out +++ b/tests/expectations/compiler/storage/external_storage.out @@ -168,130 +168,118 @@ finalize check_initialized: contains child.aleo/flag__[false] into r0; get.or_use child.aleo/flag__[false] false into r1; ternary r0 r1 false into r2; - cast r0 r2 into r3 as Optional__ATAkdHctJwx; - assert.eq r3.is_some true; - is.eq r3.val true into r4; + assert.eq r0 true; + is.eq r2 true into r3; + assert.eq r3 true; + contains child.aleo/scalar_val__[false] into r4; + get.or_use child.aleo/scalar_val__[false] 0scalar into r5; + ternary r4 r5 0scalar into r6; assert.eq r4 true; - contains child.aleo/scalar_val__[false] into r5; - get.or_use child.aleo/scalar_val__[false] 0scalar into r6; - ternary r5 r6 0scalar into r7; - cast r5 r7 into r8 as Optional__9y0TjJOC4Nk; - assert.eq r8.is_some true; - is.eq r8.val 1scalar into r9; - assert.eq r9 true; - contains child.aleo/field_val__[false] into r10; - get.or_use child.aleo/field_val__[false] 0field into r11; - ternary r10 r11 0field into r12; - cast r10 r12 into r13 as Optional__7o6su2Uhzht; - assert.eq r13.is_some true; - is.eq r13.val 42field into r14; - assert.eq r14 true; - contains child.aleo/group_val__[false] into r15; - get.or_use child.aleo/group_val__[false] 0group into r16; - ternary r15 r16 0group into r17; - cast r15 r17 into r18 as Optional__9SsWRr2WG5s; - assert.eq r18.is_some true; - is.eq r18.val 0group into r19; - assert.eq r19 true; - contains child.aleo/point__[false] into r20; - cast 0field 0field into r21 as child.aleo/Point; - get.or_use child.aleo/point__[false] r21 into r22; - cast 0field 0field into r23 as child.aleo/Point; - ternary r20 r22.x r23.x into r24; - ternary r20 r22.y r23.y into r25; - cast r24 r25 into r26 as child.aleo/Point; - cast r20 r26 into r27 as Optional__7G49nMxvEkY; - assert.eq r27.is_some true; - is.eq r27.val.x 1field into r28; - assert.eq r28 true; - is.eq r27.val.y 2field into r29; - assert.eq r29 true; - contains child.aleo/points__[false] into r30; - cast 0field 0field into r31 as child.aleo/Point; - cast r31 r31 into r32 as [child.aleo/Point; 2u32]; - get.or_use child.aleo/points__[false] r32 into r33; - cast 0field 0field into r34 as child.aleo/Point; - cast r34 r34 into r35 as [child.aleo/Point; 2u32]; - ternary r30 r33[0u32].x r35[0u32].x into r36; - ternary r30 r33[0u32].y r35[0u32].y into r37; - cast r36 r37 into r38 as child.aleo/Point; - ternary r30 r33[1u32].x r35[1u32].x into r39; - ternary r30 r33[1u32].y r35[1u32].y into r40; - cast r39 r40 into r41 as child.aleo/Point; - cast r38 r41 into r42 as [child.aleo/Point; 2u32]; - cast r30 r42 into r43 as Optional__CIFHV93i7jy; - assert.eq r43.is_some true; - is.eq r43.val[0u32].x 10field into r44; - assert.eq r44 true; - is.eq r43.val[1u32].y 40field into r45; - assert.eq r45 true; - contains child.aleo/stats__[false] into r46; - cast 0u32 0u32 0u32 into r47 as [u32; 3u32]; - cast r47 false into r48 as child.aleo/Stats; - get.or_use child.aleo/stats__[false] r48 into r49; - cast r47 false into r50 as child.aleo/Stats; - ternary r46 r49.values[0u32] r50.values[0u32] into r51; - ternary r46 r49.values[1u32] r50.values[1u32] into r52; - ternary r46 r49.values[2u32] r50.values[2u32] into r53; - cast r51 r52 r53 into r54 as [u32; 3u32]; - ternary r46 r49.active r50.active into r55; - cast r54 r55 into r56 as child.aleo/Stats; - cast r46 r56 into r57 as Optional__Lq45m8HPNtd; - assert.eq r57.is_some true; - is.eq r57.val.values[1u32] 10u32 into r58; - assert.eq r58 true; - is.eq r57.val.active true into r59; + is.eq r6 1scalar into r7; + assert.eq r7 true; + contains child.aleo/field_val__[false] into r8; + get.or_use child.aleo/field_val__[false] 0field into r9; + ternary r8 r9 0field into r10; + assert.eq r8 true; + is.eq r10 42field into r11; + assert.eq r11 true; + contains child.aleo/group_val__[false] into r12; + get.or_use child.aleo/group_val__[false] 0group into r13; + ternary r12 r13 0group into r14; + assert.eq r12 true; + is.eq r14 0group into r15; + assert.eq r15 true; + contains child.aleo/point__[false] into r16; + cast 0field 0field into r17 as child.aleo/Point; + get.or_use child.aleo/point__[false] r17 into r18; + cast 0field 0field into r19 as child.aleo/Point; + ternary r16 r18.x r19.x into r20; + ternary r16 r18.y r19.y into r21; + cast r20 r21 into r22 as child.aleo/Point; + assert.eq r16 true; + is.eq r22.x 1field into r23; + assert.eq r23 true; + is.eq r22.y 2field into r24; + assert.eq r24 true; + contains child.aleo/points__[false] into r25; + cast 0field 0field into r26 as child.aleo/Point; + cast r26 r26 into r27 as [child.aleo/Point; 2u32]; + get.or_use child.aleo/points__[false] r27 into r28; + cast 0field 0field into r29 as child.aleo/Point; + cast r29 r29 into r30 as [child.aleo/Point; 2u32]; + ternary r25 r28[0u32].x r30[0u32].x into r31; + ternary r25 r28[0u32].y r30[0u32].y into r32; + cast r31 r32 into r33 as child.aleo/Point; + ternary r25 r28[1u32].x r30[1u32].x into r34; + ternary r25 r28[1u32].y r30[1u32].y into r35; + cast r34 r35 into r36 as child.aleo/Point; + cast r33 r36 into r37 as [child.aleo/Point; 2u32]; + assert.eq r25 true; + is.eq r37[0u32].x 10field into r38; + assert.eq r38 true; + is.eq r37[1u32].y 40field into r39; + assert.eq r39 true; + contains child.aleo/stats__[false] into r40; + cast 0u32 0u32 0u32 into r41 as [u32; 3u32]; + cast r41 false into r42 as child.aleo/Stats; + get.or_use child.aleo/stats__[false] r42 into r43; + cast r41 false into r44 as child.aleo/Stats; + ternary r40 r43.values[0u32] r44.values[0u32] into r45; + ternary r40 r43.values[1u32] r44.values[1u32] into r46; + ternary r40 r43.values[2u32] r44.values[2u32] into r47; + cast r45 r46 r47 into r48 as [u32; 3u32]; + ternary r40 r43.active r44.active into r49; + cast r48 r49 into r50 as child.aleo/Stats; + assert.eq r40 true; + is.eq r50.values[1u32] 10u32 into r51; + assert.eq r51 true; + is.eq r50.active true into r52; + assert.eq r52 true; + contains child.aleo/arr_u32__[false] into r53; + get.or_use child.aleo/arr_u32__[false] r41 into r54; + ternary r53 r54[0u32] r41[0u32] into r55; + ternary r53 r54[1u32] r41[1u32] into r56; + ternary r53 r54[2u32] r41[2u32] into r57; + cast r55 r56 r57 into r58 as [u32; 3u32]; + assert.eq r53 true; + is.eq r58[2u32] 9u32 into r59; assert.eq r59 true; - contains child.aleo/arr_u32__[false] into r60; - get.or_use child.aleo/arr_u32__[false] r47 into r61; - ternary r60 r61[0u32] r47[0u32] into r62; - ternary r60 r61[1u32] r47[1u32] into r63; - ternary r60 r61[2u32] r47[2u32] into r64; - cast r62 r63 r64 into r65 as [u32; 3u32]; - cast r60 r65 into r66 as Optional__44OvQX0aUQS; - assert.eq r66.is_some true; - is.eq r66.val[2u32] 9u32 into r67; + contains child.aleo/arr_bool__[false] into r60; + cast false false into r61 as [boolean; 2u32]; + get.or_use child.aleo/arr_bool__[false] r61 into r62; + ternary r60 r62[0u32] r61[0u32] into r63; + ternary r60 r62[1u32] r61[1u32] into r64; + cast r63 r64 into r65 as [boolean; 2u32]; + assert.eq r60 true; + is.eq r65[0u32] true into r66; + assert.eq r66 true; + contains child.aleo/nested__[false] into r67; + cast 0u8 0u8 into r68 as [u8; 2u32]; + cast r68 r68 into r69 as [[u8; 2u32]; 2u32]; + get.or_use child.aleo/nested__[false] r69 into r70; + ternary r67 r70[0u32][0u32] r69[0u32][0u32] into r71; + ternary r67 r70[0u32][1u32] r69[0u32][1u32] into r72; + cast r71 r72 into r73 as [u8; 2u32]; + ternary r67 r70[1u32][0u32] r69[1u32][0u32] into r74; + ternary r67 r70[1u32][1u32] r69[1u32][1u32] into r75; + cast r74 r75 into r76 as [u8; 2u32]; + cast r73 r76 into r77 as [[u8; 2u32]; 2u32]; assert.eq r67 true; - contains child.aleo/arr_bool__[false] into r68; - cast false false into r69 as [boolean; 2u32]; - get.or_use child.aleo/arr_bool__[false] r69 into r70; - ternary r68 r70[0u32] r69[0u32] into r71; - ternary r68 r70[1u32] r69[1u32] into r72; - cast r71 r72 into r73 as [boolean; 2u32]; - cast r68 r73 into r74 as Optional__1QRp3ZHeoMr; - assert.eq r74.is_some true; - is.eq r74.val[0u32] true into r75; - assert.eq r75 true; - contains child.aleo/nested__[false] into r76; - cast 0u8 0u8 into r77 as [u8; 2u32]; - cast r77 r77 into r78 as [[u8; 2u32]; 2u32]; - get.or_use child.aleo/nested__[false] r78 into r79; - ternary r76 r79[0u32][0u32] r78[0u32][0u32] into r80; - ternary r76 r79[0u32][1u32] r78[0u32][1u32] into r81; - cast r80 r81 into r82 as [u8; 2u32]; - ternary r76 r79[1u32][0u32] r78[1u32][0u32] into r83; - ternary r76 r79[1u32][1u32] r78[1u32][1u32] into r84; - cast r83 r84 into r85 as [u8; 2u32]; - cast r82 r85 into r86 as [[u8; 2u32]; 2u32]; - cast r76 r86 into r87 as Optional__BYnjU42CUEm; - assert.eq r87.is_some true; - is.eq r87.val[1u32][1u32] 4u8 into r88; - assert.eq r88 true; - contains child.aleo/counter__[false] into r89; - get.or_use child.aleo/counter__[false] 0u8 into r90; - ternary r89 r90 0u8 into r91; - cast r89 r91 into r92 as Optional__3aph2JMPtnA; - assert.eq r92.is_some true; - is.eq r92.val 9u8 into r93; - assert.eq r93 true; - get.or_use child.aleo/vec__len__[false] 0u32 into r94; - lt 2u32 r94 into r95; - get.or_use child.aleo/vec__[2u32] 0u8 into r96; - ternary r95 r96 0u8 into r97; - cast r95 r97 into r98 as Optional__3aph2JMPtnA; - assert.eq r98.is_some true; - is.eq r98.val 70u8 into r99; - assert.eq r99 true; + is.eq r77[1u32][1u32] 4u8 into r78; + assert.eq r78 true; + contains child.aleo/counter__[false] into r79; + get.or_use child.aleo/counter__[false] 0u8 into r80; + ternary r79 r80 0u8 into r81; + assert.eq r79 true; + is.eq r81 9u8 into r82; + assert.eq r82 true; + get.or_use child.aleo/vec__len__[false] 0u32 into r83; + lt 2u32 r83 into r84; + get.or_use child.aleo/vec__[2u32] 0u8 into r85; + ternary r84 r85 0u8 into r86; + assert.eq r84 true; + is.eq r86 70u8 into r87; + assert.eq r87 true; function check_wiped: async check_wiped into r0; @@ -427,145 +415,134 @@ finalize check_fallback: contains child.aleo/flag__[false] into r0; get.or_use child.aleo/flag__[false] false into r1; ternary r0 r1 false into r2; - cast r0 r2 into r3 as Optional__ATAkdHctJwx; - ternary r3.is_some r3.val false into r4; - is.eq r4 false into r5; - assert.eq r5 true; - contains child.aleo/scalar_val__[false] into r6; - get.or_use child.aleo/scalar_val__[false] 0scalar into r7; - ternary r6 r7 0scalar into r8; - cast r6 r8 into r9 as Optional__9y0TjJOC4Nk; - ternary r9.is_some r9.val 0scalar into r10; - is.eq r10 0scalar into r11; - assert.eq r11 true; - contains child.aleo/field_val__[false] into r12; - get.or_use child.aleo/field_val__[false] 0field into r13; - ternary r12 r13 0field into r14; - cast r12 r14 into r15 as Optional__7o6su2Uhzht; - ternary r15.is_some r15.val 0field into r16; - is.eq r16 0field into r17; - assert.eq r17 true; - contains child.aleo/group_val__[false] into r18; - get.or_use child.aleo/group_val__[false] 0group into r19; - ternary r18 r19 0group into r20; - cast r18 r20 into r21 as Optional__9SsWRr2WG5s; - ternary r21.is_some r21.val 0group into r22; - is.eq r22 0group into r23; - assert.eq r23 true; - contains child.aleo/point__[false] into r24; - cast 0field 0field into r25 as child.aleo/Point; - get.or_use child.aleo/point__[false] r25 into r26; - cast 0field 0field into r27 as child.aleo/Point; - ternary r24 r26.x r27.x into r28; - ternary r24 r26.y r27.y into r29; - cast r28 r29 into r30 as child.aleo/Point; - cast r24 r30 into r31 as Optional__7G49nMxvEkY; - ternary r31.is_some r31.val.x 0field into r32; - ternary r31.is_some r31.val.y 0field into r33; - cast r32 r33 into r34 as child.aleo/Point; - is.eq r34.x 0field into r35; - assert.eq r35 true; - contains child.aleo/points__[false] into r36; - cast 0field 0field into r37 as child.aleo/Point; - cast r37 r37 into r38 as [child.aleo/Point; 2u32]; - get.or_use child.aleo/points__[false] r38 into r39; - cast 0field 0field into r40 as child.aleo/Point; - cast r40 r40 into r41 as [child.aleo/Point; 2u32]; - ternary r36 r39[0u32].x r41[0u32].x into r42; - ternary r36 r39[0u32].y r41[0u32].y into r43; - cast r42 r43 into r44 as child.aleo/Point; - ternary r36 r39[1u32].x r41[1u32].x into r45; - ternary r36 r39[1u32].y r41[1u32].y into r46; - cast r45 r46 into r47 as child.aleo/Point; - cast r44 r47 into r48 as [child.aleo/Point; 2u32]; - cast r36 r48 into r49 as Optional__CIFHV93i7jy; - cast 0field 0field into r50 as child.aleo/Point; - cast 0field 0field into r51 as child.aleo/Point; - cast r50 r51 into r52 as [child.aleo/Point; 2u32]; - ternary r49.is_some r49.val[0u32].x r52[0u32].x into r53; - ternary r49.is_some r49.val[0u32].y r52[0u32].y into r54; - cast r53 r54 into r55 as child.aleo/Point; - ternary r49.is_some r49.val[1u32].x r52[1u32].x into r56; - ternary r49.is_some r49.val[1u32].y r52[1u32].y into r57; - cast r56 r57 into r58 as child.aleo/Point; - cast r55 r58 into r59 as [child.aleo/Point; 2u32]; - is.eq r59[0u32].x 0field into r60; - assert.eq r60 true; - contains child.aleo/stats__[false] into r61; - cast 0u32 0u32 0u32 into r62 as [u32; 3u32]; - cast r62 false into r63 as child.aleo/Stats; - get.or_use child.aleo/stats__[false] r63 into r64; - cast r62 false into r65 as child.aleo/Stats; - ternary r61 r64.values[0u32] r65.values[0u32] into r66; - ternary r61 r64.values[1u32] r65.values[1u32] into r67; - ternary r61 r64.values[2u32] r65.values[2u32] into r68; - cast r66 r67 r68 into r69 as [u32; 3u32]; - ternary r61 r64.active r65.active into r70; - cast r69 r70 into r71 as child.aleo/Stats; - cast r61 r71 into r72 as Optional__Lq45m8HPNtd; - cast 0u32 0u32 0u32 into r73 as [u32; 3u32]; - cast r73 false into r74 as child.aleo/Stats; - ternary r72.is_some r72.val.values[0u32] r74.values[0u32] into r75; - ternary r72.is_some r72.val.values[1u32] r74.values[1u32] into r76; - ternary r72.is_some r72.val.values[2u32] r74.values[2u32] into r77; - cast r75 r76 r77 into r78 as [u32; 3u32]; - ternary r72.is_some r72.val.active r74.active into r79; - cast r78 r79 into r80 as child.aleo/Stats; - is.eq r80.active false into r81; - assert.eq r81 true; - contains child.aleo/arr_u32__[false] into r82; - get.or_use child.aleo/arr_u32__[false] r62 into r83; - ternary r82 r83[0u32] r62[0u32] into r84; - ternary r82 r83[1u32] r62[1u32] into r85; - ternary r82 r83[2u32] r62[2u32] into r86; - cast r84 r85 r86 into r87 as [u32; 3u32]; - cast r82 r87 into r88 as Optional__44OvQX0aUQS; - ternary r88.is_some r88.val[0u32] 0u32 into r89; - ternary r88.is_some r88.val[1u32] 0u32 into r90; - ternary r88.is_some r88.val[2u32] 0u32 into r91; - cast r89 r90 r91 into r92 as [u32; 3u32]; - is.eq r92[1u32] 0u32 into r93; - assert.eq r93 true; - contains child.aleo/arr_bool__[false] into r94; - cast false false into r95 as [boolean; 2u32]; - get.or_use child.aleo/arr_bool__[false] r95 into r96; - ternary r94 r96[0u32] r95[0u32] into r97; - ternary r94 r96[1u32] r95[1u32] into r98; - cast r97 r98 into r99 as [boolean; 2u32]; - cast r94 r99 into r100 as Optional__1QRp3ZHeoMr; - ternary r100.is_some r100.val[0u32] false into r101; - ternary r100.is_some r100.val[1u32] false into r102; - cast r101 r102 into r103 as [boolean; 2u32]; - is.eq r103[1u32] false into r104; - assert.eq r104 true; - contains child.aleo/nested__[false] into r105; - cast 0u8 0u8 into r106 as [u8; 2u32]; - cast r106 r106 into r107 as [[u8; 2u32]; 2u32]; - get.or_use child.aleo/nested__[false] r107 into r108; - ternary r105 r108[0u32][0u32] r107[0u32][0u32] into r109; - ternary r105 r108[0u32][1u32] r107[0u32][1u32] into r110; - cast r109 r110 into r111 as [u8; 2u32]; - ternary r105 r108[1u32][0u32] r107[1u32][0u32] into r112; - ternary r105 r108[1u32][1u32] r107[1u32][1u32] into r113; - cast r112 r113 into r114 as [u8; 2u32]; - cast r111 r114 into r115 as [[u8; 2u32]; 2u32]; - cast r105 r115 into r116 as Optional__BYnjU42CUEm; - ternary r116.is_some r116.val[0u32][0u32] 0u8 into r117; - ternary r116.is_some r116.val[0u32][1u32] 0u8 into r118; - cast r117 r118 into r119 as [u8; 2u32]; - ternary r116.is_some r116.val[1u32][0u32] 0u8 into r120; - ternary r116.is_some r116.val[1u32][1u32] 0u8 into r121; - cast r120 r121 into r122 as [u8; 2u32]; - cast r119 r122 into r123 as [[u8; 2u32]; 2u32]; - is.eq r123[0u32][0u32] 0u8 into r124; - assert.eq r124 true; - contains child.aleo/counter__[false] into r125; - get.or_use child.aleo/counter__[false] 0u8 into r126; - ternary r125 r126 0u8 into r127; - cast r125 r127 into r128 as Optional__3aph2JMPtnA; - ternary r128.is_some r128.val 123u8 into r129; - is.eq r129 123u8 into r130; - assert.eq r130 true; + ternary r0 r2 false into r3; + is.eq r3 false into r4; + assert.eq r4 true; + contains child.aleo/scalar_val__[false] into r5; + get.or_use child.aleo/scalar_val__[false] 0scalar into r6; + ternary r5 r6 0scalar into r7; + ternary r5 r7 0scalar into r8; + is.eq r8 0scalar into r9; + assert.eq r9 true; + contains child.aleo/field_val__[false] into r10; + get.or_use child.aleo/field_val__[false] 0field into r11; + ternary r10 r11 0field into r12; + ternary r10 r12 0field into r13; + is.eq r13 0field into r14; + assert.eq r14 true; + contains child.aleo/group_val__[false] into r15; + get.or_use child.aleo/group_val__[false] 0group into r16; + ternary r15 r16 0group into r17; + ternary r15 r17 0group into r18; + is.eq r18 0group into r19; + assert.eq r19 true; + contains child.aleo/point__[false] into r20; + cast 0field 0field into r21 as child.aleo/Point; + get.or_use child.aleo/point__[false] r21 into r22; + cast 0field 0field into r23 as child.aleo/Point; + ternary r20 r22.x r23.x into r24; + ternary r20 r22.y r23.y into r25; + cast r24 r25 into r26 as child.aleo/Point; + ternary r20 r26.x 0field into r27; + ternary r20 r26.y 0field into r28; + cast r27 r28 into r29 as child.aleo/Point; + is.eq r29.x 0field into r30; + assert.eq r30 true; + contains child.aleo/points__[false] into r31; + cast 0field 0field into r32 as child.aleo/Point; + cast r32 r32 into r33 as [child.aleo/Point; 2u32]; + get.or_use child.aleo/points__[false] r33 into r34; + cast 0field 0field into r35 as child.aleo/Point; + cast r35 r35 into r36 as [child.aleo/Point; 2u32]; + ternary r31 r34[0u32].x r36[0u32].x into r37; + ternary r31 r34[0u32].y r36[0u32].y into r38; + cast r37 r38 into r39 as child.aleo/Point; + ternary r31 r34[1u32].x r36[1u32].x into r40; + ternary r31 r34[1u32].y r36[1u32].y into r41; + cast r40 r41 into r42 as child.aleo/Point; + cast r39 r42 into r43 as [child.aleo/Point; 2u32]; + cast 0field 0field into r44 as child.aleo/Point; + cast 0field 0field into r45 as child.aleo/Point; + cast r44 r45 into r46 as [child.aleo/Point; 2u32]; + ternary r31 r43[0u32].x r46[0u32].x into r47; + ternary r31 r43[0u32].y r46[0u32].y into r48; + cast r47 r48 into r49 as child.aleo/Point; + ternary r31 r43[1u32].x r46[1u32].x into r50; + ternary r31 r43[1u32].y r46[1u32].y into r51; + cast r50 r51 into r52 as child.aleo/Point; + cast r49 r52 into r53 as [child.aleo/Point; 2u32]; + is.eq r53[0u32].x 0field into r54; + assert.eq r54 true; + contains child.aleo/stats__[false] into r55; + cast 0u32 0u32 0u32 into r56 as [u32; 3u32]; + cast r56 false into r57 as child.aleo/Stats; + get.or_use child.aleo/stats__[false] r57 into r58; + cast r56 false into r59 as child.aleo/Stats; + ternary r55 r58.values[0u32] r59.values[0u32] into r60; + ternary r55 r58.values[1u32] r59.values[1u32] into r61; + ternary r55 r58.values[2u32] r59.values[2u32] into r62; + cast r60 r61 r62 into r63 as [u32; 3u32]; + ternary r55 r58.active r59.active into r64; + cast r63 r64 into r65 as child.aleo/Stats; + cast 0u32 0u32 0u32 into r66 as [u32; 3u32]; + cast r66 false into r67 as child.aleo/Stats; + ternary r55 r65.values[0u32] r67.values[0u32] into r68; + ternary r55 r65.values[1u32] r67.values[1u32] into r69; + ternary r55 r65.values[2u32] r67.values[2u32] into r70; + cast r68 r69 r70 into r71 as [u32; 3u32]; + ternary r55 r65.active r67.active into r72; + cast r71 r72 into r73 as child.aleo/Stats; + is.eq r73.active false into r74; + assert.eq r74 true; + contains child.aleo/arr_u32__[false] into r75; + get.or_use child.aleo/arr_u32__[false] r56 into r76; + ternary r75 r76[0u32] r56[0u32] into r77; + ternary r75 r76[1u32] r56[1u32] into r78; + ternary r75 r76[2u32] r56[2u32] into r79; + cast r77 r78 r79 into r80 as [u32; 3u32]; + ternary r75 r80[0u32] 0u32 into r81; + ternary r75 r80[1u32] 0u32 into r82; + ternary r75 r80[2u32] 0u32 into r83; + cast r81 r82 r83 into r84 as [u32; 3u32]; + is.eq r84[1u32] 0u32 into r85; + assert.eq r85 true; + contains child.aleo/arr_bool__[false] into r86; + cast false false into r87 as [boolean; 2u32]; + get.or_use child.aleo/arr_bool__[false] r87 into r88; + ternary r86 r88[0u32] r87[0u32] into r89; + ternary r86 r88[1u32] r87[1u32] into r90; + cast r89 r90 into r91 as [boolean; 2u32]; + ternary r86 r91[0u32] false into r92; + ternary r86 r91[1u32] false into r93; + cast r92 r93 into r94 as [boolean; 2u32]; + is.eq r94[1u32] false into r95; + assert.eq r95 true; + contains child.aleo/nested__[false] into r96; + cast 0u8 0u8 into r97 as [u8; 2u32]; + cast r97 r97 into r98 as [[u8; 2u32]; 2u32]; + get.or_use child.aleo/nested__[false] r98 into r99; + ternary r96 r99[0u32][0u32] r98[0u32][0u32] into r100; + ternary r96 r99[0u32][1u32] r98[0u32][1u32] into r101; + cast r100 r101 into r102 as [u8; 2u32]; + ternary r96 r99[1u32][0u32] r98[1u32][0u32] into r103; + ternary r96 r99[1u32][1u32] r98[1u32][1u32] into r104; + cast r103 r104 into r105 as [u8; 2u32]; + cast r102 r105 into r106 as [[u8; 2u32]; 2u32]; + ternary r96 r106[0u32][0u32] 0u8 into r107; + ternary r96 r106[0u32][1u32] 0u8 into r108; + cast r107 r108 into r109 as [u8; 2u32]; + ternary r96 r106[1u32][0u32] 0u8 into r110; + ternary r96 r106[1u32][1u32] 0u8 into r111; + cast r110 r111 into r112 as [u8; 2u32]; + cast r109 r112 into r113 as [[u8; 2u32]; 2u32]; + is.eq r113[0u32][0u32] 0u8 into r114; + assert.eq r114 true; + contains child.aleo/counter__[false] into r115; + get.or_use child.aleo/counter__[false] 0u8 into r116; + ternary r115 r116 0u8 into r117; + ternary r115 r117 123u8 into r118; + is.eq r118 123u8 into r119; + assert.eq r119 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/external_storage_multi_deps.out b/tests/expectations/compiler/storage/external_storage_multi_deps.out index 4eaebaff30d..9f18f8884fa 100644 --- a/tests/expectations/compiler/storage/external_storage_multi_deps.out +++ b/tests/expectations/compiler/storage/external_storage_multi_deps.out @@ -41,10 +41,9 @@ finalize init: contains base.aleo/val_u32__[false] into r0; get.or_use base.aleo/val_u32__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - is.eq r3.val 99u32 into r4; - assert.eq r4 true; + assert.eq r0 true; + is.eq r2 99u32 into r3; + assert.eq r3 true; function wipe: async wipe into r0; @@ -88,17 +87,15 @@ finalize init: contains base.aleo/val_u32__[false] into r0; get.or_use base.aleo/val_u32__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - is.eq r3.val 99u32 into r4; + assert.eq r0 true; + is.eq r2 99u32 into r3; + assert.eq r3 true; + contains mid1.aleo/flag__[false] into r4; + get.or_use mid1.aleo/flag__[false] false into r5; + ternary r4 r5 false into r6; assert.eq r4 true; - contains mid1.aleo/flag__[false] into r5; - get.or_use mid1.aleo/flag__[false] false into r6; - ternary r5 r6 false into r7; - cast r5 r7 into r8 as Optional__ATAkdHctJwx; - assert.eq r8.is_some true; - is.eq r8.val true into r9; - assert.eq r9 true; + is.eq r6 true into r7; + assert.eq r7 true; function wipe: async wipe into r0; @@ -142,24 +139,21 @@ finalize test_initialized: contains base.aleo/val_u32__[false] into r0; get.or_use base.aleo/val_u32__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - is.eq r3.val 99u32 into r4; + assert.eq r0 true; + is.eq r2 99u32 into r3; + assert.eq r3 true; + contains mid1.aleo/flag__[false] into r4; + get.or_use mid1.aleo/flag__[false] false into r5; + ternary r4 r5 false into r6; assert.eq r4 true; - contains mid1.aleo/flag__[false] into r5; - get.or_use mid1.aleo/flag__[false] false into r6; - ternary r5 r6 false into r7; - cast r5 r7 into r8 as Optional__ATAkdHctJwx; - assert.eq r8.is_some true; - is.eq r8.val true into r9; - assert.eq r9 true; - contains mid2.aleo/counter__[false] into r10; - get.or_use mid2.aleo/counter__[false] 0u8 into r11; - ternary r10 r11 0u8 into r12; - cast r10 r12 into r13 as Optional__3aph2JMPtnA; - assert.eq r13.is_some true; - is.eq r13.val 7u8 into r14; - assert.eq r14 true; + is.eq r6 true into r7; + assert.eq r7 true; + contains mid2.aleo/counter__[false] into r8; + get.or_use mid2.aleo/counter__[false] 0u8 into r9; + ternary r8 r9 0u8 into r10; + assert.eq r8 true; + is.eq r10 7u8 into r11; + assert.eq r11 true; function test_fallback: async test_fallback into r0; @@ -169,24 +163,21 @@ finalize test_fallback: contains base.aleo/val_u32__[false] into r0; get.or_use base.aleo/val_u32__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - ternary r3.is_some r3.val 0u32 into r4; - is.eq r4 0u32 into r5; - assert.eq r5 true; - contains mid1.aleo/flag__[false] into r6; - get.or_use mid1.aleo/flag__[false] false into r7; - ternary r6 r7 false into r8; - cast r6 r8 into r9 as Optional__ATAkdHctJwx; - ternary r9.is_some r9.val false into r10; - is.eq r10 false into r11; - assert.eq r11 true; - contains mid2.aleo/counter__[false] into r12; - get.or_use mid2.aleo/counter__[false] 0u8 into r13; - ternary r12 r13 0u8 into r14; - cast r12 r14 into r15 as Optional__3aph2JMPtnA; - ternary r15.is_some r15.val 11u8 into r16; - is.eq r16 11u8 into r17; - assert.eq r17 true; + ternary r0 r2 0u32 into r3; + is.eq r3 0u32 into r4; + assert.eq r4 true; + contains mid1.aleo/flag__[false] into r5; + get.or_use mid1.aleo/flag__[false] false into r6; + ternary r5 r6 false into r7; + ternary r5 r7 false into r8; + is.eq r8 false into r9; + assert.eq r9 true; + contains mid2.aleo/counter__[false] into r10; + get.or_use mid2.aleo/counter__[false] 0u8 into r11; + ternary r10 r11 0u8 into r12; + ternary r10 r12 11u8 into r13; + is.eq r13 11u8 into r14; + assert.eq r14 true; function test_none: async test_none into r0; diff --git a/tests/expectations/compiler/storage/long_names.out b/tests/expectations/compiler/storage/long_names.out index b8160fbc478..276a0b070b2 100644 --- a/tests/expectations/compiler/storage/long_names.out +++ b/tests/expectations/compiler/storage/long_names.out @@ -28,9 +28,8 @@ finalize foo: contains some_very_long_sto__3ynimxWUALp[false] into r2; get.or_use some_very_long_sto__3ynimxWUALp[false] 0u8 into r3; ternary r2 r3 0u8 into r4; - cast r2 r4 into r5 as Optional__3aph2JMPtnA; - assert.eq r5.is_some true; - set r5.val into some_verrry_long_s__F3Lfva7X0lK[r0]; + assert.eq r2 true; + set r4 into some_verrry_long_s__F3Lfva7X0lK[r0]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/primitives.out b/tests/expectations/compiler/storage/primitives.out index 26ee4bdfe3d..6ac51aa8a75 100644 --- a/tests/expectations/compiler/storage/primitives.out +++ b/tests/expectations/compiler/storage/primitives.out @@ -70,79 +70,69 @@ finalize check1: contains flag__[false] into r0; get.or_use flag__[false] false into r1; ternary r0 r1 false into r2; - cast r0 r2 into r3 as Optional__ATAkdHctJwx; - assert.eq r3.is_some true; - is.eq r3.val true into r4; + assert.eq r0 true; + is.eq r2 true into r3; + assert.eq r3 true; + contains scalar_val__[false] into r4; + get.or_use scalar_val__[false] 0scalar into r5; + ternary r4 r5 0scalar into r6; + assert.eq r4 true; + is.eq r6 1scalar into r7; + assert.eq r7 true; + contains field_val__[false] into r8; + get.or_use field_val__[false] 0field into r9; + ternary r8 r9 0field into r10; + assert.eq r8 true; + is.eq r10 42field into r11; + assert.eq r11 true; + contains group_val__[false] into r12; + get.or_use group_val__[false] 0group into r13; + ternary r12 r13 0group into r14; + assert.eq r12 true; + is.eq r14 0group into r15; + assert.eq r15 true; + contains addr_val__[false] into r16; + get.or_use addr_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r17; + ternary r16 r17 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r18; + assert.eq r16 true; + is.eq r18 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r19; + assert.eq r19 true; + +function check2: + async check2 into r0; + output r0 as primitives.aleo/check2.future; + +finalize check2: + contains flag__[false] into r0; + get.or_use flag__[false] false into r1; + ternary r0 r1 false into r2; + ternary r0 r2 false into r3; + is.eq r3 true into r4; assert.eq r4 true; contains scalar_val__[false] into r5; get.or_use scalar_val__[false] 0scalar into r6; ternary r5 r6 0scalar into r7; - cast r5 r7 into r8 as Optional__9y0TjJOC4Nk; - assert.eq r8.is_some true; - is.eq r8.val 1scalar into r9; + ternary r5 r7 0scalar into r8; + is.eq r8 1scalar into r9; assert.eq r9 true; contains field_val__[false] into r10; get.or_use field_val__[false] 0field into r11; ternary r10 r11 0field into r12; - cast r10 r12 into r13 as Optional__7o6su2Uhzht; - assert.eq r13.is_some true; - is.eq r13.val 42field into r14; + ternary r10 r12 0field into r13; + is.eq r13 42field into r14; assert.eq r14 true; contains group_val__[false] into r15; get.or_use group_val__[false] 0group into r16; ternary r15 r16 0group into r17; - cast r15 r17 into r18 as Optional__9SsWRr2WG5s; - assert.eq r18.is_some true; - is.eq r18.val 0group into r19; + ternary r15 r17 0group into r18; + is.eq r18 0group into r19; assert.eq r19 true; contains addr_val__[false] into r20; get.or_use addr_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r21; ternary r20 r21 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r22; - cast r20 r22 into r23 as Optional__6wU7KHJhSvv; - assert.eq r23.is_some true; - is.eq r23.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r24; + ternary r20 r22 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r23; + is.eq r23 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r24; assert.eq r24 true; -function check2: - async check2 into r0; - output r0 as primitives.aleo/check2.future; - -finalize check2: - contains flag__[false] into r0; - get.or_use flag__[false] false into r1; - ternary r0 r1 false into r2; - cast r0 r2 into r3 as Optional__ATAkdHctJwx; - ternary r3.is_some r3.val false into r4; - is.eq r4 true into r5; - assert.eq r5 true; - contains scalar_val__[false] into r6; - get.or_use scalar_val__[false] 0scalar into r7; - ternary r6 r7 0scalar into r8; - cast r6 r8 into r9 as Optional__9y0TjJOC4Nk; - ternary r9.is_some r9.val 0scalar into r10; - is.eq r10 1scalar into r11; - assert.eq r11 true; - contains field_val__[false] into r12; - get.or_use field_val__[false] 0field into r13; - ternary r12 r13 0field into r14; - cast r12 r14 into r15 as Optional__7o6su2Uhzht; - ternary r15.is_some r15.val 0field into r16; - is.eq r16 42field into r17; - assert.eq r17 true; - contains group_val__[false] into r18; - get.or_use group_val__[false] 0group into r19; - ternary r18 r19 0group into r20; - cast r18 r20 into r21 as Optional__9SsWRr2WG5s; - ternary r21.is_some r21.val 0group into r22; - is.eq r22 0group into r23; - assert.eq r23 true; - contains addr_val__[false] into r24; - get.or_use addr_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r25; - ternary r24 r25 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r26; - cast r24 r26 into r27 as Optional__6wU7KHJhSvv; - ternary r27.is_some r27.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r28; - is.eq r28 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r29; - assert.eq r29 true; - constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/signed.out b/tests/expectations/compiler/storage/signed.out index 9de078a0a89..7d74129af95 100644 --- a/tests/expectations/compiler/storage/signed.out +++ b/tests/expectations/compiler/storage/signed.out @@ -70,79 +70,69 @@ finalize check1: contains counter_i8__[false] into r0; get.or_use counter_i8__[false] 0i8 into r1; ternary r0 r1 0i8 into r2; - cast r0 r2 into r3 as Optional__LDaTFs7R9lV; - assert.eq r3.is_some true; - is.eq r3.val -1i8 into r4; + assert.eq r0 true; + is.eq r2 -1i8 into r3; + assert.eq r3 true; + contains counter_i16__[false] into r4; + get.or_use counter_i16__[false] 0i16 into r5; + ternary r4 r5 0i16 into r6; + assert.eq r4 true; + is.eq r6 -2i16 into r7; + assert.eq r7 true; + contains counter_i32__[false] into r8; + get.or_use counter_i32__[false] 0i32 into r9; + ternary r8 r9 0i32 into r10; + assert.eq r8 true; + is.eq r10 -3i32 into r11; + assert.eq r11 true; + contains counter_i64__[false] into r12; + get.or_use counter_i64__[false] 0i64 into r13; + ternary r12 r13 0i64 into r14; + assert.eq r12 true; + is.eq r14 -4i64 into r15; + assert.eq r15 true; + contains counter_i128__[false] into r16; + get.or_use counter_i128__[false] 0i128 into r17; + ternary r16 r17 0i128 into r18; + assert.eq r16 true; + is.eq r18 -5i128 into r19; + assert.eq r19 true; + +function check2: + async check2 into r0; + output r0 as signed.aleo/check2.future; + +finalize check2: + contains counter_i8__[false] into r0; + get.or_use counter_i8__[false] 0i8 into r1; + ternary r0 r1 0i8 into r2; + ternary r0 r2 0i8 into r3; + is.eq r3 -1i8 into r4; assert.eq r4 true; contains counter_i16__[false] into r5; get.or_use counter_i16__[false] 0i16 into r6; ternary r5 r6 0i16 into r7; - cast r5 r7 into r8 as Optional__29g5iOancAc; - assert.eq r8.is_some true; - is.eq r8.val -2i16 into r9; + ternary r5 r7 0i16 into r8; + is.eq r8 -2i16 into r9; assert.eq r9 true; contains counter_i32__[false] into r10; get.or_use counter_i32__[false] 0i32 into r11; ternary r10 r11 0i32 into r12; - cast r10 r12 into r13 as Optional__CI2lf3EvJat; - assert.eq r13.is_some true; - is.eq r13.val -3i32 into r14; + ternary r10 r12 0i32 into r13; + is.eq r13 -3i32 into r14; assert.eq r14 true; contains counter_i64__[false] into r15; get.or_use counter_i64__[false] 0i64 into r16; ternary r15 r16 0i64 into r17; - cast r15 r17 into r18 as Optional__GfbJUku6XoG; - assert.eq r18.is_some true; - is.eq r18.val -4i64 into r19; + ternary r15 r17 0i64 into r18; + is.eq r18 -4i64 into r19; assert.eq r19 true; contains counter_i128__[false] into r20; get.or_use counter_i128__[false] 0i128 into r21; ternary r20 r21 0i128 into r22; - cast r20 r22 into r23 as Optional__KL3cDgKUnaT; - assert.eq r23.is_some true; - is.eq r23.val -5i128 into r24; + ternary r20 r22 0i128 into r23; + is.eq r23 -5i128 into r24; assert.eq r24 true; -function check2: - async check2 into r0; - output r0 as signed.aleo/check2.future; - -finalize check2: - contains counter_i8__[false] into r0; - get.or_use counter_i8__[false] 0i8 into r1; - ternary r0 r1 0i8 into r2; - cast r0 r2 into r3 as Optional__LDaTFs7R9lV; - ternary r3.is_some r3.val 0i8 into r4; - is.eq r4 -1i8 into r5; - assert.eq r5 true; - contains counter_i16__[false] into r6; - get.or_use counter_i16__[false] 0i16 into r7; - ternary r6 r7 0i16 into r8; - cast r6 r8 into r9 as Optional__29g5iOancAc; - ternary r9.is_some r9.val 0i16 into r10; - is.eq r10 -2i16 into r11; - assert.eq r11 true; - contains counter_i32__[false] into r12; - get.or_use counter_i32__[false] 0i32 into r13; - ternary r12 r13 0i32 into r14; - cast r12 r14 into r15 as Optional__CI2lf3EvJat; - ternary r15.is_some r15.val 0i32 into r16; - is.eq r16 -3i32 into r17; - assert.eq r17 true; - contains counter_i64__[false] into r18; - get.or_use counter_i64__[false] 0i64 into r19; - ternary r18 r19 0i64 into r20; - cast r18 r20 into r21 as Optional__GfbJUku6XoG; - ternary r21.is_some r21.val 0i64 into r22; - is.eq r22 -4i64 into r23; - assert.eq r23 true; - contains counter_i128__[false] into r24; - get.or_use counter_i128__[false] 0i128 into r25; - ternary r24 r25 0i128 into r26; - cast r24 r26 into r27 as Optional__KL3cDgKUnaT; - ternary r27.is_some r27.val 0i128 into r28; - is.eq r28 -5i128 into r29; - assert.eq r29 true; - constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/unsigned.out b/tests/expectations/compiler/storage/unsigned.out index 8bfcc49d83e..d5769250112 100644 --- a/tests/expectations/compiler/storage/unsigned.out +++ b/tests/expectations/compiler/storage/unsigned.out @@ -70,79 +70,69 @@ finalize check1: contains counter_u8__[false] into r0; get.or_use counter_u8__[false] 0u8 into r1; ternary r0 r1 0u8 into r2; - cast r0 r2 into r3 as Optional__3aph2JMPtnA; - assert.eq r3.is_some true; - is.eq r3.val 1u8 into r4; + assert.eq r0 true; + is.eq r2 1u8 into r3; + assert.eq r3 true; + contains counter_u16__[false] into r4; + get.or_use counter_u16__[false] 0u16 into r5; + ternary r4 r5 0u16 into r6; + assert.eq r4 true; + is.eq r6 2u16 into r7; + assert.eq r7 true; + contains counter_u32__[false] into r8; + get.or_use counter_u32__[false] 0u32 into r9; + ternary r8 r9 0u32 into r10; + assert.eq r8 true; + is.eq r10 3u32 into r11; + assert.eq r11 true; + contains counter_u64__[false] into r12; + get.or_use counter_u64__[false] 0u64 into r13; + ternary r12 r13 0u64 into r14; + assert.eq r12 true; + is.eq r14 4u64 into r15; + assert.eq r15 true; + contains counter_u128__[false] into r16; + get.or_use counter_u128__[false] 0u128 into r17; + ternary r16 r17 0u128 into r18; + assert.eq r16 true; + is.eq r18 5u128 into r19; + assert.eq r19 true; + +function check2: + async check2 into r0; + output r0 as unsigned.aleo/check2.future; + +finalize check2: + contains counter_u8__[false] into r0; + get.or_use counter_u8__[false] 0u8 into r1; + ternary r0 r1 0u8 into r2; + ternary r0 r2 0u8 into r3; + is.eq r3 1u8 into r4; assert.eq r4 true; contains counter_u16__[false] into r5; get.or_use counter_u16__[false] 0u16 into r6; ternary r5 r6 0u16 into r7; - cast r5 r7 into r8 as Optional__H2QyNyZ20sa; - assert.eq r8.is_some true; - is.eq r8.val 2u16 into r9; + ternary r5 r7 0u16 into r8; + is.eq r8 2u16 into r9; assert.eq r9 true; contains counter_u32__[false] into r10; get.or_use counter_u32__[false] 0u32 into r11; ternary r10 r11 0u32 into r12; - cast r10 r12 into r13 as Optional__JzunLORyB8U; - assert.eq r13.is_some true; - is.eq r13.val 3u32 into r14; + ternary r10 r12 0u32 into r13; + is.eq r13 3u32 into r14; assert.eq r14 true; contains counter_u64__[false] into r15; get.or_use counter_u64__[false] 0u64 into r16; ternary r15 r16 0u64 into r17; - cast r15 r17 into r18 as Optional__DmN5CQ9hzeK; - assert.eq r18.is_some true; - is.eq r18.val 4u64 into r19; + ternary r15 r17 0u64 into r18; + is.eq r18 4u64 into r19; assert.eq r19 true; contains counter_u128__[false] into r20; get.or_use counter_u128__[false] 0u128 into r21; ternary r20 r21 0u128 into r22; - cast r20 r22 into r23 as Optional__6A9ZdhLQa8N; - assert.eq r23.is_some true; - is.eq r23.val 5u128 into r24; + ternary r20 r22 0u128 into r23; + is.eq r23 5u128 into r24; assert.eq r24 true; -function check2: - async check2 into r0; - output r0 as unsigned.aleo/check2.future; - -finalize check2: - contains counter_u8__[false] into r0; - get.or_use counter_u8__[false] 0u8 into r1; - ternary r0 r1 0u8 into r2; - cast r0 r2 into r3 as Optional__3aph2JMPtnA; - ternary r3.is_some r3.val 0u8 into r4; - is.eq r4 1u8 into r5; - assert.eq r5 true; - contains counter_u16__[false] into r6; - get.or_use counter_u16__[false] 0u16 into r7; - ternary r6 r7 0u16 into r8; - cast r6 r8 into r9 as Optional__H2QyNyZ20sa; - ternary r9.is_some r9.val 0u16 into r10; - is.eq r10 2u16 into r11; - assert.eq r11 true; - contains counter_u32__[false] into r12; - get.or_use counter_u32__[false] 0u32 into r13; - ternary r12 r13 0u32 into r14; - cast r12 r14 into r15 as Optional__JzunLORyB8U; - ternary r15.is_some r15.val 0u32 into r16; - is.eq r16 3u32 into r17; - assert.eq r17 true; - contains counter_u64__[false] into r18; - get.or_use counter_u64__[false] 0u64 into r19; - ternary r18 r19 0u64 into r20; - cast r18 r20 into r21 as Optional__DmN5CQ9hzeK; - ternary r21.is_some r21.val 0u64 into r22; - is.eq r22 4u64 into r23; - assert.eq r23 true; - contains counter_u128__[false] into r24; - get.or_use counter_u128__[false] 0u128 into r25; - ternary r24 r25 0u128 into r26; - cast r24 r26 into r27 as Optional__6A9ZdhLQa8N; - ternary r27.is_some r27.val 0u128 into r28; - is.eq r28 5u128 into r29; - assert.eq r29 true; - constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out b/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out index 52297d5e9b4..bf0ad52e8d1 100644 --- a/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out +++ b/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out @@ -1,5 +1,9 @@ program test.aleo; +struct Optional__3aph2JMPtnA: + is_some as boolean; + val as u8; + mapping result: key as boolean.public; value as u8.public; @@ -23,7 +27,8 @@ finalize read_one: lt r0 r1 into r2; get.or_use data__[r0] 0u8 into r3; ternary r2 r3 0u8 into r4; - set r4 into result[false]; + ternary r2 r4 0u8 into r5; + set r5 into result[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/view/view_uses_storage_and_vector.out b/tests/expectations/compiler/view/view_uses_storage_and_vector.out index 1fc799e1511..6d88a89d606 100644 --- a/tests/expectations/compiler/view/view_uses_storage_and_vector.out +++ b/tests/expectations/compiler/view/view_uses_storage_and_vector.out @@ -28,9 +28,8 @@ view current_owner: contains owner__[false] into r0; get.or_use owner__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r1; ternary r0 r1 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r2; - cast r0 r2 into r3 as Optional__6wU7KHJhSvv; - ternary r3.is_some r3.val aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9 into r4; - output r4 as address.public; + ternary r0 r2 aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9 into r3; + output r3 as address.public; view entry_count: get.or_use entries__len__[false] 0u32 into r0; @@ -42,9 +41,8 @@ view entry_at: lt r0 r1 into r2; get.or_use entries__[r0] 0u64 into r3; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - ternary r5.is_some r5.val 0u64 into r6; - output r6 as u64.public; + ternary r2 r4 0u64 into r5; + output r5 as u64.public; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/complex_vector.out b/tests/expectations/execution/complex_vector.out index 39191a8780d..97a3a20f733 100644 --- a/tests/expectations/execution/complex_vector.out +++ b/tests/expectations/execution/complex_vector.out @@ -76,56 +76,52 @@ finalize test_vector_primitives_behavior: lt r0 r12 into r13; get.or_use ids__[r0] 0u32 into r14; ternary r13 r14 0u32 into r15; - cast r13 r15 into r16 as Optional__JzunLORyB8U; - assert.eq r16.is_some true; - is.eq r16.val 20u32 into r17; - assert.eq r17 true; - assert.eq r16.is_some true; - is.eq r16.val 20u32 into r18; + assert.eq r13 true; + is.eq r15 20u32 into r16; + assert.eq r16 true; + assert.eq r13 true; + assert.eq r16 true; + get.or_use ids__len__[false] 0u32 into r17; + lt r0 r17 into r18; assert.eq r18 true; + set r1 into ids__[r0]; get.or_use ids__len__[false] 0u32 into r19; lt r0 r19 into r20; + get.or_use ids__[r0] 0u32 into r21; + ternary r20 r21 0u32 into r22; assert.eq r20 true; - set r1 into ids__[r0]; - get.or_use ids__len__[false] 0u32 into r21; - lt r0 r21 into r22; - get.or_use ids__[r0] 0u32 into r23; - ternary r22 r23 0u32 into r24; - cast r22 r24 into r25 as Optional__JzunLORyB8U; - assert.eq r25.is_some true; - is.eq r25.val r1 into r26; - assert.eq r26 true; - get.or_use ids__len__[false] 0u32 into r27; - lt 2u32 r27 into r28; - assert.eq r28 true; - get ids__[2u32] into r29; - sub r27 1u32 into r30; - get ids__[r30] into r31; - set r31 into ids__[2u32]; - set r30 into ids__len__[false]; - is.eq r29 30u32 into r32; - assert.eq r32 true; - get.or_use ids__len__[false] 0u32 into r33; - is.eq r33 2u32 into r34; - assert.eq r34 true; - get.or_use ids__len__[false] 0u32 into r35; - gt r35 0u32 into r36; - sub.w r35 1u32 into r37; - ternary r36 r37 r35 into r38; - set r38 into ids__len__[false]; - get.or_use ids__[r37] 0u32 into r39; - ternary r36 r39 0u32 into r40; - cast r36 r40 into r41 as Optional__JzunLORyB8U; - assert.eq r41.is_some true; - is.eq r41.val r1 into r42; - assert.eq r42 true; - get.or_use ids__len__[false] 0u32 into r43; - is.eq r43 1u32 into r44; - assert.eq r44 true; + is.eq r22 r1 into r23; + assert.eq r23 true; + get.or_use ids__len__[false] 0u32 into r24; + lt 2u32 r24 into r25; + assert.eq r25 true; + get ids__[2u32] into r26; + sub r24 1u32 into r27; + get ids__[r27] into r28; + set r28 into ids__[2u32]; + set r27 into ids__len__[false]; + is.eq r26 30u32 into r29; + assert.eq r29 true; + get.or_use ids__len__[false] 0u32 into r30; + is.eq r30 2u32 into r31; + assert.eq r31 true; + get.or_use ids__len__[false] 0u32 into r32; + gt r32 0u32 into r33; + sub.w r32 1u32 into r34; + ternary r33 r34 r32 into r35; + set r35 into ids__len__[false]; + get.or_use ids__[r34] 0u32 into r36; + ternary r33 r36 0u32 into r37; + assert.eq r33 true; + is.eq r37 r1 into r38; + assert.eq r38 true; + get.or_use ids__len__[false] 0u32 into r39; + is.eq r39 1u32 into r40; + assert.eq r40 true; set 0u32 into ids__len__[false]; - get.or_use ids__len__[false] 0u32 into r45; - is.eq r45 0u32 into r46; - assert.eq r46 true; + get.or_use ids__len__[false] 0u32 into r41; + is.eq r41 0u32 into r42; + assert.eq r42 true; function test_vector_structs_behavior: input r0 as u32.private; @@ -158,37 +154,35 @@ finalize test_vector_structs_behavior: ternary r12 r14.x r15.x into r16; ternary r12 r14.y r15.y into r17; cast r16 r17 into r18 as Point; - cast r12 r18 into r19 as Optional__7G49nMxvEkY; - assert.eq r19.is_some true; - add r19.val.x r19.val.y into r20; - is.eq r20 3field into r21; - add r19.val.x r19.val.y into r22; - is.eq r22 7field into r23; - or r21 r23 into r24; - assert.eq r24 true; - get.or_use points__len__[false] 0u32 into r25; - lt r0 r25 into r26; - assert.eq r26 true; - cast 9field 9field into r27 as Point; - set r27 into points__[r0]; - get.or_use points__len__[false] 0u32 into r28; - lt r0 r28 into r29; - cast 0field 0field into r30 as Point; - get.or_use points__[r0] r30 into r31; - cast 0field 0field into r32 as Point; - ternary r29 r31.x r32.x into r33; - ternary r29 r31.y r32.y into r34; - cast r33 r34 into r35 as Point; - cast r29 r35 into r36 as Optional__7G49nMxvEkY; - assert.eq r36.is_some true; - is.eq r36.val.x 9field into r37; - assert.eq r37 true; - is.eq r36.val.y 9field into r38; - assert.eq r38 true; + assert.eq r12 true; + add r18.x r18.y into r19; + is.eq r19 3field into r20; + add r18.x r18.y into r21; + is.eq r21 7field into r22; + or r20 r22 into r23; + assert.eq r23 true; + get.or_use points__len__[false] 0u32 into r24; + lt r0 r24 into r25; + assert.eq r25 true; + cast 9field 9field into r26 as Point; + set r26 into points__[r0]; + get.or_use points__len__[false] 0u32 into r27; + lt r0 r27 into r28; + cast 0field 0field into r29 as Point; + get.or_use points__[r0] r29 into r30; + cast 0field 0field into r31 as Point; + ternary r28 r30.x r31.x into r32; + ternary r28 r30.y r31.y into r33; + cast r32 r33 into r34 as Point; + assert.eq r28 true; + is.eq r34.x 9field into r35; + assert.eq r35 true; + is.eq r34.y 9field into r36; + assert.eq r36 true; set 0u32 into points__len__[false]; - get.or_use points__len__[false] 0u32 into r39; - is.eq r39 0u32 into r40; - assert.eq r40 true; + get.or_use points__len__[false] 0u32 into r37; + is.eq r37 0u32 into r38; + assert.eq r38 true; function test_vector_containers_behavior: input r0 as u32.private; @@ -237,48 +231,46 @@ finalize test_vector_containers_behavior: cast r28 r31 into r32 as [Point; 2u32]; ternary r18 r22.id r25.id into r33; cast r33 r32 into r34 as Container; - cast r18 r34 into r35 as Optional__CrW6ZMYLUhu; - assert.eq r35.is_some true; - is.eq r35.val.id 1u32 into r36; - is.eq r35.val.id 2u32 into r37; - or r36 r37 into r38; - assert.eq r38 true; - get.or_use containers__len__[false] 0u32 into r39; - lt r0 r39 into r40; - assert.eq r40 true; - cast 999field 999field into r41 as Point; - cast 33field 33field into r42 as Point; - cast r41 r42 into r43 as [Point; 2u32]; - cast 99u32 r43 into r44 as Container; - set r44 into containers__[r0]; - get.or_use containers__len__[false] 0u32 into r45; - lt r0 r45 into r46; - cast 0field 0field into r47 as Point; - cast r47 r47 into r48 as [Point; 2u32]; - cast 0u32 r48 into r49 as Container; - get.or_use containers__[r0] r49 into r50; - cast 0field 0field into r51 as Point; - cast r51 r51 into r52 as [Point; 2u32]; - cast 0u32 r52 into r53 as Container; - ternary r46 r50.points[0u32].x r53.points[0u32].x into r54; - ternary r46 r50.points[0u32].y r53.points[0u32].y into r55; - cast r54 r55 into r56 as Point; - ternary r46 r50.points[1u32].x r53.points[1u32].x into r57; - ternary r46 r50.points[1u32].y r53.points[1u32].y into r58; - cast r57 r58 into r59 as Point; - cast r56 r59 into r60 as [Point; 2u32]; - ternary r46 r50.id r53.id into r61; - cast r61 r60 into r62 as Container; - cast r46 r62 into r63 as Optional__CrW6ZMYLUhu; - assert.eq r63.is_some true; - is.eq r63.val.id 99u32 into r64; - assert.eq r64 true; - is.eq r63.val.points[0u32].x 999field into r65; - assert.eq r65 true; + assert.eq r18 true; + is.eq r34.id 1u32 into r35; + is.eq r34.id 2u32 into r36; + or r35 r36 into r37; + assert.eq r37 true; + get.or_use containers__len__[false] 0u32 into r38; + lt r0 r38 into r39; + assert.eq r39 true; + cast 999field 999field into r40 as Point; + cast 33field 33field into r41 as Point; + cast r40 r41 into r42 as [Point; 2u32]; + cast 99u32 r42 into r43 as Container; + set r43 into containers__[r0]; + get.or_use containers__len__[false] 0u32 into r44; + lt r0 r44 into r45; + cast 0field 0field into r46 as Point; + cast r46 r46 into r47 as [Point; 2u32]; + cast 0u32 r47 into r48 as Container; + get.or_use containers__[r0] r48 into r49; + cast 0field 0field into r50 as Point; + cast r50 r50 into r51 as [Point; 2u32]; + cast 0u32 r51 into r52 as Container; + ternary r45 r49.points[0u32].x r52.points[0u32].x into r53; + ternary r45 r49.points[0u32].y r52.points[0u32].y into r54; + cast r53 r54 into r55 as Point; + ternary r45 r49.points[1u32].x r52.points[1u32].x into r56; + ternary r45 r49.points[1u32].y r52.points[1u32].y into r57; + cast r56 r57 into r58 as Point; + cast r55 r58 into r59 as [Point; 2u32]; + ternary r45 r49.id r52.id into r60; + cast r60 r59 into r61 as Container; + assert.eq r45 true; + is.eq r61.id 99u32 into r62; + assert.eq r62 true; + is.eq r61.points[0u32].x 999field into r63; + assert.eq r63 true; set 0u32 into containers__len__[false]; - get.or_use containers__len__[false] 0u32 into r66; - is.eq r66 0u32 into r67; - assert.eq r67 true; + get.or_use containers__len__[false] 0u32 into r64; + is.eq r64 0u32 into r65; + assert.eq r65 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/counter_storage.out b/tests/expectations/execution/counter_storage.out index 39283d63b43..2da9b1dd8be 100644 --- a/tests/expectations/execution/counter_storage.out +++ b/tests/expectations/execution/counter_storage.out @@ -23,17 +23,15 @@ finalize increment: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - ternary r3.is_some r3.val 0u32 into r4; - add r4 1u32 into r5; - set r5 into counter__[false]; - contains counter__[false] into r6; - get.or_use counter__[false] 0u32 into r7; - ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - assert.eq r9.is_some true; - is.eq r9.val r5 into r10; - assert.eq r10 true; + ternary r0 r2 0u32 into r3; + add r3 1u32 into r4; + set r4 into counter__[false]; + contains counter__[false] into r5; + get.or_use counter__[false] 0u32 into r6; + ternary r5 r6 0u32 into r7; + assert.eq r5 true; + is.eq r7 r4 into r8; + assert.eq r8 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_call_future.out b/tests/expectations/execution/dynamic_call_future.out index 4ac413d259c..2d9275eb22c 100644 --- a/tests/expectations/execution/dynamic_call_future.out +++ b/tests/expectations/execution/dynamic_call_future.out @@ -19,10 +19,9 @@ finalize increment: contains count__[false] into r1; get.or_use count__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - cast r1 r3 into r4 as Optional__JzunLORyB8U; - ternary r4.is_some r4.val 0u32 into r5; - add r5 r0 into r6; - set r6 into count__[false]; + ternary r1 r3 0u32 into r4; + add r4 r0 into r5; + set r5 into count__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_call_future_with_extra_args.out b/tests/expectations/execution/dynamic_call_future_with_extra_args.out index df0305b13b0..78fc0a09d61 100644 --- a/tests/expectations/execution/dynamic_call_future_with_extra_args.out +++ b/tests/expectations/execution/dynamic_call_future_with_extra_args.out @@ -46,10 +46,9 @@ finalize main: contains local_count__[false] into r2; get.or_use local_count__[false] 0u32 into r3; ternary r2 r3 0u32 into r4; - cast r2 r4 into r5 as Optional__JzunLORyB8U; - ternary r5.is_some r5.val 0u32 into r6; - add r6 r1 into r7; - set r7 into local_count__[false]; + ternary r2 r4 0u32 into r5; + add r5 r1 into r6; + set r6 into local_count__[false]; constructor: assert.eq edition 0u16; From 44b2a19c207a1648dc8d598261f505f0e4460da8 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:26:41 +0800 Subject: [PATCH 26/65] Update remaining optional execution expectations --- .../dynamic_call_multiple_same_target.out | 7 +- .../dynamic_dispatch_intrinsic_future.out | 7 +- .../execution/dynamic_storage_interface.out | 25 ++-- .../execution/external_storage.out | 67 ++++----- .../execution/external_storage_vector.out | 131 ++++++++---------- 5 files changed, 108 insertions(+), 129 deletions(-) diff --git a/tests/expectations/execution/dynamic_call_multiple_same_target.out b/tests/expectations/execution/dynamic_call_multiple_same_target.out index 9f363623326..ef592e0cbbf 100644 --- a/tests/expectations/execution/dynamic_call_multiple_same_target.out +++ b/tests/expectations/execution/dynamic_call_multiple_same_target.out @@ -21,10 +21,9 @@ finalize compute: contains total__[false] into r1; get.or_use total__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - cast r1 r3 into r4 as Optional__JzunLORyB8U; - ternary r4.is_some r4.val 0u32 into r5; - add r5 r0 into r6; - set r6 into total__[false]; + ternary r1 r3 0u32 into r4; + add r4 r0 into r5; + set r5 into total__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out b/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out index 4ac413d259c..2d9275eb22c 100644 --- a/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out +++ b/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out @@ -19,10 +19,9 @@ finalize increment: contains count__[false] into r1; get.or_use count__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - cast r1 r3 into r4 as Optional__JzunLORyB8U; - ternary r4.is_some r4.val 0u32 into r5; - add r5 r0 into r6; - set r6 into count__[false]; + ternary r1 r3 0u32 into r4; + add r4 r0 into r5; + set r5 into count__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_storage_interface.out b/tests/expectations/execution/dynamic_storage_interface.out index 7890b9c26a4..6f306e22a78 100644 --- a/tests/expectations/execution/dynamic_storage_interface.out +++ b/tests/expectations/execution/dynamic_storage_interface.out @@ -26,14 +26,13 @@ finalize bump: contains counter__[false] into r1; get.or_use counter__[false] 0u64 into r2; ternary r1 r2 0u64 into r3; - cast r1 r3 into r4 as Optional__DmN5CQ9hzeK; - ternary r4.is_some r4.val 0u64 into r5; - add r5 1u64 into r6; - set r6 into counter__[false]; - get.or_use entries__len__[false] 0u32 into r7; - add r7 1u32 into r8; - set r8 into entries__len__[false]; - set r0 into entries__[r7]; + ternary r1 r3 0u64 into r4; + add r4 1u64 into r5; + set r5 into counter__[false]; + get.or_use entries__len__[false] 0u32 into r6; + add r6 1u32 into r7; + set r7 into entries__len__[false]; + set r0 into entries__[r6]; function check_counter: input r0 as field.private; @@ -47,9 +46,8 @@ finalize check_counter: contains.dynamic r0 'aleo' 'counter__'[false] into r2; get.or_use.dynamic r0 'aleo' 'counter__'[false] 0u64 into r3 as u64; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - assert.eq r5.is_some true; - assert.eq r5.val r1; + assert.eq r2 true; + assert.eq r4 r1; function check_entry: input r0 as field.private; @@ -66,9 +64,8 @@ finalize check_entry: lt r1 r3 into r4; get.or_use.dynamic r0 'aleo' 'entries__'[r1] 0u64 into r5 as u64; ternary r4 r5 0u64 into r6; - cast r4 r6 into r7 as Optional__DmN5CQ9hzeK; - assert.eq r7.is_some true; - assert.eq r7.val r2; + assert.eq r4 true; + assert.eq r6 r2; function check_entry_oob: input r0 as field.private; diff --git a/tests/expectations/execution/external_storage.out b/tests/expectations/execution/external_storage.out index 15410e3e884..01cc241bced 100644 --- a/tests/expectations/execution/external_storage.out +++ b/tests/expectations/execution/external_storage.out @@ -16,10 +16,9 @@ finalize c: contains count__[false] into r0; get.or_use count__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - cast r0 r2 into r3 as Optional__DmN5CQ9hzeK; - ternary r3.is_some r3.val 0u64 into r4; - add r4 1u64 into r5; - set r5 into count__[false]; + ternary r0 r2 0u64 into r3; + add r3 1u64 into r4; + set r4 into count__[false]; constructor: assert.eq edition 0u16; @@ -42,10 +41,9 @@ finalize d: contains count__[false] into r0; get.or_use count__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - cast r0 r2 into r3 as Optional__DmN5CQ9hzeK; - ternary r3.is_some r3.val 0u64 into r4; - add r4 2u64 into r5; - set r5 into count__[false]; + ternary r0 r2 0u64 into r3; + add r3 2u64 into r4; + set r4 into count__[false]; constructor: assert.eq edition 0u16; @@ -76,36 +74,31 @@ finalize b: contains zero_program.aleo/count__[false] into r2; get.or_use zero_program.aleo/count__[false] 0u64 into r3; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - assert.eq r5.is_some true; - is.eq r5.val 1u64 into r6; + assert.eq r2 true; + is.eq r4 1u64 into r5; + assert.eq r5 true; + contains one_program.aleo/count__[false] into r6; + get.or_use one_program.aleo/count__[false] 0u64 into r7; + ternary r6 r7 0u64 into r8; assert.eq r6 true; - contains one_program.aleo/count__[false] into r7; - get.or_use one_program.aleo/count__[false] 0u64 into r8; - ternary r7 r8 0u64 into r9; - cast r7 r9 into r10 as Optional__DmN5CQ9hzeK; - assert.eq r10.is_some true; - is.eq r10.val 2u64 into r11; - assert.eq r11 true; - contains zero_program.aleo/count__[false] into r12; - get.or_use zero_program.aleo/count__[false] 0u64 into r13; - ternary r12 r13 0u64 into r14; - cast r12 r14 into r15 as Optional__DmN5CQ9hzeK; - assert.eq r15.is_some true; - contains one_program.aleo/count__[false] into r16; - get.or_use one_program.aleo/count__[false] 0u64 into r17; - ternary r16 r17 0u64 into r18; - cast r16 r18 into r19 as Optional__DmN5CQ9hzeK; - assert.eq r19.is_some true; - add r15.val r19.val into r20; - set r20 into count__[false]; - contains count__[false] into r21; - get.or_use count__[false] 0u64 into r22; - ternary r21 r22 0u64 into r23; - cast r21 r23 into r24 as Optional__DmN5CQ9hzeK; - assert.eq r24.is_some true; - is.eq r24.val 3u64 into r25; - assert.eq r25 true; + is.eq r8 2u64 into r9; + assert.eq r9 true; + contains zero_program.aleo/count__[false] into r10; + get.or_use zero_program.aleo/count__[false] 0u64 into r11; + ternary r10 r11 0u64 into r12; + assert.eq r10 true; + contains one_program.aleo/count__[false] into r13; + get.or_use one_program.aleo/count__[false] 0u64 into r14; + ternary r13 r14 0u64 into r15; + assert.eq r13 true; + add r12 r15 into r16; + set r16 into count__[false]; + contains count__[false] into r17; + get.or_use count__[false] 0u64 into r18; + ternary r17 r18 0u64 into r19; + assert.eq r17 true; + is.eq r19 3u64 into r20; + assert.eq r20 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/external_storage_vector.out b/tests/expectations/execution/external_storage_vector.out index 1173f2e008f..e4dad902a17 100644 --- a/tests/expectations/execution/external_storage_vector.out +++ b/tests/expectations/execution/external_storage_vector.out @@ -94,77 +94,68 @@ finalize combine: lt 0u32 r6 into r7; get.or_use vec_program_a.aleo/numbers__[0u32] 0u32 into r8; ternary r7 r8 0u32 into r9; - cast r7 r9 into r10 as Optional__JzunLORyB8U; - ternary r10.is_some r10.val 0u32 into r11; - get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r12; - lt 0u32 r12 into r13; - get.or_use vec_program_b.aleo/numbers__[0u32] 0u32 into r14; - ternary r13 r14 0u32 into r15; - cast r13 r15 into r16 as Optional__JzunLORyB8U; - ternary r16.is_some r16.val 0u32 into r17; - get.or_use sum_vec__len__[false] 0u32 into r18; - add r18 1u32 into r19; - set r19 into sum_vec__len__[false]; - add r11 r17 into r20; - set r20 into sum_vec__[r18]; - get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r21; - lt 1u32 r21 into r22; - get.or_use vec_program_a.aleo/numbers__[1u32] 0u32 into r23; - ternary r22 r23 0u32 into r24; - cast r22 r24 into r25 as Optional__JzunLORyB8U; - ternary r25.is_some r25.val 0u32 into r26; - get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r27; - lt 1u32 r27 into r28; - get.or_use vec_program_b.aleo/numbers__[1u32] 0u32 into r29; - ternary r28 r29 0u32 into r30; - cast r28 r30 into r31 as Optional__JzunLORyB8U; - ternary r31.is_some r31.val 0u32 into r32; - get.or_use sum_vec__len__[false] 0u32 into r33; - add r33 1u32 into r34; - set r34 into sum_vec__len__[false]; - add r26 r32 into r35; - set r35 into sum_vec__[r33]; - get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r36; - lt 2u32 r36 into r37; - get.or_use vec_program_a.aleo/numbers__[2u32] 0u32 into r38; - ternary r37 r38 0u32 into r39; - cast r37 r39 into r40 as Optional__JzunLORyB8U; - ternary r40.is_some r40.val 0u32 into r41; - get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r42; - lt 2u32 r42 into r43; - get.or_use vec_program_b.aleo/numbers__[2u32] 0u32 into r44; - ternary r43 r44 0u32 into r45; - cast r43 r45 into r46 as Optional__JzunLORyB8U; - ternary r46.is_some r46.val 0u32 into r47; - get.or_use sum_vec__len__[false] 0u32 into r48; - add r48 1u32 into r49; - set r49 into sum_vec__len__[false]; - add r41 r47 into r50; - set r50 into sum_vec__[r48]; - get.or_use sum_vec__len__[false] 0u32 into r51; - lt 0u32 r51 into r52; - get.or_use sum_vec__[0u32] 0u32 into r53; - ternary r52 r53 0u32 into r54; - cast r52 r54 into r55 as Optional__JzunLORyB8U; - assert.eq r55.is_some true; - is.eq r55.val 11u32 into r56; + ternary r7 r9 0u32 into r10; + get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r11; + lt 0u32 r11 into r12; + get.or_use vec_program_b.aleo/numbers__[0u32] 0u32 into r13; + ternary r12 r13 0u32 into r14; + ternary r12 r14 0u32 into r15; + get.or_use sum_vec__len__[false] 0u32 into r16; + add r16 1u32 into r17; + set r17 into sum_vec__len__[false]; + add r10 r15 into r18; + set r18 into sum_vec__[r16]; + get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r19; + lt 1u32 r19 into r20; + get.or_use vec_program_a.aleo/numbers__[1u32] 0u32 into r21; + ternary r20 r21 0u32 into r22; + ternary r20 r22 0u32 into r23; + get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r24; + lt 1u32 r24 into r25; + get.or_use vec_program_b.aleo/numbers__[1u32] 0u32 into r26; + ternary r25 r26 0u32 into r27; + ternary r25 r27 0u32 into r28; + get.or_use sum_vec__len__[false] 0u32 into r29; + add r29 1u32 into r30; + set r30 into sum_vec__len__[false]; + add r23 r28 into r31; + set r31 into sum_vec__[r29]; + get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r32; + lt 2u32 r32 into r33; + get.or_use vec_program_a.aleo/numbers__[2u32] 0u32 into r34; + ternary r33 r34 0u32 into r35; + ternary r33 r35 0u32 into r36; + get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r37; + lt 2u32 r37 into r38; + get.or_use vec_program_b.aleo/numbers__[2u32] 0u32 into r39; + ternary r38 r39 0u32 into r40; + ternary r38 r40 0u32 into r41; + get.or_use sum_vec__len__[false] 0u32 into r42; + add r42 1u32 into r43; + set r43 into sum_vec__len__[false]; + add r36 r41 into r44; + set r44 into sum_vec__[r42]; + get.or_use sum_vec__len__[false] 0u32 into r45; + lt 0u32 r45 into r46; + get.or_use sum_vec__[0u32] 0u32 into r47; + ternary r46 r47 0u32 into r48; + assert.eq r46 true; + is.eq r48 11u32 into r49; + assert.eq r49 true; + get.or_use sum_vec__len__[false] 0u32 into r50; + lt 1u32 r50 into r51; + get.or_use sum_vec__[1u32] 0u32 into r52; + ternary r51 r52 0u32 into r53; + assert.eq r51 true; + is.eq r53 22u32 into r54; + assert.eq r54 true; + get.or_use sum_vec__len__[false] 0u32 into r55; + lt 2u32 r55 into r56; + get.or_use sum_vec__[2u32] 0u32 into r57; + ternary r56 r57 0u32 into r58; assert.eq r56 true; - get.or_use sum_vec__len__[false] 0u32 into r57; - lt 1u32 r57 into r58; - get.or_use sum_vec__[1u32] 0u32 into r59; - ternary r58 r59 0u32 into r60; - cast r58 r60 into r61 as Optional__JzunLORyB8U; - assert.eq r61.is_some true; - is.eq r61.val 22u32 into r62; - assert.eq r62 true; - get.or_use sum_vec__len__[false] 0u32 into r63; - lt 2u32 r63 into r64; - get.or_use sum_vec__[2u32] 0u32 into r65; - ternary r64 r65 0u32 into r66; - cast r64 r66 into r67 as Optional__JzunLORyB8U; - assert.eq r67.is_some true; - is.eq r67.val 3u32 into r68; - assert.eq r68 true; + is.eq r58 3u32 into r59; + assert.eq r59 true; constructor: assert.eq edition 0u16; From 6b22cbec2f9e894a09382e6b9e3ce72a5b9785e8 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:35:01 +0800 Subject: [PATCH 27/65] Update stacked execution expectations --- .../execution/implicit_option_wrapping.out | 63 +++++++------------ .../execution/libraries/conditional.out | 8 +-- 2 files changed, 27 insertions(+), 44 deletions(-) diff --git a/tests/expectations/execution/implicit_option_wrapping.out b/tests/expectations/execution/implicit_option_wrapping.out index a34ae737c30..5c2d978434a 100644 --- a/tests/expectations/execution/implicit_option_wrapping.out +++ b/tests/expectations/execution/implicit_option_wrapping.out @@ -26,21 +26,17 @@ struct Optional__8r9D5P05auT: val as [Wrapper; 3u32]; function basic_implicit_return: - cast true 5u8 into r0 as Optional__3aph2JMPtnA; - assert.eq r0.is_some true; - output r0.val as u8.private; + assert.eq true true; + output 5u8 as u8.private; function basic_implicit_argument: - cast true 42u8 into r0 as Optional__3aph2JMPtnA; - ternary r0.is_some r0.val 100u8 into r1; - output r1 as u8.private; + output 42u8 as u8.private; function basic_implicit_ternary: input r0 as boolean.private; ternary r0 10u8 0u8 into r1; - cast r0 r1 into r2 as Optional__3aph2JMPtnA; - ternary r2.is_some r2.val 42u8 into r3; - output r3 as u8.private; + ternary r0 r1 42u8 into r2; + output r2 as u8.private; function basic_implicit_reassignment: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -61,11 +57,9 @@ function complex_implicit_return: cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; cast r6 into r7 as Wrapper; - cast true r7 into r8 as Optional__90gnFMeDKTp; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - assert.eq r8.val.arr[0u32].val.x.is_some true; - output r8.val.arr[0u32].val.x.val as u8.private; + assert.eq r7.arr[0u32].is_some true; + assert.eq r7.arr[0u32].val.x.is_some true; + output r7.arr[0u32].val.x.val as u8.private; function complex_implicit_argument: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -76,11 +70,9 @@ function complex_implicit_argument: cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; cast r6 into r7 as Wrapper; - cast true r7 into r8 as Optional__90gnFMeDKTp; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - ternary r8.val.arr[0u32].val.x.is_some r8.val.arr[0u32].val.x.val 42u8 into r9; - output r9 as u8.private; + assert.eq r7.arr[0u32].is_some true; + ternary r7.arr[0u32].val.x.is_some r7.arr[0u32].val.x.val 42u8 into r8; + output r8 as u8.private; function complex_implicit_ternary: input r0 as boolean.private; @@ -111,11 +103,10 @@ function complex_implicit_ternary: cast r24 r23 into r25 as Optional__DH9PtMwOkLt; cast r19 r25 into r26 as [Optional__DH9PtMwOkLt; 2u32]; cast r26 into r27 as Wrapper; - cast r0 r27 into r28 as Optional__90gnFMeDKTp; - assert.eq r28.is_some true; - assert.eq r28.val.arr[0u32].is_some true; - ternary r28.val.arr[0u32].val.x.is_some r28.val.arr[0u32].val.x.val 69u8 into r29; - output r29 as u8.private; + assert.eq r0 true; + assert.eq r27.arr[0u32].is_some true; + ternary r27.arr[0u32].val.x.is_some r27.arr[0u32].val.x.val 69u8 into r28; + output r28 as u8.private; function complex_implicit_reassignment: cast true 7u8 into r0 as Optional__3aph2JMPtnA; @@ -126,11 +117,9 @@ function complex_implicit_reassignment: cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; cast r6 into r7 as Wrapper; - cast true r7 into r8 as Optional__90gnFMeDKTp; - assert.eq r8.is_some true; - assert.eq r8.val.arr[0u32].is_some true; - assert.eq r8.val.arr[0u32].val.x.is_some true; - output r8.val.arr[0u32].val.x.val as u8.private; + assert.eq r7.arr[0u32].is_some true; + assert.eq r7.arr[0u32].val.x.is_some true; + output r7.arr[0u32].val.x.val as u8.private; function complex_array_wrapping: cast true 1u8 into r0 as Optional__3aph2JMPtnA; @@ -158,11 +147,9 @@ function complex_array_wrapping: cast r18 r21 into r22 as [Optional__DH9PtMwOkLt; 2u32]; cast r22 into r23 as Wrapper; cast r7 r15 r23 into r24 as [Wrapper; 3u32]; - cast true r24 into r25 as Optional__8r9D5P05auT; - assert.eq r25.is_some true; - assert.eq r25.val[0u32].arr[0u32].is_some true; - assert.eq r25.val[0u32].arr[0u32].val.x.is_some true; - output r25.val[0u32].arr[0u32].val.x.val as u8.private; + assert.eq r24[0u32].arr[0u32].is_some true; + assert.eq r24[0u32].arr[0u32].val.x.is_some true; + output r24[0u32].arr[0u32].val.x.val as u8.private; function complex_array_access: cast true 10u8 into r0 as Optional__3aph2JMPtnA; @@ -190,11 +177,9 @@ function complex_array_access: cast r18 r21 into r22 as [Optional__DH9PtMwOkLt; 2u32]; cast r22 into r23 as Wrapper; cast r7 r15 r23 into r24 as [Wrapper; 3u32]; - cast true r24 into r25 as Optional__8r9D5P05auT; - assert.eq r25.is_some true; - assert.eq r25.val[1u32].arr[0u32].is_some true; - assert.eq r25.val[1u32].arr[0u32].val.x.is_some true; - output r25.val[1u32].arr[0u32].val.x.val as u8.private; + assert.eq r24[1u32].arr[0u32].is_some true; + assert.eq r24[1u32].arr[0u32].val.x.is_some true; + output r24[1u32].arr[0u32].val.x.val as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/libraries/conditional.out b/tests/expectations/execution/libraries/conditional.out index d064234fd28..3ee62da4ae2 100644 --- a/tests/expectations/execution/libraries/conditional.out +++ b/tests/expectations/execution/libraries/conditional.out @@ -4,11 +4,9 @@ function classify: input r0 as u32.private; lt r0 10u32 into r1; lt r0 25u32 into r2; - lt r0 75u32 into r3; - ternary r3 110u32 110u32 into r4; - ternary r2 35u32 r4 into r5; - ternary r1 1u32 r5 into r6; - output r6 as u32.private; + ternary r2 35u32 110u32 into r3; + ternary r1 1u32 r3 into r4; + output r4 as u32.private; constructor: assert.eq edition 0u16; From 967f298cdfd3a00f8ac144363397c1e5c77a3c47 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:43:19 +0800 Subject: [PATCH 28/65] Update struct roundtrip execution expectation --- .../execution/libraries/lib_struct_fn_roundtrip.out | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/expectations/execution/libraries/lib_struct_fn_roundtrip.out b/tests/expectations/execution/libraries/lib_struct_fn_roundtrip.out index 4783785043b..fda5bb605e5 100644 --- a/tests/expectations/execution/libraries/lib_struct_fn_roundtrip.out +++ b/tests/expectations/execution/libraries/lib_struct_fn_roundtrip.out @@ -6,8 +6,7 @@ struct Wrap__7dHW66DosY9: function roundtrip: input r0 as u32.private; mul r0 2u32 into r1; - cast r1 into r2 as Wrap__7dHW66DosY9; - output r2.val as u32.private; + output r1 as u32.private; constructor: assert.eq edition 0u16; From 38f51eff4f0ec6c713ca5f88991437f525562efc Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:44:52 +0800 Subject: [PATCH 29/65] Update stacked optional execution expectations --- .../expectations/execution/optional_types.out | 116 ++++++------------ .../execution/optional_unwrap_none.out | 16 +-- 2 files changed, 41 insertions(+), 91 deletions(-) diff --git a/tests/expectations/execution/optional_types.out b/tests/expectations/execution/optional_types.out index 0d8818a925f..282ec028aa9 100644 --- a/tests/expectations/execution/optional_types.out +++ b/tests/expectations/execution/optional_types.out @@ -122,12 +122,8 @@ struct Optional__CnAbS95OdiL: val as SigStruct; function optional_basic_primitives: - cast true 10u32 into r0 as Optional__JzunLORyB8U; - cast false 0u32 into r1 as Optional__JzunLORyB8U; - assert.eq r0.is_some true; - ternary r1.is_some r1.val 42u32 into r2; - add r0.val r2 into r3; - output r3 as u32.private; + assert.eq true true; + output 52u32 as u32.private; function array_of_optionals: cast true 1u8 into r0 as Optional__3aph2JMPtnA; @@ -145,33 +141,23 @@ function optional_array: cast true 1000u128 into r0 as Optional__6A9ZdhLQa8N; cast false 0u128 into r1 as Optional__6A9ZdhLQa8N; cast r0 r1 into r2 as [Optional__6A9ZdhLQa8N; 2u32]; - cast true r2 into r3 as Optional__FzaKfjivwCm; - cast true 42u128 into r4 as Optional__6A9ZdhLQa8N; - cast r4 r4 r4 into r5 as [Optional__6A9ZdhLQa8N; 3u32]; - cast true r5 into r6 as Optional__IeL1hLZCJ5A; - assert.eq r3.is_some true; - assert.eq r3.is_some true; - assert.eq r6.is_some true; - assert.eq r6.is_some true; - ternary r3.val[0u32].is_some r3.val[0u32].val 10u128 into r7; - ternary r3.val[1u32].is_some r3.val[1u32].val 11u128 into r8; + cast true 42u128 into r3 as Optional__6A9ZdhLQa8N; + cast r3 r3 r3 into r4 as [Optional__6A9ZdhLQa8N; 3u32]; + ternary r2[0u32].is_some r2[0u32].val 10u128 into r5; + ternary r2[1u32].is_some r2[1u32].val 11u128 into r6; + add r5 r6 into r7; + ternary r4[0u32].is_some r4[0u32].val 12u128 into r8; add r7 r8 into r9; - ternary r6.val[0u32].is_some r6.val[0u32].val 12u128 into r10; + ternary r4[2u32].is_some r4[2u32].val 13u128 into r10; add r9 r10 into r11; - ternary r6.val[2u32].is_some r6.val[2u32].val 13u128 into r12; - add r11 r12 into r13; - output r13 as u128.private; + output r11 as u128.private; function optional_struct_field: - cast false 0u16 into r0 as Optional__H2QyNyZ20sa; - ternary r0.is_some r0.val 123u16 into r1; - output r1 as u16.private; + output 123u16 as u16.private; function optional_struct: cast 5u8 into r0 as MyStruct; - cast true r0 into r1 as Optional__D1ZVwkVAP8R; - assert.eq r1.is_some true; - output r1.val.x as u8.private; + output r0.x as u8.private; function array_of_optional_structs: cast 10u8 into r0 as Foo; @@ -203,73 +189,41 @@ function nested_optional_structs: cast r9 r16 into r17 as [Optional__90gnFMeDKTp; 2u32]; cast true r17 into r18 as Optional__4aWy0bP6UHu; cast r18 into r19 as Container; - cast true r19 into r20 as Optional__CrW6ZMYLUhu; - assert.eq r20.is_some true; - assert.eq r20.val.wrappers.is_some true; - assert.eq r20.val.wrappers.val[0u32].is_some true; - assert.eq r20.val.wrappers.val[0u32].val.arr.is_some true; - assert.eq r20.val.wrappers.val[0u32].val.arr.val[0u32].is_some true; - assert.eq r20.val.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some true; - output r20.val.wrappers.val[0u32].val.arr.val[0u32].val.val.val as u8.private; + assert.eq r19.wrappers.is_some true; + assert.eq r19.wrappers.val[0u32].is_some true; + assert.eq r19.wrappers.val[0u32].val.arr.is_some true; + assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].is_some true; + assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some true; + output r19.wrappers.val[0u32].val.arr.val[0u32].val.val.val as u8.private; function tuples_with_optional_elements: - cast true 200u32 into r0 as Optional__JzunLORyB8U; - cast false 0u32 into r1 as Optional__JzunLORyB8U; - ternary r0.is_some r0.val 0u32 into r2; - add 100u32 r2 into r3; - add r3 300u32 into r4; - ternary r1.is_some r1.val 50u32 into r5; - add r4 r5 into r6; - output r6 as u32.private; + output 650u32 as u32.private; function optional_misc_primitive_types: - cast true 0group into r0 as Optional__9SsWRr2WG5s; - cast true 1field into r1 as Optional__7o6su2Uhzht; - cast true 2scalar into r2 as Optional__9y0TjJOC4Nk; - assert.eq r0.is_some true; - assert.eq r2.is_some true; - ternary r1.is_some r1.val 2field into r3; - output r0.val as group.private; - output r3 as field.private; - output r2.val as scalar.private; + assert.eq true true; + output 0group as group.private; + output 1field as field.private; + output 2scalar as scalar.private; function optional_address: cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r0 as Optional__6wU7KHJhSvv; - cast true aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r1 as Optional__6wU7KHJhSvv; - ternary r0.is_some r0.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r2; - ternary r1.is_some r1.val r2 into r3; - cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r4 as Optional__6wU7KHJhSvv; - ternary r4.is_some r4.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r5; - cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r6 as Optional__6wU7KHJhSvv; - cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta r6 into r7 as AddrStruct; - cast true r7 into r8 as Optional__AJzmwrlBPM0; - assert.eq r8.is_some true; - cast true aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r9 as Optional__6wU7KHJhSvv; - cast r9 into r10 as InnerAddr; - assert.eq r10.val.is_some true; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta r0 into r1 as AddrStruct; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r2 as address; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r3 as address; + output aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta as address.private; + output r2 as address.private; + output r1.a as address.private; output r3 as address.private; - output r5 as address.private; - output r8.val.a as address.private; - output r10.val.val as address.private; function optional_signature: cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r0 as Optional__I4L6GJTpfLe; - cast true sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r1 as Optional__I4L6GJTpfLe; - ternary r0.is_some r0.val sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r2; - ternary r1.is_some r1.val r2 into r3; - cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r4 as Optional__I4L6GJTpfLe; - ternary r4.is_some r4.val sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r5; - cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r6 as Optional__I4L6GJTpfLe; - cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj r6 into r7 as SigStruct; - cast true r7 into r8 as Optional__CnAbS95OdiL; - assert.eq r8.is_some true; - cast true sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r9 as Optional__I4L6GJTpfLe; - cast r9 into r10 as InnerSig; - assert.eq r10.val.is_some true; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj r0 into r1 as SigStruct; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r2 as signature; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r3 as signature; + output sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj as signature.private; + output r2 as signature.private; + output r1.a as signature.private; output r3 as signature.private; - output r5 as signature.private; - output r8.val.a as signature.private; - output r10.val.val as signature.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/optional_unwrap_none.out b/tests/expectations/execution/optional_unwrap_none.out index 76096208719..e40e8a07cb5 100644 --- a/tests/expectations/execution/optional_unwrap_none.out +++ b/tests/expectations/execution/optional_unwrap_none.out @@ -12,20 +12,16 @@ struct Optional__3aph2JMPtnA: val as u8; function unwrap_none: - cast false 0u8 into r0 as Optional__3aph2JMPtnA; - assert.eq r0.is_some true; - gt r0.val 0u8 into r1; - assert.eq r1 true; + assert.eq false true; + assert.eq false true; function unwrap_struct_field_none: - cast false 0u64 into r0 as Optional__DmN5CQ9hzeK; - assert.eq r0.is_some true; - gt r0.val 0u64 into r1; - assert.eq r1 true; + assert.eq false true; + assert.eq false true; constructor: assert.eq edition 0u16; -status: failed: Process authorization failed: Stack authorization failed: Stack execution failed: Instruction (assert.eq r0.is_some true;) at index 1 failed: Failed to execute: Constraint unsatisfied: (0 * 1) != 1 +status: failed: Process authorization failed: Stack authorization failed: Stack execution failed: Instruction (assert.eq false true;) at index 0 failed: Failed to execute: Constraint unsatisfied: (0 * 1) != 1 output: () -status: failed: Process authorization failed: Stack authorization failed: Stack execution failed: Instruction (assert.eq r0.is_some true;) at index 1 failed: Failed to execute: Constraint unsatisfied: (0 * 1) != 1 +status: failed: Process authorization failed: Stack authorization failed: Stack execution failed: Instruction (assert.eq false true;) at index 0 failed: Failed to execute: Constraint unsatisfied: (0 * 1) != 1 output: () From 7ec1d8c100cbb8a64d35f7149c1ca5da1cf16030 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:45:16 +0800 Subject: [PATCH 30/65] Update stacked simple vector expectation --- .../expectations/execution/simple_vector.out | 171 +++++++++--------- 1 file changed, 83 insertions(+), 88 deletions(-) diff --git a/tests/expectations/execution/simple_vector.out b/tests/expectations/execution/simple_vector.out index 72e78202fc8..9c8ab53da47 100644 --- a/tests/expectations/execution/simple_vector.out +++ b/tests/expectations/execution/simple_vector.out @@ -39,100 +39,95 @@ finalize test_vector_ops: lt 1u32 r10 into r11; get.or_use vec__[1u32] 0u32 into r12; ternary r11 r12 0u32 into r13; - cast r11 r13 into r14 as Optional__JzunLORyB8U; - assert.eq r14.is_some true; - is.eq r14.val 20u32 into r15; - assert.eq r15 true; - get.or_use vec__len__[false] 0u32 into r16; - lt 1u32 r16 into r17; - assert.eq r17 true; + assert.eq r11 true; + is.eq r13 20u32 into r14; + assert.eq r14 true; + get.or_use vec__len__[false] 0u32 into r15; + lt 1u32 r15 into r16; + assert.eq r16 true; set 25u32 into vec__[1u32]; - get.or_use vec__len__[false] 0u32 into r18; - lt 1u32 r18 into r19; - get.or_use vec__[1u32] 0u32 into r20; - ternary r19 r20 0u32 into r21; - cast r19 r21 into r22 as Optional__JzunLORyB8U; - assert.eq r22.is_some true; - is.eq r22.val 25u32 into r23; + get.or_use vec__len__[false] 0u32 into r17; + lt 1u32 r17 into r18; + get.or_use vec__[1u32] 0u32 into r19; + ternary r18 r19 0u32 into r20; + assert.eq r18 true; + is.eq r20 25u32 into r21; + assert.eq r21 true; + get.or_use vec__len__[false] 0u32 into r22; + lt 0u32 r22 into r23; assert.eq r23 true; - get.or_use vec__len__[false] 0u32 into r24; - lt 0u32 r24 into r25; - assert.eq r25 true; - get vec__[0u32] into r26; - sub r24 1u32 into r27; - get vec__[r27] into r28; - set r28 into vec__[0u32]; - set r27 into vec__len__[false]; - is.eq r26 10u32 into r29; + get vec__[0u32] into r24; + sub r22 1u32 into r25; + get vec__[r25] into r26; + set r26 into vec__[0u32]; + set r25 into vec__len__[false]; + is.eq r24 10u32 into r27; + assert.eq r27 true; + get.or_use vec__len__[false] 0u32 into r28; + is.eq r28 2u32 into r29; assert.eq r29 true; get.or_use vec__len__[false] 0u32 into r30; - is.eq r30 2u32 into r31; + lt 0u32 r30 into r31; + get.or_use vec__[0u32] 0u32 into r32; + ternary r31 r32 0u32 into r33; assert.eq r31 true; - get.or_use vec__len__[false] 0u32 into r32; - lt 0u32 r32 into r33; - get.or_use vec__[0u32] 0u32 into r34; - ternary r33 r34 0u32 into r35; - cast r33 r35 into r36 as Optional__JzunLORyB8U; - assert.eq r36.is_some true; - is.eq r36.val 30u32 into r37; - assert.eq r37 true; - get.or_use vec__len__[false] 0u32 into r38; - lt 1u32 r38 into r39; - get.or_use vec__[1u32] 0u32 into r40; - ternary r39 r40 0u32 into r41; - cast r39 r41 into r42 as Optional__JzunLORyB8U; - assert.eq r42.is_some true; - is.eq r42.val 25u32 into r43; - assert.eq r43 true; - get.or_use vec__len__[false] 0u32 into r44; - gt r44 0u32 into r45; - sub.w r44 1u32 into r46; - ternary r45 r46 r44 into r47; - set r47 into vec__len__[false]; - get.or_use vec__[r46] 0u32 into r48; - ternary r45 r48 0u32 into r49; - cast r45 r49 into r50 as Optional__JzunLORyB8U; - assert.eq r50.is_some true; - is.eq r50.val 25u32 into r51; - assert.eq r51 true; - get.or_use vec__len__[false] 0u32 into r52; - is.eq r52 1u32 into r53; - assert.eq r53 true; + is.eq r33 30u32 into r34; + assert.eq r34 true; + get.or_use vec__len__[false] 0u32 into r35; + lt 1u32 r35 into r36; + get.or_use vec__[1u32] 0u32 into r37; + ternary r36 r37 0u32 into r38; + assert.eq r36 true; + is.eq r38 25u32 into r39; + assert.eq r39 true; + get.or_use vec__len__[false] 0u32 into r40; + gt r40 0u32 into r41; + sub.w r40 1u32 into r42; + ternary r41 r42 r40 into r43; + set r43 into vec__len__[false]; + get.or_use vec__[r42] 0u32 into r44; + ternary r41 r44 0u32 into r45; + assert.eq r41 true; + is.eq r45 25u32 into r46; + assert.eq r46 true; + get.or_use vec__len__[false] 0u32 into r47; + is.eq r47 1u32 into r48; + assert.eq r48 true; set 0u32 into vec__len__[false]; - get.or_use vec__len__[false] 0u32 into r54; - is.eq r54 0u32 into r55; - assert.eq r55 true; - get.or_use vec__len__[false] 0u32 into r56; - gt r56 0u32 into r57; - sub.w r56 1u32 into r58; - ternary r57 r58 r56 into r59; - set r59 into vec__len__[false]; - get.or_use vec__[r58] 0u32 into r60; - ternary r57 r60 0u32 into r61; - cast r57 r61 into r62 as Optional__JzunLORyB8U; - cast false 0u32 into r63 as Optional__JzunLORyB8U; - is.eq r62 r63 into r64; - assert.eq r64 true; - get.or_use vec__len__[false] 0u32 into r65; - add r65 1u32 into r66; - set r66 into vec__len__[false]; - set 99u32 into vec__[r65]; - get.or_use vec__len__[false] 0u32 into r67; - is.eq r67 1u32 into r68; - assert.eq r68 true; - get.or_use vec__len__[false] 0u32 into r69; - lt 0u32 r69 into r70; - assert.eq r70 true; - get vec__[0u32] into r71; - sub r69 1u32 into r72; - get vec__[r72] into r73; - set r73 into vec__[0u32]; - set r72 into vec__len__[false]; - is.eq r71 99u32 into r74; - assert.eq r74 true; - get.or_use vec__len__[false] 0u32 into r75; - is.eq r75 0u32 into r76; - assert.eq r76 true; + get.or_use vec__len__[false] 0u32 into r49; + is.eq r49 0u32 into r50; + assert.eq r50 true; + get.or_use vec__len__[false] 0u32 into r51; + gt r51 0u32 into r52; + sub.w r51 1u32 into r53; + ternary r52 r53 r51 into r54; + set r54 into vec__len__[false]; + get.or_use vec__[r53] 0u32 into r55; + ternary r52 r55 0u32 into r56; + cast r52 r56 into r57 as Optional__JzunLORyB8U; + cast false 0u32 into r58 as Optional__JzunLORyB8U; + is.eq r57 r58 into r59; + assert.eq r59 true; + get.or_use vec__len__[false] 0u32 into r60; + add r60 1u32 into r61; + set r61 into vec__len__[false]; + set 99u32 into vec__[r60]; + get.or_use vec__len__[false] 0u32 into r62; + is.eq r62 1u32 into r63; + assert.eq r63 true; + get.or_use vec__len__[false] 0u32 into r64; + lt 0u32 r64 into r65; + assert.eq r65 true; + get vec__[0u32] into r66; + sub r64 1u32 into r67; + get vec__[r67] into r68; + set r68 into vec__[0u32]; + set r67 into vec__len__[false]; + is.eq r66 99u32 into r69; + assert.eq r69 true; + get.or_use vec__len__[false] 0u32 into r70; + is.eq r70 0u32 into r71; + assert.eq r71 true; constructor: assert.eq edition 0u16; From 3aa06f2efe46f00b7946e175c63ef2b143bd6ea5 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 18:53:54 +0800 Subject: [PATCH 31/65] Update stacked storage and view expectations --- .../execution/various_storage_types.out | 371 +++++++++--------- .../execution/various_storage_types_none.out | 211 +++++----- .../expectations/execution/view_aggregate.out | 31 +- .../execution/view_storage_and_vector.out | 15 +- 4 files changed, 293 insertions(+), 335 deletions(-) diff --git a/tests/expectations/execution/various_storage_types.out b/tests/expectations/execution/various_storage_types.out index cd00b3ff6f8..ca2f8ba920e 100644 --- a/tests/expectations/execution/various_storage_types.out +++ b/tests/expectations/execution/various_storage_types.out @@ -89,31 +89,27 @@ finalize unsigned_integers: contains counter_u32__[false] into r0; get.or_use counter_u32__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - assert.eq r3.is_some true; - is.eq r3.val 10u32 into r4; - assert.eq r4 true; - contains counter_u32__[false] into r5; - get.or_use counter_u32__[false] 0u32 into r6; - ternary r5 r6 0u32 into r7; - cast r5 r7 into r8 as Optional__JzunLORyB8U; - ternary r8.is_some r8.val 0u32 into r9; - add r9 5u32 into r10; - set r10 into counter_u32__[false]; - contains counter_u32__[false] into r11; - get.or_use counter_u32__[false] 0u32 into r12; - ternary r11 r12 0u32 into r13; - cast r11 r13 into r14 as Optional__JzunLORyB8U; - assert.eq r14.is_some true; - is.eq r14.val 15u32 into r15; - assert.eq r15 true; - contains counter_u32__[false] into r16; - get.or_use counter_u32__[false] 0u32 into r17; - ternary r16 r17 0u32 into r18; - cast r16 r18 into r19 as Optional__JzunLORyB8U; - ternary r19.is_some r19.val 99u32 into r20; - is.eq r20 15u32 into r21; - assert.eq r21 true; + assert.eq r0 true; + is.eq r2 10u32 into r3; + assert.eq r3 true; + contains counter_u32__[false] into r4; + get.or_use counter_u32__[false] 0u32 into r5; + ternary r4 r5 0u32 into r6; + ternary r4 r6 0u32 into r7; + add r7 5u32 into r8; + set r8 into counter_u32__[false]; + contains counter_u32__[false] into r9; + get.or_use counter_u32__[false] 0u32 into r10; + ternary r9 r10 0u32 into r11; + assert.eq r9 true; + is.eq r11 15u32 into r12; + assert.eq r12 true; + contains counter_u32__[false] into r13; + get.or_use counter_u32__[false] 0u32 into r14; + ternary r13 r14 0u32 into r15; + ternary r13 r15 99u32 into r16; + is.eq r16 15u32 into r17; + assert.eq r17 true; function signed_integers: async signed_integers into r0; @@ -124,31 +120,27 @@ finalize signed_integers: contains counter_i32__[false] into r0; get.or_use counter_i32__[false] 0i32 into r1; ternary r0 r1 0i32 into r2; - cast r0 r2 into r3 as Optional__CI2lf3EvJat; - assert.eq r3.is_some true; - is.eq r3.val -5i32 into r4; - assert.eq r4 true; - contains counter_i32__[false] into r5; - get.or_use counter_i32__[false] 0i32 into r6; - ternary r5 r6 0i32 into r7; - cast r5 r7 into r8 as Optional__CI2lf3EvJat; - ternary r8.is_some r8.val 0i32 into r9; - sub r9 3i32 into r10; - set r10 into counter_i32__[false]; - contains counter_i32__[false] into r11; - get.or_use counter_i32__[false] 0i32 into r12; - ternary r11 r12 0i32 into r13; - cast r11 r13 into r14 as Optional__CI2lf3EvJat; - assert.eq r14.is_some true; - is.eq r14.val -8i32 into r15; - assert.eq r15 true; - contains counter_i32__[false] into r16; - get.or_use counter_i32__[false] 0i32 into r17; - ternary r16 r17 0i32 into r18; - cast r16 r18 into r19 as Optional__CI2lf3EvJat; - ternary r19.is_some r19.val 1i32 into r20; - is.eq r20 -8i32 into r21; - assert.eq r21 true; + assert.eq r0 true; + is.eq r2 -5i32 into r3; + assert.eq r3 true; + contains counter_i32__[false] into r4; + get.or_use counter_i32__[false] 0i32 into r5; + ternary r4 r5 0i32 into r6; + ternary r4 r6 0i32 into r7; + sub r7 3i32 into r8; + set r8 into counter_i32__[false]; + contains counter_i32__[false] into r9; + get.or_use counter_i32__[false] 0i32 into r10; + ternary r9 r10 0i32 into r11; + assert.eq r9 true; + is.eq r11 -8i32 into r12; + assert.eq r12 true; + contains counter_i32__[false] into r13; + get.or_use counter_i32__[false] 0i32 into r14; + ternary r13 r14 0i32 into r15; + ternary r13 r15 1i32 into r16; + is.eq r16 -8i32 into r17; + assert.eq r17 true; function primitive_types: async primitive_types into r0; @@ -163,66 +155,57 @@ finalize primitive_types: contains flag__[false] into r0; get.or_use flag__[false] false into r1; ternary r0 r1 false into r2; - cast r0 r2 into r3 as Optional__ATAkdHctJwx; - assert.eq r3.is_some true; - is.eq r3.val true into r4; + assert.eq r0 true; + is.eq r2 true into r3; + assert.eq r3 true; + contains scalar_val__[false] into r4; + get.or_use scalar_val__[false] 0scalar into r5; + ternary r4 r5 0scalar into r6; assert.eq r4 true; - contains scalar_val__[false] into r5; - get.or_use scalar_val__[false] 0scalar into r6; - ternary r5 r6 0scalar into r7; - cast r5 r7 into r8 as Optional__9y0TjJOC4Nk; - assert.eq r8.is_some true; - is.eq r8.val 2scalar into r9; - assert.eq r9 true; - contains field_val__[false] into r10; - get.or_use field_val__[false] 0field into r11; - ternary r10 r11 0field into r12; - cast r10 r12 into r13 as Optional__7o6su2Uhzht; - assert.eq r13.is_some true; - is.eq r13.val 21field into r14; - assert.eq r14 true; - contains group_val__[false] into r15; - get.or_use group_val__[false] 0group into r16; - ternary r15 r16 0group into r17; - cast r15 r17 into r18 as Optional__9SsWRr2WG5s; - assert.eq r18.is_some true; - is.eq r18.val 0group into r19; + is.eq r6 2scalar into r7; + assert.eq r7 true; + contains field_val__[false] into r8; + get.or_use field_val__[false] 0field into r9; + ternary r8 r9 0field into r10; + assert.eq r8 true; + is.eq r10 21field into r11; + assert.eq r11 true; + contains group_val__[false] into r12; + get.or_use group_val__[false] 0group into r13; + ternary r12 r13 0group into r14; + assert.eq r12 true; + is.eq r14 0group into r15; + assert.eq r15 true; + contains address_val__[false] into r16; + get.or_use address_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r17; + ternary r16 r17 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r18; + assert.eq r16 true; + is.eq r18 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r19; assert.eq r19 true; - contains address_val__[false] into r20; - get.or_use address_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r21; - ternary r20 r21 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r22; - cast r20 r22 into r23 as Optional__6wU7KHJhSvv; - assert.eq r23.is_some true; - is.eq r23.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r24; + contains flag__[false] into r20; + get.or_use flag__[false] false into r21; + ternary r20 r21 false into r22; + assert.eq r20 true; + not r22 into r23; + set r23 into flag__[false]; + contains flag__[false] into r24; + get.or_use flag__[false] false into r25; + ternary r24 r25 false into r26; assert.eq r24 true; - contains flag__[false] into r25; - get.or_use flag__[false] false into r26; - ternary r25 r26 false into r27; - cast r25 r27 into r28 as Optional__ATAkdHctJwx; - assert.eq r28.is_some true; - not r28.val into r29; - set r29 into flag__[false]; - contains flag__[false] into r30; - get.or_use flag__[false] false into r31; - ternary r30 r31 false into r32; - cast r30 r32 into r33 as Optional__ATAkdHctJwx; - assert.eq r33.is_some true; - is.eq r33.val false into r34; - assert.eq r34 true; - contains flag__[false] into r35; - get.or_use flag__[false] false into r36; - ternary r35 r36 false into r37; - cast r35 r37 into r38 as Optional__ATAkdHctJwx; - ternary r38.is_some r38.val true into r39; - is.eq r39 false into r40; - assert.eq r40 true; - contains field_val__[false] into r41; - get.or_use field_val__[false] 0field into r42; - ternary r41 r42 0field into r43; - cast r41 r43 into r44 as Optional__7o6su2Uhzht; - ternary r44.is_some r44.val 0field into r45; - is.eq r45 21field into r46; - assert.eq r46 true; + is.eq r26 false into r27; + assert.eq r27 true; + contains flag__[false] into r28; + get.or_use flag__[false] false into r29; + ternary r28 r29 false into r30; + ternary r28 r30 true into r31; + is.eq r31 false into r32; + assert.eq r32 true; + contains field_val__[false] into r33; + get.or_use field_val__[false] 0field into r34; + ternary r33 r34 0field into r35; + ternary r33 r35 0field into r36; + is.eq r36 21field into r37; + assert.eq r37 true; function structs_and_arrays: async structs_and_arrays into r0; @@ -269,103 +252,99 @@ finalize structs_and_arrays: ternary r9 r14[1u32].label r18[1u32].label into r35; cast r34 r35 into r36 as Container; cast r27 r36 into r37 as [Container; 2u32]; - cast r9 r37 into r38 as Optional__FxQoVJO2IeJ; - assert.eq r38.is_some true; - is.eq r38.val[0u32].points[0u32].x 1field into r39; + assert.eq r9 true; + is.eq r37[0u32].points[0u32].x 1field into r38; + assert.eq r38 true; + is.eq r37[1u32].points[0u32].y 6field into r39; assert.eq r39 true; - is.eq r38.val[1u32].points[0u32].y 6field into r40; + is.eq r37[0u32].label 10u8 into r40; assert.eq r40 true; - is.eq r38.val[0u32].label 10u8 into r41; + is.eq r37[1u32].label 20u8 into r41; assert.eq r41 true; - is.eq r38.val[1u32].label 20u8 into r42; - assert.eq r42 true; - cast 9field r38.val[0u32].points[0u32].y into r43 as Point; - cast r43 r38.val[0u32].points[1u32] into r44 as [Point; 2u32]; - cast r44 r38.val[0u32].label into r45 as Container; - cast r45 r38.val[1u32] into r46 as [Container; 2u32]; - set r46 into containers__[false]; - contains containers__[false] into r47; - cast 0field 0field into r48 as Point; - cast r48 r48 into r49 as [Point; 2u32]; - cast r49 0u8 into r50 as Container; - cast r50 r50 into r51 as [Container; 2u32]; - get.or_use containers__[false] r51 into r52; - cast 0field 0field into r53 as Point; - cast r53 r53 into r54 as [Point; 2u32]; - cast r54 0u8 into r55 as Container; - cast r55 r55 into r56 as [Container; 2u32]; - ternary r47 r52[0u32].points[0u32].x r56[0u32].points[0u32].x into r57; - ternary r47 r52[0u32].points[0u32].y r56[0u32].points[0u32].y into r58; - cast r57 r58 into r59 as Point; - ternary r47 r52[0u32].points[1u32].x r56[0u32].points[1u32].x into r60; - ternary r47 r52[0u32].points[1u32].y r56[0u32].points[1u32].y into r61; - cast r60 r61 into r62 as Point; - cast r59 r62 into r63 as [Point; 2u32]; - ternary r47 r52[0u32].label r56[0u32].label into r64; - cast r63 r64 into r65 as Container; - ternary r47 r52[1u32].points[0u32].x r56[1u32].points[0u32].x into r66; - ternary r47 r52[1u32].points[0u32].y r56[1u32].points[0u32].y into r67; - cast r66 r67 into r68 as Point; - ternary r47 r52[1u32].points[1u32].x r56[1u32].points[1u32].x into r69; - ternary r47 r52[1u32].points[1u32].y r56[1u32].points[1u32].y into r70; - cast r69 r70 into r71 as Point; - cast r68 r71 into r72 as [Point; 2u32]; - ternary r47 r52[1u32].label r56[1u32].label into r73; - cast r72 r73 into r74 as Container; - cast r65 r74 into r75 as [Container; 2u32]; - cast r47 r75 into r76 as Optional__FxQoVJO2IeJ; - assert.eq r76.is_some true; - is.eq r76.val[0u32].points[0u32].x 9field into r77; + cast 9field r37[0u32].points[0u32].y into r42 as Point; + cast r42 r37[0u32].points[1u32] into r43 as [Point; 2u32]; + cast r43 r37[0u32].label into r44 as Container; + cast r44 r37[1u32] into r45 as [Container; 2u32]; + set r45 into containers__[false]; + contains containers__[false] into r46; + cast 0field 0field into r47 as Point; + cast r47 r47 into r48 as [Point; 2u32]; + cast r48 0u8 into r49 as Container; + cast r49 r49 into r50 as [Container; 2u32]; + get.or_use containers__[false] r50 into r51; + cast 0field 0field into r52 as Point; + cast r52 r52 into r53 as [Point; 2u32]; + cast r53 0u8 into r54 as Container; + cast r54 r54 into r55 as [Container; 2u32]; + ternary r46 r51[0u32].points[0u32].x r55[0u32].points[0u32].x into r56; + ternary r46 r51[0u32].points[0u32].y r55[0u32].points[0u32].y into r57; + cast r56 r57 into r58 as Point; + ternary r46 r51[0u32].points[1u32].x r55[0u32].points[1u32].x into r59; + ternary r46 r51[0u32].points[1u32].y r55[0u32].points[1u32].y into r60; + cast r59 r60 into r61 as Point; + cast r58 r61 into r62 as [Point; 2u32]; + ternary r46 r51[0u32].label r55[0u32].label into r63; + cast r62 r63 into r64 as Container; + ternary r46 r51[1u32].points[0u32].x r55[1u32].points[0u32].x into r65; + ternary r46 r51[1u32].points[0u32].y r55[1u32].points[0u32].y into r66; + cast r65 r66 into r67 as Point; + ternary r46 r51[1u32].points[1u32].x r55[1u32].points[1u32].x into r68; + ternary r46 r51[1u32].points[1u32].y r55[1u32].points[1u32].y into r69; + cast r68 r69 into r70 as Point; + cast r67 r70 into r71 as [Point; 2u32]; + ternary r46 r51[1u32].label r55[1u32].label into r72; + cast r71 r72 into r73 as Container; + cast r64 r73 into r74 as [Container; 2u32]; + assert.eq r46 true; + is.eq r74[0u32].points[0u32].x 9field into r75; + assert.eq r75 true; + is.eq r74[1u32].points[0u32].x 5field into r76; + assert.eq r76 true; + contains points_array__[false] into r77; + cast 0field 0field into r78 as Point; + cast r78 r78 r78 into r79 as [Point; 3u32]; + get.or_use points_array__[false] r79 into r80; + cast 0field 0field into r81 as Point; + cast r81 r81 r81 into r82 as [Point; 3u32]; + ternary r77 r80[0u32].x r82[0u32].x into r83; + ternary r77 r80[0u32].y r82[0u32].y into r84; + cast r83 r84 into r85 as Point; + ternary r77 r80[1u32].x r82[1u32].x into r86; + ternary r77 r80[1u32].y r82[1u32].y into r87; + cast r86 r87 into r88 as Point; + ternary r77 r80[2u32].x r82[2u32].x into r89; + ternary r77 r80[2u32].y r82[2u32].y into r90; + cast r89 r90 into r91 as Point; + cast r85 r88 r91 into r92 as [Point; 3u32]; assert.eq r77 true; - is.eq r76.val[1u32].points[0u32].x 5field into r78; - assert.eq r78 true; - contains points_array__[false] into r79; - cast 0field 0field into r80 as Point; - cast r80 r80 r80 into r81 as [Point; 3u32]; - get.or_use points_array__[false] r81 into r82; - cast 0field 0field into r83 as Point; - cast r83 r83 r83 into r84 as [Point; 3u32]; - ternary r79 r82[0u32].x r84[0u32].x into r85; - ternary r79 r82[0u32].y r84[0u32].y into r86; - cast r85 r86 into r87 as Point; - ternary r79 r82[1u32].x r84[1u32].x into r88; - ternary r79 r82[1u32].y r84[1u32].y into r89; - cast r88 r89 into r90 as Point; - ternary r79 r82[2u32].x r84[2u32].x into r91; - ternary r79 r82[2u32].y r84[2u32].y into r92; - cast r91 r92 into r93 as Point; - cast r87 r90 r93 into r94 as [Point; 3u32]; - cast r79 r94 into r95 as Optional__E9UBDm0DXxP; - assert.eq r95.is_some true; - is.eq r95.val[0u32].x 1field into r96; - assert.eq r96 true; - is.eq r95.val[2u32].y 6field into r97; - assert.eq r97 true; - cast r95.val[1u32].x r95.val[1u32].y into r98 as Point; - add r98.x 10field into r99; - cast r99 r95.val[1u32].y into r100 as Point; - cast r95.val[0u32] r100 r95.val[2u32] into r101 as [Point; 3u32]; - set r101 into points_array__[false]; - contains points_array__[false] into r102; + is.eq r92[0u32].x 1field into r93; + assert.eq r93 true; + is.eq r92[2u32].y 6field into r94; + assert.eq r94 true; + cast r92[1u32].x r92[1u32].y into r95 as Point; + add r95.x 10field into r96; + cast r96 r92[1u32].y into r97 as Point; + cast r92[0u32] r97 r92[2u32] into r98 as [Point; 3u32]; + set r98 into points_array__[false]; + contains points_array__[false] into r99; + cast 0field 0field into r100 as Point; + cast r100 r100 r100 into r101 as [Point; 3u32]; + get.or_use points_array__[false] r101 into r102; cast 0field 0field into r103 as Point; cast r103 r103 r103 into r104 as [Point; 3u32]; - get.or_use points_array__[false] r104 into r105; - cast 0field 0field into r106 as Point; - cast r106 r106 r106 into r107 as [Point; 3u32]; - ternary r102 r105[0u32].x r107[0u32].x into r108; - ternary r102 r105[0u32].y r107[0u32].y into r109; + ternary r99 r102[0u32].x r104[0u32].x into r105; + ternary r99 r102[0u32].y r104[0u32].y into r106; + cast r105 r106 into r107 as Point; + ternary r99 r102[1u32].x r104[1u32].x into r108; + ternary r99 r102[1u32].y r104[1u32].y into r109; cast r108 r109 into r110 as Point; - ternary r102 r105[1u32].x r107[1u32].x into r111; - ternary r102 r105[1u32].y r107[1u32].y into r112; + ternary r99 r102[2u32].x r104[2u32].x into r111; + ternary r99 r102[2u32].y r104[2u32].y into r112; cast r111 r112 into r113 as Point; - ternary r102 r105[2u32].x r107[2u32].x into r114; - ternary r102 r105[2u32].y r107[2u32].y into r115; - cast r114 r115 into r116 as Point; - cast r110 r113 r116 into r117 as [Point; 3u32]; - cast r102 r117 into r118 as Optional__E9UBDm0DXxP; - assert.eq r118.is_some true; - is.eq r118.val[1u32].x 13field into r119; - assert.eq r119 true; + cast r107 r110 r113 into r114 as [Point; 3u32]; + assert.eq r99 true; + is.eq r114[1u32].x 13field into r115; + assert.eq r115 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/various_storage_types_none.out b/tests/expectations/execution/various_storage_types_none.out index 72a4e29e778..19405e67d0b 100644 --- a/tests/expectations/execution/various_storage_types_none.out +++ b/tests/expectations/execution/various_storage_types_none.out @@ -75,33 +75,30 @@ finalize integers_none_behavior: contains counter_u32__[false] into r6; get.or_use counter_u32__[false] 0u32 into r7; ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - ternary r9.is_some r9.val 99u32 into r10; - is.eq r10 99u32 into r11; - assert.eq r11 true; + ternary r6 r8 99u32 into r9; + is.eq r9 99u32 into r10; + assert.eq r10 true; set 42u32 into counter_u32__[false]; - contains counter_u32__[false] into r12; - get.or_use counter_u32__[false] 0u32 into r13; - ternary r12 r13 0u32 into r14; - cast r12 r14 into r15 as Optional__JzunLORyB8U; - assert.eq r15.is_some true; - is.eq r15.val 42u32 into r16; - assert.eq r16 true; + contains counter_u32__[false] into r11; + get.or_use counter_u32__[false] 0u32 into r12; + ternary r11 r12 0u32 into r13; + assert.eq r11 true; + is.eq r13 42u32 into r14; + assert.eq r14 true; remove counter_u32__[false]; - contains counter_u32__[false] into r17; - get.or_use counter_u32__[false] 0u32 into r18; - ternary r17 r18 0u32 into r19; - cast r17 r19 into r20 as Optional__JzunLORyB8U; - cast false 0u32 into r21 as Optional__JzunLORyB8U; - is.eq r20 r21 into r22; - assert.eq r22 true; - contains counter_u32__[false] into r23; - get.or_use counter_u32__[false] 0u32 into r24; - ternary r23 r24 0u32 into r25; - cast r23 r25 into r26 as Optional__JzunLORyB8U; - ternary r26.is_some r26.val 7u32 into r27; - is.eq r27 7u32 into r28; - assert.eq r28 true; + contains counter_u32__[false] into r15; + get.or_use counter_u32__[false] 0u32 into r16; + ternary r15 r16 0u32 into r17; + cast r15 r17 into r18 as Optional__JzunLORyB8U; + cast false 0u32 into r19 as Optional__JzunLORyB8U; + is.eq r18 r19 into r20; + assert.eq r20 true; + contains counter_u32__[false] into r21; + get.or_use counter_u32__[false] 0u32 into r22; + ternary r21 r22 0u32 into r23; + ternary r21 r23 7u32 into r24; + is.eq r24 7u32 into r25; + assert.eq r25 true; function primitives_none_behavior: async primitives_none_behavior into r0; @@ -118,65 +115,60 @@ finalize primitives_none_behavior: contains flag__[false] into r6; get.or_use flag__[false] false into r7; ternary r6 r7 false into r8; - cast r6 r8 into r9 as Optional__ATAkdHctJwx; - ternary r9.is_some r9.val true into r10; - is.eq r10 true into r11; - assert.eq r11 true; + ternary r6 r8 true into r9; + is.eq r9 true into r10; + assert.eq r10 true; set false into flag__[false]; - contains flag__[false] into r12; - get.or_use flag__[false] false into r13; - ternary r12 r13 false into r14; - cast r12 r14 into r15 as Optional__ATAkdHctJwx; - assert.eq r15.is_some true; - is.eq r15.val false into r16; - assert.eq r16 true; + contains flag__[false] into r11; + get.or_use flag__[false] false into r12; + ternary r11 r12 false into r13; + assert.eq r11 true; + is.eq r13 false into r14; + assert.eq r14 true; remove flag__[false]; - contains flag__[false] into r17; - get.or_use flag__[false] false into r18; - ternary r17 r18 false into r19; - cast r17 r19 into r20 as Optional__ATAkdHctJwx; - cast false false into r21 as Optional__ATAkdHctJwx; - is.eq r20 r21 into r22; - assert.eq r22 true; - contains flag__[false] into r23; - get.or_use flag__[false] false into r24; - ternary r23 r24 false into r25; - cast r23 r25 into r26 as Optional__ATAkdHctJwx; - ternary r26.is_some r26.val false into r27; - is.eq r27 false into r28; - assert.eq r28 true; + contains flag__[false] into r15; + get.or_use flag__[false] false into r16; + ternary r15 r16 false into r17; + cast r15 r17 into r18 as Optional__ATAkdHctJwx; + cast false false into r19 as Optional__ATAkdHctJwx; + is.eq r18 r19 into r20; + assert.eq r20 true; + contains flag__[false] into r21; + get.or_use flag__[false] false into r22; + ternary r21 r22 false into r23; + ternary r21 r23 false into r24; + is.eq r24 false into r25; + assert.eq r25 true; remove scalar_val__[false]; remove field_val__[false]; - contains scalar_val__[false] into r29; - get.or_use scalar_val__[false] 0scalar into r30; - ternary r29 r30 0scalar into r31; - cast r29 r31 into r32 as Optional__9y0TjJOC4Nk; - cast false 0scalar into r33 as Optional__9y0TjJOC4Nk; - is.eq r32 r33 into r34; - assert.eq r34 true; - contains field_val__[false] into r35; - get.or_use field_val__[false] 0field into r36; - ternary r35 r36 0field into r37; - cast r35 r37 into r38 as Optional__7o6su2Uhzht; - cast false 0field into r39 as Optional__7o6su2Uhzht; - is.eq r38 r39 into r40; - assert.eq r40 true; + contains scalar_val__[false] into r26; + get.or_use scalar_val__[false] 0scalar into r27; + ternary r26 r27 0scalar into r28; + cast r26 r28 into r29 as Optional__9y0TjJOC4Nk; + cast false 0scalar into r30 as Optional__9y0TjJOC4Nk; + is.eq r29 r30 into r31; + assert.eq r31 true; + contains field_val__[false] into r32; + get.or_use field_val__[false] 0field into r33; + ternary r32 r33 0field into r34; + cast r32 r34 into r35 as Optional__7o6su2Uhzht; + cast false 0field into r36 as Optional__7o6su2Uhzht; + is.eq r35 r36 into r37; + assert.eq r37 true; set 1scalar into scalar_val__[false]; set 5field into field_val__[false]; - contains scalar_val__[false] into r41; - get.or_use scalar_val__[false] 0scalar into r42; - ternary r41 r42 0scalar into r43; - cast r41 r43 into r44 as Optional__9y0TjJOC4Nk; - assert.eq r44.is_some true; - is.eq r44.val 1scalar into r45; + contains scalar_val__[false] into r38; + get.or_use scalar_val__[false] 0scalar into r39; + ternary r38 r39 0scalar into r40; + assert.eq r38 true; + is.eq r40 1scalar into r41; + assert.eq r41 true; + contains field_val__[false] into r42; + get.or_use field_val__[false] 0field into r43; + ternary r42 r43 0field into r44; + assert.eq r42 true; + is.eq r44 5field into r45; assert.eq r45 true; - contains field_val__[false] into r46; - get.or_use field_val__[false] 0field into r47; - ternary r46 r47 0field into r48; - cast r46 r48 into r49 as Optional__7o6su2Uhzht; - assert.eq r49.is_some true; - is.eq r49.val 5field into r50; - assert.eq r50 true; function arrays_none_behavior: async arrays_none_behavior into r0; @@ -225,10 +217,9 @@ finalize arrays_none_behavior: ternary r22 r25[1u32].y r27[1u32].y into r32; cast r31 r32 into r33 as Point; cast r30 r33 into r34 as [Point; 2u32]; - cast r22 r34 into r35 as Optional__CIFHV93i7jy; - assert.eq r35.is_some true; - is.eq r35.val[1u32].x 9field into r36; - assert.eq r36 true; + assert.eq r22 true; + is.eq r34[1u32].x 9field into r35; + assert.eq r35 true; function structs_none_behavior: async structs_none_behavior into r0; @@ -244,39 +235,33 @@ finalize structs_none_behavior: is.eq r2 r5 into r6; assert.eq r6 true; cast 0field 0field into r7 as Point; - ternary r2.is_some r2.val.point.x r7.x into r8; - ternary r2.is_some r2.val.point.y r7.y into r9; - cast r8 r9 into r10 as Point; - ternary r2.is_some r2.val.id 0u8 into r11; - cast r11 r10 into r12 as Container; - is.eq r12.id 0u8 into r13; + cast r7.x r7.y into r8 as Point; + cast 0u8 r8 into r9 as Container; + is.eq r9.id 0u8 into r10; + assert.eq r10 true; + cast 5field 10field into r11 as Point; + cast 1u8 r11 into r12 as Container; + is.eq r11.x 5field into r13; assert.eq r13 true; - cast 5field 10field into r14 as Point; - cast 1u8 r14 into r15 as Container; - is.eq r14.x 5field into r16; - assert.eq r16 true; - cast true r15 into r17 as Optional__CrW6ZMYLUhu; - assert.eq r17.is_some true; - is.eq r17.val.point.y 10field into r18; - assert.eq r18 true; - cast 9field 9field into r19 as Point; - cast 9u8 r19 into r20 as Container; - set r20 into container__[false]; - contains container__[false] into r21; - cast 0field 0field into r22 as Point; - cast 0u8 r22 into r23 as Container; - get.or_use container__[false] r23 into r24; - cast 0field 0field into r25 as Point; - cast 0u8 r25 into r26 as Container; - ternary r21 r24.point.x r26.point.x into r27; - ternary r21 r24.point.y r26.point.y into r28; - cast r27 r28 into r29 as Point; - ternary r21 r24.id r26.id into r30; - cast r30 r29 into r31 as Container; - cast r21 r31 into r32 as Optional__CrW6ZMYLUhu; - assert.eq r32.is_some true; - is.eq r32.val.point.x 9field into r33; - assert.eq r33 true; + is.eq r12.point.y 10field into r14; + assert.eq r14 true; + cast 9field 9field into r15 as Point; + cast 9u8 r15 into r16 as Container; + set r16 into container__[false]; + contains container__[false] into r17; + cast 0field 0field into r18 as Point; + cast 0u8 r18 into r19 as Container; + get.or_use container__[false] r19 into r20; + cast 0field 0field into r21 as Point; + cast 0u8 r21 into r22 as Container; + ternary r17 r20.point.x r22.point.x into r23; + ternary r17 r20.point.y r22.point.y into r24; + cast r23 r24 into r25 as Point; + ternary r17 r20.id r22.id into r26; + cast r26 r25 into r27 as Container; + assert.eq r17 true; + is.eq r27.point.x 9field into r28; + assert.eq r28 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/view_aggregate.out b/tests/expectations/execution/view_aggregate.out index d01f2590cbb..db8b51f22e5 100644 --- a/tests/expectations/execution/view_aggregate.out +++ b/tests/expectations/execution/view_aggregate.out @@ -25,23 +25,20 @@ view sum_first_three: lt 0u32 r0 into r1; get.or_use entries__[0u32] 0u64 into r2; ternary r1 r2 0u64 into r3; - cast r1 r3 into r4 as Optional__DmN5CQ9hzeK; - ternary r4.is_some r4.val 0u64 into r5; - get.or_use entries__len__[false] 0u32 into r6; - lt 1u32 r6 into r7; - get.or_use entries__[1u32] 0u64 into r8; - ternary r7 r8 0u64 into r9; - cast r7 r9 into r10 as Optional__DmN5CQ9hzeK; - ternary r10.is_some r10.val 0u64 into r11; - add r5 r11 into r12; - get.or_use entries__len__[false] 0u32 into r13; - lt 2u32 r13 into r14; - get.or_use entries__[2u32] 0u64 into r15; - ternary r14 r15 0u64 into r16; - cast r14 r16 into r17 as Optional__DmN5CQ9hzeK; - ternary r17.is_some r17.val 0u64 into r18; - add r12 r18 into r19; - output r19 as u64.public; + ternary r1 r3 0u64 into r4; + get.or_use entries__len__[false] 0u32 into r5; + lt 1u32 r5 into r6; + get.or_use entries__[1u32] 0u64 into r7; + ternary r6 r7 0u64 into r8; + ternary r6 r8 0u64 into r9; + add r4 r9 into r10; + get.or_use entries__len__[false] 0u32 into r11; + lt 2u32 r11 into r12; + get.or_use entries__[2u32] 0u64 into r13; + ternary r12 r13 0u64 into r14; + ternary r12 r14 0u64 into r15; + add r10 r15 into r16; + output r16 as u64.public; view weighted_balance: input r0 as address.public; diff --git a/tests/expectations/execution/view_storage_and_vector.out b/tests/expectations/execution/view_storage_and_vector.out index f05944a61c1..4a444f17930 100644 --- a/tests/expectations/execution/view_storage_and_vector.out +++ b/tests/expectations/execution/view_storage_and_vector.out @@ -28,9 +28,8 @@ view current_owner: contains owner__[false] into r0; get.or_use owner__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r1; ternary r0 r1 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r2; - cast r0 r2 into r3 as Optional__6wU7KHJhSvv; - ternary r3.is_some r3.val aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r4; - output r4 as address.public; + ternary r0 r2 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r3; + output r3 as address.public; view entry_count: get.or_use entries__len__[false] 0u32 into r0; @@ -42,9 +41,8 @@ view entry_at: lt r0 r1 into r2; get.or_use entries__[r0] 0u64 into r3; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - ternary r5.is_some r5.val 0u64 into r6; - output r6 as u64.public; + ternary r2 r4 0u64 into r5; + output r5 as u64.public; view entry_at_oob: input r0 as u32.public; @@ -52,9 +50,8 @@ view entry_at_oob: lt r0 r1 into r2; get.or_use entries__[r0] 0u64 into r3; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - ternary r5.is_some r5.val 99u64 into r6; - output r6 as u64.public; + ternary r2 r4 99u64 into r5; + output r5 as u64.public; constructor: assert.eq edition 0u16; From 665b21e75fc7b242de6d901a469ef383a4578bf7 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 19:05:09 +0800 Subject: [PATCH 32/65] Restore ternary absorption snapshot ending --- .../passes/ssa_const_propagation/nested_ternary_absorption.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 01698b2727e..126d90b2d54 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,3 +23,4 @@ program test.aleo { return $var$21; } } + From 2c2960865c8649a3910625b591b9bec6fa1327df Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 19:16:40 +0800 Subject: [PATCH 33/65] Update stacked ABI CLI expectation --- tests/expectations/cli/test_abi_comprehensive/STDOUT | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/expectations/cli/test_abi_comprehensive/STDOUT b/tests/expectations/cli/test_abi_comprehensive/STDOUT index 9daddfdacb8..6e484e5ca90 100644 --- a/tests/expectations/cli/test_abi_comprehensive/STDOUT +++ b/tests/expectations/cli/test_abi_comprehensive/STDOUT @@ -2,7 +2,7 @@ ⚠️ No endpoint specified, defaulting to 'https://api.explorer.provable.com/v1'. Leo 🔨 Compiling 'abi_test.aleo' - Leo The program checksum is: '[147u8, 105u8, 236u8, 139u8, 183u8, 167u8, 83u8, 66u8, 169u8, 230u8, 240u8, 183u8, 226u8, 65u8, 221u8, 93u8, 124u8, 254u8, 215u8, 43u8, 81u8, 204u8, 98u8, 180u8, 105u8, 144u8, 195u8, 133u8, 20u8, 100u8, 141u8, 55u8]'. + Leo The program checksum is: '[189u8, 121u8, 73u8, 247u8, 71u8, 59u8, 160u8, 253u8, 67u8, 23u8, 171u8, 84u8, 70u8, 200u8, 152u8, 65u8, 151u8, 2u8, 112u8, 52u8, 238u8, 132u8, 87u8, 96u8, 188u8, 176u8, 252u8, 164u8, 179u8, 157u8, 50u8, 189u8]'. Leo `single_primitive` function checksum is: '[254u8, 116u8, 136u8, 108u8, 147u8, 170u8, 6u8, 194u8, 208u8, 248u8, 149u8, 8u8, 201u8, 219u8, 159u8, 150u8, 177u8, 3u8, 16u8, 42u8, 81u8, 97u8, 216u8, 1u8, 242u8, 217u8, 232u8, 103u8, 194u8, 196u8, 13u8, 117u8]'. Leo `multi_input` function checksum is: '[38u8, 55u8, 47u8, 136u8, 27u8, 204u8, 61u8, 24u8, 138u8, 108u8, 154u8, 149u8, 115u8, 175u8, 167u8, 41u8, 76u8, 16u8, 106u8, 118u8, 158u8, 178u8, 219u8, 78u8, 82u8, 35u8, 7u8, 237u8, 154u8, 50u8, 23u8, 177u8]'. Leo `multi_output` function checksum is: '[54u8, 229u8, 225u8, 245u8, 4u8, 96u8, 230u8, 173u8, 142u8, 152u8, 212u8, 92u8, 128u8, 54u8, 53u8, 90u8, 113u8, 139u8, 194u8, 31u8, 1u8, 70u8, 30u8, 199u8, 107u8, 73u8, 127u8, 177u8, 253u8, 112u8, 131u8, 156u8]'. @@ -19,9 +19,9 @@ Leo `update_balance` function checksum is: '[26u8, 173u8, 136u8, 218u8, 50u8, 83u8, 52u8, 154u8, 58u8, 222u8, 59u8, 82u8, 242u8, 149u8, 30u8, 78u8, 10u8, 137u8, 148u8, 186u8, 13u8, 157u8, 194u8, 80u8, 220u8, 168u8, 250u8, 155u8, 52u8, 234u8, 171u8, 226u8]'. Leo `get_balance` function checksum is: '[60u8, 39u8, 55u8, 93u8, 164u8, 106u8, 158u8, 53u8, 139u8, 1u8, 123u8, 93u8, 17u8, 63u8, 252u8, 207u8, 19u8, 170u8, 90u8, 218u8, 45u8, 151u8, 221u8, 216u8, 10u8, 208u8, 9u8, 163u8, 152u8, 6u8, 239u8, 215u8]'. Leo `echo_point` function checksum is: '[213u8, 253u8, 222u8, 75u8, 87u8, 228u8, 163u8, 218u8, 157u8, 245u8, 119u8, 211u8, 203u8, 238u8, 98u8, 52u8, 85u8, 114u8, 188u8, 151u8, 159u8, 254u8, 81u8, 95u8, 86u8, 228u8, 103u8, 88u8, 85u8, 150u8, 105u8, 144u8]'. - Leo `current_counter` function checksum is: '[104u8, 145u8, 52u8, 167u8, 235u8, 110u8, 66u8, 220u8, 96u8, 147u8, 66u8, 149u8, 223u8, 122u8, 63u8, 148u8, 105u8, 55u8, 212u8, 10u8, 12u8, 85u8, 14u8, 8u8, 116u8, 143u8, 106u8, 213u8, 155u8, 106u8, 251u8, 23u8]'. - Leo `counters` function checksum is: '[116u8, 190u8, 126u8, 73u8, 57u8, 62u8, 237u8, 117u8, 26u8, 44u8, 146u8, 207u8, 255u8, 3u8, 190u8, 136u8, 63u8, 87u8, 243u8, 229u8, 241u8, 113u8, 49u8, 203u8, 126u8, 151u8, 196u8, 34u8, 138u8, 24u8, 26u8, 38u8]'. - Leo Program size: 4.09 KB / 2000.00 KB + Leo `current_counter` function checksum is: '[181u8, 12u8, 66u8, 207u8, 160u8, 202u8, 97u8, 140u8, 182u8, 16u8, 185u8, 160u8, 217u8, 223u8, 18u8, 179u8, 37u8, 66u8, 0u8, 77u8, 231u8, 29u8, 84u8, 191u8, 81u8, 153u8, 85u8, 230u8, 248u8, 200u8, 104u8, 112u8]'. + Leo `counters` function checksum is: '[219u8, 184u8, 138u8, 247u8, 57u8, 19u8, 29u8, 3u8, 141u8, 74u8, 74u8, 116u8, 148u8, 8u8, 196u8, 221u8, 250u8, 219u8, 81u8, 129u8, 35u8, 13u8, 74u8, 252u8, 163u8, 29u8, 41u8, 132u8, 170u8, 129u8, 56u8, 195u8]'. + Leo Program size: 3.97 KB / 2000.00 KB Leo ✅ Compiled 'abi_test.aleo' into Aleo instructions. Leo ✅ Generated ABI for program 'abi_test.aleo'. @@ -933,4 +933,4 @@ ] } ] -} \ No newline at end of file +} From 46ac1755030f95e6a35cf5bf66600741137bf30f Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 19:32:29 +0800 Subject: [PATCH 34/65] Update stacked ABI Aleo expectation --- .../contents/build/abi_test/abi_test.aleo | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo index 0c785ffdd29..b876862e395 100644 --- a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo +++ b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo @@ -165,19 +165,17 @@ view current_counter: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - ternary r3.is_some r3.val 0u32 into r4; - output r4 as u32.public; + ternary r0 r2 0u32 into r3; + output r3 as u32.public; view counters: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - cast r0 r2 into r3 as Optional__JzunLORyB8U; - ternary r3.is_some r3.val 0u32 into r4; - add r4 1u32 into r5; + ternary r0 r2 0u32 into r3; + add r3 1u32 into r4; + output r3 as u32.public; output r4 as u32.public; - output r5 as u32.public; constructor: assert.eq edition 0u16; From d68feb7750fa32be940cf39acc8a4a3d6b78501e Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sat, 20 Jun 2026 19:42:35 +0800 Subject: [PATCH 35/65] Restore stacked ABI CLI snapshot ending --- tests/expectations/cli/test_abi_comprehensive/STDOUT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/expectations/cli/test_abi_comprehensive/STDOUT b/tests/expectations/cli/test_abi_comprehensive/STDOUT index 6e484e5ca90..64f05f28a05 100644 --- a/tests/expectations/cli/test_abi_comprehensive/STDOUT +++ b/tests/expectations/cli/test_abi_comprehensive/STDOUT @@ -933,4 +933,4 @@ ] } ] -} +} \ No newline at end of file From 3f13bca72742d36e06e91d5d4c50b4c7b0212b4b Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sun, 21 Jun 2026 00:18:22 +0800 Subject: [PATCH 36/65] Refresh stacked storage unit CLI fixture --- tests/expectations/cli/test_storage_from_unit_test/STDOUT | 6 +++--- .../contents/build/storage_demo/storage_demo.aleo | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/expectations/cli/test_storage_from_unit_test/STDOUT b/tests/expectations/cli/test_storage_from_unit_test/STDOUT index 60c4437691c..ca48475c22d 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/STDOUT +++ b/tests/expectations/cli/test_storage_from_unit_test/STDOUT @@ -2,14 +2,14 @@ ⚠️ No endpoint specified, defaulting to 'https://api.explorer.provable.com/v1'. Leo 🔨 Compiling 'storage_demo.aleo' - Leo Program size: 5.43 KB / 2000.00 KB + Leo Program size: 5.37 KB / 2000.00 KB Leo ✅ Compiled 'storage_demo.aleo' into Aleo instructions. Leo ✅ Generated ABI for program 'storage_demo.aleo'. Leo 🔨 Compiling 'test_storage_demo.aleo' - Leo Program size: 20.35 KB / 2000.00 KB + Leo Program size: 18.28 KB / 2000.00 KB Leo ✅ Compiled 'test_storage_demo.aleo' into Aleo instructions. - Leo Import 'storage_demo.aleo': checksum = '[226u8, 104u8, 115u8, 137u8, 3u8, 83u8, 131u8, 89u8, 56u8, 167u8, 125u8, 100u8, 155u8, 220u8, 210u8, 53u8, 15u8, 25u8, 15u8, 152u8, 34u8, 88u8, 82u8, 31u8, 208u8, 157u8, 23u8, 145u8, 128u8, 36u8, 118u8, 40u8]' + Leo Import 'storage_demo.aleo': checksum = '[181u8, 196u8, 11u8, 13u8, 176u8, 224u8, 84u8, 194u8, 122u8, 47u8, 204u8, 224u8, 175u8, 181u8, 20u8, 6u8, 165u8, 4u8, 170u8, 248u8, 93u8, 190u8, 224u8, 136u8, 197u8, 69u8, 42u8, 144u8, 52u8, 166u8, 103u8, 25u8]' Leo Loading the ledger from storage... Leo Loading the ledger from storage... Leo Loading the ledger from storage... diff --git a/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo b/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo index 8b9fd2df95e..1c12a7a6b24 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo +++ b/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo @@ -82,10 +82,9 @@ finalize bump_counter: contains counter__[false] into r0; get.or_use counter__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - cast r0 r2 into r3 as Optional__DmN5CQ9hzeK; - ternary r3.is_some r3.val 0u64 into r4; - add r4 1u64 into r5; - set r5 into counter__[false]; + ternary r0 r2 0u64 into r3; + add r3 1u64 into r4; + set r4 into counter__[false]; function clear_counter: async clear_counter into r0; From 277305333479c7cf22c6b9c3b3a497bc83567faf Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sun, 21 Jun 2026 00:32:59 +0800 Subject: [PATCH 37/65] Refresh generated stacked storage unit fixture --- .../test_storage_demo/test_storage_demo.aleo | 339 ++++++++---------- 1 file changed, 153 insertions(+), 186 deletions(-) diff --git a/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo b/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo index 9c79d139494..2e580fea711 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo +++ b/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo @@ -49,55 +49,49 @@ finalize unset_singletons_default: contains storage_demo.aleo/flag__[false] into r0; get.or_use storage_demo.aleo/flag__[false] false into r1; ternary r0 r1 false into r2; - cast r0 r2 into r3 as Optional__ATAkdHctJwx; - ternary r3.is_some r3.val false into r4; - is.eq r4 false into r5; - assert.eq r5 true; - contains storage_demo.aleo/counter__[false] into r6; - get.or_use storage_demo.aleo/counter__[false] 0u64 into r7; - ternary r6 r7 0u64 into r8; - cast r6 r8 into r9 as Optional__DmN5CQ9hzeK; - ternary r9.is_some r9.val 0u64 into r10; - is.eq r10 0u64 into r11; - assert.eq r11 true; - contains storage_demo.aleo/tiny__[false] into r12; - get.or_use storage_demo.aleo/tiny__[false] 0u8 into r13; - ternary r12 r13 0u8 into r14; - cast r12 r14 into r15 as Optional__3aph2JMPtnA; - ternary r15.is_some r15.val 0u8 into r16; - is.eq r16 0u8 into r17; - assert.eq r17 true; - contains storage_demo.aleo/signed__[false] into r18; - get.or_use storage_demo.aleo/signed__[false] 0i64 into r19; - ternary r18 r19 0i64 into r20; - cast r18 r20 into r21 as Optional__GfbJUku6XoG; - ternary r21.is_some r21.val 0i64 into r22; - is.eq r22 0i64 into r23; - assert.eq r23 true; - contains storage_demo.aleo/marker__[false] into r24; - get.or_use storage_demo.aleo/marker__[false] 0field into r25; - ternary r24 r25 0field into r26; - cast r24 r26 into r27 as Optional__7o6su2Uhzht; - ternary r27.is_some r27.val 0field into r28; - is.eq r28 0field into r29; - assert.eq r29 true; - contains storage_demo.aleo/quad__[false] into r30; - cast 0u32 0u32 0u32 0u32 into r31 as [u32; 4u32]; - get.or_use storage_demo.aleo/quad__[false] r31 into r32; - ternary r30 r32[0u32] r31[0u32] into r33; - ternary r30 r32[1u32] r31[1u32] into r34; - ternary r30 r32[2u32] r31[2u32] into r35; - ternary r30 r32[3u32] r31[3u32] into r36; - cast r33 r34 r35 r36 into r37 as [u32; 4u32]; - cast r30 r37 into r38 as Optional__BnktEVOqVZ2; - cast 0u32 0u32 0u32 0u32 into r39 as [u32; 4u32]; - ternary r38.is_some r38.val[0u32] 0u32 into r40; - ternary r38.is_some r38.val[1u32] 0u32 into r41; - ternary r38.is_some r38.val[2u32] 0u32 into r42; - ternary r38.is_some r38.val[3u32] 0u32 into r43; - cast r40 r41 r42 r43 into r44 as [u32; 4u32]; - is.eq r44 r39 into r45; - assert.eq r45 true; + ternary r0 r2 false into r3; + is.eq r3 false into r4; + assert.eq r4 true; + contains storage_demo.aleo/counter__[false] into r5; + get.or_use storage_demo.aleo/counter__[false] 0u64 into r6; + ternary r5 r6 0u64 into r7; + ternary r5 r7 0u64 into r8; + is.eq r8 0u64 into r9; + assert.eq r9 true; + contains storage_demo.aleo/tiny__[false] into r10; + get.or_use storage_demo.aleo/tiny__[false] 0u8 into r11; + ternary r10 r11 0u8 into r12; + ternary r10 r12 0u8 into r13; + is.eq r13 0u8 into r14; + assert.eq r14 true; + contains storage_demo.aleo/signed__[false] into r15; + get.or_use storage_demo.aleo/signed__[false] 0i64 into r16; + ternary r15 r16 0i64 into r17; + ternary r15 r17 0i64 into r18; + is.eq r18 0i64 into r19; + assert.eq r19 true; + contains storage_demo.aleo/marker__[false] into r20; + get.or_use storage_demo.aleo/marker__[false] 0field into r21; + ternary r20 r21 0field into r22; + ternary r20 r22 0field into r23; + is.eq r23 0field into r24; + assert.eq r24 true; + contains storage_demo.aleo/quad__[false] into r25; + cast 0u32 0u32 0u32 0u32 into r26 as [u32; 4u32]; + get.or_use storage_demo.aleo/quad__[false] r26 into r27; + ternary r25 r27[0u32] r26[0u32] into r28; + ternary r25 r27[1u32] r26[1u32] into r29; + ternary r25 r27[2u32] r26[2u32] into r30; + ternary r25 r27[3u32] r26[3u32] into r31; + cast r28 r29 r30 r31 into r32 as [u32; 4u32]; + cast 0u32 0u32 0u32 0u32 into r33 as [u32; 4u32]; + ternary r25 r32[0u32] 0u32 into r34; + ternary r25 r32[1u32] 0u32 into r35; + ternary r25 r32[2u32] 0u32 into r36; + ternary r25 r32[3u32] 0u32 into r37; + cast r34 r35 r36 r37 into r38 as [u32; 4u32]; + is.eq r38 r33 into r39; + assert.eq r39 true; function set_and_read_flag: call storage_demo.aleo/set_flag true into r0; @@ -110,10 +104,9 @@ finalize set_and_read_flag: contains storage_demo.aleo/flag__[false] into r1; get.or_use storage_demo.aleo/flag__[false] false into r2; ternary r1 r2 false into r3; - cast r1 r3 into r4 as Optional__ATAkdHctJwx; - assert.eq r4.is_some true; - is.eq r4.val true into r5; - assert.eq r5 true; + assert.eq r1 true; + is.eq r3 true into r4; + assert.eq r4 true; function set_and_read_counter: call storage_demo.aleo/set_counter 42u64 into r0; @@ -126,17 +119,15 @@ finalize set_and_read_counter: contains storage_demo.aleo/counter__[false] into r1; get.or_use storage_demo.aleo/counter__[false] 0u64 into r2; ternary r1 r2 0u64 into r3; - cast r1 r3 into r4 as Optional__DmN5CQ9hzeK; - assert.eq r4.is_some true; - is.eq r4.val 42u64 into r5; - assert.eq r5 true; - contains storage_demo.aleo/counter__[false] into r6; - get.or_use storage_demo.aleo/counter__[false] 0u64 into r7; - ternary r6 r7 0u64 into r8; - cast r6 r8 into r9 as Optional__DmN5CQ9hzeK; - ternary r9.is_some r9.val 0u64 into r10; - is.eq r10 42u64 into r11; - assert.eq r11 true; + assert.eq r1 true; + is.eq r3 42u64 into r4; + assert.eq r4 true; + contains storage_demo.aleo/counter__[false] into r5; + get.or_use storage_demo.aleo/counter__[false] 0u64 into r6; + ternary r5 r6 0u64 into r7; + ternary r5 r7 0u64 into r8; + is.eq r8 42u64 into r9; + assert.eq r9 true; function bump_counter_from_unset: call storage_demo.aleo/bump_counter into r0; @@ -149,10 +140,9 @@ finalize bump_counter_from_unset: contains storage_demo.aleo/counter__[false] into r1; get.or_use storage_demo.aleo/counter__[false] 0u64 into r2; ternary r1 r2 0u64 into r3; - cast r1 r3 into r4 as Optional__DmN5CQ9hzeK; - assert.eq r4.is_some true; - is.eq r4.val 1u64 into r5; - assert.eq r5 true; + assert.eq r1 true; + is.eq r3 1u64 into r4; + assert.eq r4 true; function bump_counter_twice: call storage_demo.aleo/bump_counter into r0; @@ -168,10 +158,9 @@ finalize bump_counter_twice: contains storage_demo.aleo/counter__[false] into r2; get.or_use storage_demo.aleo/counter__[false] 0u64 into r3; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - assert.eq r5.is_some true; - is.eq r5.val 2u64 into r6; - assert.eq r6 true; + assert.eq r2 true; + is.eq r4 2u64 into r5; + assert.eq r5 true; function clear_counter_resets_default: call storage_demo.aleo/set_counter 99u64 into r0; @@ -187,10 +176,9 @@ finalize clear_counter_resets_default: contains storage_demo.aleo/counter__[false] into r2; get.or_use storage_demo.aleo/counter__[false] 0u64 into r3; ternary r2 r3 0u64 into r4; - cast r2 r4 into r5 as Optional__DmN5CQ9hzeK; - ternary r5.is_some r5.val 0u64 into r6; - is.eq r6 0u64 into r7; - assert.eq r7 true; + ternary r2 r4 0u64 into r5; + is.eq r5 0u64 into r6; + assert.eq r6 true; function set_and_read_tiny: call storage_demo.aleo/set_tiny 255u8 into r0; @@ -203,10 +191,9 @@ finalize set_and_read_tiny: contains storage_demo.aleo/tiny__[false] into r1; get.or_use storage_demo.aleo/tiny__[false] 0u8 into r2; ternary r1 r2 0u8 into r3; - cast r1 r3 into r4 as Optional__3aph2JMPtnA; - assert.eq r4.is_some true; - is.eq r4.val 255u8 into r5; - assert.eq r5 true; + assert.eq r1 true; + is.eq r3 255u8 into r4; + assert.eq r4 true; function set_and_read_signed: call storage_demo.aleo/set_signed -1234i64 into r0; @@ -219,10 +206,9 @@ finalize set_and_read_signed: contains storage_demo.aleo/signed__[false] into r1; get.or_use storage_demo.aleo/signed__[false] 0i64 into r2; ternary r1 r2 0i64 into r3; - cast r1 r3 into r4 as Optional__GfbJUku6XoG; - assert.eq r4.is_some true; - is.eq r4.val -1234i64 into r5; - assert.eq r5 true; + assert.eq r1 true; + is.eq r3 -1234i64 into r4; + assert.eq r4 true; function set_and_read_tag: call storage_demo.aleo/set_tag aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px into r0; @@ -236,10 +222,9 @@ finalize set_and_read_tag: contains storage_demo.aleo/tag__[false] into r2; get.or_use storage_demo.aleo/tag__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r3; ternary r2 r3 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r4; - cast r2 r4 into r5 as Optional__6wU7KHJhSvv; - assert.eq r5.is_some true; - is.eq r5.val r1 into r6; - assert.eq r6 true; + assert.eq r2 true; + is.eq r4 r1 into r5; + assert.eq r5 true; function set_and_read_marker: call storage_demo.aleo/set_marker 7field into r0; @@ -252,10 +237,9 @@ finalize set_and_read_marker: contains storage_demo.aleo/marker__[false] into r1; get.or_use storage_demo.aleo/marker__[false] 0field into r2; ternary r1 r2 0field into r3; - cast r1 r3 into r4 as Optional__7o6su2Uhzht; - assert.eq r4.is_some true; - is.eq r4.val 7field into r5; - assert.eq r5 true; + assert.eq r1 true; + is.eq r3 7field into r4; + assert.eq r4 true; function set_and_read_pivot: call storage_demo.aleo/set_pivot 2group into r0; @@ -269,10 +253,9 @@ finalize set_and_read_pivot: contains storage_demo.aleo/pivot__[false] into r2; get.or_use storage_demo.aleo/pivot__[false] 0group into r3; ternary r2 r3 0group into r4; - cast r2 r4 into r5 as Optional__9SsWRr2WG5s; - assert.eq r5.is_some true; - is.eq r5.val r1 into r6; - assert.eq r6 true; + assert.eq r2 true; + is.eq r4 r1 into r5; + assert.eq r5 true; function set_and_read_point: cast -5i64 9i64 into r0 as storage_demo.aleo/Point; @@ -290,12 +273,11 @@ finalize set_and_read_point: ternary r1 r3.x r4.x into r5; ternary r1 r3.y r4.y into r6; cast r5 r6 into r7 as storage_demo.aleo/Point; - cast r1 r7 into r8 as Optional__7G49nMxvEkY; - assert.eq r8.is_some true; - is.eq r8.val.x -5i64 into r9; + assert.eq r1 true; + is.eq r7.x -5i64 into r8; + assert.eq r8 true; + is.eq r7.y 9i64 into r9; assert.eq r9 true; - is.eq r8.val.y 9i64 into r10; - assert.eq r10 true; function set_and_read_quad: cast 1u32 2u32 3u32 4u32 into r0 as [u32; 4u32]; @@ -314,16 +296,15 @@ finalize set_and_read_quad: ternary r1 r3[2u32] r2[2u32] into r6; ternary r1 r3[3u32] r2[3u32] into r7; cast r4 r5 r6 r7 into r8 as [u32; 4u32]; - cast r1 r8 into r9 as Optional__BnktEVOqVZ2; - assert.eq r9.is_some true; - is.eq r9.val[0u32] 1u32 into r10; + assert.eq r1 true; + is.eq r8[0u32] 1u32 into r9; + assert.eq r9 true; + is.eq r8[1u32] 2u32 into r10; assert.eq r10 true; - is.eq r9.val[1u32] 2u32 into r11; + is.eq r8[2u32] 3u32 into r11; assert.eq r11 true; - is.eq r9.val[2u32] 3u32 into r12; + is.eq r8[3u32] 4u32 into r12; assert.eq r12 true; - is.eq r9.val[3u32] 4u32 into r13; - assert.eq r13 true; function vector_starts_empty: async vector_starts_empty into r0; @@ -337,10 +318,9 @@ finalize vector_starts_empty: lt 0u32 r2 into r3; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r4; ternary r3 r4 0u32 into r5; - cast r3 r5 into r6 as Optional__JzunLORyB8U; - ternary r6.is_some r6.val 0u32 into r7; - is.eq r7 0u32 into r8; - assert.eq r8 true; + ternary r3 r5 0u32 into r6; + is.eq r6 0u32 into r7; + assert.eq r7 true; function push_then_len_and_get: call storage_demo.aleo/push_history 10u32 into r0; @@ -363,34 +343,30 @@ finalize push_then_len_and_get: lt 0u32 r5 into r6; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r7; ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - assert.eq r9.is_some true; - is.eq r9.val 10u32 into r10; - assert.eq r10 true; - get.or_use storage_demo.aleo/history__len__[false] 0u32 into r11; - lt 1u32 r11 into r12; - get.or_use storage_demo.aleo/history__[1u32] 0u32 into r13; - ternary r12 r13 0u32 into r14; - cast r12 r14 into r15 as Optional__JzunLORyB8U; - assert.eq r15.is_some true; - is.eq r15.val 20u32 into r16; + assert.eq r6 true; + is.eq r8 10u32 into r9; + assert.eq r9 true; + get.or_use storage_demo.aleo/history__len__[false] 0u32 into r10; + lt 1u32 r10 into r11; + get.or_use storage_demo.aleo/history__[1u32] 0u32 into r12; + ternary r11 r12 0u32 into r13; + assert.eq r11 true; + is.eq r13 20u32 into r14; + assert.eq r14 true; + get.or_use storage_demo.aleo/history__len__[false] 0u32 into r15; + lt 2u32 r15 into r16; + get.or_use storage_demo.aleo/history__[2u32] 0u32 into r17; + ternary r16 r17 0u32 into r18; assert.eq r16 true; - get.or_use storage_demo.aleo/history__len__[false] 0u32 into r17; - lt 2u32 r17 into r18; - get.or_use storage_demo.aleo/history__[2u32] 0u32 into r19; - ternary r18 r19 0u32 into r20; - cast r18 r20 into r21 as Optional__JzunLORyB8U; - assert.eq r21.is_some true; - is.eq r21.val 30u32 into r22; - assert.eq r22 true; - get.or_use storage_demo.aleo/history__len__[false] 0u32 into r23; - lt 3u32 r23 into r24; - get.or_use storage_demo.aleo/history__[3u32] 0u32 into r25; - ternary r24 r25 0u32 into r26; - cast r24 r26 into r27 as Optional__JzunLORyB8U; - ternary r27.is_some r27.val 0u32 into r28; - is.eq r28 0u32 into r29; - assert.eq r29 true; + is.eq r18 30u32 into r19; + assert.eq r19 true; + get.or_use storage_demo.aleo/history__len__[false] 0u32 into r20; + lt 3u32 r20 into r21; + get.or_use storage_demo.aleo/history__[3u32] 0u32 into r22; + ternary r21 r22 0u32 into r23; + ternary r21 r23 0u32 into r24; + is.eq r24 0u32 into r25; + assert.eq r25 true; function pop_drops_last_element: call storage_demo.aleo/push_history 7u32 into r0; @@ -413,10 +389,9 @@ finalize pop_drops_last_element: lt 0u32 r5 into r6; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r7; ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - assert.eq r9.is_some true; - is.eq r9.val 7u32 into r10; - assert.eq r10 true; + assert.eq r6 true; + is.eq r8 7u32 into r9; + assert.eq r9 true; function set_replaces_slot: call storage_demo.aleo/push_history 100u32 into r0; @@ -439,18 +414,16 @@ finalize set_replaces_slot: lt 0u32 r5 into r6; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r7; ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - assert.eq r9.is_some true; - is.eq r9.val 100u32 into r10; - assert.eq r10 true; - get.or_use storage_demo.aleo/history__len__[false] 0u32 into r11; - lt 1u32 r11 into r12; - get.or_use storage_demo.aleo/history__[1u32] 0u32 into r13; - ternary r12 r13 0u32 into r14; - cast r12 r14 into r15 as Optional__JzunLORyB8U; - assert.eq r15.is_some true; - is.eq r15.val 999u32 into r16; - assert.eq r16 true; + assert.eq r6 true; + is.eq r8 100u32 into r9; + assert.eq r9 true; + get.or_use storage_demo.aleo/history__len__[false] 0u32 into r10; + lt 1u32 r10 into r11; + get.or_use storage_demo.aleo/history__[1u32] 0u32 into r12; + ternary r11 r12 0u32 into r13; + assert.eq r11 true; + is.eq r13 999u32 into r14; + assert.eq r14 true; function swap_remove_pulls_last: call storage_demo.aleo/push_history 1u32 into r0; @@ -479,26 +452,23 @@ finalize swap_remove_pulls_last: lt 0u32 r7 into r8; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r9; ternary r8 r9 0u32 into r10; - cast r8 r10 into r11 as Optional__JzunLORyB8U; - assert.eq r11.is_some true; - is.eq r11.val 1u32 into r12; - assert.eq r12 true; - get.or_use storage_demo.aleo/history__len__[false] 0u32 into r13; - lt 1u32 r13 into r14; - get.or_use storage_demo.aleo/history__[1u32] 0u32 into r15; - ternary r14 r15 0u32 into r16; - cast r14 r16 into r17 as Optional__JzunLORyB8U; - assert.eq r17.is_some true; - is.eq r17.val 4u32 into r18; + assert.eq r8 true; + is.eq r10 1u32 into r11; + assert.eq r11 true; + get.or_use storage_demo.aleo/history__len__[false] 0u32 into r12; + lt 1u32 r12 into r13; + get.or_use storage_demo.aleo/history__[1u32] 0u32 into r14; + ternary r13 r14 0u32 into r15; + assert.eq r13 true; + is.eq r15 4u32 into r16; + assert.eq r16 true; + get.or_use storage_demo.aleo/history__len__[false] 0u32 into r17; + lt 2u32 r17 into r18; + get.or_use storage_demo.aleo/history__[2u32] 0u32 into r19; + ternary r18 r19 0u32 into r20; assert.eq r18 true; - get.or_use storage_demo.aleo/history__len__[false] 0u32 into r19; - lt 2u32 r19 into r20; - get.or_use storage_demo.aleo/history__[2u32] 0u32 into r21; - ternary r20 r21 0u32 into r22; - cast r20 r22 into r23 as Optional__JzunLORyB8U; - assert.eq r23.is_some true; - is.eq r23.val 3u32 into r24; - assert.eq r24 true; + is.eq r20 3u32 into r21; + assert.eq r21 true; function clear_resets_length: call storage_demo.aleo/push_history 1u32 into r0; @@ -521,10 +491,9 @@ finalize clear_resets_length: lt 0u32 r5 into r6; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r7; ternary r6 r7 0u32 into r8; - cast r6 r8 into r9 as Optional__JzunLORyB8U; - ternary r9.is_some r9.val 0u32 into r10; - is.eq r10 0u32 into r11; - assert.eq r11 true; + ternary r6 r8 0u32 into r9; + is.eq r9 0u32 into r10; + assert.eq r10 true; function unwrap_unset_singleton_halts: async unwrap_unset_singleton_halts into r0; @@ -534,10 +503,9 @@ finalize unwrap_unset_singleton_halts: contains storage_demo.aleo/counter__[false] into r0; get.or_use storage_demo.aleo/counter__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - cast r0 r2 into r3 as Optional__DmN5CQ9hzeK; - assert.eq r3.is_some true; - is.eq r3.val 0u64 into r4; - assert.eq r4 true; + assert.eq r0 true; + is.eq r2 0u64 into r3; + assert.eq r3 true; function unwrap_oob_get_halts: async unwrap_oob_get_halts into r0; @@ -548,10 +516,9 @@ finalize unwrap_oob_get_halts: lt 0u32 r0 into r1; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r2; ternary r1 r2 0u32 into r3; - cast r1 r3 into r4 as Optional__JzunLORyB8U; - assert.eq r4.is_some true; - is.eq r4.val 0u32 into r5; - assert.eq r5 true; + assert.eq r1 true; + is.eq r3 0u32 into r4; + assert.eq r4 true; constructor: assert.eq edition 0u16; From c0d02760f7446d51b0918545b997f25d8e8364da Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sun, 21 Jun 2026 20:10:22 +0800 Subject: [PATCH 38/65] Forward SSA composite aliases generally --- crates/passes/src/ssa_const_propagation/ast.rs | 4 ---- crates/passes/src/ssa_const_propagation/visitor.rs | 4 ---- .../composite_alias_field_forwarding.out | 5 ++--- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index abf862ee3e4..5a99881045f 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -22,7 +22,6 @@ use super::{ TrackedTernary, is_atom, is_one_literal, - is_optional_field, is_optional_wrapper_type, is_zero_literal, same_ssa_atom, @@ -83,9 +82,6 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { return (input.into(), None); } let name = self.resolve_composite_alias(original_name); - if name != original_name && !is_optional_field(input.name.name) { - return (input.into(), None); - } let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 369dd47efdc..a8a79f68b82 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -68,10 +68,6 @@ pub(super) fn is_optional_wrapper_type(ty: &leo_ast::Type) -> bool { ) } -pub(super) fn is_optional_field(name: Symbol) -> bool { - name == Symbol::intern("is_some") || name == Symbol::intern("val") -} - /// Parse a numeric literal string, handling underscores and radix prefixes (0x, 0o, 0b). fn parse_literal_value(s: &str) -> Option { let clean = s.replace('_', ""); diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index 25c7d85ae8b..d76e95f663f 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -9,10 +9,9 @@ program test.aleo { fn alias_field(p$$0: u32, q$$1: u32) -> u32 { let s$#2 = test.aleo::Pair { a: p$$0, b: q$$1 }; let alias$#3 = s$#2; - let $var$4 = alias$#3.a; - let $var$5 = alias$#3.b; + let $var$4 = p$$0; + let $var$5 = q$$1; let $var$6 = $var$4 + $var$5; return $var$6; } } - From 29b7078227bcdac986c6ef87e6967cc038c26de5 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Sun, 21 Jun 2026 20:25:38 +0800 Subject: [PATCH 39/65] Fold redundant generated ternaries --- .../passes/src/peephole_optimization/mod.rs | 30 +++++++++++++++++++ .../storage/vector_get_unwrap_or_minimal.out | 3 +- .../nested_ternary_absorption.out | 1 - 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/crates/passes/src/peephole_optimization/mod.rs b/crates/passes/src/peephole_optimization/mod.rs index bef0c28ac3e..6e20085e4e1 100644 --- a/crates/passes/src/peephole_optimization/mod.rs +++ b/crates/passes/src/peephole_optimization/mod.rs @@ -22,6 +22,7 @@ //! - **Identity operation folding**: eliminates `add x 0`, `mul x 1`, `or x false`, etc. //! - **Trivial assert elimination**: removes `assert.eq ` when both sides are equal, //! preserving the dummy assert required for empty closures/finalizes. +//! - **Ternary absorption**: collapses redundant nested selects over the same condition. //! - **Dead register elimination**: removes pure instructions whose destination register is never read. //! - **Consecutive cast folding**: merges adjacent casts through the same intermediate register. //! - **Register renumbering**: compacts register indices after instruction removal. @@ -44,6 +45,7 @@ impl Pass for PeepholeOptimizing { input.for_each_statement_list(|stmts, num_inputs| { fold_identity_operations(stmts); eliminate_trivial_asserts(stmts); + fold_redundant_ternaries(stmts); eliminate_dead_registers(stmts); fold_consecutive_casts(stmts); renumber_registers(stmts, num_inputs); @@ -431,6 +433,34 @@ fn eliminate_trivial_asserts(stmts: &mut Vec) { } } +// Ternary absorption + +fn fold_redundant_ternaries(stmts: &mut [AleoStmt]) { + let mut ternaries: HashMap = HashMap::new(); + + for stmt in stmts { + if let AleoStmt::Ternary(condition, if_true, if_false, dest) = stmt { + if let AleoExpr::Reg(inner) = if_true.clone() + && let Some((inner_condition, inner_true, inner_false)) = ternaries.get(&inner) + && condition == inner_condition + && if_false == inner_false + { + *if_true = inner_true.clone(); + } + + if let AleoExpr::Reg(inner) = if_false.clone() + && let Some((inner_condition, inner_true, inner_false)) = ternaries.get(&inner) + && condition == inner_condition + && if_true == inner_true + { + *if_false = inner_false.clone(); + } + + ternaries.insert(dest.clone(), (condition.clone(), if_true.clone(), if_false.clone())); + } + } +} + // Dead register elimination /// Collect all registers that are read (used as operands) in a statement. diff --git a/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out b/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out index bf0ad52e8d1..39e1505c0cd 100644 --- a/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out +++ b/tests/expectations/compiler/storage/vector_get_unwrap_or_minimal.out @@ -27,8 +27,7 @@ finalize read_one: lt r0 r1 into r2; get.or_use data__[r0] 0u8 into r3; ternary r2 r3 0u8 into r4; - ternary r2 r4 0u8 into r5; - set r5 into result[false]; + set r4 into result[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 126d90b2d54..01698b2727e 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,4 +23,3 @@ program test.aleo { return $var$21; } } - From 9387a0fc7e62ae0128dd26ee735464e40ca999e9 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 02:14:47 +0800 Subject: [PATCH 40/65] Refresh ternary absorption expectations --- .../passes/src/ssa_const_propagation/ast.rs | 22 +- .../cei/blind_storage_read_in_helper.out | 3 +- .../cei/class2_storage_stale_read_warn.out | 5 +- ...3_external_storage_read_after_run_warn.out | 8 +- .../basic_const_generic_structs.out | 15 +- .../compiler/examples/tictactoe.out | 54 +- .../compiler/expression/cast_coersion.out | 17 +- .../flatten_inlined_tuples_of_structs.out | 53 +- .../compiler/function/flatten_test.out | 327 +++++----- .../function/flatten_tuples_of_structs.out | 53 +- .../libraries/aleo_stub_struct_in_storage.out | 7 +- .../deep_nested_lib_struct_in_storage.out | 12 +- .../libraries/leo_stub_struct_in_storage.out | 7 +- .../lib_fn_cross_lib_with_struct.out | 9 +- .../libraries/lib_fn_struct_call_chain.out | 9 +- .../lib_fn_uses_lib_struct_locally.out | 5 +- .../compiler/libraries/lib_fn_with_struct.out | 9 +- .../lib_nested_struct_in_storage.out | 11 +- .../libraries/lib_struct_field_optional.out | 4 +- .../libraries/lib_struct_in_storage.out | 10 +- .../lib_struct_optional_local_binding.out | 3 +- ...b_submodule_optional_wrapper_placement.out | 5 +- .../lib_submodule_struct_in_storage.out | 11 +- .../libraries/lib_submodule_with_struct.out | 6 +- .../nested_lib_struct_in_storage.out | 13 +- .../libraries/nested_library_structs.out | 30 +- .../expectations/compiler/modules/complex.out | 8 +- .../compiler/option/all_types.out | 35 +- tests/expectations/compiler/option/b28961.out | 10 +- .../compiler/option/implicit_wrapping.out | 76 ++- .../compiler/option/in_modules.out | 158 +++-- .../compiler/option/unwrap_or_deep.out | 89 ++- .../compiler/statements/assign.out | 3 +- .../compiler/storage/aggregates.out | 348 ++++++----- .../compiler/storage/counter_storage.out | 17 +- .../compiler/storage/external_storage.out | 559 +++++++++--------- .../storage/external_storage_multi_deps.out | 28 +- .../compiler/storage/primitives.out | 50 +- .../expectations/compiler/storage/signed.out | 47 +- .../compiler/storage/unsigned.out | 47 +- .../external_program_cross_module_combo.out | 10 +- .../type_inference/basic_inference.out | 2 +- .../view/view_uses_storage_and_vector.out | 3 +- tests/expectations/execution/array_write.out | 53 +- .../expectations/execution/cast_coersion.out | 17 +- .../expectations/execution/complex_vector.out | 138 ++--- .../execution/counter_storage.out | 25 +- .../execution/dynamic_call_future.out | 5 +- .../dynamic_call_future_with_extra_args.out | 5 +- .../dynamic_call_multiple_same_target.out | 5 +- .../dynamic_dispatch_intrinsic_future.out | 5 +- .../execution/dynamic_storage_interface.out | 13 +- 52 files changed, 1099 insertions(+), 1365 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 5a99881045f..dc1cfed55c0 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -18,14 +18,7 @@ use crate::expression_can_be_discarded; use super::{ SsaConstPropagationVisitor, - visitor::{ - TrackedTernary, - is_atom, - is_one_literal, - is_optional_wrapper_type, - is_zero_literal, - same_ssa_atom, - }, + visitor::{TrackedTernary, is_atom, is_one_literal, is_optional_wrapper_type, is_zero_literal, same_ssa_atom}, }; use leo_ast::{ @@ -637,11 +630,14 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && is_atom(&ternary.if_true) && is_atom(&ternary.if_false) { - self.ternaries.insert(identifier.name, TrackedTernary { - condition: ternary.condition.clone(), - if_true: ternary.if_true.clone(), - if_false: ternary.if_false.clone(), - }); + self.ternaries.insert( + identifier.name, + TrackedTernary { + condition: ternary.condition.clone(), + if_true: ternary.if_true.clone(), + if_false: ternary.if_false.clone(), + }, + ); } if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) diff --git a/tests/expectations/compiler/cei/blind_storage_read_in_helper.out b/tests/expectations/compiler/cei/blind_storage_read_in_helper.out index 26ac382cc77..f19724772c3 100644 --- a/tests/expectations/compiler/cei/blind_storage_read_in_helper.out +++ b/tests/expectations/compiler/cei/blind_storage_read_in_helper.out @@ -52,8 +52,7 @@ finalize do_work: contains counter__[false] into r1; get.or_use counter__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - ternary r1 r3 0u32 into r4; - set r4 into balances[0u32]; + set r3 into balances[0u32]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out b/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out index cdf49341f12..9cf44eff482 100644 --- a/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out +++ b/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out @@ -48,10 +48,9 @@ finalize do_work: contains counter__[false] into r2; get.or_use counter__[false] 0u32 into r3; ternary r2 r3 0u32 into r4; - ternary r2 r4 0u32 into r5; await r0; - add r5 r1 into r6; - set r6 into counter__[false]; + add r4 r1 into r5; + set r5 into counter__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out b/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out index 3bf8272278c..505137b640a 100644 --- a/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out +++ b/tests/expectations/compiler/cei/class3_external_storage_read_after_run_warn.out @@ -34,9 +34,8 @@ finalize bump: contains dep_counter__[false] into r0; get.or_use dep_counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - ternary r0 r2 0u32 into r3; - add r3 1u32 into r4; - set r4 into dep_counter__[false]; + add r2 1u32 into r3; + set r3 into dep_counter__[false]; constructor: assert.eq edition 0u16; @@ -63,8 +62,7 @@ finalize do_work: contains dep.aleo/dep_counter__[false] into r1; get.or_use dep.aleo/dep_counter__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - ternary r1 r3 0u32 into r4; - set r4 into my_counter__[false]; + set r3 into my_counter__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/const_generics/basic_const_generic_structs.out b/tests/expectations/compiler/const_generics/basic_const_generic_structs.out index 0bf79d519cd..a534a4aa591 100644 --- a/tests/expectations/compiler/const_generics/basic_const_generic_structs.out +++ b/tests/expectations/compiler/const_generics/basic_const_generic_structs.out @@ -35,15 +35,12 @@ function main: input r1 as Baz.private; input r2 as u32.private; cast 42u32 42u32 42u32 42u32 42u32 42u32 into r3 as [u32; 6u32]; - cast r3 into r4 as Foo__9mDhqPfVudH; - cast 3u32 3u32 3u32 3u32 3u32 3u32 3u32 3u32 into r5 as [u32; 8u32]; - cast 42u32 42u32 42u32 42u32 42u32 42u32 42u32 42u32 42u32 into r6 as [u32; 9u32]; - cast r6 into r7 as Foo__D1bzlHdvaiB; - cast r7 into r8 as Goo__66lvYV7poRf; - add r0.f.arr[6u32] r5[7u32] into r9; - add r9 r4.arr[5u32] into r10; - add r10 r8.f.arr[8u32] into r11; - output r11 as u32.private; + cast 3u32 3u32 3u32 3u32 3u32 3u32 3u32 3u32 into r4 as [u32; 8u32]; + cast 42u32 42u32 42u32 42u32 42u32 42u32 42u32 42u32 42u32 into r5 as [u32; 9u32]; + add r0.f.arr[6u32] r4[7u32] into r6; + add r6 r3[5u32] into r7; + add r7 r5[8u32] into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/examples/tictactoe.out b/tests/expectations/compiler/examples/tictactoe.out index b9b63ee1e77..9f9c0c3fd8e 100644 --- a/tests/expectations/compiler/examples/tictactoe.out +++ b/tests/expectations/compiler/examples/tictactoe.out @@ -149,36 +149,30 @@ function make_move: not r72 into r73; call check_for_win r71 2u8 into r74; and r73 r74 into r75; - ternary r75 r71.r1.c1 r71.r1.c1 into r76; - ternary r75 r71.r1.c2 r71.r1.c2 into r77; - ternary r75 r71.r1.c3 r71.r1.c3 into r78; - cast r76 r77 r78 into r79 as Row; - ternary r75 r71.r2.c1 r71.r2.c1 into r80; - ternary r75 r71.r2.c2 r71.r2.c2 into r81; - ternary r75 r71.r2.c3 r71.r2.c3 into r82; - cast r80 r81 r82 into r83 as Row; - ternary r75 r71.r3.c1 r71.r3.c1 into r84; - ternary r75 r71.r3.c2 r71.r3.c2 into r85; - ternary r75 r71.r3.c3 r71.r3.c3 into r86; - cast r84 r85 r86 into r87 as Row; - cast r79 r83 r87 into r88 as Board; - ternary r72 r71.r1.c1 r88.r1.c1 into r89; - ternary r72 r71.r1.c2 r88.r1.c2 into r90; - ternary r72 r71.r1.c3 r88.r1.c3 into r91; - cast r89 r90 r91 into r92 as Row; - ternary r72 r71.r2.c1 r88.r2.c1 into r93; - ternary r72 r71.r2.c2 r88.r2.c2 into r94; - ternary r72 r71.r2.c3 r88.r2.c3 into r95; - cast r93 r94 r95 into r96 as Row; - ternary r72 r71.r3.c1 r88.r3.c1 into r97; - ternary r72 r71.r3.c2 r88.r3.c2 into r98; - ternary r72 r71.r3.c3 r88.r3.c3 into r99; - cast r97 r98 r99 into r100 as Row; - cast r92 r96 r100 into r101 as Board; - ternary r75 2u8 0u8 into r102; - ternary r72 1u8 r102 into r103; - output r101 as Board.private; - output r103 as u8.private; + ternary r75 r61 r61 into r76; + ternary r75 r62 r62 into r77; + ternary r75 r63 r63 into r78; + ternary r75 r64 r64 into r79; + ternary r75 r65 r65 into r80; + ternary r75 r66 r66 into r81; + ternary r75 r67 r67 into r82; + ternary r72 r61 r76 into r83; + ternary r72 r62 r77 into r84; + ternary r72 r63 r78 into r85; + cast r83 r84 r85 into r86 as Row; + ternary r72 r64 r79 into r87; + ternary r72 r65 r80 into r88; + ternary r72 r66 r81 into r89; + cast r87 r88 r89 into r90 as Row; + ternary r72 r67 r82 into r91; + ternary r72 r65 r80 into r92; + ternary r72 r66 r81 into r93; + cast r91 r92 r93 into r94 as Row; + cast r86 r90 r94 into r95 as Board; + ternary r75 2u8 0u8 into r96; + ternary r72 1u8 r96 into r97; + output r95 as Board.private; + output r97 as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/expression/cast_coersion.out b/tests/expectations/compiler/expression/cast_coersion.out index 3e0d3597c94..a4bdf0d59c0 100644 --- a/tests/expectations/compiler/expression/cast_coersion.out +++ b/tests/expectations/compiler/expression/cast_coersion.out @@ -8,16 +8,13 @@ function main: input r1 as group.private; input r2 as address.private; cast r1 into r3 as field; - cast r3 into r4 as foo; - cast 1field into r5 as foo; - cast r2 into r6 as field; - cast r6 into r7 as foo; - ternary r0 r4.data r4.data into r8; - cast r8 into r9 as foo; - ternary r0 r5.data r7.data into r10; - cast r10 into r11 as foo; - output r9 as foo.private; - output r11 as foo.private; + cast r2 into r4 as field; + ternary r0 r3 r3 into r5; + cast r5 into r6 as foo; + ternary r0 1field r4 into r7; + cast r7 into r8 as foo; + output r6 as foo.private; + output r8 as foo.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/function/flatten_inlined_tuples_of_structs.out b/tests/expectations/compiler/function/flatten_inlined_tuples_of_structs.out index ee575b17123..2b2e7ddf2b0 100644 --- a/tests/expectations/compiler/function/flatten_inlined_tuples_of_structs.out +++ b/tests/expectations/compiler/function/flatten_inlined_tuples_of_structs.out @@ -11,21 +11,18 @@ struct Data: closure foo: input r0 as u8; input r1 as u8; - cast r0 into r2 as Extra; - cast r0 r1 r2 into r3 as Data; - is.eq r0 r1 into r4; - add r0 r1 into r5; - sub r0 r1 into r6; - ternary r4 r3.c.c r3.c.c into r7; - cast r7 into r8 as Extra; - ternary r4 r3.a r3.a into r9; - ternary r4 r3.b r3.b into r10; - cast r9 r10 r8 into r11 as Data; - ternary r4 r0 r5 into r12; - ternary r4 r1 r6 into r13; - output r12 as u8; - output r13 as u8; - output r11 as Data; + is.eq r0 r1 into r2; + add r0 r1 into r3; + sub r0 r1 into r4; + ternary r2 r0 r0 into r5; + cast r5 into r6 as Extra; + ternary r2 r1 r1 into r7; + cast r5 r7 r6 into r8 as Data; + ternary r2 r0 r3 into r9; + ternary r2 r1 r4 into r10; + output r9 as u8; + output r10 as u8; + output r8 as Data; function bar: input r0 as boolean.private; @@ -39,20 +36,18 @@ function bar: ternary r1 r10 r13 into r16; ternary r1 r11 r14 into r17; ternary r1 r12.c.c r15.c.c into r18; - cast r18 into r19 as Extra; - ternary r1 r12.a r15.a into r20; - ternary r1 r12.b r15.b into r21; - cast r20 r21 r19 into r22 as Data; - ternary r0 r7 r16 into r23; - ternary r0 r8 r17 into r24; - ternary r0 r9.c.c r22.c.c into r25; - cast r25 into r26 as Extra; - ternary r0 r9.a r22.a into r27; - ternary r0 r9.b r22.b into r28; - cast r27 r28 r26 into r29 as Data; - output r23 as u8.private; - output r24 as u8.private; - output r29 as Data.private; + ternary r1 r12.a r15.a into r19; + ternary r1 r12.b r15.b into r20; + ternary r0 r7 r16 into r21; + ternary r0 r8 r17 into r22; + ternary r0 r9.c.c r18 into r23; + cast r23 into r24 as Extra; + ternary r0 r9.a r19 into r25; + ternary r0 r9.b r20 into r26; + cast r25 r26 r24 into r27 as Data; + output r21 as u8.private; + output r22 as u8.private; + output r27 as Data.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/function/flatten_test.out b/tests/expectations/compiler/function/flatten_test.out index a27420598b0..0924f72d0fc 100644 --- a/tests/expectations/compiler/function/flatten_test.out +++ b/tests/expectations/compiler/function/flatten_test.out @@ -72,194 +72,149 @@ function main: and r4 r5 into r6; is.eq r3.r1.e1 0u8 into r7; and r6 r7 into r8; - cast r0 r3.r1.e2 r3.r1.e3 into r9 as Row; - is.eq r2 2u8 into r10; - and r4 r10 into r11; - is.eq r3.r1.e2 0u8 into r12; - and r11 r12 into r13; - cast r3.r1.e1 r0 r3.r1.e3 into r14 as Row; - is.eq r2 3u8 into r15; - and r4 r15 into r16; - is.eq r3.r1.e3 0u8 into r17; - and r16 r17 into r18; - cast r3.r1.e1 r3.r1.e2 r0 into r19 as Row; - is.eq r1 2u8 into r20; - and r20 r5 into r21; - is.eq r3.r2.e1 0u8 into r22; + is.eq r2 2u8 into r9; + and r4 r9 into r10; + is.eq r3.r1.e2 0u8 into r11; + and r10 r11 into r12; + is.eq r2 3u8 into r13; + and r4 r13 into r14; + is.eq r3.r1.e3 0u8 into r15; + and r14 r15 into r16; + is.eq r1 2u8 into r17; + and r17 r5 into r18; + is.eq r3.r2.e1 0u8 into r19; + and r18 r19 into r20; + and r17 r9 into r21; + is.eq r3.r2.e2 0u8 into r22; and r21 r22 into r23; - cast r0 r3.r2.e2 r3.r2.e3 into r24 as Row; - and r20 r10 into r25; - is.eq r3.r2.e2 0u8 into r26; - and r25 r26 into r27; - cast r3.r2.e1 r0 r3.r2.e3 into r28 as Row; - and r20 r15 into r29; - is.eq r3.r2.e3 0u8 into r30; - and r29 r30 into r31; - cast r3.r2.e1 r3.r2.e2 r0 into r32 as Row; - is.eq r1 3u8 into r33; - and r33 r5 into r34; - is.eq r3.r3.e1 0u8 into r35; + and r17 r13 into r24; + is.eq r3.r2.e3 0u8 into r25; + and r24 r25 into r26; + is.eq r1 3u8 into r27; + and r27 r5 into r28; + is.eq r3.r3.e1 0u8 into r29; + and r28 r29 into r30; + and r27 r9 into r31; + is.eq r3.r3.e2 0u8 into r32; + and r31 r32 into r33; + and r27 r13 into r34; + is.eq r3.r3.e3 0u8 into r35; and r34 r35 into r36; - cast r0 r3.r3.e2 r3.r3.e3 into r37 as Row; - and r33 r10 into r38; - is.eq r3.r3.e2 0u8 into r39; - and r38 r39 into r40; - cast r3.r3.e1 r0 r3.r3.e3 into r41 as Row; - and r33 r15 into r42; - is.eq r3.r3.e3 0u8 into r43; - and r42 r43 into r44; - cast r3.r3.e1 r3.r3.e2 r0 into r45 as Row; - ternary r44 r3.r1.e1 r3.r1.e1 into r46; - ternary r44 r3.r1.e2 r3.r1.e2 into r47; - ternary r44 r3.r1.e3 r3.r1.e3 into r48; - cast r46 r47 r48 into r49 as Row; - ternary r44 r3.r2.e1 r3.r2.e1 into r50; - ternary r44 r3.r2.e2 r3.r2.e2 into r51; - ternary r44 r3.r2.e3 r3.r2.e3 into r52; - cast r50 r51 r52 into r53 as Row; - ternary r44 r45.e1 r3.r3.e1 into r54; - ternary r44 r45.e2 r3.r3.e2 into r55; - ternary r44 r45.e3 r3.r3.e3 into r56; - cast r54 r55 r56 into r57 as Row; - cast r49 r53 r57 into r58 as Board; - ternary r40 r3.r1.e1 r58.r1.e1 into r59; - ternary r40 r3.r1.e2 r58.r1.e2 into r60; - ternary r40 r3.r1.e3 r58.r1.e3 into r61; - cast r59 r60 r61 into r62 as Row; - ternary r40 r3.r2.e1 r58.r2.e1 into r63; - ternary r40 r3.r2.e2 r58.r2.e2 into r64; - ternary r40 r3.r2.e3 r58.r2.e3 into r65; - cast r63 r64 r65 into r66 as Row; - ternary r40 r41.e1 r58.r3.e1 into r67; - ternary r40 r41.e2 r58.r3.e2 into r68; - ternary r40 r41.e3 r58.r3.e3 into r69; - cast r67 r68 r69 into r70 as Row; - cast r62 r66 r70 into r71 as Board; - ternary r36 r3.r1.e1 r71.r1.e1 into r72; - ternary r36 r3.r1.e2 r71.r1.e2 into r73; - ternary r36 r3.r1.e3 r71.r1.e3 into r74; - cast r72 r73 r74 into r75 as Row; - ternary r36 r3.r2.e1 r71.r2.e1 into r76; - ternary r36 r3.r2.e2 r71.r2.e2 into r77; - ternary r36 r3.r2.e3 r71.r2.e3 into r78; - cast r76 r77 r78 into r79 as Row; - ternary r36 r37.e1 r71.r3.e1 into r80; - ternary r36 r37.e2 r71.r3.e2 into r81; - ternary r36 r37.e3 r71.r3.e3 into r82; - cast r80 r81 r82 into r83 as Row; - cast r75 r79 r83 into r84 as Board; - ternary r31 r3.r1.e1 r84.r1.e1 into r85; - ternary r31 r3.r1.e2 r84.r1.e2 into r86; - ternary r31 r3.r1.e3 r84.r1.e3 into r87; - cast r85 r86 r87 into r88 as Row; - ternary r31 r32.e1 r84.r2.e1 into r89; - ternary r31 r32.e2 r84.r2.e2 into r90; - ternary r31 r32.e3 r84.r2.e3 into r91; - cast r89 r90 r91 into r92 as Row; - ternary r31 r3.r3.e1 r84.r3.e1 into r93; - ternary r31 r3.r3.e2 r84.r3.e2 into r94; - ternary r31 r3.r3.e3 r84.r3.e3 into r95; - cast r93 r94 r95 into r96 as Row; - cast r88 r92 r96 into r97 as Board; - ternary r27 r3.r1.e1 r97.r1.e1 into r98; - ternary r27 r3.r1.e2 r97.r1.e2 into r99; - ternary r27 r3.r1.e3 r97.r1.e3 into r100; - cast r98 r99 r100 into r101 as Row; - ternary r27 r28.e1 r97.r2.e1 into r102; - ternary r27 r28.e2 r97.r2.e2 into r103; - ternary r27 r28.e3 r97.r2.e3 into r104; - cast r102 r103 r104 into r105 as Row; - ternary r27 r3.r3.e1 r97.r3.e1 into r106; - ternary r27 r3.r3.e2 r97.r3.e2 into r107; - ternary r27 r3.r3.e3 r97.r3.e3 into r108; - cast r106 r107 r108 into r109 as Row; - cast r101 r105 r109 into r110 as Board; - ternary r23 r3.r1.e1 r110.r1.e1 into r111; - ternary r23 r3.r1.e2 r110.r1.e2 into r112; - ternary r23 r3.r1.e3 r110.r1.e3 into r113; - cast r111 r112 r113 into r114 as Row; - ternary r23 r24.e1 r110.r2.e1 into r115; - ternary r23 r24.e2 r110.r2.e2 into r116; - ternary r23 r24.e3 r110.r2.e3 into r117; - cast r115 r116 r117 into r118 as Row; - ternary r23 r3.r3.e1 r110.r3.e1 into r119; - ternary r23 r3.r3.e2 r110.r3.e2 into r120; - ternary r23 r3.r3.e3 r110.r3.e3 into r121; - cast r119 r120 r121 into r122 as Row; - cast r114 r118 r122 into r123 as Board; - ternary r18 r19.e1 r123.r1.e1 into r124; - ternary r18 r19.e2 r123.r1.e2 into r125; - ternary r18 r19.e3 r123.r1.e3 into r126; - cast r124 r125 r126 into r127 as Row; - ternary r18 r3.r2.e1 r123.r2.e1 into r128; - ternary r18 r3.r2.e2 r123.r2.e2 into r129; - ternary r18 r3.r2.e3 r123.r2.e3 into r130; - cast r128 r129 r130 into r131 as Row; - ternary r18 r3.r3.e1 r123.r3.e1 into r132; - ternary r18 r3.r3.e2 r123.r3.e2 into r133; - ternary r18 r3.r3.e3 r123.r3.e3 into r134; - cast r132 r133 r134 into r135 as Row; - cast r127 r131 r135 into r136 as Board; - ternary r13 r14.e1 r136.r1.e1 into r137; - ternary r13 r14.e2 r136.r1.e2 into r138; - ternary r13 r14.e3 r136.r1.e3 into r139; - cast r137 r138 r139 into r140 as Row; - ternary r13 r3.r2.e1 r136.r2.e1 into r141; - ternary r13 r3.r2.e2 r136.r2.e2 into r142; - ternary r13 r3.r2.e3 r136.r2.e3 into r143; - cast r141 r142 r143 into r144 as Row; - ternary r13 r3.r3.e1 r136.r3.e1 into r145; - ternary r13 r3.r3.e2 r136.r3.e2 into r146; - ternary r13 r3.r3.e3 r136.r3.e3 into r147; - cast r145 r146 r147 into r148 as Row; - cast r140 r144 r148 into r149 as Board; - ternary r8 r9.e1 r149.r1.e1 into r150; - ternary r8 r9.e2 r149.r1.e2 into r151; - ternary r8 r9.e3 r149.r1.e3 into r152; - cast r150 r151 r152 into r153 as Row; - ternary r8 r3.r2.e1 r149.r2.e1 into r154; - ternary r8 r3.r2.e2 r149.r2.e2 into r155; - ternary r8 r3.r2.e3 r149.r2.e3 into r156; - cast r154 r155 r156 into r157 as Row; - ternary r8 r3.r3.e1 r149.r3.e1 into r158; - ternary r8 r3.r3.e2 r149.r3.e2 into r159; - ternary r8 r3.r3.e3 r149.r3.e3 into r160; - cast r158 r159 r160 into r161 as Row; - cast r153 r157 r161 into r162 as Board; - call win r162 1u8 into r163; - not r163 into r164; - call win r162 2u8 into r165; - and r164 r165 into r166; - ternary r166 r162.r1.e1 r162.r1.e1 into r167; - ternary r166 r162.r1.e2 r162.r1.e2 into r168; - ternary r166 r162.r1.e3 r162.r1.e3 into r169; - cast r167 r168 r169 into r170 as Row; - ternary r166 r162.r2.e1 r162.r2.e1 into r171; - ternary r166 r162.r2.e2 r162.r2.e2 into r172; - ternary r166 r162.r2.e3 r162.r2.e3 into r173; - cast r171 r172 r173 into r174 as Row; - ternary r166 r162.r3.e1 r162.r3.e1 into r175; - ternary r166 r162.r3.e2 r162.r3.e2 into r176; - ternary r166 r162.r3.e3 r162.r3.e3 into r177; - cast r175 r176 r177 into r178 as Row; - cast r170 r174 r178 into r179 as Board; - ternary r163 r162.r1.e1 r179.r1.e1 into r180; - ternary r163 r162.r1.e2 r179.r1.e2 into r181; - ternary r163 r162.r1.e3 r179.r1.e3 into r182; - cast r180 r181 r182 into r183 as Row; - ternary r163 r162.r2.e1 r179.r2.e1 into r184; - ternary r163 r162.r2.e2 r179.r2.e2 into r185; - ternary r163 r162.r2.e3 r179.r2.e3 into r186; - cast r184 r185 r186 into r187 as Row; - ternary r163 r162.r3.e1 r179.r3.e1 into r188; - ternary r163 r162.r3.e2 r179.r3.e2 into r189; - ternary r163 r162.r3.e3 r179.r3.e3 into r190; - cast r188 r189 r190 into r191 as Row; - cast r183 r187 r191 into r192 as Board; - ternary r166 2u8 0u8 into r193; - ternary r163 1u8 r193 into r194; - output r192 as Board.private; - output r194 as u8.private; + ternary r36 r3.r1.e1 r3.r1.e1 into r37; + ternary r36 r3.r1.e2 r3.r1.e2 into r38; + ternary r36 r3.r1.e3 r3.r1.e3 into r39; + ternary r36 r3.r2.e1 r3.r2.e1 into r40; + ternary r36 r3.r2.e2 r3.r2.e2 into r41; + ternary r36 r3.r2.e3 r3.r2.e3 into r42; + ternary r36 r3.r3.e1 r3.r3.e1 into r43; + ternary r36 r3.r3.e2 r3.r3.e2 into r44; + ternary r36 r0 r3.r3.e3 into r45; + ternary r33 r3.r1.e1 r37 into r46; + ternary r33 r3.r1.e2 r38 into r47; + ternary r33 r3.r1.e3 r39 into r48; + ternary r33 r3.r2.e1 r40 into r49; + ternary r33 r3.r2.e2 r41 into r50; + ternary r33 r3.r2.e3 r42 into r51; + ternary r33 r3.r3.e1 r43 into r52; + ternary r33 r0 r44 into r53; + ternary r33 r3.r3.e3 r45 into r54; + ternary r30 r3.r1.e1 r46 into r55; + ternary r30 r3.r1.e2 r47 into r56; + ternary r30 r3.r1.e3 r48 into r57; + ternary r30 r3.r2.e1 r49 into r58; + ternary r30 r3.r2.e2 r50 into r59; + ternary r30 r3.r2.e3 r51 into r60; + ternary r30 r0 r52 into r61; + ternary r30 r3.r3.e2 r53 into r62; + ternary r30 r3.r3.e3 r54 into r63; + ternary r26 r3.r1.e1 r55 into r64; + ternary r26 r3.r1.e2 r56 into r65; + ternary r26 r3.r1.e3 r57 into r66; + ternary r26 r3.r2.e1 r58 into r67; + ternary r26 r3.r2.e2 r59 into r68; + ternary r26 r0 r60 into r69; + ternary r26 r3.r3.e1 r61 into r70; + ternary r26 r3.r3.e2 r62 into r71; + ternary r26 r3.r3.e3 r63 into r72; + ternary r23 r3.r1.e1 r64 into r73; + ternary r23 r3.r1.e2 r65 into r74; + ternary r23 r3.r1.e3 r66 into r75; + ternary r23 r3.r2.e1 r67 into r76; + ternary r23 r0 r68 into r77; + ternary r23 r3.r2.e3 r69 into r78; + ternary r23 r3.r3.e1 r70 into r79; + ternary r23 r3.r3.e2 r71 into r80; + ternary r23 r3.r3.e3 r72 into r81; + ternary r20 r3.r1.e1 r73 into r82; + ternary r20 r3.r1.e2 r74 into r83; + ternary r20 r3.r1.e3 r75 into r84; + ternary r20 r0 r76 into r85; + ternary r20 r3.r2.e2 r77 into r86; + ternary r20 r3.r2.e3 r78 into r87; + ternary r20 r3.r3.e1 r79 into r88; + ternary r20 r3.r3.e2 r80 into r89; + ternary r20 r3.r3.e3 r81 into r90; + ternary r16 r3.r1.e1 r82 into r91; + ternary r16 r3.r1.e2 r83 into r92; + ternary r16 r0 r84 into r93; + ternary r16 r3.r2.e1 r85 into r94; + ternary r16 r3.r2.e2 r86 into r95; + ternary r16 r3.r2.e3 r87 into r96; + ternary r16 r3.r3.e1 r88 into r97; + ternary r16 r3.r3.e2 r89 into r98; + ternary r16 r3.r3.e3 r90 into r99; + ternary r12 r3.r1.e1 r91 into r100; + ternary r12 r0 r92 into r101; + ternary r12 r3.r1.e3 r93 into r102; + ternary r12 r3.r2.e1 r94 into r103; + ternary r12 r3.r2.e2 r95 into r104; + ternary r12 r3.r2.e3 r96 into r105; + ternary r12 r3.r3.e1 r97 into r106; + ternary r12 r3.r3.e2 r98 into r107; + ternary r12 r3.r3.e3 r99 into r108; + ternary r8 r0 r100 into r109; + ternary r8 r3.r1.e2 r101 into r110; + ternary r8 r3.r1.e3 r102 into r111; + cast r109 r110 r111 into r112 as Row; + ternary r8 r3.r2.e1 r103 into r113; + ternary r8 r3.r2.e2 r104 into r114; + ternary r8 r3.r2.e3 r105 into r115; + cast r113 r114 r115 into r116 as Row; + ternary r8 r3.r3.e1 r106 into r117; + ternary r8 r3.r3.e2 r107 into r118; + ternary r8 r3.r3.e3 r108 into r119; + cast r117 r118 r119 into r120 as Row; + cast r112 r116 r120 into r121 as Board; + call win r121 1u8 into r122; + not r122 into r123; + call win r121 2u8 into r124; + and r123 r124 into r125; + ternary r125 r109 r109 into r126; + ternary r125 r110 r110 into r127; + ternary r125 r111 r111 into r128; + ternary r125 r113 r113 into r129; + ternary r125 r114 r114 into r130; + ternary r125 r115 r115 into r131; + ternary r125 r117 r117 into r132; + ternary r125 r118 r118 into r133; + ternary r125 r119 r119 into r134; + ternary r122 r109 r126 into r135; + ternary r122 r110 r127 into r136; + ternary r122 r111 r128 into r137; + cast r135 r136 r137 into r138 as Row; + ternary r122 r113 r129 into r139; + ternary r122 r114 r130 into r140; + ternary r122 r115 r131 into r141; + cast r139 r140 r141 into r142 as Row; + ternary r122 r117 r132 into r143; + ternary r122 r118 r133 into r144; + ternary r122 r119 r134 into r145; + cast r143 r144 r145 into r146 as Row; + cast r138 r142 r146 into r147 as Board; + ternary r125 2u8 0u8 into r148; + ternary r122 1u8 r148 into r149; + output r147 as Board.private; + output r149 as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/function/flatten_tuples_of_structs.out b/tests/expectations/compiler/function/flatten_tuples_of_structs.out index ee575b17123..2b2e7ddf2b0 100644 --- a/tests/expectations/compiler/function/flatten_tuples_of_structs.out +++ b/tests/expectations/compiler/function/flatten_tuples_of_structs.out @@ -11,21 +11,18 @@ struct Data: closure foo: input r0 as u8; input r1 as u8; - cast r0 into r2 as Extra; - cast r0 r1 r2 into r3 as Data; - is.eq r0 r1 into r4; - add r0 r1 into r5; - sub r0 r1 into r6; - ternary r4 r3.c.c r3.c.c into r7; - cast r7 into r8 as Extra; - ternary r4 r3.a r3.a into r9; - ternary r4 r3.b r3.b into r10; - cast r9 r10 r8 into r11 as Data; - ternary r4 r0 r5 into r12; - ternary r4 r1 r6 into r13; - output r12 as u8; - output r13 as u8; - output r11 as Data; + is.eq r0 r1 into r2; + add r0 r1 into r3; + sub r0 r1 into r4; + ternary r2 r0 r0 into r5; + cast r5 into r6 as Extra; + ternary r2 r1 r1 into r7; + cast r5 r7 r6 into r8 as Data; + ternary r2 r0 r3 into r9; + ternary r2 r1 r4 into r10; + output r9 as u8; + output r10 as u8; + output r8 as Data; function bar: input r0 as boolean.private; @@ -39,20 +36,18 @@ function bar: ternary r1 r10 r13 into r16; ternary r1 r11 r14 into r17; ternary r1 r12.c.c r15.c.c into r18; - cast r18 into r19 as Extra; - ternary r1 r12.a r15.a into r20; - ternary r1 r12.b r15.b into r21; - cast r20 r21 r19 into r22 as Data; - ternary r0 r7 r16 into r23; - ternary r0 r8 r17 into r24; - ternary r0 r9.c.c r22.c.c into r25; - cast r25 into r26 as Extra; - ternary r0 r9.a r22.a into r27; - ternary r0 r9.b r22.b into r28; - cast r27 r28 r26 into r29 as Data; - output r23 as u8.private; - output r24 as u8.private; - output r29 as Data.private; + ternary r1 r12.a r15.a into r19; + ternary r1 r12.b r15.b into r20; + ternary r0 r7 r16 into r21; + ternary r0 r8 r17 into r22; + ternary r0 r9.c.c r18 into r23; + cast r23 into r24 as Extra; + ternary r0 r9.a r19 into r25; + ternary r0 r9.b r20 into r26; + cast r25 r26 r24 into r27 as Data; + output r21 as u8.private; + output r22 as u8.private; + output r27 as Data.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out b/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out index 6a43ae6f00a..e1fe3359406 100644 --- a/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out @@ -17,12 +17,9 @@ finalize peek: contains latest__[false] into r0; cast 0u32 0u32 into r1 as base.aleo/Data; get.or_use latest__[false] r1 into r2; - cast 0u32 0u32 into r3 as base.aleo/Data; - ternary r0 r2.x r3.x into r4; - ternary r0 r2.y r3.y into r5; - cast r4 r5 into r6 as base.aleo/Data; + ternary r0 r2.x 0u32 into r3; assert.eq r0 true; - assert.eq r6.x r6.x; + assert.eq r3 r3; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out b/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out index e56cfc09e65..5ef47897516 100644 --- a/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/deep_nested_lib_struct_in_storage.out @@ -29,17 +29,9 @@ finalize make: cast r1 0u32 into r2 as Core__6z1xuJtF5OT; cast r2 0u32 into r3 as Capsule__CKJ9uYgKLhI; get.or_use latest__[false] r3 into r4; - cast 0u32 into r5 as Atom__Dnr7ZcA2EXI; - cast r5 0u32 into r6 as Core__6z1xuJtF5OT; - cast r6 0u32 into r7 as Capsule__CKJ9uYgKLhI; - ternary r0 r4.c.a.n r7.c.a.n into r8; - cast r8 into r9 as Atom__Dnr7ZcA2EXI; - ternary r0 r4.c.tag r7.c.tag into r10; - cast r9 r10 into r11 as Core__6z1xuJtF5OT; - ternary r0 r4.extra r7.extra into r12; - cast r11 r12 into r13 as Capsule__CKJ9uYgKLhI; + ternary r0 r4.c.a.n 0u32 into r5; assert.eq r0 true; - assert.eq r13.c.a.n r13.c.a.n; + assert.eq r5 r5; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out b/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out index 500a0b9729d..ee6a30299f5 100644 --- a/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out @@ -32,12 +32,9 @@ finalize peek: contains latest__[false] into r0; cast 0u32 0u32 into r1 as base.aleo/Data; get.or_use latest__[false] r1 into r2; - cast 0u32 0u32 into r3 as base.aleo/Data; - ternary r0 r2.x r3.x into r4; - ternary r0 r2.y r3.y into r5; - cast r4 r5 into r6 as base.aleo/Data; + ternary r0 r2.x 0u32 into r3; assert.eq r0 true; - assert.eq r6.x r6.x; + assert.eq r3 r3; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_fn_cross_lib_with_struct.out b/tests/expectations/compiler/libraries/lib_fn_cross_lib_with_struct.out index 4a8929e9396..1d43f95e1c8 100644 --- a/tests/expectations/compiler/libraries/lib_fn_cross_lib_with_struct.out +++ b/tests/expectations/compiler/libraries/lib_fn_cross_lib_with_struct.out @@ -11,11 +11,10 @@ function compute: input r3 as u32.private; add r0 r2 into r4; add r1 r3 into r5; - cast r4 r5 into r6 as Point__7VbTm7beYPk; - mul r6.x r6.x into r7; - mul r6.y r6.y into r8; - add r7 r8 into r9; - output r9 as u32.private; + mul r4 r4 into r6; + mul r5 r5 into r7; + add r6 r7 into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_fn_struct_call_chain.out b/tests/expectations/compiler/libraries/lib_fn_struct_call_chain.out index 4a8929e9396..1d43f95e1c8 100644 --- a/tests/expectations/compiler/libraries/lib_fn_struct_call_chain.out +++ b/tests/expectations/compiler/libraries/lib_fn_struct_call_chain.out @@ -11,11 +11,10 @@ function compute: input r3 as u32.private; add r0 r2 into r4; add r1 r3 into r5; - cast r4 r5 into r6 as Point__7VbTm7beYPk; - mul r6.x r6.x into r7; - mul r6.y r6.y into r8; - add r7 r8 into r9; - output r9 as u32.private; + mul r4 r4 into r6; + mul r5 r5 into r7; + add r6 r7 into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_fn_uses_lib_struct_locally.out b/tests/expectations/compiler/libraries/lib_fn_uses_lib_struct_locally.out index 06a82411f2f..fb77ec9c406 100644 --- a/tests/expectations/compiler/libraries/lib_fn_uses_lib_struct_locally.out +++ b/tests/expectations/compiler/libraries/lib_fn_uses_lib_struct_locally.out @@ -7,9 +7,8 @@ struct Vec2__2uTzJohxeLR: function compute: input r0 as u32.private; input r1 as u32.private; - cast r0 r1 into r2 as Vec2__2uTzJohxeLR; - add r2.x r2.y into r3; - output r3 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_fn_with_struct.out b/tests/expectations/compiler/libraries/lib_fn_with_struct.out index 4a8929e9396..1d43f95e1c8 100644 --- a/tests/expectations/compiler/libraries/lib_fn_with_struct.out +++ b/tests/expectations/compiler/libraries/lib_fn_with_struct.out @@ -11,11 +11,10 @@ function compute: input r3 as u32.private; add r0 r2 into r4; add r1 r3 into r5; - cast r4 r5 into r6 as Point__7VbTm7beYPk; - mul r6.x r6.x into r7; - mul r6.y r6.y into r8; - add r7 r8 into r9; - output r9 as u32.private; + mul r4 r4 into r6; + mul r5 r5 into r7; + add r6 r7 into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out b/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out index 0866149cabd..79653ef7bb3 100644 --- a/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out @@ -26,16 +26,9 @@ finalize pick: cast 0u32 0u32 into r1 as Point__7VbTm7beYPk; cast r1 0u32 0u32 into r2 as Rect__2UBYikAziAq; get.or_use selection__[false] r2 into r3; - cast 0u32 0u32 into r4 as Point__7VbTm7beYPk; - cast r4 0u32 0u32 into r5 as Rect__2UBYikAziAq; - ternary r0 r3.top_left.x r5.top_left.x into r6; - ternary r0 r3.top_left.y r5.top_left.y into r7; - cast r6 r7 into r8 as Point__7VbTm7beYPk; - ternary r0 r3.size_x r5.size_x into r9; - ternary r0 r3.size_y r5.size_y into r10; - cast r8 r9 r10 into r11 as Rect__2UBYikAziAq; + ternary r0 r3.top_left.x 0u32 into r4; assert.eq r0 true; - assert.eq r11.top_left.x r11.top_left.x; + assert.eq r4 r4; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_struct_field_optional.out b/tests/expectations/compiler/libraries/lib_struct_field_optional.out index cbc0fad8b12..a1ba2a791c4 100644 --- a/tests/expectations/compiler/libraries/lib_struct_field_optional.out +++ b/tests/expectations/compiler/libraries/lib_struct_field_optional.out @@ -10,9 +10,7 @@ struct Balance__Ffn8747pljt: function compute: input r0 as u64.private; - cast false 0u64 into r1 as Optional__EJ8P9BQtc8W; - cast r0 r1 into r2 as Balance__Ffn8747pljt; - output r2.amount as u64.private; + output r0 as u64.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_struct_in_storage.out b/tests/expectations/compiler/libraries/lib_struct_in_storage.out index 1dfcb3053ab..c2b18d2b544 100644 --- a/tests/expectations/compiler/libraries/lib_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/lib_struct_in_storage.out @@ -23,15 +23,9 @@ finalize unwrap_info: contains token_info__[false] into r0; cast 0u128 0u128 0u8 0u128 0u128 into r1 as TokenInfo__CxbbwT70PGX; get.or_use token_info__[false] r1 into r2; - cast 0u128 0u128 0u8 0u128 0u128 into r3 as TokenInfo__CxbbwT70PGX; - ternary r0 r2.name r3.name into r4; - ternary r0 r2.symbol r3.symbol into r5; - ternary r0 r2.decimals r3.decimals into r6; - ternary r0 r2.supply r3.supply into r7; - ternary r0 r2.max_supply r3.max_supply into r8; - cast r4 r5 r6 r7 r8 into r9 as TokenInfo__CxbbwT70PGX; + ternary r0 r2.decimals 0u8 into r3; assert.eq r0 true; - assert.eq r9.decimals 8u8; + assert.eq r3 8u8; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out b/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out index 95cb473c9b7..75815ab7533 100644 --- a/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out +++ b/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out @@ -10,8 +10,7 @@ struct Optional__7G49nMxvEkY: function maybe_origin: input r0 as boolean.private; - cast 0u32 0u32 into r1 as Point__7VbTm7beYPk; - output r1.x as u32.private; + output 0u32 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out b/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out index 88436be8db6..a084b2c6ff6 100644 --- a/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out +++ b/tests/expectations/compiler/libraries/lib_submodule_optional_wrapper_placement.out @@ -9,10 +9,7 @@ struct Thing__3u5BloN95qc: function compute: input r0 as u32.private; - cast true r0 into r1 as Optional__ERfM1j1qbAs; - cast r1 into r2 as Thing__3u5BloN95qc; - ternary r2.v.is_some r2.v.val 0u32 into r3; - output r3 as u32.private; + output r0 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out b/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out index df62324b93f..cbf7809566d 100644 --- a/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out @@ -20,14 +20,11 @@ finalize area: contains bbox__[false] into r0; cast 0u32 0u32 into r1 as Rect__ANLpT5iOmJt; get.or_use bbox__[false] r1 into r2; - cast 0u32 0u32 into r3 as Rect__ANLpT5iOmJt; - ternary r0 r2.width r3.width into r4; - ternary r0 r2.height r3.height into r5; - cast r4 r5 into r6 as Rect__ANLpT5iOmJt; + ternary r0 r2.width 0u32 into r3; + ternary r0 r2.height 0u32 into r4; assert.eq r0 true; - mul r6.width r6.height into r7; - mul r6.width r6.height into r8; - assert.eq r7 r8; + mul r3 r4 into r5; + assert.eq r5 r5; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/lib_submodule_with_struct.out b/tests/expectations/compiler/libraries/lib_submodule_with_struct.out index f9df2900358..1f2c034d3be 100644 --- a/tests/expectations/compiler/libraries/lib_submodule_with_struct.out +++ b/tests/expectations/compiler/libraries/lib_submodule_with_struct.out @@ -5,11 +5,7 @@ struct Vec2__9e3R1rSz4V6: y as u32; function main: - cast 3u32 4u32 into r0 as Vec2__9e3R1rSz4V6; - mul r0.x r0.x into r1; - mul r0.y r0.y into r2; - add r1 r2 into r3; - output r3 as u32.private; + output 25u32 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out b/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out index 31b408ab897..1856d64b64d 100644 --- a/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out +++ b/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out @@ -26,18 +26,9 @@ finalize measure: cast 0u32 0u32 into r2 as Point__7VbTm7beYPk; cast r1 r2 into r3 as Rect__yHB5zqEAd9; get.or_use current__[false] r3 into r4; - cast 0u32 0u32 into r5 as Point__7VbTm7beYPk; - cast 0u32 0u32 into r6 as Point__7VbTm7beYPk; - cast r5 r6 into r7 as Rect__yHB5zqEAd9; - ternary r0 r4.top_left.x r7.top_left.x into r8; - ternary r0 r4.top_left.y r7.top_left.y into r9; - cast r8 r9 into r10 as Point__7VbTm7beYPk; - ternary r0 r4.bottom_right.x r7.bottom_right.x into r11; - ternary r0 r4.bottom_right.y r7.bottom_right.y into r12; - cast r11 r12 into r13 as Point__7VbTm7beYPk; - cast r10 r13 into r14 as Rect__yHB5zqEAd9; + ternary r0 r4.top_left.x 0u32 into r5; assert.eq r0 true; - assert.eq r14.top_left.x r14.top_left.x; + assert.eq r5 r5; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/libraries/nested_library_structs.out b/tests/expectations/compiler/libraries/nested_library_structs.out index 197e0d18090..964e51c3d79 100644 --- a/tests/expectations/compiler/libraries/nested_library_structs.out +++ b/tests/expectations/compiler/libraries/nested_library_structs.out @@ -16,12 +16,11 @@ function add_offset: input r0 as u32.private; cast 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 12u32 into r1 as [u32; 100u32]; cast 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 4u32 into r2 as [u32; 43u32]; - cast r2 into r3 as Foo__23hLlpkr7IV; - add r0 15u32 into r4; - add r4 10u32 into r5; - add r5 r1[42u32] into r6; - add r6 r3.x[3u32] into r7; - output r7 as u32.private; + add r0 15u32 into r3; + add r3 10u32 into r4; + add r4 r1[42u32] into r5; + add r5 r2[3u32] into r6; + output r6 as u32.private; constructor: assert.eq edition 0u16; @@ -48,16 +47,15 @@ function compute: input r0 as u32.private; call helper.aleo/add_offset r0 into r1; cast 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 1000u32 into r2 as [u32; 43u32]; - cast r2 into r3 as Foo__23hLlpkr7IV; - add r3.x[0u32] r1 into r4; - add r4 35u32 into r5; - add r5 20u32 into r6; - cast 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 into r7 as [u32; 44u32]; - cast r7 into r8 as Foo__KZDH7kc0tn0; - cast 199u32 into r9 as Foo; - output r6 as u32.private; - output r8 as Foo__KZDH7kc0tn0.private; - output r9 as Foo.private; + add r2[0u32] r1 into r3; + add r3 35u32 into r4; + add r4 20u32 into r5; + cast 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 99u32 into r6 as [u32; 44u32]; + cast r6 into r7 as Foo__KZDH7kc0tn0; + cast 199u32 into r8 as Foo; + output r5 as u32.private; + output r7 as Foo__KZDH7kc0tn0.private; + output r8 as Foo.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/modules/complex.out b/tests/expectations/compiler/modules/complex.out index 2ce4338e7cf..1aeb94a9d2a 100644 --- a/tests/expectations/compiler/modules/complex.out +++ b/tests/expectations/compiler/modules/complex.out @@ -16,11 +16,9 @@ struct Nested: function main: cast 2u32 2u32 2u32 into r0 as [u32; 3u32]; - cast 5u32 into r1 as Inner__1MgmvWKiTkA; - add r1.n 4u32 into r2; - add 9u32 r0[1u32] into r3; - add r3 r2 into r4; - output r4 as u32.private; + add 9u32 r0[1u32] into r1; + add r1 9u32 into r2; + output r2 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/all_types.out b/tests/expectations/compiler/option/all_types.out index 143ef881b7c..8bbb431efa6 100644 --- a/tests/expectations/compiler/option/all_types.out +++ b/tests/expectations/compiler/option/all_types.out @@ -140,8 +140,8 @@ function optional_struct_field: output 123u16 as u16.private; function optional_struct: - cast 5u8 into r0 as MyStruct; - output r0.x as u8.private; + assert.eq true true; + output 5u8 as u8.private; function array_of_optional_structs: cast 10u8 into r0 as Foo; @@ -171,14 +171,11 @@ function nested_optional_structs: cast r14 into r15 as Wrapper; cast false r15 into r16 as Optional__90gnFMeDKTp; cast r9 r16 into r17 as [Optional__90gnFMeDKTp; 2u32]; - cast true r17 into r18 as Optional__4aWy0bP6UHu; - cast r18 into r19 as Container; - assert.eq r19.wrappers.is_some true; - assert.eq r19.wrappers.val[0u32].is_some true; - assert.eq r19.wrappers.val[0u32].val.arr.is_some true; - assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].is_some true; - assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some true; - output r19.wrappers.val[0u32].val.arr.val[0u32].val.val.val as u8.private; + assert.eq r17[0u32].is_some true; + assert.eq r17[0u32].val.arr.is_some true; + assert.eq r17[0u32].val.arr.val[0u32].is_some true; + assert.eq r17[0u32].val.arr.val[0u32].val.val.is_some true; + output r17[0u32].val.arr.val[0u32].val.val.val as u8.private; function tuples_with_optional_elements: output 650u32 as u32.private; @@ -190,24 +187,22 @@ function optional_misc_primitive_types: output 2scalar as scalar.private; function optional_address_allowed: - cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r0 as Optional__6wU7KHJhSvv; - cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta r0 into r1 as AddrStruct; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r0 as address; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r1 as address; cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r2 as address; - cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r3 as address; output aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta as address.private; + output r0 as address.private; + output r1 as address.private; output r2 as address.private; - output r1.a as address.private; - output r3 as address.private; function optional_signature: - cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r0 as Optional__I4L6GJTpfLe; - cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj r0 into r1 as SigStruct; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r0 as signature; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r1 as signature; cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r2 as signature; - cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r3 as signature; output sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj as signature.private; + output r0 as signature.private; + output r1 as signature.private; output r2 as signature.private; - output r1.a as signature.private; - output r3 as signature.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/b28961.out b/tests/expectations/compiler/option/b28961.out index 34c20e21378..f48a6191e04 100644 --- a/tests/expectations/compiler/option/b28961.out +++ b/tests/expectations/compiler/option/b28961.out @@ -54,14 +54,12 @@ function optional_array_handling: output r2[0u32].val as u32.private; function optional_struct_field_expr: - cast 11u32 into r0 as S; - add r0.x 5u32 into r1; - output r1 as u32.private; + assert.eq true true; + output 16u32 as u32.private; function optional_struct_unwrap_assign: - cast 30u32 into r0 as S; - add r0.x 12u32 into r1; - output r1 as u32.private; + assert.eq true true; + output 42u32 as u32.private; function nested_struct_array_mix: cast true 1u32 into r0 as Optional__JzunLORyB8U; diff --git a/tests/expectations/compiler/option/implicit_wrapping.out b/tests/expectations/compiler/option/implicit_wrapping.out index 95f1b16e9b9..f0dda40633f 100644 --- a/tests/expectations/compiler/option/implicit_wrapping.out +++ b/tests/expectations/compiler/option/implicit_wrapping.out @@ -47,13 +47,12 @@ function complex_implicit_return: cast r3 into r4 as Foo; cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; - cast r6 into r7 as Wrapper; - assert.eq r7.arr[0u32].is_some true; - assert.eq r7.arr[0u32].val.x.is_some true; - assert.eq r7.arr[1u32].is_some true; - assert.eq r7.arr[1u32].val.x.is_some true; - cast r7.arr[0u32].val.x.val r7.arr[1u32].val.x.val into r8 as [u8; 2u32]; - output r8 as [u8; 2u32].private; + assert.eq r6[0u32].is_some true; + assert.eq r6[0u32].val.x.is_some true; + assert.eq r6[1u32].is_some true; + assert.eq r6[1u32].val.x.is_some true; + cast r6[0u32].val.x.val r6[1u32].val.x.val into r7 as [u8; 2u32]; + output r7 as [u8; 2u32].private; function complex_implicit_argument: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -63,10 +62,9 @@ function complex_implicit_argument: cast r3 into r4 as Foo; cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; - cast r6 into r7 as Wrapper; - assert.eq r7.arr[0u32].is_some true; - ternary r7.arr[0u32].val.x.is_some r7.arr[0u32].val.x.val 0u8 into r8; - output r8 as u8.private; + assert.eq r6[0u32].is_some true; + ternary r6[0u32].val.x.is_some r6[0u32].val.x.val 0u8 into r7; + output r7 as u8.private; function complex_implicit_ternary: input r0 as boolean.private; @@ -77,33 +75,30 @@ function complex_implicit_ternary: cast r4 into r5 as Foo; cast false r5 into r6 as Optional__DH9PtMwOkLt; cast r3 r6 into r7 as [Optional__DH9PtMwOkLt; 2u32]; - cast r7 into r8 as Wrapper; - cast false 0u8 into r9 as Optional__3aph2JMPtnA; - cast r9 into r10 as Foo; - cast false r10 into r11 as Optional__DH9PtMwOkLt; - cast r11 r11 into r12 as [Optional__DH9PtMwOkLt; 2u32]; - cast r12 into r13 as Wrapper; - ternary r0 r8.arr[0u32].val.x.is_some r13.arr[0u32].val.x.is_some into r14; - ternary r0 r8.arr[0u32].val.x.val r13.arr[0u32].val.x.val into r15; - cast r14 r15 into r16 as Optional__3aph2JMPtnA; - cast r16 into r17 as Foo; - ternary r0 r8.arr[0u32].is_some r13.arr[0u32].is_some into r18; - cast r18 r17 into r19 as Optional__DH9PtMwOkLt; - ternary r0 r8.arr[1u32].val.x.is_some r13.arr[1u32].val.x.is_some into r20; - ternary r0 r8.arr[1u32].val.x.val r13.arr[1u32].val.x.val into r21; - cast r20 r21 into r22 as Optional__3aph2JMPtnA; - cast r22 into r23 as Foo; - ternary r0 r8.arr[1u32].is_some r13.arr[1u32].is_some into r24; - cast r24 r23 into r25 as Optional__DH9PtMwOkLt; - cast r19 r25 into r26 as [Optional__DH9PtMwOkLt; 2u32]; - cast r26 into r27 as Wrapper; + cast false 0u8 into r8 as Optional__3aph2JMPtnA; + cast r8 into r9 as Foo; + cast false r9 into r10 as Optional__DH9PtMwOkLt; + cast r10 r10 into r11 as [Optional__DH9PtMwOkLt; 2u32]; + ternary r0 r7[0u32].val.x.is_some r11[0u32].val.x.is_some into r12; + ternary r0 r7[0u32].val.x.val r11[0u32].val.x.val into r13; + cast r12 r13 into r14 as Optional__3aph2JMPtnA; + cast r14 into r15 as Foo; + ternary r0 r7[0u32].is_some r11[0u32].is_some into r16; + cast r16 r15 into r17 as Optional__DH9PtMwOkLt; + ternary r0 r7[1u32].val.x.is_some r11[1u32].val.x.is_some into r18; + ternary r0 r7[1u32].val.x.val r11[1u32].val.x.val into r19; + cast r18 r19 into r20 as Optional__3aph2JMPtnA; + cast r20 into r21 as Foo; + ternary r0 r7[1u32].is_some r11[1u32].is_some into r22; + cast r22 r21 into r23 as Optional__DH9PtMwOkLt; + cast r17 r23 into r24 as [Optional__DH9PtMwOkLt; 2u32]; assert.eq r0 true; - assert.eq r27.arr[0u32].is_some true; - assert.eq r27.arr[0u32].val.x.is_some true; - assert.eq r27.arr[1u32].is_some true; - assert.eq r27.arr[1u32].val.x.is_some true; - cast r27.arr[0u32].val.x.val r27.arr[1u32].val.x.val into r28 as [u8; 2u32]; - output r28 as [u8; 2u32].private; + assert.eq r24[0u32].is_some true; + assert.eq r24[0u32].val.x.is_some true; + assert.eq r24[1u32].is_some true; + assert.eq r24[1u32].val.x.is_some true; + cast r24[0u32].val.x.val r24[1u32].val.x.val into r25 as [u8; 2u32]; + output r25 as [u8; 2u32].private; function complex_implicit_reassignment: cast true 7u8 into r0 as Optional__3aph2JMPtnA; @@ -113,10 +108,9 @@ function complex_implicit_reassignment: cast r3 into r4 as Foo; cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; - cast r6 into r7 as Wrapper; - assert.eq r7.arr[0u32].is_some true; - assert.eq r7.arr[0u32].val.x.is_some true; - output r7.arr[0u32].val.x.val as u8.private; + assert.eq r6[0u32].is_some true; + assert.eq r6[0u32].val.x.is_some true; + output r6[0u32].val.x.val as u8.private; function complex_array_wrapping: cast true 1u8 into r0 as Optional__3aph2JMPtnA; diff --git a/tests/expectations/compiler/option/in_modules.out b/tests/expectations/compiler/option/in_modules.out index cec6584297b..e416bab6482 100644 --- a/tests/expectations/compiler/option/in_modules.out +++ b/tests/expectations/compiler/option/in_modules.out @@ -47,17 +47,15 @@ function complex_implicit_return: cast r3 into r4 as Foo__JLzIT8VEyGW; cast false r4 into r5 as Optional__4x5ZWv8vmos; cast r2 r5 into r6 as [Optional__4x5ZWv8vmos; 2u32]; - cast r6 into r7 as Wrapper__6VZ6TvN0ax; - assert.eq r7.arr[0u32].is_some true; - ternary r7.arr[1u32].is_some r7.arr[1u32].val.x.is_some false into r8; - ternary r7.arr[1u32].is_some r7.arr[1u32].val.x.val 0u8 into r9; - cast r8 r9 into r10 as Optional__3aph2JMPtnA; - cast r10 into r11 as Foo__JLzIT8VEyGW; - cast r7.arr[0u32].val.x r11.x into r12 as [Optional__3aph2JMPtnA; 2u32]; - assert.eq r12[0u32].is_some true; - ternary r12[1u32].is_some r12[1u32].val 0u8 into r13; - cast r12[0u32].val r13 into r14 as [u8; 2u32]; - output r14 as [u8; 2u32].private; + assert.eq r6[0u32].is_some true; + ternary r6[1u32].is_some r6[1u32].val.x.is_some false into r7; + ternary r6[1u32].is_some r6[1u32].val.x.val 0u8 into r8; + cast r7 r8 into r9 as Optional__3aph2JMPtnA; + cast r6[0u32].val.x r9 into r10 as [Optional__3aph2JMPtnA; 2u32]; + assert.eq r10[0u32].is_some true; + ternary r10[1u32].is_some r10[1u32].val 0u8 into r11; + cast r10[0u32].val r11 into r12 as [u8; 2u32]; + output r12 as [u8; 2u32].private; function complex_implicit_argument: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -67,10 +65,9 @@ function complex_implicit_argument: cast r3 into r4 as Foo__JLzIT8VEyGW; cast false r4 into r5 as Optional__4x5ZWv8vmos; cast r2 r5 into r6 as [Optional__4x5ZWv8vmos; 2u32]; - cast r6 into r7 as Wrapper__6VZ6TvN0ax; - assert.eq r7.arr[0u32].is_some true; - ternary r7.arr[0u32].val.x.is_some r7.arr[0u32].val.x.val 0u8 into r8; - output r8 as u8.private; + assert.eq r6[0u32].is_some true; + ternary r6[0u32].val.x.is_some r6[0u32].val.x.val 0u8 into r7; + output r7 as u8.private; function complex_implicit_ternary: input r0 as boolean.private; @@ -81,37 +78,33 @@ function complex_implicit_ternary: cast r4 into r5 as Foo__JLzIT8VEyGW; cast false r5 into r6 as Optional__4x5ZWv8vmos; cast r3 r6 into r7 as [Optional__4x5ZWv8vmos; 2u32]; - cast r7 into r8 as Wrapper__6VZ6TvN0ax; - cast false 0u8 into r9 as Optional__3aph2JMPtnA; - cast r9 into r10 as Foo__JLzIT8VEyGW; - cast false r10 into r11 as Optional__4x5ZWv8vmos; - cast r11 r11 into r12 as [Optional__4x5ZWv8vmos; 2u32]; - cast r12 into r13 as Wrapper__6VZ6TvN0ax; - ternary r0 r8.arr[0u32].val.x.is_some r13.arr[0u32].val.x.is_some into r14; - ternary r0 r8.arr[0u32].val.x.val r13.arr[0u32].val.x.val into r15; - cast r14 r15 into r16 as Optional__3aph2JMPtnA; - cast r16 into r17 as Foo__JLzIT8VEyGW; - ternary r0 r8.arr[0u32].is_some r13.arr[0u32].is_some into r18; - cast r18 r17 into r19 as Optional__4x5ZWv8vmos; - ternary r0 r8.arr[1u32].val.x.is_some r13.arr[1u32].val.x.is_some into r20; - ternary r0 r8.arr[1u32].val.x.val r13.arr[1u32].val.x.val into r21; - cast r20 r21 into r22 as Optional__3aph2JMPtnA; - cast r22 into r23 as Foo__JLzIT8VEyGW; - ternary r0 r8.arr[1u32].is_some r13.arr[1u32].is_some into r24; - cast r24 r23 into r25 as Optional__4x5ZWv8vmos; - cast r19 r25 into r26 as [Optional__4x5ZWv8vmos; 2u32]; - cast r26 into r27 as Wrapper__6VZ6TvN0ax; + cast false 0u8 into r8 as Optional__3aph2JMPtnA; + cast r8 into r9 as Foo__JLzIT8VEyGW; + cast false r9 into r10 as Optional__4x5ZWv8vmos; + cast r10 r10 into r11 as [Optional__4x5ZWv8vmos; 2u32]; + ternary r0 r7[0u32].val.x.is_some r11[0u32].val.x.is_some into r12; + ternary r0 r7[0u32].val.x.val r11[0u32].val.x.val into r13; + cast r12 r13 into r14 as Optional__3aph2JMPtnA; + cast r14 into r15 as Foo__JLzIT8VEyGW; + ternary r0 r7[0u32].is_some r11[0u32].is_some into r16; + cast r16 r15 into r17 as Optional__4x5ZWv8vmos; + ternary r0 r7[1u32].val.x.is_some r11[1u32].val.x.is_some into r18; + ternary r0 r7[1u32].val.x.val r11[1u32].val.x.val into r19; + cast r18 r19 into r20 as Optional__3aph2JMPtnA; + cast r20 into r21 as Foo__JLzIT8VEyGW; + ternary r0 r7[1u32].is_some r11[1u32].is_some into r22; + cast r22 r21 into r23 as Optional__4x5ZWv8vmos; + cast r17 r23 into r24 as [Optional__4x5ZWv8vmos; 2u32]; assert.eq r0 true; - assert.eq r27.arr[0u32].is_some true; - ternary r27.arr[1u32].is_some r27.arr[1u32].val.x.is_some false into r28; - ternary r27.arr[1u32].is_some r27.arr[1u32].val.x.val 0u8 into r29; - cast r28 r29 into r30 as Optional__3aph2JMPtnA; - cast r30 into r31 as Foo__JLzIT8VEyGW; - cast r27.arr[0u32].val.x r31.x into r32 as [Optional__3aph2JMPtnA; 2u32]; - ternary r32[0u32].is_some r32[0u32].val 0u8 into r33; - ternary r32[1u32].is_some r32[1u32].val 0u8 into r34; - cast r33 r34 into r35 as [u8; 2u32]; - output r35 as [u8; 2u32].private; + assert.eq r24[0u32].is_some true; + ternary r24[1u32].is_some r24[1u32].val.x.is_some false into r25; + ternary r24[1u32].is_some r24[1u32].val.x.val 0u8 into r26; + cast r25 r26 into r27 as Optional__3aph2JMPtnA; + cast r24[0u32].val.x r27 into r28 as [Optional__3aph2JMPtnA; 2u32]; + ternary r28[0u32].is_some r28[0u32].val 0u8 into r29; + ternary r28[1u32].is_some r28[1u32].val 0u8 into r30; + cast r29 r30 into r31 as [u8; 2u32]; + output r31 as [u8; 2u32].private; function complex_implicit_reassignment: cast true 7u8 into r0 as Optional__3aph2JMPtnA; @@ -121,10 +114,9 @@ function complex_implicit_reassignment: cast r3 into r4 as Foo__JLzIT8VEyGW; cast false r4 into r5 as Optional__4x5ZWv8vmos; cast r2 r5 into r6 as [Optional__4x5ZWv8vmos; 2u32]; - cast r6 into r7 as Wrapper__6VZ6TvN0ax; - assert.eq r7.arr[0u32].is_some true; - assert.eq r7.arr[0u32].val.x.is_some true; - output r7.arr[0u32].val.x.val as u8.private; + assert.eq r6[0u32].is_some true; + assert.eq r6[0u32].val.x.is_some true; + output r6[0u32].val.x.val as u8.private; function complex_array_wrapping: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -139,25 +131,21 @@ function complex_array_wrapping: ternary r5[0u32].arr[1u32].is_some r5[0u32].arr[1u32].val.x.is_some false into r6; ternary r5[0u32].arr[1u32].is_some r5[0u32].arr[1u32].val.x.val 0u8 into r7; cast r6 r7 into r8 as Optional__3aph2JMPtnA; - cast r8 into r9 as Foo__JLzIT8VEyGW; - cast r5[0u32].arr[0u32].val.x r9.x into r10 as [Optional__3aph2JMPtnA; 2u32]; - ternary r5[1u32].arr[0u32].is_some r5[1u32].arr[0u32].val.x.is_some false into r11; - ternary r5[1u32].arr[0u32].is_some r5[1u32].arr[0u32].val.x.val 0u8 into r12; - cast r11 r12 into r13 as Optional__3aph2JMPtnA; - cast r13 into r14 as Foo__JLzIT8VEyGW; - ternary r5[1u32].arr[1u32].is_some r5[1u32].arr[1u32].val.x.is_some false into r15; - ternary r5[1u32].arr[1u32].is_some r5[1u32].arr[1u32].val.x.val 0u8 into r16; - cast r15 r16 into r17 as Optional__3aph2JMPtnA; - cast r17 into r18 as Foo__JLzIT8VEyGW; - cast r14.x r18.x into r19 as [Optional__3aph2JMPtnA; 2u32]; - ternary r5[2u32].arr[1u32].is_some r5[2u32].arr[1u32].val.x.is_some false into r20; - ternary r5[2u32].arr[1u32].is_some r5[2u32].arr[1u32].val.x.val 0u8 into r21; - cast r20 r21 into r22 as Optional__3aph2JMPtnA; - cast r22 into r23 as Foo__JLzIT8VEyGW; - cast r5[2u32].arr[0u32].val.x r23.x into r24 as [Optional__3aph2JMPtnA; 2u32]; - cast r10 r19 r24 into r25 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; - ternary r25[0u32][0u32].is_some r25[0u32][0u32].val 0u8 into r26; - output r26 as u8.private; + cast r5[0u32].arr[0u32].val.x r8 into r9 as [Optional__3aph2JMPtnA; 2u32]; + ternary r5[1u32].arr[0u32].is_some r5[1u32].arr[0u32].val.x.is_some false into r10; + ternary r5[1u32].arr[0u32].is_some r5[1u32].arr[0u32].val.x.val 0u8 into r11; + cast r10 r11 into r12 as Optional__3aph2JMPtnA; + ternary r5[1u32].arr[1u32].is_some r5[1u32].arr[1u32].val.x.is_some false into r13; + ternary r5[1u32].arr[1u32].is_some r5[1u32].arr[1u32].val.x.val 0u8 into r14; + cast r13 r14 into r15 as Optional__3aph2JMPtnA; + cast r12 r15 into r16 as [Optional__3aph2JMPtnA; 2u32]; + ternary r5[2u32].arr[1u32].is_some r5[2u32].arr[1u32].val.x.is_some false into r17; + ternary r5[2u32].arr[1u32].is_some r5[2u32].arr[1u32].val.x.val 0u8 into r18; + cast r17 r18 into r19 as Optional__3aph2JMPtnA; + cast r5[2u32].arr[0u32].val.x r19 into r20 as [Optional__3aph2JMPtnA; 2u32]; + cast r9 r16 r20 into r21 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; + ternary r21[0u32][0u32].is_some r21[0u32][0u32].val 0u8 into r22; + output r22 as u8.private; function complex_array_access: cast true 10u8 into r0 as Optional__3aph2JMPtnA; @@ -190,25 +178,21 @@ function complex_array_access: ternary r24[0u32].arr[1u32].is_some r24[0u32].arr[1u32].val.x.is_some false into r25; ternary r24[0u32].arr[1u32].is_some r24[0u32].arr[1u32].val.x.val 0u8 into r26; cast r25 r26 into r27 as Optional__3aph2JMPtnA; - cast r27 into r28 as Foo__JLzIT8VEyGW; - cast r24[0u32].arr[0u32].val.x r28.x into r29 as [Optional__3aph2JMPtnA; 2u32]; - ternary r24[1u32].arr[1u32].is_some r24[1u32].arr[1u32].val.x.is_some false into r30; - ternary r24[1u32].arr[1u32].is_some r24[1u32].arr[1u32].val.x.val 0u8 into r31; - cast r30 r31 into r32 as Optional__3aph2JMPtnA; - cast r32 into r33 as Foo__JLzIT8VEyGW; - cast r24[1u32].arr[0u32].val.x r33.x into r34 as [Optional__3aph2JMPtnA; 2u32]; - ternary r24[2u32].arr[0u32].is_some r24[2u32].arr[0u32].val.x.is_some false into r35; - ternary r24[2u32].arr[0u32].is_some r24[2u32].arr[0u32].val.x.val 0u8 into r36; - cast r35 r36 into r37 as Optional__3aph2JMPtnA; - cast r37 into r38 as Foo__JLzIT8VEyGW; - ternary r24[2u32].arr[1u32].is_some r24[2u32].arr[1u32].val.x.is_some false into r39; - ternary r24[2u32].arr[1u32].is_some r24[2u32].arr[1u32].val.x.val 0u8 into r40; - cast r39 r40 into r41 as Optional__3aph2JMPtnA; - cast r41 into r42 as Foo__JLzIT8VEyGW; - cast r38.x r42.x into r43 as [Optional__3aph2JMPtnA; 2u32]; - cast r29 r34 r43 into r44 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; - assert.eq r44[1u32][0u32].is_some true; - output r44[1u32][0u32].val as u8.private; + cast r24[0u32].arr[0u32].val.x r27 into r28 as [Optional__3aph2JMPtnA; 2u32]; + ternary r24[1u32].arr[1u32].is_some r24[1u32].arr[1u32].val.x.is_some false into r29; + ternary r24[1u32].arr[1u32].is_some r24[1u32].arr[1u32].val.x.val 0u8 into r30; + cast r29 r30 into r31 as Optional__3aph2JMPtnA; + cast r24[1u32].arr[0u32].val.x r31 into r32 as [Optional__3aph2JMPtnA; 2u32]; + ternary r24[2u32].arr[0u32].is_some r24[2u32].arr[0u32].val.x.is_some false into r33; + ternary r24[2u32].arr[0u32].is_some r24[2u32].arr[0u32].val.x.val 0u8 into r34; + cast r33 r34 into r35 as Optional__3aph2JMPtnA; + ternary r24[2u32].arr[1u32].is_some r24[2u32].arr[1u32].val.x.is_some false into r36; + ternary r24[2u32].arr[1u32].is_some r24[2u32].arr[1u32].val.x.val 0u8 into r37; + cast r36 r37 into r38 as Optional__3aph2JMPtnA; + cast r35 r38 into r39 as [Optional__3aph2JMPtnA; 2u32]; + cast r28 r32 r39 into r40 as [[Optional__3aph2JMPtnA; 2u32]; 3u32]; + assert.eq r40[1u32][0u32].is_some true; + output r40[1u32][0u32].val as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/option/unwrap_or_deep.out b/tests/expectations/compiler/option/unwrap_or_deep.out index ab5187bb6a9..2361a39d0e9 100644 --- a/tests/expectations/compiler/option/unwrap_or_deep.out +++ b/tests/expectations/compiler/option/unwrap_or_deep.out @@ -45,64 +45,47 @@ function unwrap_or_deep: cast r4 into r5 as Wrapper; cast true r5 into r6 as Optional__90gnFMeDKTp; cast r6 into r7 as [Optional__90gnFMeDKTp; 1u32]; - cast true r7 into r8 as Optional__BetGHuxYwx2; - cast r8 into r9 as Container; - cast true 55u8 into r10 as Optional__3aph2JMPtnA; + cast true 55u8 into r8 as Optional__3aph2JMPtnA; + cast r8 into r9 as Inner; + cast r7[0u32].val.arr.val[0u32].val.val.is_some r7[0u32].val.arr.val[0u32].val.val.val into r10 as Optional__3aph2JMPtnA; cast r10 into r11 as Inner; - cast r9.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some r9.wrappers.val[0u32].val.arr.val[0u32].val.val.val into r12 as Optional__3aph2JMPtnA; - cast r12 into r13 as Inner; - cast r9.wrappers.val[0u32].val.arr.val[0u32].is_some r13 into r14 as Optional__AqOs5VODSRH; - cast r14 into r15 as [Optional__AqOs5VODSRH; 1u32]; - cast r9.wrappers.val[0u32].val.arr.is_some r15 into r16 as Optional__FVD6sPKEWr0; - cast r16 into r17 as Wrapper; - cast r9.wrappers.val[0u32].is_some r17 into r18 as Optional__90gnFMeDKTp; - cast r18 into r19 as [Optional__90gnFMeDKTp; 1u32]; - cast r9.wrappers.is_some r19 into r20 as Optional__BetGHuxYwx2; - cast r20 into r21 as Container; - cast true r11 into r22 as Optional__AqOs5VODSRH; - cast r22 into r23 as [Optional__AqOs5VODSRH; 1u32]; - cast true r23 into r24 as Optional__FVD6sPKEWr0; - cast r24 into r25 as Wrapper; - cast true r25 into r26 as Optional__90gnFMeDKTp; - cast r26 into r27 as [Optional__90gnFMeDKTp; 1u32]; - ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some r27[0u32].val.arr.val[0u32].val.val.is_some into r28; - ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.val[0u32].val.val.val r27[0u32].val.arr.val[0u32].val.val.val into r29; + cast r7[0u32].val.arr.val[0u32].is_some r11 into r12 as Optional__AqOs5VODSRH; + cast r12 into r13 as [Optional__AqOs5VODSRH; 1u32]; + cast r7[0u32].val.arr.is_some r13 into r14 as Optional__FVD6sPKEWr0; + cast r14 into r15 as Wrapper; + cast r7[0u32].is_some r15 into r16 as Optional__90gnFMeDKTp; + cast r16 into r17 as [Optional__90gnFMeDKTp; 1u32]; + cast r17[0u32].val.arr.val[0u32].val.val.is_some r17[0u32].val.arr.val[0u32].val.val.val into r18 as Optional__3aph2JMPtnA; + cast r18 into r19 as Inner; + cast r17[0u32].val.arr.val[0u32].is_some r19 into r20 as Optional__AqOs5VODSRH; + cast r20 into r21 as [Optional__AqOs5VODSRH; 1u32]; + cast r17[0u32].val.arr.is_some r21 into r22 as Optional__FVD6sPKEWr0; + cast r22 into r23 as Wrapper; + cast r17[0u32].is_some r23 into r24 as Optional__90gnFMeDKTp; + cast r24 into r25 as [Optional__90gnFMeDKTp; 1u32]; + cast true r9 into r26 as Optional__AqOs5VODSRH; + cast r26 into r27 as [Optional__AqOs5VODSRH; 1u32]; + ternary r25[0u32].is_some r25[0u32].val.arr.val[0u32].val.val.is_some r27[0u32].val.val.is_some into r28; + ternary r25[0u32].is_some r25[0u32].val.arr.val[0u32].val.val.val r27[0u32].val.val.val into r29; cast r28 r29 into r30 as Optional__3aph2JMPtnA; cast r30 into r31 as Inner; - ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.val[0u32].is_some r27[0u32].val.arr.val[0u32].is_some into r32; + ternary r25[0u32].is_some r25[0u32].val.arr.val[0u32].is_some r27[0u32].is_some into r32; cast r32 r31 into r33 as Optional__AqOs5VODSRH; cast r33 into r34 as [Optional__AqOs5VODSRH; 1u32]; - ternary r21.wrappers.is_some r21.wrappers.val[0u32].val.arr.is_some r27[0u32].val.arr.is_some into r35; - cast r35 r34 into r36 as Optional__FVD6sPKEWr0; - cast r36 into r37 as Wrapper; - ternary r21.wrappers.is_some r21.wrappers.val[0u32].is_some r27[0u32].is_some into r38; - cast r38 r37 into r39 as Optional__90gnFMeDKTp; - cast r39 into r40 as [Optional__90gnFMeDKTp; 1u32]; - cast true r11 into r41 as Optional__AqOs5VODSRH; - cast r41 into r42 as [Optional__AqOs5VODSRH; 1u32]; - ternary r40[0u32].is_some r40[0u32].val.arr.val[0u32].val.val.is_some r42[0u32].val.val.is_some into r43; - ternary r40[0u32].is_some r40[0u32].val.arr.val[0u32].val.val.val r42[0u32].val.val.val into r44; - cast r43 r44 into r45 as Optional__3aph2JMPtnA; - cast r45 into r46 as Inner; - ternary r40[0u32].is_some r40[0u32].val.arr.val[0u32].is_some r42[0u32].is_some into r47; - cast r47 r46 into r48 as Optional__AqOs5VODSRH; - cast r48 into r49 as [Optional__AqOs5VODSRH; 1u32]; - ternary r40[0u32].is_some r40[0u32].val.arr.is_some true into r50; - cast r50 r49 into r51 as Optional__FVD6sPKEWr0; - cast r51 into r52 as Wrapper; - cast true r11 into r53 as Optional__AqOs5VODSRH; - cast r53 into r54 as [Optional__AqOs5VODSRH; 1u32]; - ternary r52.arr.is_some r52.arr.val[0u32].val.val.is_some r54[0u32].val.val.is_some into r55; - ternary r52.arr.is_some r52.arr.val[0u32].val.val.val r54[0u32].val.val.val into r56; - cast r55 r56 into r57 as Optional__3aph2JMPtnA; - cast r57 into r58 as Inner; - ternary r52.arr.is_some r52.arr.val[0u32].is_some r54[0u32].is_some into r59; - cast r59 r58 into r60 as Optional__AqOs5VODSRH; - cast r60 into r61 as [Optional__AqOs5VODSRH; 1u32]; - ternary r61[0u32].is_some r61[0u32].val.val.is_some true into r62; - ternary r61[0u32].is_some r61[0u32].val.val.val 55u8 into r63; - ternary r62 r63 99u8 into r64; - output r64 as u8.private; + ternary r25[0u32].is_some r25[0u32].val.arr.is_some true into r35; + cast true r9 into r36 as Optional__AqOs5VODSRH; + cast r36 into r37 as [Optional__AqOs5VODSRH; 1u32]; + ternary r35 r34[0u32].val.val.is_some r37[0u32].val.val.is_some into r38; + ternary r35 r34[0u32].val.val.val r37[0u32].val.val.val into r39; + cast r38 r39 into r40 as Optional__3aph2JMPtnA; + cast r40 into r41 as Inner; + ternary r35 r34[0u32].is_some r37[0u32].is_some into r42; + cast r42 r41 into r43 as Optional__AqOs5VODSRH; + cast r43 into r44 as [Optional__AqOs5VODSRH; 1u32]; + ternary r44[0u32].is_some r44[0u32].val.val.is_some true into r45; + ternary r44[0u32].is_some r44[0u32].val.val.val 55u8 into r46; + ternary r45 r46 99u8 into r47; + output r47 as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/statements/assign.out b/tests/expectations/compiler/statements/assign.out index 6bd0c1cde2b..23a9af7afcf 100644 --- a/tests/expectations/compiler/statements/assign.out +++ b/tests/expectations/compiler/statements/assign.out @@ -7,8 +7,7 @@ function main: add r1 1u8 into r3; add r1 2u8 into r4; ternary r2 r3 r4 into r5; - ternary r2 r3 r5 into r6; - output r6 as u8.private; + output r5 as u8.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/aggregates.out b/tests/expectations/compiler/storage/aggregates.out index 97af6471ff1..3fba34480b9 100644 --- a/tests/expectations/compiler/storage/aggregates.out +++ b/tests/expectations/compiler/storage/aggregates.out @@ -99,85 +99,81 @@ finalize check1: contains point__[false] into r0; cast 0field 0field into r1 as Point; get.or_use point__[false] r1 into r2; - cast 0field 0field into r3 as Point; - ternary r0 r2.x r3.x into r4; - ternary r0 r2.y r3.y into r5; - cast r4 r5 into r6 as Point; + ternary r0 r2.x 0field into r3; + ternary r0 r2.y 0field into r4; assert.eq r0 true; - is.eq r6.x 1field into r7; + is.eq r3 1field into r5; + assert.eq r5 true; + is.eq r4 2field into r6; + assert.eq r6 true; + contains points__[false] into r7; + cast 0field 0field into r8 as Point; + cast r8 r8 into r9 as [Point; 2u32]; + get.or_use points__[false] r9 into r10; + cast 0field 0field into r11 as Point; + cast r11 r11 into r12 as [Point; 2u32]; + ternary r7 r10[0u32].x r12[0u32].x into r13; + ternary r7 r10[0u32].y r12[0u32].y into r14; + cast r13 r14 into r15 as Point; + ternary r7 r10[1u32].x r12[1u32].x into r16; + ternary r7 r10[1u32].y r12[1u32].y into r17; + cast r16 r17 into r18 as Point; + cast r15 r18 into r19 as [Point; 2u32]; assert.eq r7 true; - is.eq r6.y 2field into r8; - assert.eq r8 true; - contains points__[false] into r9; - cast 0field 0field into r10 as Point; - cast r10 r10 into r11 as [Point; 2u32]; - get.or_use points__[false] r11 into r12; - cast 0field 0field into r13 as Point; - cast r13 r13 into r14 as [Point; 2u32]; - ternary r9 r12[0u32].x r14[0u32].x into r15; - ternary r9 r12[0u32].y r14[0u32].y into r16; - cast r15 r16 into r17 as Point; - ternary r9 r12[1u32].x r14[1u32].x into r18; - ternary r9 r12[1u32].y r14[1u32].y into r19; - cast r18 r19 into r20 as Point; - cast r17 r20 into r21 as [Point; 2u32]; - assert.eq r9 true; - is.eq r21[0u32].x 10field into r22; + is.eq r19[0u32].x 10field into r20; + assert.eq r20 true; + is.eq r19[1u32].y 40field into r21; + assert.eq r21 true; + contains stats__[false] into r22; + cast 0u32 0u32 0u32 into r23 as [u32; 3u32]; + cast r23 false into r24 as Stats; + get.or_use stats__[false] r24 into r25; + ternary r22 r25.values[0u32] r23[0u32] into r26; + ternary r22 r25.values[1u32] r23[1u32] into r27; + ternary r22 r25.values[2u32] r23[2u32] into r28; + cast r26 r27 r28 into r29 as [u32; 3u32]; + ternary r22 r25.active false into r30; assert.eq r22 true; - is.eq r21[1u32].y 40field into r23; - assert.eq r23 true; - contains stats__[false] into r24; - cast 0u32 0u32 0u32 into r25 as [u32; 3u32]; - cast r25 false into r26 as Stats; - get.or_use stats__[false] r26 into r27; - cast r25 false into r28 as Stats; - ternary r24 r27.values[0u32] r28.values[0u32] into r29; - ternary r24 r27.values[1u32] r28.values[1u32] into r30; - ternary r24 r27.values[2u32] r28.values[2u32] into r31; - cast r29 r30 r31 into r32 as [u32; 3u32]; - ternary r24 r27.active r28.active into r33; - cast r32 r33 into r34 as Stats; - assert.eq r24 true; - is.eq r34.values[1u32] 10u32 into r35; - assert.eq r35 true; - is.eq r34.active true into r36; - assert.eq r36 true; - contains arr_u32__[false] into r37; - get.or_use arr_u32__[false] r25 into r38; - ternary r37 r38[0u32] r25[0u32] into r39; - ternary r37 r38[1u32] r25[1u32] into r40; - ternary r37 r38[2u32] r25[2u32] into r41; - cast r39 r40 r41 into r42 as [u32; 3u32]; - assert.eq r37 true; - is.eq r42[2u32] 9u32 into r43; - assert.eq r43 true; - contains arr_bool__[false] into r44; - cast false false into r45 as [boolean; 2u32]; - get.or_use arr_bool__[false] r45 into r46; - ternary r44 r46[0u32] r45[0u32] into r47; - ternary r44 r46[1u32] r45[1u32] into r48; - cast r47 r48 into r49 as [boolean; 2u32]; - assert.eq r44 true; - is.eq r49[0u32] true into r50; - assert.eq r50 true; - is.eq r49[1u32] false into r51; - assert.eq r51 true; - contains nested__[false] into r52; - cast 0u8 0u8 into r53 as [u8; 2u32]; - cast r53 r53 into r54 as [[u8; 2u32]; 2u32]; - get.or_use nested__[false] r54 into r55; - ternary r52 r55[0u32][0u32] r54[0u32][0u32] into r56; - ternary r52 r55[0u32][1u32] r54[0u32][1u32] into r57; - cast r56 r57 into r58 as [u8; 2u32]; - ternary r52 r55[1u32][0u32] r54[1u32][0u32] into r59; - ternary r52 r55[1u32][1u32] r54[1u32][1u32] into r60; - cast r59 r60 into r61 as [u8; 2u32]; - cast r58 r61 into r62 as [[u8; 2u32]; 2u32]; - assert.eq r52 true; - is.eq r62[0u32][1u32] 2u8 into r63; - assert.eq r63 true; - is.eq r62[1u32][0u32] 3u8 into r64; - assert.eq r64 true; + is.eq r29[1u32] 10u32 into r31; + assert.eq r31 true; + is.eq r30 true into r32; + assert.eq r32 true; + contains arr_u32__[false] into r33; + get.or_use arr_u32__[false] r23 into r34; + ternary r33 r34[0u32] r23[0u32] into r35; + ternary r33 r34[1u32] r23[1u32] into r36; + ternary r33 r34[2u32] r23[2u32] into r37; + cast r35 r36 r37 into r38 as [u32; 3u32]; + assert.eq r33 true; + is.eq r38[2u32] 9u32 into r39; + assert.eq r39 true; + contains arr_bool__[false] into r40; + cast false false into r41 as [boolean; 2u32]; + get.or_use arr_bool__[false] r41 into r42; + ternary r40 r42[0u32] r41[0u32] into r43; + ternary r40 r42[1u32] r41[1u32] into r44; + cast r43 r44 into r45 as [boolean; 2u32]; + assert.eq r40 true; + is.eq r45[0u32] true into r46; + assert.eq r46 true; + is.eq r45[1u32] false into r47; + assert.eq r47 true; + contains nested__[false] into r48; + cast 0u8 0u8 into r49 as [u8; 2u32]; + cast r49 r49 into r50 as [[u8; 2u32]; 2u32]; + get.or_use nested__[false] r50 into r51; + ternary r48 r51[0u32][0u32] r50[0u32][0u32] into r52; + ternary r48 r51[0u32][1u32] r50[0u32][1u32] into r53; + cast r52 r53 into r54 as [u8; 2u32]; + ternary r48 r51[1u32][0u32] r50[1u32][0u32] into r55; + ternary r48 r51[1u32][1u32] r50[1u32][1u32] into r56; + cast r55 r56 into r57 as [u8; 2u32]; + cast r54 r57 into r58 as [[u8; 2u32]; 2u32]; + assert.eq r48 true; + is.eq r58[0u32][1u32] 2u8 into r59; + assert.eq r59 true; + is.eq r58[1u32][0u32] 3u8 into r60; + assert.eq r60 true; function check2: async check2 into r0; @@ -187,110 +183,102 @@ finalize check2: contains point__[false] into r0; cast 0field 0field into r1 as Point; get.or_use point__[false] r1 into r2; - cast 0field 0field into r3 as Point; - ternary r0 r2.x r3.x into r4; - ternary r0 r2.y r3.y into r5; - cast r4 r5 into r6 as Point; - ternary r0 r6.x 0field into r7; - ternary r0 r6.y 0field into r8; - cast r7 r8 into r9 as Point; - is.eq r9.x 1field into r10; - assert.eq r10 true; - is.eq r9.y 2field into r11; - assert.eq r11 true; - contains points__[false] into r12; - cast 0field 0field into r13 as Point; - cast r13 r13 into r14 as [Point; 2u32]; - get.or_use points__[false] r14 into r15; - cast 0field 0field into r16 as Point; - cast r16 r16 into r17 as [Point; 2u32]; - ternary r12 r15[0u32].x r17[0u32].x into r18; - ternary r12 r15[0u32].y r17[0u32].y into r19; - cast r18 r19 into r20 as Point; - ternary r12 r15[1u32].x r17[1u32].x into r21; - ternary r12 r15[1u32].y r17[1u32].y into r22; - cast r21 r22 into r23 as Point; - cast r20 r23 into r24 as [Point; 2u32]; - cast 0field 0field into r25 as Point; - cast 0field 0field into r26 as Point; - cast r25 r26 into r27 as [Point; 2u32]; - ternary r12 r24[0u32].x r27[0u32].x into r28; - ternary r12 r24[0u32].y r27[0u32].y into r29; - cast r28 r29 into r30 as Point; - ternary r12 r24[1u32].x r27[1u32].x into r31; - ternary r12 r24[1u32].y r27[1u32].y into r32; - cast r31 r32 into r33 as Point; - cast r30 r33 into r34 as [Point; 2u32]; - is.eq r34[0u32].x 10field into r35; - assert.eq r35 true; - is.eq r34[1u32].y 40field into r36; - assert.eq r36 true; - contains stats__[false] into r37; - cast 0u32 0u32 0u32 into r38 as [u32; 3u32]; - cast r38 false into r39 as Stats; - get.or_use stats__[false] r39 into r40; - cast r38 false into r41 as Stats; - ternary r37 r40.values[0u32] r41.values[0u32] into r42; - ternary r37 r40.values[1u32] r41.values[1u32] into r43; - ternary r37 r40.values[2u32] r41.values[2u32] into r44; - cast r42 r43 r44 into r45 as [u32; 3u32]; - ternary r37 r40.active r41.active into r46; - cast r45 r46 into r47 as Stats; - cast 0u32 0u32 0u32 into r48 as [u32; 3u32]; - cast r48 false into r49 as Stats; - ternary r37 r47.values[0u32] r49.values[0u32] into r50; - ternary r37 r47.values[1u32] r49.values[1u32] into r51; - ternary r37 r47.values[2u32] r49.values[2u32] into r52; - cast r50 r51 r52 into r53 as [u32; 3u32]; - ternary r37 r47.active r49.active into r54; - cast r53 r54 into r55 as Stats; - is.eq r55.values[2u32] 15u32 into r56; - assert.eq r56 true; - is.eq r55.active true into r57; - assert.eq r57 true; - contains arr_u32__[false] into r58; - get.or_use arr_u32__[false] r38 into r59; - ternary r58 r59[0u32] r38[0u32] into r60; - ternary r58 r59[1u32] r38[1u32] into r61; - ternary r58 r59[2u32] r38[2u32] into r62; - cast r60 r61 r62 into r63 as [u32; 3u32]; - ternary r58 r63[0u32] 0u32 into r64; - ternary r58 r63[1u32] 0u32 into r65; - ternary r58 r63[2u32] 0u32 into r66; - cast r64 r65 r66 into r67 as [u32; 3u32]; - is.eq r67[1u32] 8u32 into r68; - assert.eq r68 true; - contains arr_bool__[false] into r69; - cast false false into r70 as [boolean; 2u32]; - get.or_use arr_bool__[false] r70 into r71; - ternary r69 r71[0u32] r70[0u32] into r72; - ternary r69 r71[1u32] r70[1u32] into r73; - cast r72 r73 into r74 as [boolean; 2u32]; - ternary r69 r74[0u32] false into r75; - ternary r69 r74[1u32] false into r76; - cast r75 r76 into r77 as [boolean; 2u32]; - is.eq r77[0u32] true into r78; - assert.eq r78 true; - contains nested__[false] into r79; - cast 0u8 0u8 into r80 as [u8; 2u32]; - cast r80 r80 into r81 as [[u8; 2u32]; 2u32]; - get.or_use nested__[false] r81 into r82; - ternary r79 r82[0u32][0u32] r81[0u32][0u32] into r83; - ternary r79 r82[0u32][1u32] r81[0u32][1u32] into r84; - cast r83 r84 into r85 as [u8; 2u32]; - ternary r79 r82[1u32][0u32] r81[1u32][0u32] into r86; - ternary r79 r82[1u32][1u32] r81[1u32][1u32] into r87; - cast r86 r87 into r88 as [u8; 2u32]; - cast r85 r88 into r89 as [[u8; 2u32]; 2u32]; - ternary r79 r89[0u32][0u32] 0u8 into r90; - ternary r79 r89[0u32][1u32] 0u8 into r91; - cast r90 r91 into r92 as [u8; 2u32]; - ternary r79 r89[1u32][0u32] 0u8 into r93; - ternary r79 r89[1u32][1u32] 0u8 into r94; - cast r93 r94 into r95 as [u8; 2u32]; - cast r92 r95 into r96 as [[u8; 2u32]; 2u32]; - is.eq r96[1u32][1u32] 4u8 into r97; - assert.eq r97 true; + ternary r0 r2.x 0field into r3; + ternary r0 r2.y 0field into r4; + is.eq r3 1field into r5; + assert.eq r5 true; + is.eq r4 2field into r6; + assert.eq r6 true; + contains points__[false] into r7; + cast 0field 0field into r8 as Point; + cast r8 r8 into r9 as [Point; 2u32]; + get.or_use points__[false] r9 into r10; + cast 0field 0field into r11 as Point; + cast r11 r11 into r12 as [Point; 2u32]; + ternary r7 r10[0u32].x r12[0u32].x into r13; + ternary r7 r10[0u32].y r12[0u32].y into r14; + cast r13 r14 into r15 as Point; + ternary r7 r10[1u32].x r12[1u32].x into r16; + ternary r7 r10[1u32].y r12[1u32].y into r17; + cast r16 r17 into r18 as Point; + cast r15 r18 into r19 as [Point; 2u32]; + cast 0field 0field into r20 as Point; + cast 0field 0field into r21 as Point; + cast r20 r21 into r22 as [Point; 2u32]; + ternary r7 r19[0u32].x r22[0u32].x into r23; + ternary r7 r19[0u32].y r22[0u32].y into r24; + cast r23 r24 into r25 as Point; + ternary r7 r19[1u32].x r22[1u32].x into r26; + ternary r7 r19[1u32].y r22[1u32].y into r27; + cast r26 r27 into r28 as Point; + cast r25 r28 into r29 as [Point; 2u32]; + is.eq r29[0u32].x 10field into r30; + assert.eq r30 true; + is.eq r29[1u32].y 40field into r31; + assert.eq r31 true; + contains stats__[false] into r32; + cast 0u32 0u32 0u32 into r33 as [u32; 3u32]; + cast r33 false into r34 as Stats; + get.or_use stats__[false] r34 into r35; + ternary r32 r35.values[0u32] r33[0u32] into r36; + ternary r32 r35.values[1u32] r33[1u32] into r37; + ternary r32 r35.values[2u32] r33[2u32] into r38; + cast r36 r37 r38 into r39 as [u32; 3u32]; + ternary r32 r35.active false into r40; + cast 0u32 0u32 0u32 into r41 as [u32; 3u32]; + cast r41 false into r42 as Stats; + ternary r32 r39[0u32] r42.values[0u32] into r43; + ternary r32 r39[1u32] r42.values[1u32] into r44; + ternary r32 r39[2u32] r42.values[2u32] into r45; + cast r43 r44 r45 into r46 as [u32; 3u32]; + ternary r32 r40 r42.active into r47; + is.eq r46[2u32] 15u32 into r48; + assert.eq r48 true; + is.eq r47 true into r49; + assert.eq r49 true; + contains arr_u32__[false] into r50; + get.or_use arr_u32__[false] r33 into r51; + ternary r50 r51[0u32] r33[0u32] into r52; + ternary r50 r51[1u32] r33[1u32] into r53; + ternary r50 r51[2u32] r33[2u32] into r54; + cast r52 r53 r54 into r55 as [u32; 3u32]; + ternary r50 r55[0u32] 0u32 into r56; + ternary r50 r55[1u32] 0u32 into r57; + ternary r50 r55[2u32] 0u32 into r58; + cast r56 r57 r58 into r59 as [u32; 3u32]; + is.eq r59[1u32] 8u32 into r60; + assert.eq r60 true; + contains arr_bool__[false] into r61; + cast false false into r62 as [boolean; 2u32]; + get.or_use arr_bool__[false] r62 into r63; + ternary r61 r63[0u32] r62[0u32] into r64; + ternary r61 r63[1u32] r62[1u32] into r65; + cast r64 r65 into r66 as [boolean; 2u32]; + ternary r61 r66[0u32] false into r67; + ternary r61 r66[1u32] false into r68; + cast r67 r68 into r69 as [boolean; 2u32]; + is.eq r69[0u32] true into r70; + assert.eq r70 true; + contains nested__[false] into r71; + cast 0u8 0u8 into r72 as [u8; 2u32]; + cast r72 r72 into r73 as [[u8; 2u32]; 2u32]; + get.or_use nested__[false] r73 into r74; + ternary r71 r74[0u32][0u32] r73[0u32][0u32] into r75; + ternary r71 r74[0u32][1u32] r73[0u32][1u32] into r76; + cast r75 r76 into r77 as [u8; 2u32]; + ternary r71 r74[1u32][0u32] r73[1u32][0u32] into r78; + ternary r71 r74[1u32][1u32] r73[1u32][1u32] into r79; + cast r78 r79 into r80 as [u8; 2u32]; + cast r77 r80 into r81 as [[u8; 2u32]; 2u32]; + ternary r71 r81[0u32][0u32] 0u8 into r82; + ternary r71 r81[0u32][1u32] 0u8 into r83; + cast r82 r83 into r84 as [u8; 2u32]; + ternary r71 r81[1u32][0u32] 0u8 into r85; + ternary r71 r81[1u32][1u32] 0u8 into r86; + cast r85 r86 into r87 as [u8; 2u32]; + cast r84 r87 into r88 as [[u8; 2u32]; 2u32]; + is.eq r88[1u32][1u32] 4u8 into r89; + assert.eq r89 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/counter_storage.out b/tests/expectations/compiler/storage/counter_storage.out index c6d14a36ca6..cea2f5e58b8 100644 --- a/tests/expectations/compiler/storage/counter_storage.out +++ b/tests/expectations/compiler/storage/counter_storage.out @@ -23,15 +23,14 @@ finalize increment: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - ternary r0 r2 0u32 into r3; - add r3 1u32 into r4; - set r4 into counter__[false]; - contains counter__[false] into r5; - get.or_use counter__[false] 0u32 into r6; - ternary r5 r6 0u32 into r7; - assert.eq r5 true; - is.eq r7 r4 into r8; - assert.eq r8 true; + add r2 1u32 into r3; + set r3 into counter__[false]; + contains counter__[false] into r4; + get.or_use counter__[false] 0u32 into r5; + ternary r4 r5 0u32 into r6; + assert.eq r4 true; + is.eq r6 r3 into r7; + assert.eq r7 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/external_storage.out b/tests/expectations/compiler/storage/external_storage.out index a500874a66d..8bf5fe2dd61 100644 --- a/tests/expectations/compiler/storage/external_storage.out +++ b/tests/expectations/compiler/storage/external_storage.out @@ -192,94 +192,90 @@ finalize check_initialized: contains child.aleo/point__[false] into r16; cast 0field 0field into r17 as child.aleo/Point; get.or_use child.aleo/point__[false] r17 into r18; - cast 0field 0field into r19 as child.aleo/Point; - ternary r16 r18.x r19.x into r20; - ternary r16 r18.y r19.y into r21; - cast r20 r21 into r22 as child.aleo/Point; + ternary r16 r18.x 0field into r19; + ternary r16 r18.y 0field into r20; assert.eq r16 true; - is.eq r22.x 1field into r23; + is.eq r19 1field into r21; + assert.eq r21 true; + is.eq r20 2field into r22; + assert.eq r22 true; + contains child.aleo/points__[false] into r23; + cast 0field 0field into r24 as child.aleo/Point; + cast r24 r24 into r25 as [child.aleo/Point; 2u32]; + get.or_use child.aleo/points__[false] r25 into r26; + cast 0field 0field into r27 as child.aleo/Point; + cast r27 r27 into r28 as [child.aleo/Point; 2u32]; + ternary r23 r26[0u32].x r28[0u32].x into r29; + ternary r23 r26[0u32].y r28[0u32].y into r30; + cast r29 r30 into r31 as child.aleo/Point; + ternary r23 r26[1u32].x r28[1u32].x into r32; + ternary r23 r26[1u32].y r28[1u32].y into r33; + cast r32 r33 into r34 as child.aleo/Point; + cast r31 r34 into r35 as [child.aleo/Point; 2u32]; assert.eq r23 true; - is.eq r22.y 2field into r24; - assert.eq r24 true; - contains child.aleo/points__[false] into r25; - cast 0field 0field into r26 as child.aleo/Point; - cast r26 r26 into r27 as [child.aleo/Point; 2u32]; - get.or_use child.aleo/points__[false] r27 into r28; - cast 0field 0field into r29 as child.aleo/Point; - cast r29 r29 into r30 as [child.aleo/Point; 2u32]; - ternary r25 r28[0u32].x r30[0u32].x into r31; - ternary r25 r28[0u32].y r30[0u32].y into r32; - cast r31 r32 into r33 as child.aleo/Point; - ternary r25 r28[1u32].x r30[1u32].x into r34; - ternary r25 r28[1u32].y r30[1u32].y into r35; - cast r34 r35 into r36 as child.aleo/Point; - cast r33 r36 into r37 as [child.aleo/Point; 2u32]; - assert.eq r25 true; - is.eq r37[0u32].x 10field into r38; + is.eq r35[0u32].x 10field into r36; + assert.eq r36 true; + is.eq r35[1u32].y 40field into r37; + assert.eq r37 true; + contains child.aleo/stats__[false] into r38; + cast 0u32 0u32 0u32 into r39 as [u32; 3u32]; + cast r39 false into r40 as child.aleo/Stats; + get.or_use child.aleo/stats__[false] r40 into r41; + ternary r38 r41.values[0u32] r39[0u32] into r42; + ternary r38 r41.values[1u32] r39[1u32] into r43; + ternary r38 r41.values[2u32] r39[2u32] into r44; + cast r42 r43 r44 into r45 as [u32; 3u32]; + ternary r38 r41.active false into r46; assert.eq r38 true; - is.eq r37[1u32].y 40field into r39; - assert.eq r39 true; - contains child.aleo/stats__[false] into r40; - cast 0u32 0u32 0u32 into r41 as [u32; 3u32]; - cast r41 false into r42 as child.aleo/Stats; - get.or_use child.aleo/stats__[false] r42 into r43; - cast r41 false into r44 as child.aleo/Stats; - ternary r40 r43.values[0u32] r44.values[0u32] into r45; - ternary r40 r43.values[1u32] r44.values[1u32] into r46; - ternary r40 r43.values[2u32] r44.values[2u32] into r47; - cast r45 r46 r47 into r48 as [u32; 3u32]; - ternary r40 r43.active r44.active into r49; - cast r48 r49 into r50 as child.aleo/Stats; - assert.eq r40 true; - is.eq r50.values[1u32] 10u32 into r51; - assert.eq r51 true; - is.eq r50.active true into r52; - assert.eq r52 true; - contains child.aleo/arr_u32__[false] into r53; - get.or_use child.aleo/arr_u32__[false] r41 into r54; - ternary r53 r54[0u32] r41[0u32] into r55; - ternary r53 r54[1u32] r41[1u32] into r56; - ternary r53 r54[2u32] r41[2u32] into r57; - cast r55 r56 r57 into r58 as [u32; 3u32]; - assert.eq r53 true; - is.eq r58[2u32] 9u32 into r59; - assert.eq r59 true; - contains child.aleo/arr_bool__[false] into r60; - cast false false into r61 as [boolean; 2u32]; - get.or_use child.aleo/arr_bool__[false] r61 into r62; - ternary r60 r62[0u32] r61[0u32] into r63; - ternary r60 r62[1u32] r61[1u32] into r64; - cast r63 r64 into r65 as [boolean; 2u32]; - assert.eq r60 true; - is.eq r65[0u32] true into r66; - assert.eq r66 true; - contains child.aleo/nested__[false] into r67; - cast 0u8 0u8 into r68 as [u8; 2u32]; - cast r68 r68 into r69 as [[u8; 2u32]; 2u32]; - get.or_use child.aleo/nested__[false] r69 into r70; - ternary r67 r70[0u32][0u32] r69[0u32][0u32] into r71; - ternary r67 r70[0u32][1u32] r69[0u32][1u32] into r72; - cast r71 r72 into r73 as [u8; 2u32]; - ternary r67 r70[1u32][0u32] r69[1u32][0u32] into r74; - ternary r67 r70[1u32][1u32] r69[1u32][1u32] into r75; - cast r74 r75 into r76 as [u8; 2u32]; - cast r73 r76 into r77 as [[u8; 2u32]; 2u32]; - assert.eq r67 true; - is.eq r77[1u32][1u32] 4u8 into r78; + is.eq r45[1u32] 10u32 into r47; + assert.eq r47 true; + is.eq r46 true into r48; + assert.eq r48 true; + contains child.aleo/arr_u32__[false] into r49; + get.or_use child.aleo/arr_u32__[false] r39 into r50; + ternary r49 r50[0u32] r39[0u32] into r51; + ternary r49 r50[1u32] r39[1u32] into r52; + ternary r49 r50[2u32] r39[2u32] into r53; + cast r51 r52 r53 into r54 as [u32; 3u32]; + assert.eq r49 true; + is.eq r54[2u32] 9u32 into r55; + assert.eq r55 true; + contains child.aleo/arr_bool__[false] into r56; + cast false false into r57 as [boolean; 2u32]; + get.or_use child.aleo/arr_bool__[false] r57 into r58; + ternary r56 r58[0u32] r57[0u32] into r59; + ternary r56 r58[1u32] r57[1u32] into r60; + cast r59 r60 into r61 as [boolean; 2u32]; + assert.eq r56 true; + is.eq r61[0u32] true into r62; + assert.eq r62 true; + contains child.aleo/nested__[false] into r63; + cast 0u8 0u8 into r64 as [u8; 2u32]; + cast r64 r64 into r65 as [[u8; 2u32]; 2u32]; + get.or_use child.aleo/nested__[false] r65 into r66; + ternary r63 r66[0u32][0u32] r65[0u32][0u32] into r67; + ternary r63 r66[0u32][1u32] r65[0u32][1u32] into r68; + cast r67 r68 into r69 as [u8; 2u32]; + ternary r63 r66[1u32][0u32] r65[1u32][0u32] into r70; + ternary r63 r66[1u32][1u32] r65[1u32][1u32] into r71; + cast r70 r71 into r72 as [u8; 2u32]; + cast r69 r72 into r73 as [[u8; 2u32]; 2u32]; + assert.eq r63 true; + is.eq r73[1u32][1u32] 4u8 into r74; + assert.eq r74 true; + contains child.aleo/counter__[false] into r75; + get.or_use child.aleo/counter__[false] 0u8 into r76; + ternary r75 r76 0u8 into r77; + assert.eq r75 true; + is.eq r77 9u8 into r78; assert.eq r78 true; - contains child.aleo/counter__[false] into r79; - get.or_use child.aleo/counter__[false] 0u8 into r80; - ternary r79 r80 0u8 into r81; - assert.eq r79 true; - is.eq r81 9u8 into r82; - assert.eq r82 true; - get.or_use child.aleo/vec__len__[false] 0u32 into r83; - lt 2u32 r83 into r84; - get.or_use child.aleo/vec__[2u32] 0u8 into r85; - ternary r84 r85 0u8 into r86; - assert.eq r84 true; - is.eq r86 70u8 into r87; - assert.eq r87 true; + get.or_use child.aleo/vec__len__[false] 0u32 into r79; + lt 2u32 r79 into r80; + get.or_use child.aleo/vec__[2u32] 0u8 into r81; + ternary r80 r81 0u8 into r82; + assert.eq r80 true; + is.eq r82 70u8 into r83; + assert.eq r83 true; function check_wiped: async check_wiped into r0; @@ -317,95 +313,93 @@ finalize check_wiped: contains child.aleo/point__[false] into r24; cast 0field 0field into r25 as child.aleo/Point; get.or_use child.aleo/point__[false] r25 into r26; - cast 0field 0field into r27 as child.aleo/Point; - ternary r24 r26.x r27.x into r28; - ternary r24 r26.y r27.y into r29; - cast r28 r29 into r30 as child.aleo/Point; - cast r24 r30 into r31 as Optional__7G49nMxvEkY; - cast 0field 0field into r32 as child.aleo/Point; - cast false r32 into r33 as Optional__7G49nMxvEkY; - is.eq r31 r33 into r34; - assert.eq r34 true; - contains child.aleo/points__[false] into r35; - cast 0field 0field into r36 as child.aleo/Point; - cast r36 r36 into r37 as [child.aleo/Point; 2u32]; - get.or_use child.aleo/points__[false] r37 into r38; - cast 0field 0field into r39 as child.aleo/Point; - cast r39 r39 into r40 as [child.aleo/Point; 2u32]; - ternary r35 r38[0u32].x r40[0u32].x into r41; - ternary r35 r38[0u32].y r40[0u32].y into r42; - cast r41 r42 into r43 as child.aleo/Point; - ternary r35 r38[1u32].x r40[1u32].x into r44; - ternary r35 r38[1u32].y r40[1u32].y into r45; - cast r44 r45 into r46 as child.aleo/Point; - cast r43 r46 into r47 as [child.aleo/Point; 2u32]; - cast r35 r47 into r48 as Optional__CIFHV93i7jy; - cast 0field 0field into r49 as child.aleo/Point; - cast r49 r49 into r50 as [child.aleo/Point; 2u32]; - cast false r50 into r51 as Optional__CIFHV93i7jy; - is.eq r48 r51 into r52; - assert.eq r52 true; - contains child.aleo/stats__[false] into r53; - cast 0u32 0u32 0u32 into r54 as [u32; 3u32]; - cast r54 false into r55 as child.aleo/Stats; - get.or_use child.aleo/stats__[false] r55 into r56; - cast r54 false into r57 as child.aleo/Stats; - ternary r53 r56.values[0u32] r57.values[0u32] into r58; - ternary r53 r56.values[1u32] r57.values[1u32] into r59; - ternary r53 r56.values[2u32] r57.values[2u32] into r60; - cast r58 r59 r60 into r61 as [u32; 3u32]; - ternary r53 r56.active r57.active into r62; - cast r61 r62 into r63 as child.aleo/Stats; - cast r53 r63 into r64 as Optional__Lq45m8HPNtd; - cast r54 false into r65 as child.aleo/Stats; - cast false r65 into r66 as Optional__Lq45m8HPNtd; - is.eq r64 r66 into r67; - assert.eq r67 true; - contains child.aleo/arr_u32__[false] into r68; - get.or_use child.aleo/arr_u32__[false] r54 into r69; - ternary r68 r69[0u32] r54[0u32] into r70; - ternary r68 r69[1u32] r54[1u32] into r71; - ternary r68 r69[2u32] r54[2u32] into r72; - cast r70 r71 r72 into r73 as [u32; 3u32]; - cast r68 r73 into r74 as Optional__44OvQX0aUQS; - cast false r54 into r75 as Optional__44OvQX0aUQS; - is.eq r74 r75 into r76; - assert.eq r76 true; - contains child.aleo/arr_bool__[false] into r77; - cast false false into r78 as [boolean; 2u32]; - get.or_use child.aleo/arr_bool__[false] r78 into r79; - ternary r77 r79[0u32] r78[0u32] into r80; - ternary r77 r79[1u32] r78[1u32] into r81; - cast r80 r81 into r82 as [boolean; 2u32]; - cast r77 r82 into r83 as Optional__1QRp3ZHeoMr; - cast false r78 into r84 as Optional__1QRp3ZHeoMr; - is.eq r83 r84 into r85; - assert.eq r85 true; - contains child.aleo/nested__[false] into r86; - cast 0u8 0u8 into r87 as [u8; 2u32]; - cast r87 r87 into r88 as [[u8; 2u32]; 2u32]; - get.or_use child.aleo/nested__[false] r88 into r89; - ternary r86 r89[0u32][0u32] r88[0u32][0u32] into r90; - ternary r86 r89[0u32][1u32] r88[0u32][1u32] into r91; - cast r90 r91 into r92 as [u8; 2u32]; - ternary r86 r89[1u32][0u32] r88[1u32][0u32] into r93; - ternary r86 r89[1u32][1u32] r88[1u32][1u32] into r94; - cast r93 r94 into r95 as [u8; 2u32]; - cast r92 r95 into r96 as [[u8; 2u32]; 2u32]; - cast r86 r96 into r97 as Optional__BYnjU42CUEm; - cast false r88 into r98 as Optional__BYnjU42CUEm; - is.eq r97 r98 into r99; - assert.eq r99 true; - contains child.aleo/counter__[false] into r100; - get.or_use child.aleo/counter__[false] 0u8 into r101; - ternary r100 r101 0u8 into r102; - cast r100 r102 into r103 as Optional__3aph2JMPtnA; - cast false 0u8 into r104 as Optional__3aph2JMPtnA; - is.eq r103 r104 into r105; + ternary r24 r26.x 0field into r27; + ternary r24 r26.y 0field into r28; + cast r27 r28 into r29 as child.aleo/Point; + cast r24 r29 into r30 as Optional__7G49nMxvEkY; + cast 0field 0field into r31 as child.aleo/Point; + cast false r31 into r32 as Optional__7G49nMxvEkY; + is.eq r30 r32 into r33; + assert.eq r33 true; + contains child.aleo/points__[false] into r34; + cast 0field 0field into r35 as child.aleo/Point; + cast r35 r35 into r36 as [child.aleo/Point; 2u32]; + get.or_use child.aleo/points__[false] r36 into r37; + cast 0field 0field into r38 as child.aleo/Point; + cast r38 r38 into r39 as [child.aleo/Point; 2u32]; + ternary r34 r37[0u32].x r39[0u32].x into r40; + ternary r34 r37[0u32].y r39[0u32].y into r41; + cast r40 r41 into r42 as child.aleo/Point; + ternary r34 r37[1u32].x r39[1u32].x into r43; + ternary r34 r37[1u32].y r39[1u32].y into r44; + cast r43 r44 into r45 as child.aleo/Point; + cast r42 r45 into r46 as [child.aleo/Point; 2u32]; + cast r34 r46 into r47 as Optional__CIFHV93i7jy; + cast 0field 0field into r48 as child.aleo/Point; + cast r48 r48 into r49 as [child.aleo/Point; 2u32]; + cast false r49 into r50 as Optional__CIFHV93i7jy; + is.eq r47 r50 into r51; + assert.eq r51 true; + contains child.aleo/stats__[false] into r52; + cast 0u32 0u32 0u32 into r53 as [u32; 3u32]; + cast r53 false into r54 as child.aleo/Stats; + get.or_use child.aleo/stats__[false] r54 into r55; + ternary r52 r55.values[0u32] r53[0u32] into r56; + ternary r52 r55.values[1u32] r53[1u32] into r57; + ternary r52 r55.values[2u32] r53[2u32] into r58; + cast r56 r57 r58 into r59 as [u32; 3u32]; + ternary r52 r55.active false into r60; + cast r59 r60 into r61 as child.aleo/Stats; + cast r52 r61 into r62 as Optional__Lq45m8HPNtd; + cast r53 false into r63 as child.aleo/Stats; + cast false r63 into r64 as Optional__Lq45m8HPNtd; + is.eq r62 r64 into r65; + assert.eq r65 true; + contains child.aleo/arr_u32__[false] into r66; + get.or_use child.aleo/arr_u32__[false] r53 into r67; + ternary r66 r67[0u32] r53[0u32] into r68; + ternary r66 r67[1u32] r53[1u32] into r69; + ternary r66 r67[2u32] r53[2u32] into r70; + cast r68 r69 r70 into r71 as [u32; 3u32]; + cast r66 r71 into r72 as Optional__44OvQX0aUQS; + cast false r53 into r73 as Optional__44OvQX0aUQS; + is.eq r72 r73 into r74; + assert.eq r74 true; + contains child.aleo/arr_bool__[false] into r75; + cast false false into r76 as [boolean; 2u32]; + get.or_use child.aleo/arr_bool__[false] r76 into r77; + ternary r75 r77[0u32] r76[0u32] into r78; + ternary r75 r77[1u32] r76[1u32] into r79; + cast r78 r79 into r80 as [boolean; 2u32]; + cast r75 r80 into r81 as Optional__1QRp3ZHeoMr; + cast false r76 into r82 as Optional__1QRp3ZHeoMr; + is.eq r81 r82 into r83; + assert.eq r83 true; + contains child.aleo/nested__[false] into r84; + cast 0u8 0u8 into r85 as [u8; 2u32]; + cast r85 r85 into r86 as [[u8; 2u32]; 2u32]; + get.or_use child.aleo/nested__[false] r86 into r87; + ternary r84 r87[0u32][0u32] r86[0u32][0u32] into r88; + ternary r84 r87[0u32][1u32] r86[0u32][1u32] into r89; + cast r88 r89 into r90 as [u8; 2u32]; + ternary r84 r87[1u32][0u32] r86[1u32][0u32] into r91; + ternary r84 r87[1u32][1u32] r86[1u32][1u32] into r92; + cast r91 r92 into r93 as [u8; 2u32]; + cast r90 r93 into r94 as [[u8; 2u32]; 2u32]; + cast r84 r94 into r95 as Optional__BYnjU42CUEm; + cast false r86 into r96 as Optional__BYnjU42CUEm; + is.eq r95 r96 into r97; + assert.eq r97 true; + contains child.aleo/counter__[false] into r98; + get.or_use child.aleo/counter__[false] 0u8 into r99; + ternary r98 r99 0u8 into r100; + cast r98 r100 into r101 as Optional__3aph2JMPtnA; + cast false 0u8 into r102 as Optional__3aph2JMPtnA; + is.eq r101 r102 into r103; + assert.eq r103 true; + get.or_use child.aleo/vec__len__[false] 0u32 into r104; + is.eq r104 0u32 into r105; assert.eq r105 true; - get.or_use child.aleo/vec__len__[false] 0u32 into r106; - is.eq r106 0u32 into r107; - assert.eq r107 true; function check_fallback: async check_fallback into r0; @@ -415,134 +409,113 @@ finalize check_fallback: contains child.aleo/flag__[false] into r0; get.or_use child.aleo/flag__[false] false into r1; ternary r0 r1 false into r2; - ternary r0 r2 false into r3; - is.eq r3 false into r4; - assert.eq r4 true; - contains child.aleo/scalar_val__[false] into r5; - get.or_use child.aleo/scalar_val__[false] 0scalar into r6; - ternary r5 r6 0scalar into r7; - ternary r5 r7 0scalar into r8; - is.eq r8 0scalar into r9; - assert.eq r9 true; - contains child.aleo/field_val__[false] into r10; - get.or_use child.aleo/field_val__[false] 0field into r11; - ternary r10 r11 0field into r12; - ternary r10 r12 0field into r13; - is.eq r13 0field into r14; - assert.eq r14 true; - contains child.aleo/group_val__[false] into r15; - get.or_use child.aleo/group_val__[false] 0group into r16; - ternary r15 r16 0group into r17; - ternary r15 r17 0group into r18; - is.eq r18 0group into r19; - assert.eq r19 true; - contains child.aleo/point__[false] into r20; - cast 0field 0field into r21 as child.aleo/Point; - get.or_use child.aleo/point__[false] r21 into r22; - cast 0field 0field into r23 as child.aleo/Point; - ternary r20 r22.x r23.x into r24; - ternary r20 r22.y r23.y into r25; - cast r24 r25 into r26 as child.aleo/Point; - ternary r20 r26.x 0field into r27; - ternary r20 r26.y 0field into r28; + is.eq r2 false into r3; + assert.eq r3 true; + contains child.aleo/scalar_val__[false] into r4; + get.or_use child.aleo/scalar_val__[false] 0scalar into r5; + ternary r4 r5 0scalar into r6; + is.eq r6 0scalar into r7; + assert.eq r7 true; + contains child.aleo/field_val__[false] into r8; + get.or_use child.aleo/field_val__[false] 0field into r9; + ternary r8 r9 0field into r10; + is.eq r10 0field into r11; + assert.eq r11 true; + contains child.aleo/group_val__[false] into r12; + get.or_use child.aleo/group_val__[false] 0group into r13; + ternary r12 r13 0group into r14; + is.eq r14 0group into r15; + assert.eq r15 true; + contains child.aleo/point__[false] into r16; + cast 0field 0field into r17 as child.aleo/Point; + get.or_use child.aleo/point__[false] r17 into r18; + ternary r16 r18.x 0field into r19; + is.eq r19 0field into r20; + assert.eq r20 true; + contains child.aleo/points__[false] into r21; + cast 0field 0field into r22 as child.aleo/Point; + cast r22 r22 into r23 as [child.aleo/Point; 2u32]; + get.or_use child.aleo/points__[false] r23 into r24; + cast 0field 0field into r25 as child.aleo/Point; + cast r25 r25 into r26 as [child.aleo/Point; 2u32]; + ternary r21 r24[0u32].x r26[0u32].x into r27; + ternary r21 r24[0u32].y r26[0u32].y into r28; cast r27 r28 into r29 as child.aleo/Point; - is.eq r29.x 0field into r30; - assert.eq r30 true; - contains child.aleo/points__[false] into r31; - cast 0field 0field into r32 as child.aleo/Point; - cast r32 r32 into r33 as [child.aleo/Point; 2u32]; - get.or_use child.aleo/points__[false] r33 into r34; + ternary r21 r24[1u32].x r26[1u32].x into r30; + ternary r21 r24[1u32].y r26[1u32].y into r31; + cast r30 r31 into r32 as child.aleo/Point; + cast r29 r32 into r33 as [child.aleo/Point; 2u32]; + cast 0field 0field into r34 as child.aleo/Point; cast 0field 0field into r35 as child.aleo/Point; - cast r35 r35 into r36 as [child.aleo/Point; 2u32]; - ternary r31 r34[0u32].x r36[0u32].x into r37; - ternary r31 r34[0u32].y r36[0u32].y into r38; + cast r34 r35 into r36 as [child.aleo/Point; 2u32]; + ternary r21 r33[0u32].x r36[0u32].x into r37; + ternary r21 r33[0u32].y r36[0u32].y into r38; cast r37 r38 into r39 as child.aleo/Point; - ternary r31 r34[1u32].x r36[1u32].x into r40; - ternary r31 r34[1u32].y r36[1u32].y into r41; + ternary r21 r33[1u32].x r36[1u32].x into r40; + ternary r21 r33[1u32].y r36[1u32].y into r41; cast r40 r41 into r42 as child.aleo/Point; cast r39 r42 into r43 as [child.aleo/Point; 2u32]; - cast 0field 0field into r44 as child.aleo/Point; - cast 0field 0field into r45 as child.aleo/Point; - cast r44 r45 into r46 as [child.aleo/Point; 2u32]; - ternary r31 r43[0u32].x r46[0u32].x into r47; - ternary r31 r43[0u32].y r46[0u32].y into r48; - cast r47 r48 into r49 as child.aleo/Point; - ternary r31 r43[1u32].x r46[1u32].x into r50; - ternary r31 r43[1u32].y r46[1u32].y into r51; - cast r50 r51 into r52 as child.aleo/Point; - cast r49 r52 into r53 as [child.aleo/Point; 2u32]; - is.eq r53[0u32].x 0field into r54; - assert.eq r54 true; - contains child.aleo/stats__[false] into r55; - cast 0u32 0u32 0u32 into r56 as [u32; 3u32]; - cast r56 false into r57 as child.aleo/Stats; - get.or_use child.aleo/stats__[false] r57 into r58; - cast r56 false into r59 as child.aleo/Stats; - ternary r55 r58.values[0u32] r59.values[0u32] into r60; - ternary r55 r58.values[1u32] r59.values[1u32] into r61; - ternary r55 r58.values[2u32] r59.values[2u32] into r62; + is.eq r43[0u32].x 0field into r44; + assert.eq r44 true; + contains child.aleo/stats__[false] into r45; + cast 0u32 0u32 0u32 into r46 as [u32; 3u32]; + cast r46 false into r47 as child.aleo/Stats; + get.or_use child.aleo/stats__[false] r47 into r48; + ternary r45 r48.active false into r49; + cast 0u32 0u32 0u32 into r50 as [u32; 3u32]; + cast r50 false into r51 as child.aleo/Stats; + ternary r45 r49 r51.active into r52; + is.eq r52 false into r53; + assert.eq r53 true; + contains child.aleo/arr_u32__[false] into r54; + get.or_use child.aleo/arr_u32__[false] r46 into r55; + ternary r54 r55[0u32] r46[0u32] into r56; + ternary r54 r55[1u32] r46[1u32] into r57; + ternary r54 r55[2u32] r46[2u32] into r58; + cast r56 r57 r58 into r59 as [u32; 3u32]; + ternary r54 r59[0u32] 0u32 into r60; + ternary r54 r59[1u32] 0u32 into r61; + ternary r54 r59[2u32] 0u32 into r62; cast r60 r61 r62 into r63 as [u32; 3u32]; - ternary r55 r58.active r59.active into r64; - cast r63 r64 into r65 as child.aleo/Stats; - cast 0u32 0u32 0u32 into r66 as [u32; 3u32]; - cast r66 false into r67 as child.aleo/Stats; - ternary r55 r65.values[0u32] r67.values[0u32] into r68; - ternary r55 r65.values[1u32] r67.values[1u32] into r69; - ternary r55 r65.values[2u32] r67.values[2u32] into r70; - cast r68 r69 r70 into r71 as [u32; 3u32]; - ternary r55 r65.active r67.active into r72; - cast r71 r72 into r73 as child.aleo/Stats; - is.eq r73.active false into r74; + is.eq r63[1u32] 0u32 into r64; + assert.eq r64 true; + contains child.aleo/arr_bool__[false] into r65; + cast false false into r66 as [boolean; 2u32]; + get.or_use child.aleo/arr_bool__[false] r66 into r67; + ternary r65 r67[0u32] r66[0u32] into r68; + ternary r65 r67[1u32] r66[1u32] into r69; + cast r68 r69 into r70 as [boolean; 2u32]; + ternary r65 r70[0u32] false into r71; + ternary r65 r70[1u32] false into r72; + cast r71 r72 into r73 as [boolean; 2u32]; + is.eq r73[1u32] false into r74; assert.eq r74 true; - contains child.aleo/arr_u32__[false] into r75; - get.or_use child.aleo/arr_u32__[false] r56 into r76; - ternary r75 r76[0u32] r56[0u32] into r77; - ternary r75 r76[1u32] r56[1u32] into r78; - ternary r75 r76[2u32] r56[2u32] into r79; - cast r77 r78 r79 into r80 as [u32; 3u32]; - ternary r75 r80[0u32] 0u32 into r81; - ternary r75 r80[1u32] 0u32 into r82; - ternary r75 r80[2u32] 0u32 into r83; - cast r81 r82 r83 into r84 as [u32; 3u32]; - is.eq r84[1u32] 0u32 into r85; - assert.eq r85 true; - contains child.aleo/arr_bool__[false] into r86; - cast false false into r87 as [boolean; 2u32]; - get.or_use child.aleo/arr_bool__[false] r87 into r88; - ternary r86 r88[0u32] r87[0u32] into r89; - ternary r86 r88[1u32] r87[1u32] into r90; - cast r89 r90 into r91 as [boolean; 2u32]; - ternary r86 r91[0u32] false into r92; - ternary r86 r91[1u32] false into r93; - cast r92 r93 into r94 as [boolean; 2u32]; - is.eq r94[1u32] false into r95; - assert.eq r95 true; - contains child.aleo/nested__[false] into r96; - cast 0u8 0u8 into r97 as [u8; 2u32]; - cast r97 r97 into r98 as [[u8; 2u32]; 2u32]; - get.or_use child.aleo/nested__[false] r98 into r99; - ternary r96 r99[0u32][0u32] r98[0u32][0u32] into r100; - ternary r96 r99[0u32][1u32] r98[0u32][1u32] into r101; - cast r100 r101 into r102 as [u8; 2u32]; - ternary r96 r99[1u32][0u32] r98[1u32][0u32] into r103; - ternary r96 r99[1u32][1u32] r98[1u32][1u32] into r104; - cast r103 r104 into r105 as [u8; 2u32]; - cast r102 r105 into r106 as [[u8; 2u32]; 2u32]; - ternary r96 r106[0u32][0u32] 0u8 into r107; - ternary r96 r106[0u32][1u32] 0u8 into r108; - cast r107 r108 into r109 as [u8; 2u32]; - ternary r96 r106[1u32][0u32] 0u8 into r110; - ternary r96 r106[1u32][1u32] 0u8 into r111; - cast r110 r111 into r112 as [u8; 2u32]; - cast r109 r112 into r113 as [[u8; 2u32]; 2u32]; - is.eq r113[0u32][0u32] 0u8 into r114; - assert.eq r114 true; - contains child.aleo/counter__[false] into r115; - get.or_use child.aleo/counter__[false] 0u8 into r116; - ternary r115 r116 0u8 into r117; - ternary r115 r117 123u8 into r118; - is.eq r118 123u8 into r119; - assert.eq r119 true; + contains child.aleo/nested__[false] into r75; + cast 0u8 0u8 into r76 as [u8; 2u32]; + cast r76 r76 into r77 as [[u8; 2u32]; 2u32]; + get.or_use child.aleo/nested__[false] r77 into r78; + ternary r75 r78[0u32][0u32] r77[0u32][0u32] into r79; + ternary r75 r78[0u32][1u32] r77[0u32][1u32] into r80; + cast r79 r80 into r81 as [u8; 2u32]; + ternary r75 r78[1u32][0u32] r77[1u32][0u32] into r82; + ternary r75 r78[1u32][1u32] r77[1u32][1u32] into r83; + cast r82 r83 into r84 as [u8; 2u32]; + cast r81 r84 into r85 as [[u8; 2u32]; 2u32]; + ternary r75 r85[0u32][0u32] 0u8 into r86; + ternary r75 r85[0u32][1u32] 0u8 into r87; + cast r86 r87 into r88 as [u8; 2u32]; + ternary r75 r85[1u32][0u32] 0u8 into r89; + ternary r75 r85[1u32][1u32] 0u8 into r90; + cast r89 r90 into r91 as [u8; 2u32]; + cast r88 r91 into r92 as [[u8; 2u32]; 2u32]; + is.eq r92[0u32][0u32] 0u8 into r93; + assert.eq r93 true; + contains child.aleo/counter__[false] into r94; + get.or_use child.aleo/counter__[false] 0u8 into r95; + ternary r94 r95 0u8 into r96; + ternary r94 r96 123u8 into r97; + is.eq r97 123u8 into r98; + assert.eq r98 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/external_storage_multi_deps.out b/tests/expectations/compiler/storage/external_storage_multi_deps.out index 9f18f8884fa..78dd2629ece 100644 --- a/tests/expectations/compiler/storage/external_storage_multi_deps.out +++ b/tests/expectations/compiler/storage/external_storage_multi_deps.out @@ -163,21 +163,19 @@ finalize test_fallback: contains base.aleo/val_u32__[false] into r0; get.or_use base.aleo/val_u32__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - ternary r0 r2 0u32 into r3; - is.eq r3 0u32 into r4; - assert.eq r4 true; - contains mid1.aleo/flag__[false] into r5; - get.or_use mid1.aleo/flag__[false] false into r6; - ternary r5 r6 false into r7; - ternary r5 r7 false into r8; - is.eq r8 false into r9; - assert.eq r9 true; - contains mid2.aleo/counter__[false] into r10; - get.or_use mid2.aleo/counter__[false] 0u8 into r11; - ternary r10 r11 0u8 into r12; - ternary r10 r12 11u8 into r13; - is.eq r13 11u8 into r14; - assert.eq r14 true; + is.eq r2 0u32 into r3; + assert.eq r3 true; + contains mid1.aleo/flag__[false] into r4; + get.or_use mid1.aleo/flag__[false] false into r5; + ternary r4 r5 false into r6; + is.eq r6 false into r7; + assert.eq r7 true; + contains mid2.aleo/counter__[false] into r8; + get.or_use mid2.aleo/counter__[false] 0u8 into r9; + ternary r8 r9 0u8 into r10; + ternary r8 r10 11u8 into r11; + is.eq r11 11u8 into r12; + assert.eq r12 true; function test_none: async test_none into r0; diff --git a/tests/expectations/compiler/storage/primitives.out b/tests/expectations/compiler/storage/primitives.out index 6ac51aa8a75..11ed7823b89 100644 --- a/tests/expectations/compiler/storage/primitives.out +++ b/tests/expectations/compiler/storage/primitives.out @@ -106,33 +106,29 @@ finalize check2: contains flag__[false] into r0; get.or_use flag__[false] false into r1; ternary r0 r1 false into r2; - ternary r0 r2 false into r3; - is.eq r3 true into r4; - assert.eq r4 true; - contains scalar_val__[false] into r5; - get.or_use scalar_val__[false] 0scalar into r6; - ternary r5 r6 0scalar into r7; - ternary r5 r7 0scalar into r8; - is.eq r8 1scalar into r9; - assert.eq r9 true; - contains field_val__[false] into r10; - get.or_use field_val__[false] 0field into r11; - ternary r10 r11 0field into r12; - ternary r10 r12 0field into r13; - is.eq r13 42field into r14; - assert.eq r14 true; - contains group_val__[false] into r15; - get.or_use group_val__[false] 0group into r16; - ternary r15 r16 0group into r17; - ternary r15 r17 0group into r18; - is.eq r18 0group into r19; - assert.eq r19 true; - contains addr_val__[false] into r20; - get.or_use addr_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r21; - ternary r20 r21 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r22; - ternary r20 r22 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r23; - is.eq r23 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r24; - assert.eq r24 true; + is.eq r2 true into r3; + assert.eq r3 true; + contains scalar_val__[false] into r4; + get.or_use scalar_val__[false] 0scalar into r5; + ternary r4 r5 0scalar into r6; + is.eq r6 1scalar into r7; + assert.eq r7 true; + contains field_val__[false] into r8; + get.or_use field_val__[false] 0field into r9; + ternary r8 r9 0field into r10; + is.eq r10 42field into r11; + assert.eq r11 true; + contains group_val__[false] into r12; + get.or_use group_val__[false] 0group into r13; + ternary r12 r13 0group into r14; + is.eq r14 0group into r15; + assert.eq r15 true; + contains addr_val__[false] into r16; + get.or_use addr_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r17; + ternary r16 r17 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r18; + ternary r16 r18 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r19; + is.eq r19 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r20; + assert.eq r20 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/signed.out b/tests/expectations/compiler/storage/signed.out index 7d74129af95..9a17ba6f2a7 100644 --- a/tests/expectations/compiler/storage/signed.out +++ b/tests/expectations/compiler/storage/signed.out @@ -106,33 +106,28 @@ finalize check2: contains counter_i8__[false] into r0; get.or_use counter_i8__[false] 0i8 into r1; ternary r0 r1 0i8 into r2; - ternary r0 r2 0i8 into r3; - is.eq r3 -1i8 into r4; - assert.eq r4 true; - contains counter_i16__[false] into r5; - get.or_use counter_i16__[false] 0i16 into r6; - ternary r5 r6 0i16 into r7; - ternary r5 r7 0i16 into r8; - is.eq r8 -2i16 into r9; - assert.eq r9 true; - contains counter_i32__[false] into r10; - get.or_use counter_i32__[false] 0i32 into r11; - ternary r10 r11 0i32 into r12; - ternary r10 r12 0i32 into r13; - is.eq r13 -3i32 into r14; - assert.eq r14 true; - contains counter_i64__[false] into r15; - get.or_use counter_i64__[false] 0i64 into r16; - ternary r15 r16 0i64 into r17; - ternary r15 r17 0i64 into r18; - is.eq r18 -4i64 into r19; + is.eq r2 -1i8 into r3; + assert.eq r3 true; + contains counter_i16__[false] into r4; + get.or_use counter_i16__[false] 0i16 into r5; + ternary r4 r5 0i16 into r6; + is.eq r6 -2i16 into r7; + assert.eq r7 true; + contains counter_i32__[false] into r8; + get.or_use counter_i32__[false] 0i32 into r9; + ternary r8 r9 0i32 into r10; + is.eq r10 -3i32 into r11; + assert.eq r11 true; + contains counter_i64__[false] into r12; + get.or_use counter_i64__[false] 0i64 into r13; + ternary r12 r13 0i64 into r14; + is.eq r14 -4i64 into r15; + assert.eq r15 true; + contains counter_i128__[false] into r16; + get.or_use counter_i128__[false] 0i128 into r17; + ternary r16 r17 0i128 into r18; + is.eq r18 -5i128 into r19; assert.eq r19 true; - contains counter_i128__[false] into r20; - get.or_use counter_i128__[false] 0i128 into r21; - ternary r20 r21 0i128 into r22; - ternary r20 r22 0i128 into r23; - is.eq r23 -5i128 into r24; - assert.eq r24 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/unsigned.out b/tests/expectations/compiler/storage/unsigned.out index d5769250112..3b82460b231 100644 --- a/tests/expectations/compiler/storage/unsigned.out +++ b/tests/expectations/compiler/storage/unsigned.out @@ -106,33 +106,28 @@ finalize check2: contains counter_u8__[false] into r0; get.or_use counter_u8__[false] 0u8 into r1; ternary r0 r1 0u8 into r2; - ternary r0 r2 0u8 into r3; - is.eq r3 1u8 into r4; - assert.eq r4 true; - contains counter_u16__[false] into r5; - get.or_use counter_u16__[false] 0u16 into r6; - ternary r5 r6 0u16 into r7; - ternary r5 r7 0u16 into r8; - is.eq r8 2u16 into r9; - assert.eq r9 true; - contains counter_u32__[false] into r10; - get.or_use counter_u32__[false] 0u32 into r11; - ternary r10 r11 0u32 into r12; - ternary r10 r12 0u32 into r13; - is.eq r13 3u32 into r14; - assert.eq r14 true; - contains counter_u64__[false] into r15; - get.or_use counter_u64__[false] 0u64 into r16; - ternary r15 r16 0u64 into r17; - ternary r15 r17 0u64 into r18; - is.eq r18 4u64 into r19; + is.eq r2 1u8 into r3; + assert.eq r3 true; + contains counter_u16__[false] into r4; + get.or_use counter_u16__[false] 0u16 into r5; + ternary r4 r5 0u16 into r6; + is.eq r6 2u16 into r7; + assert.eq r7 true; + contains counter_u32__[false] into r8; + get.or_use counter_u32__[false] 0u32 into r9; + ternary r8 r9 0u32 into r10; + is.eq r10 3u32 into r11; + assert.eq r11 true; + contains counter_u64__[false] into r12; + get.or_use counter_u64__[false] 0u64 into r13; + ternary r12 r13 0u64 into r14; + is.eq r14 4u64 into r15; + assert.eq r15 true; + contains counter_u128__[false] into r16; + get.or_use counter_u128__[false] 0u128 into r17; + ternary r16 r17 0u128 into r18; + is.eq r18 5u128 into r19; assert.eq r19 true; - contains counter_u128__[false] into r20; - get.or_use counter_u128__[false] 0u128 into r21; - ternary r20 r21 0u128 into r22; - ternary r20 r22 0u128 into r23; - is.eq r23 5u128 into r24; - assert.eq r24 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/structs/external_program_cross_module_combo.out b/tests/expectations/compiler/structs/external_program_cross_module_combo.out index 071dc0ed430..7531f53bc70 100644 --- a/tests/expectations/compiler/structs/external_program_cross_module_combo.out +++ b/tests/expectations/compiler/structs/external_program_cross_module_combo.out @@ -52,12 +52,10 @@ function make_and_measure: input r1 as u32.private; input r2 as u32.private; input r3 as u32.private; - cast r0 r1 into r4 as child.aleo/Point__EQrYLk3V7pa; - cast r2 r3 into r5 as child.aleo/Point__EQrYLk3V7pa; - sub r5.x r4.x into r6; - sub r5.y r4.y into r7; - add r6 r7 into r8; - output r8 as u32.private; + sub r2 r0 into r4; + sub r3 r1 into r5; + add r4 r5 into r6; + output r6 as u32.private; function full_combo: input r0 as child.aleo/Segment__14CrFljlunD.private; diff --git a/tests/expectations/compiler/type_inference/basic_inference.out b/tests/expectations/compiler/type_inference/basic_inference.out index 36d59605989..c5a551adc6c 100644 --- a/tests/expectations/compiler/type_inference/basic_inference.out +++ b/tests/expectations/compiler/type_inference/basic_inference.out @@ -14,7 +14,7 @@ function main: input r2 as address.private; input r3 as [u32; 4u32].private; cast r0 r1 into r4 as S; - cast r4.x 42u32 into r5 as S; + cast r0 42u32 into r5 as S; add r0 1u32 into r6; add r1 2u32 into r7; mul r6 r6 into r8; diff --git a/tests/expectations/compiler/view/view_uses_storage_and_vector.out b/tests/expectations/compiler/view/view_uses_storage_and_vector.out index 6d88a89d606..ee843983db3 100644 --- a/tests/expectations/compiler/view/view_uses_storage_and_vector.out +++ b/tests/expectations/compiler/view/view_uses_storage_and_vector.out @@ -41,8 +41,7 @@ view entry_at: lt r0 r1 into r2; get.or_use entries__[r0] 0u64 into r3; ternary r2 r3 0u64 into r4; - ternary r2 r4 0u64 into r5; - output r5 as u64.public; + output r4 as u64.public; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/array_write.out b/tests/expectations/execution/array_write.out index 6020f2a697e..5df83ba007f 100644 --- a/tests/expectations/execution/array_write.out +++ b/tests/expectations/execution/array_write.out @@ -9,37 +9,28 @@ function some_assignments: input r1 as boolean.public; ternary r0 10u32 0u32 into r2; cast r2 1u32 2u32 into r3 as [u32; 3u32]; - cast 3u32 r3 into r4 as S; - ternary r0 50u32 r4.y[0u32] into r5; - ternary r0 60u32 r4.y[1u32] into r6; - ternary r0 70u32 r4.y[2u32] into r7; - cast r5 r6 r7 into r8 as [u32; 3u32]; - cast 20u32 r4.y[1u32] r4.y[2u32] into r9 as [u32; 3u32]; - ternary r0 r4.y[0u32] r9[0u32] into r10; - ternary r0 r4.y[1u32] r9[1u32] into r11; - ternary r0 r4.y[2u32] r9[2u32] into r12; - cast r10 r11 r12 into r13 as [u32; 3u32]; - ternary r0 r4.x r4.x into r14; - cast r14 r13 into r15 as S; - ternary r1 20u32 r4.y[0u32] into r16; - ternary r1 30u32 r4.x into r17; - ternary r1 r8[0u32] r4.y[0u32] into r18; - ternary r1 r8[1u32] r4.y[1u32] into r19; - ternary r1 r8[2u32] r4.y[2u32] into r20; - cast r18 r19 r20 into r21 as [u32; 3u32]; - cast r16 r4.y[1u32] r4.y[2u32] into r22 as [u32; 3u32]; - ternary r1 r15.y[0u32] r22[0u32] into r23; - ternary r1 r15.y[1u32] r22[1u32] into r24; - ternary r1 r15.y[2u32] r22[2u32] into r25; - cast r23 r24 r25 into r26 as [u32; 3u32]; - ternary r1 r15.x r4.x into r27; - cast r27 r26 into r28 as S; - cast r17 r21 into r29 as S; - cast r17 r21 into r30 as S; - cast r17 r21 into r31 as S; - cast r17 r21 into r32 as S; - cast r2 1u32 2u32 r28.x r28.y[0u32] r28.y[1u32] r28.y[2u32] r29.x r30.y[0u32] r31.y[1u32] r32.y[2u32] into r33 as [u32; 11u32]; - output r33 as [u32; 11u32].public; + ternary r0 50u32 r3[0u32] into r4; + ternary r0 60u32 r3[1u32] into r5; + ternary r0 70u32 r3[2u32] into r6; + cast r4 r5 r6 into r7 as [u32; 3u32]; + cast 20u32 r3[1u32] r3[2u32] into r8 as [u32; 3u32]; + ternary r0 r3[0u32] r8[0u32] into r9; + ternary r0 r3[1u32] r8[1u32] into r10; + ternary r0 r3[2u32] r8[2u32] into r11; + cast r9 r10 r11 into r12 as [u32; 3u32]; + ternary r1 20u32 r3[0u32] into r13; + ternary r1 30u32 3u32 into r14; + ternary r1 r7[0u32] r3[0u32] into r15; + ternary r1 r7[1u32] r3[1u32] into r16; + ternary r1 r7[2u32] r3[2u32] into r17; + cast r15 r16 r17 into r18 as [u32; 3u32]; + cast r13 r3[1u32] r3[2u32] into r19 as [u32; 3u32]; + ternary r1 r12[0u32] r19[0u32] into r20; + ternary r1 r12[1u32] r19[1u32] into r21; + ternary r1 r12[2u32] r19[2u32] into r22; + cast r20 r21 r22 into r23 as [u32; 3u32]; + cast r2 1u32 2u32 3u32 r23[0u32] r23[1u32] r23[2u32] r14 r18[0u32] r18[1u32] r18[2u32] into r24 as [u32; 11u32]; + output r24 as [u32; 11u32].public; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/cast_coersion.out b/tests/expectations/execution/cast_coersion.out index 2ab8907ff4a..ca06dcd80cf 100644 --- a/tests/expectations/execution/cast_coersion.out +++ b/tests/expectations/execution/cast_coersion.out @@ -8,16 +8,13 @@ function main: input r1 as group.private; input r2 as address.private; cast r1 into r3 as field; - cast r3 into r4 as foo; - cast 1field into r5 as foo; - cast r2 into r6 as field; - cast r6 into r7 as foo; - ternary r0 r4.data r4.data into r8; - cast r8 into r9 as foo; - ternary r0 r5.data r7.data into r10; - cast r10 into r11 as foo; - output r9 as foo.private; - output r11 as foo.private; + cast r2 into r4 as field; + ternary r0 r3 r3 into r5; + cast r5 into r6 as foo; + ternary r0 1field r4 into r7; + cast r7 into r8 as foo; + output r6 as foo.private; + output r8 as foo.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/complex_vector.out b/tests/expectations/execution/complex_vector.out index 97a3a20f733..806102a1add 100644 --- a/tests/expectations/execution/complex_vector.out +++ b/tests/expectations/execution/complex_vector.out @@ -150,39 +150,34 @@ finalize test_vector_structs_behavior: lt r0 r11 into r12; cast 0field 0field into r13 as Point; get.or_use points__[r0] r13 into r14; - cast 0field 0field into r15 as Point; - ternary r12 r14.x r15.x into r16; - ternary r12 r14.y r15.y into r17; - cast r16 r17 into r18 as Point; + ternary r12 r14.x 0field into r15; + ternary r12 r14.y 0field into r16; assert.eq r12 true; - add r18.x r18.y into r19; - is.eq r19 3field into r20; - add r18.x r18.y into r21; - is.eq r21 7field into r22; - or r20 r22 into r23; - assert.eq r23 true; + add r15 r16 into r17; + is.eq r17 3field into r18; + is.eq r17 7field into r19; + or r18 r19 into r20; + assert.eq r20 true; + get.or_use points__len__[false] 0u32 into r21; + lt r0 r21 into r22; + assert.eq r22 true; + cast 9field 9field into r23 as Point; + set r23 into points__[r0]; get.or_use points__len__[false] 0u32 into r24; lt r0 r24 into r25; + cast 0field 0field into r26 as Point; + get.or_use points__[r0] r26 into r27; + ternary r25 r27.x 0field into r28; + ternary r25 r27.y 0field into r29; assert.eq r25 true; - cast 9field 9field into r26 as Point; - set r26 into points__[r0]; - get.or_use points__len__[false] 0u32 into r27; - lt r0 r27 into r28; - cast 0field 0field into r29 as Point; - get.or_use points__[r0] r29 into r30; - cast 0field 0field into r31 as Point; - ternary r28 r30.x r31.x into r32; - ternary r28 r30.y r31.y into r33; - cast r32 r33 into r34 as Point; - assert.eq r28 true; - is.eq r34.x 9field into r35; - assert.eq r35 true; - is.eq r34.y 9field into r36; - assert.eq r36 true; + is.eq r28 9field into r30; + assert.eq r30 true; + is.eq r29 9field into r31; + assert.eq r31 true; set 0u32 into points__len__[false]; - get.or_use points__len__[false] 0u32 into r37; - is.eq r37 0u32 into r38; - assert.eq r38 true; + get.or_use points__len__[false] 0u32 into r32; + is.eq r32 0u32 into r33; + assert.eq r33 true; function test_vector_containers_behavior: input r0 as u32.private; @@ -219,58 +214,45 @@ finalize test_vector_containers_behavior: cast r19 r19 into r20 as [Point; 2u32]; cast 0u32 r20 into r21 as Container; get.or_use containers__[r0] r21 into r22; - cast 0field 0field into r23 as Point; - cast r23 r23 into r24 as [Point; 2u32]; - cast 0u32 r24 into r25 as Container; - ternary r18 r22.points[0u32].x r25.points[0u32].x into r26; - ternary r18 r22.points[0u32].y r25.points[0u32].y into r27; - cast r26 r27 into r28 as Point; - ternary r18 r22.points[1u32].x r25.points[1u32].x into r29; - ternary r18 r22.points[1u32].y r25.points[1u32].y into r30; - cast r29 r30 into r31 as Point; - cast r28 r31 into r32 as [Point; 2u32]; - ternary r18 r22.id r25.id into r33; - cast r33 r32 into r34 as Container; + ternary r18 r22.id 0u32 into r23; assert.eq r18 true; - is.eq r34.id 1u32 into r35; - is.eq r34.id 2u32 into r36; - or r35 r36 into r37; - assert.eq r37 true; - get.or_use containers__len__[false] 0u32 into r38; - lt r0 r38 into r39; - assert.eq r39 true; - cast 999field 999field into r40 as Point; - cast 33field 33field into r41 as Point; - cast r40 r41 into r42 as [Point; 2u32]; - cast 99u32 r42 into r43 as Container; - set r43 into containers__[r0]; - get.or_use containers__len__[false] 0u32 into r44; - lt r0 r44 into r45; - cast 0field 0field into r46 as Point; - cast r46 r46 into r47 as [Point; 2u32]; - cast 0u32 r47 into r48 as Container; - get.or_use containers__[r0] r48 into r49; - cast 0field 0field into r50 as Point; - cast r50 r50 into r51 as [Point; 2u32]; - cast 0u32 r51 into r52 as Container; - ternary r45 r49.points[0u32].x r52.points[0u32].x into r53; - ternary r45 r49.points[0u32].y r52.points[0u32].y into r54; - cast r53 r54 into r55 as Point; - ternary r45 r49.points[1u32].x r52.points[1u32].x into r56; - ternary r45 r49.points[1u32].y r52.points[1u32].y into r57; - cast r56 r57 into r58 as Point; - cast r55 r58 into r59 as [Point; 2u32]; - ternary r45 r49.id r52.id into r60; - cast r60 r59 into r61 as Container; - assert.eq r45 true; - is.eq r61.id 99u32 into r62; - assert.eq r62 true; - is.eq r61.points[0u32].x 999field into r63; - assert.eq r63 true; + is.eq r23 1u32 into r24; + is.eq r23 2u32 into r25; + or r24 r25 into r26; + assert.eq r26 true; + get.or_use containers__len__[false] 0u32 into r27; + lt r0 r27 into r28; + assert.eq r28 true; + cast 999field 999field into r29 as Point; + cast 33field 33field into r30 as Point; + cast r29 r30 into r31 as [Point; 2u32]; + cast 99u32 r31 into r32 as Container; + set r32 into containers__[r0]; + get.or_use containers__len__[false] 0u32 into r33; + lt r0 r33 into r34; + cast 0field 0field into r35 as Point; + cast r35 r35 into r36 as [Point; 2u32]; + cast 0u32 r36 into r37 as Container; + get.or_use containers__[r0] r37 into r38; + cast 0field 0field into r39 as Point; + cast r39 r39 into r40 as [Point; 2u32]; + ternary r34 r38.points[0u32].x r40[0u32].x into r41; + ternary r34 r38.points[0u32].y r40[0u32].y into r42; + cast r41 r42 into r43 as Point; + ternary r34 r38.points[1u32].x r40[1u32].x into r44; + ternary r34 r38.points[1u32].y r40[1u32].y into r45; + cast r44 r45 into r46 as Point; + cast r43 r46 into r47 as [Point; 2u32]; + ternary r34 r38.id 0u32 into r48; + assert.eq r34 true; + is.eq r48 99u32 into r49; + assert.eq r49 true; + is.eq r47[0u32].x 999field into r50; + assert.eq r50 true; set 0u32 into containers__len__[false]; - get.or_use containers__len__[false] 0u32 into r64; - is.eq r64 0u32 into r65; - assert.eq r65 true; + get.or_use containers__len__[false] 0u32 into r51; + is.eq r51 0u32 into r52; + assert.eq r52 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/counter_storage.out b/tests/expectations/execution/counter_storage.out index 2da9b1dd8be..d4655ccafc2 100644 --- a/tests/expectations/execution/counter_storage.out +++ b/tests/expectations/execution/counter_storage.out @@ -23,15 +23,14 @@ finalize increment: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - ternary r0 r2 0u32 into r3; - add r3 1u32 into r4; - set r4 into counter__[false]; - contains counter__[false] into r5; - get.or_use counter__[false] 0u32 into r6; - ternary r5 r6 0u32 into r7; - assert.eq r5 true; - is.eq r7 r4 into r8; - assert.eq r8 true; + add r2 1u32 into r3; + set r3 into counter__[false]; + contains counter__[false] into r4; + get.or_use counter__[false] 0u32 into r5; + ternary r4 r5 0u32 into r6; + assert.eq r4 true; + is.eq r6 r3 into r7; + assert.eq r7 true; constructor: assert.eq edition 0u16; @@ -131,3 +130,11 @@ status: accepted "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu" } + PASS [ 20.201s] ( 78/816) leo-compiler test_execution::execution_tests::execution_counter_leo + PASS [ 17.598s] ( 79/816) leo-compiler test_execution::execution_tests::execution_dynamic_mapping_interface_external_leo + PASS [ 17.878s] ( 80/816) leo-compiler test_execution::execution_tests::execution_dynamic_mapping_interface_leo + PASS [ 18.693s] ( 81/816) leo-compiler test_execution::execution_tests::execution_dynamic_dispatch_intrinsic_mapping_leo + FAIL [ 19.386s] ( 82/816) leo-compiler test_execution::execution_tests::execution_dynamic_storage_interface_leo + stdout ─── + test_execution::execution_tests::execution_dynamic_storage_interface_leo + stderr ─── \ No newline at end of file diff --git a/tests/expectations/execution/dynamic_call_future.out b/tests/expectations/execution/dynamic_call_future.out index 2d9275eb22c..36f6381c083 100644 --- a/tests/expectations/execution/dynamic_call_future.out +++ b/tests/expectations/execution/dynamic_call_future.out @@ -19,9 +19,8 @@ finalize increment: contains count__[false] into r1; get.or_use count__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - ternary r1 r3 0u32 into r4; - add r4 r0 into r5; - set r5 into count__[false]; + add r3 r0 into r4; + set r4 into count__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_call_future_with_extra_args.out b/tests/expectations/execution/dynamic_call_future_with_extra_args.out index 78fc0a09d61..450780b85dc 100644 --- a/tests/expectations/execution/dynamic_call_future_with_extra_args.out +++ b/tests/expectations/execution/dynamic_call_future_with_extra_args.out @@ -46,9 +46,8 @@ finalize main: contains local_count__[false] into r2; get.or_use local_count__[false] 0u32 into r3; ternary r2 r3 0u32 into r4; - ternary r2 r4 0u32 into r5; - add r5 r1 into r6; - set r6 into local_count__[false]; + add r4 r1 into r5; + set r5 into local_count__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_call_multiple_same_target.out b/tests/expectations/execution/dynamic_call_multiple_same_target.out index ef592e0cbbf..f6c2fd5735c 100644 --- a/tests/expectations/execution/dynamic_call_multiple_same_target.out +++ b/tests/expectations/execution/dynamic_call_multiple_same_target.out @@ -21,9 +21,8 @@ finalize compute: contains total__[false] into r1; get.or_use total__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - ternary r1 r3 0u32 into r4; - add r4 r0 into r5; - set r5 into total__[false]; + add r3 r0 into r4; + set r4 into total__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out b/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out index 2d9275eb22c..36f6381c083 100644 --- a/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out +++ b/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out @@ -19,9 +19,8 @@ finalize increment: contains count__[false] into r1; get.or_use count__[false] 0u32 into r2; ternary r1 r2 0u32 into r3; - ternary r1 r3 0u32 into r4; - add r4 r0 into r5; - set r5 into count__[false]; + add r3 r0 into r4; + set r4 into count__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/dynamic_storage_interface.out b/tests/expectations/execution/dynamic_storage_interface.out index 6f306e22a78..5987e09276c 100644 --- a/tests/expectations/execution/dynamic_storage_interface.out +++ b/tests/expectations/execution/dynamic_storage_interface.out @@ -26,13 +26,12 @@ finalize bump: contains counter__[false] into r1; get.or_use counter__[false] 0u64 into r2; ternary r1 r2 0u64 into r3; - ternary r1 r3 0u64 into r4; - add r4 1u64 into r5; - set r5 into counter__[false]; - get.or_use entries__len__[false] 0u32 into r6; - add r6 1u32 into r7; - set r7 into entries__len__[false]; - set r0 into entries__[r6]; + add r3 1u64 into r4; + set r4 into counter__[false]; + get.or_use entries__len__[false] 0u32 into r5; + add r5 1u32 into r6; + set r6 into entries__len__[false]; + set r0 into entries__[r5]; function check_counter: input r0 as field.private; From 0f8c6f47e68f4b774020e3c49ac99fbf49f4914c Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 02:20:27 +0800 Subject: [PATCH 41/65] Match ternary tracking formatting --- crates/passes/src/ssa_const_propagation/ast.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index dc1cfed55c0..b770259d54f 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -630,14 +630,11 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { && is_atom(&ternary.if_true) && is_atom(&ternary.if_false) { - self.ternaries.insert( - identifier.name, - TrackedTernary { - condition: ternary.condition.clone(), - if_true: ternary.if_true.clone(), - if_false: ternary.if_false.clone(), - }, - ); + self.ternaries.insert(identifier.name, TrackedTernary { + condition: ternary.condition.clone(), + if_true: ternary.if_true.clone(), + if_false: ternary.if_false.clone(), + }); } if let (DefinitionPlace::Single(identifier), Expression::Path(path)) = (&input.place, &new_value) From 63f80c322a674dd4ad31211e5ca7cc2480b4131a Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 02:27:34 +0800 Subject: [PATCH 42/65] Remove stale counter storage log tail --- tests/expectations/execution/counter_storage.out | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/expectations/execution/counter_storage.out b/tests/expectations/execution/counter_storage.out index d4655ccafc2..e1f0868c9b7 100644 --- a/tests/expectations/execution/counter_storage.out +++ b/tests/expectations/execution/counter_storage.out @@ -129,12 +129,3 @@ status: accepted ], "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu" } - - PASS [ 20.201s] ( 78/816) leo-compiler test_execution::execution_tests::execution_counter_leo - PASS [ 17.598s] ( 79/816) leo-compiler test_execution::execution_tests::execution_dynamic_mapping_interface_external_leo - PASS [ 17.878s] ( 80/816) leo-compiler test_execution::execution_tests::execution_dynamic_mapping_interface_leo - PASS [ 18.693s] ( 81/816) leo-compiler test_execution::execution_tests::execution_dynamic_dispatch_intrinsic_mapping_leo - FAIL [ 19.386s] ( 82/816) leo-compiler test_execution::execution_tests::execution_dynamic_storage_interface_leo - stdout ─── - test_execution::execution_tests::execution_dynamic_storage_interface_leo - stderr ─── \ No newline at end of file From 271f8cfeb145fffd8926c0da63598da6094fdf29 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 02:36:42 +0800 Subject: [PATCH 43/65] Restore counter storage snapshot terminator --- tests/expectations/execution/counter_storage.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/expectations/execution/counter_storage.out b/tests/expectations/execution/counter_storage.out index e1f0868c9b7..edfc46a9d51 100644 --- a/tests/expectations/execution/counter_storage.out +++ b/tests/expectations/execution/counter_storage.out @@ -129,3 +129,4 @@ status: accepted ], "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu" } + From 38488da9c049d895dfb32f3d57a6989d157559aa Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 02:50:47 +0800 Subject: [PATCH 44/65] Refresh ternary execution snapshots --- .../execution/external_storage.out | 10 +- .../execution/external_storage_vector.out | 114 +++++++++--------- .../external_submodule_generic_composite.out | 5 +- .../flattened_function_and_inline_matches.out | 114 ++++++++---------- .../execution/generics_in_modules.out | 58 ++++----- 5 files changed, 137 insertions(+), 164 deletions(-) diff --git a/tests/expectations/execution/external_storage.out b/tests/expectations/execution/external_storage.out index 01cc241bced..048d1a3a93f 100644 --- a/tests/expectations/execution/external_storage.out +++ b/tests/expectations/execution/external_storage.out @@ -16,9 +16,8 @@ finalize c: contains count__[false] into r0; get.or_use count__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - ternary r0 r2 0u64 into r3; - add r3 1u64 into r4; - set r4 into count__[false]; + add r2 1u64 into r3; + set r3 into count__[false]; constructor: assert.eq edition 0u16; @@ -41,9 +40,8 @@ finalize d: contains count__[false] into r0; get.or_use count__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - ternary r0 r2 0u64 into r3; - add r3 2u64 into r4; - set r4 into count__[false]; + add r2 2u64 into r3; + set r3 into count__[false]; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/external_storage_vector.out b/tests/expectations/execution/external_storage_vector.out index e4dad902a17..7ef5430758e 100644 --- a/tests/expectations/execution/external_storage_vector.out +++ b/tests/expectations/execution/external_storage_vector.out @@ -94,68 +94,62 @@ finalize combine: lt 0u32 r6 into r7; get.or_use vec_program_a.aleo/numbers__[0u32] 0u32 into r8; ternary r7 r8 0u32 into r9; - ternary r7 r9 0u32 into r10; - get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r11; - lt 0u32 r11 into r12; - get.or_use vec_program_b.aleo/numbers__[0u32] 0u32 into r13; - ternary r12 r13 0u32 into r14; - ternary r12 r14 0u32 into r15; - get.or_use sum_vec__len__[false] 0u32 into r16; - add r16 1u32 into r17; - set r17 into sum_vec__len__[false]; - add r10 r15 into r18; - set r18 into sum_vec__[r16]; - get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r19; - lt 1u32 r19 into r20; - get.or_use vec_program_a.aleo/numbers__[1u32] 0u32 into r21; - ternary r20 r21 0u32 into r22; - ternary r20 r22 0u32 into r23; - get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r24; - lt 1u32 r24 into r25; - get.or_use vec_program_b.aleo/numbers__[1u32] 0u32 into r26; - ternary r25 r26 0u32 into r27; - ternary r25 r27 0u32 into r28; - get.or_use sum_vec__len__[false] 0u32 into r29; - add r29 1u32 into r30; - set r30 into sum_vec__len__[false]; - add r23 r28 into r31; - set r31 into sum_vec__[r29]; - get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r32; + get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r10; + lt 0u32 r10 into r11; + get.or_use vec_program_b.aleo/numbers__[0u32] 0u32 into r12; + ternary r11 r12 0u32 into r13; + get.or_use sum_vec__len__[false] 0u32 into r14; + add r14 1u32 into r15; + set r15 into sum_vec__len__[false]; + add r9 r13 into r16; + set r16 into sum_vec__[r14]; + get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r17; + lt 1u32 r17 into r18; + get.or_use vec_program_a.aleo/numbers__[1u32] 0u32 into r19; + ternary r18 r19 0u32 into r20; + get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r21; + lt 1u32 r21 into r22; + get.or_use vec_program_b.aleo/numbers__[1u32] 0u32 into r23; + ternary r22 r23 0u32 into r24; + get.or_use sum_vec__len__[false] 0u32 into r25; + add r25 1u32 into r26; + set r26 into sum_vec__len__[false]; + add r20 r24 into r27; + set r27 into sum_vec__[r25]; + get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r28; + lt 2u32 r28 into r29; + get.or_use vec_program_a.aleo/numbers__[2u32] 0u32 into r30; + ternary r29 r30 0u32 into r31; + get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r32; lt 2u32 r32 into r33; - get.or_use vec_program_a.aleo/numbers__[2u32] 0u32 into r34; + get.or_use vec_program_b.aleo/numbers__[2u32] 0u32 into r34; ternary r33 r34 0u32 into r35; - ternary r33 r35 0u32 into r36; - get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r37; - lt 2u32 r37 into r38; - get.or_use vec_program_b.aleo/numbers__[2u32] 0u32 into r39; - ternary r38 r39 0u32 into r40; - ternary r38 r40 0u32 into r41; - get.or_use sum_vec__len__[false] 0u32 into r42; - add r42 1u32 into r43; - set r43 into sum_vec__len__[false]; - add r36 r41 into r44; - set r44 into sum_vec__[r42]; - get.or_use sum_vec__len__[false] 0u32 into r45; - lt 0u32 r45 into r46; - get.or_use sum_vec__[0u32] 0u32 into r47; - ternary r46 r47 0u32 into r48; - assert.eq r46 true; - is.eq r48 11u32 into r49; - assert.eq r49 true; - get.or_use sum_vec__len__[false] 0u32 into r50; - lt 1u32 r50 into r51; - get.or_use sum_vec__[1u32] 0u32 into r52; - ternary r51 r52 0u32 into r53; - assert.eq r51 true; - is.eq r53 22u32 into r54; - assert.eq r54 true; - get.or_use sum_vec__len__[false] 0u32 into r55; - lt 2u32 r55 into r56; - get.or_use sum_vec__[2u32] 0u32 into r57; - ternary r56 r57 0u32 into r58; - assert.eq r56 true; - is.eq r58 3u32 into r59; - assert.eq r59 true; + get.or_use sum_vec__len__[false] 0u32 into r36; + add r36 1u32 into r37; + set r37 into sum_vec__len__[false]; + add r31 r35 into r38; + set r38 into sum_vec__[r36]; + get.or_use sum_vec__len__[false] 0u32 into r39; + lt 0u32 r39 into r40; + get.or_use sum_vec__[0u32] 0u32 into r41; + ternary r40 r41 0u32 into r42; + assert.eq r40 true; + is.eq r42 11u32 into r43; + assert.eq r43 true; + get.or_use sum_vec__len__[false] 0u32 into r44; + lt 1u32 r44 into r45; + get.or_use sum_vec__[1u32] 0u32 into r46; + ternary r45 r46 0u32 into r47; + assert.eq r45 true; + is.eq r47 22u32 into r48; + assert.eq r48 true; + get.or_use sum_vec__len__[false] 0u32 into r49; + lt 2u32 r49 into r50; + get.or_use sum_vec__[2u32] 0u32 into r51; + ternary r50 r51 0u32 into r52; + assert.eq r50 true; + is.eq r52 3u32 into r53; + assert.eq r53 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/external_submodule_generic_composite.out b/tests/expectations/execution/external_submodule_generic_composite.out index 0c0253abd22..aae0652d4e7 100644 --- a/tests/expectations/execution/external_submodule_generic_composite.out +++ b/tests/expectations/execution/external_submodule_generic_composite.out @@ -17,9 +17,8 @@ program parent.aleo; function use_pair: input r0 as u32.private; mul r0 3u32 into r1; - cast r0 r1 into r2 as child.aleo/Pair__2Avv5epyKtU; - add r2.a r2.b into r3; - output r3 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/flattened_function_and_inline_matches.out b/tests/expectations/execution/flattened_function_and_inline_matches.out index 793c4096da8..85e3e7de188 100644 --- a/tests/expectations/execution/flattened_function_and_inline_matches.out +++ b/tests/expectations/execution/flattened_function_and_inline_matches.out @@ -12,23 +12,20 @@ closure foo: input r0 as u8; input r1 as u8; input r2 as Data; - cast r0 into r3 as Extra; - cast r0 r1 r3 into r4 as Data; - is.eq r0 r1 into r5; - add r0 r1 into r6; - sub r0 r1 into r7; - add r6 r2.a into r8; - add r7 r2.b into r9; - ternary r5 r4.c.c r4.c.c into r10; - cast r10 into r11 as Extra; - ternary r5 r4.a r4.a into r12; - ternary r5 r4.b r4.b into r13; - cast r12 r13 r11 into r14 as Data; - ternary r5 r0 r8 into r15; - ternary r5 r1 r9 into r16; - output r15 as u8; - output r16 as u8; - output r14 as Data; + is.eq r0 r1 into r3; + add r0 r1 into r4; + sub r0 r1 into r5; + add r4 r2.a into r6; + add r5 r2.b into r7; + ternary r3 r0 r0 into r8; + cast r8 into r9 as Extra; + ternary r3 r1 r1 into r10; + cast r8 r10 r9 into r11 as Data; + ternary r3 r0 r6 into r12; + ternary r3 r1 r7 into r13; + output r12 as u8; + output r13 as u8; + output r11 as Data; function bar: input r0 as boolean.private; @@ -44,42 +41,37 @@ function bar: ternary r1 r12 r15 into r18; ternary r1 r13 r16 into r19; ternary r1 r14.c.c r17.c.c into r20; - cast r20 into r21 as Extra; - ternary r1 r14.a r17.a into r22; - ternary r1 r14.b r17.b into r23; - cast r22 r23 r21 into r24 as Data; - ternary r0 r9 r18 into r25; - ternary r0 r10 r19 into r26; - ternary r0 r11.c.c r24.c.c into r27; - cast r27 into r28 as Extra; - ternary r0 r11.a r24.a into r29; - ternary r0 r11.b r24.b into r30; - cast r29 r30 r28 into r31 as Data; - output r25 as u8.private; - output r26 as u8.private; - output r31 as Data.private; + ternary r1 r14.a r17.a into r21; + ternary r1 r14.b r17.b into r22; + ternary r0 r9 r18 into r23; + ternary r0 r10 r19 into r24; + ternary r0 r11.c.c r20 into r25; + cast r25 into r26 as Extra; + ternary r0 r11.a r21 into r27; + ternary r0 r11.b r22 into r28; + cast r27 r28 r26 into r29 as Data; + output r23 as u8.private; + output r24 as u8.private; + output r29 as Data.private; closure floo: input r0 as u8; input r1 as u8; input r2 as Data; - cast r0 into r3 as Extra; - cast r0 r1 r3 into r4 as Data; - is.eq r0 r1 into r5; - add r0 r1 into r6; - sub r0 r1 into r7; - add r6 r2.a into r8; - add r7 r2.b into r9; - ternary r5 r4.c.c r4.c.c into r10; - cast r10 into r11 as Extra; - ternary r5 r4.a r4.a into r12; - ternary r5 r4.b r4.b into r13; - cast r12 r13 r11 into r14 as Data; - ternary r5 r0 r8 into r15; - ternary r5 r1 r9 into r16; - output r15 as u8; - output r16 as u8; - output r14 as Data; + is.eq r0 r1 into r3; + add r0 r1 into r4; + sub r0 r1 into r5; + add r4 r2.a into r6; + add r5 r2.b into r7; + ternary r3 r0 r0 into r8; + cast r8 into r9 as Extra; + ternary r3 r1 r1 into r10; + cast r8 r10 r9 into r11 as Data; + ternary r3 r0 r6 into r12; + ternary r3 r1 r7 into r13; + output r12 as u8; + output r13 as u8; + output r11 as Data; function blar: input r0 as boolean.private; @@ -95,20 +87,18 @@ function blar: ternary r1 r12 r15 into r18; ternary r1 r13 r16 into r19; ternary r1 r14.c.c r17.c.c into r20; - cast r20 into r21 as Extra; - ternary r1 r14.a r17.a into r22; - ternary r1 r14.b r17.b into r23; - cast r22 r23 r21 into r24 as Data; - ternary r0 r9 r18 into r25; - ternary r0 r10 r19 into r26; - ternary r0 r11.c.c r24.c.c into r27; - cast r27 into r28 as Extra; - ternary r0 r11.a r24.a into r29; - ternary r0 r11.b r24.b into r30; - cast r29 r30 r28 into r31 as Data; - output r25 as u8.private; - output r26 as u8.private; - output r31 as Data.private; + ternary r1 r14.a r17.a into r21; + ternary r1 r14.b r17.b into r22; + ternary r0 r9 r18 into r23; + ternary r0 r10 r19 into r24; + ternary r0 r11.c.c r20 into r25; + cast r25 into r26 as Extra; + ternary r0 r11.a r21 into r27; + ternary r0 r11.b r22 into r28; + cast r27 r28 r26 into r29 as Data; + output r23 as u8.private; + output r24 as u8.private; + output r29 as Data.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/generics_in_modules.out b/tests/expectations/execution/generics_in_modules.out index 08441ce1542..73cca7ff8b0 100644 --- a/tests/expectations/execution/generics_in_modules.out +++ b/tests/expectations/execution/generics_in_modules.out @@ -17,39 +17,31 @@ function main: cast 1u32 2u32 3u32 into r1 as [u32; 3u32]; cast r0 r1 into r2 as [[u32; 3u32]; 2u32]; cast r2 into r3 as Matrix__1cjGkfvo5TZ; - cast r3 into r4 as WrappedMatrix__Ko9u9VWnm3M; - cast r4.inner.values[0u32][0u32] r4.inner.values[0u32][1u32] r4.inner.values[0u32][2u32] into r5 as [u32; 3u32]; - cast r4.inner.values[1u32][0u32] r4.inner.values[1u32][1u32] r4.inner.values[1u32][2u32] into r6 as [u32; 3u32]; - cast r5 r6 into r7 as [[u32; 3u32]; 2u32]; - cast r7 into r8 as Matrix__1cjGkfvo5TZ; - add r8.values[0u32][0u32] 1u32 into r9; - cast r9 r4.inner.values[0u32][1u32] r4.inner.values[0u32][2u32] into r10 as [u32; 3u32]; - cast r10 r6 into r11 as [[u32; 3u32]; 2u32]; - cast r11 into r12 as Matrix__1cjGkfvo5TZ; - add r12.values[0u32][1u32] 1u32 into r13; - cast r9 r13 r4.inner.values[0u32][2u32] into r14 as [u32; 3u32]; - cast r14 r6 into r15 as [[u32; 3u32]; 2u32]; - cast r15 into r16 as Matrix__1cjGkfvo5TZ; - add r16.values[0u32][2u32] 1u32 into r17; - cast r9 r13 r17 into r18 as [u32; 3u32]; - cast r18 r6 into r19 as [[u32; 3u32]; 2u32]; - cast r19 into r20 as Matrix__1cjGkfvo5TZ; - add r20.values[1u32][0u32] 1u32 into r21; - cast r21 r4.inner.values[1u32][1u32] r4.inner.values[1u32][2u32] into r22 as [u32; 3u32]; - cast r18 r22 into r23 as [[u32; 3u32]; 2u32]; - cast r23 into r24 as Matrix__1cjGkfvo5TZ; - add r24.values[1u32][1u32] 1u32 into r25; - cast r21 r25 r4.inner.values[1u32][2u32] into r26 as [u32; 3u32]; - cast r18 r26 into r27 as [[u32; 3u32]; 2u32]; - cast r27 into r28 as Matrix__1cjGkfvo5TZ; - add r28.values[1u32][2u32] 1u32 into r29; - cast r21 r25 r29 into r30 as [u32; 3u32]; - cast r18 r30 into r31 as [[u32; 3u32]; 2u32]; - cast r31 into r32 as Matrix__1cjGkfvo5TZ; - cast 0u32 10u32 20u32 30u32 into r33 as [u32; 4u32]; - cast r33 into r34 as InnerGeneric__JgC4Y0wyi7O; - add r32.values[0u32][1u32] r34.data[3u32] into r35; - output r35 as u32.private; + cast r3.values[0u32][0u32] r3.values[0u32][1u32] r3.values[0u32][2u32] into r4 as [u32; 3u32]; + cast r3.values[1u32][0u32] r3.values[1u32][1u32] r3.values[1u32][2u32] into r5 as [u32; 3u32]; + cast r4 r5 into r6 as [[u32; 3u32]; 2u32]; + add r6[0u32][0u32] 1u32 into r7; + cast r7 r3.values[0u32][1u32] r3.values[0u32][2u32] into r8 as [u32; 3u32]; + cast r8 r5 into r9 as [[u32; 3u32]; 2u32]; + add r9[0u32][1u32] 1u32 into r10; + cast r7 r10 r3.values[0u32][2u32] into r11 as [u32; 3u32]; + cast r11 r5 into r12 as [[u32; 3u32]; 2u32]; + add r12[0u32][2u32] 1u32 into r13; + cast r7 r10 r13 into r14 as [u32; 3u32]; + cast r14 r5 into r15 as [[u32; 3u32]; 2u32]; + add r15[1u32][0u32] 1u32 into r16; + cast r16 r3.values[1u32][1u32] r3.values[1u32][2u32] into r17 as [u32; 3u32]; + cast r14 r17 into r18 as [[u32; 3u32]; 2u32]; + add r18[1u32][1u32] 1u32 into r19; + cast r16 r19 r3.values[1u32][2u32] into r20 as [u32; 3u32]; + cast r14 r20 into r21 as [[u32; 3u32]; 2u32]; + add r21[1u32][2u32] 1u32 into r22; + cast r16 r19 r22 into r23 as [u32; 3u32]; + cast r14 r23 into r24 as [[u32; 3u32]; 2u32]; + cast 0u32 10u32 20u32 30u32 into r25 as [u32; 4u32]; + cast r25 into r26 as InnerGeneric__JgC4Y0wyi7O; + add r24[0u32][1u32] r26.data[3u32] into r27; + output r27 as u32.private; constructor: assert.eq edition 0u16; From 5b4a6e7bd86af46ceb85c5ef4905c58aa5aa63f3 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 03:00:21 +0800 Subject: [PATCH 45/65] Refresh optional ternary snapshots --- .../execution/implicit_option_wrapping.out | 64 +++++++++---------- .../lib_fn_cross_lib_with_struct.out | 9 ++- .../libraries/lib_fn_struct_call_chain.out | 9 ++- .../libraries/lib_fn_with_struct.out | 9 ++- .../expectations/execution/optional_types.out | 35 +++++----- 5 files changed, 56 insertions(+), 70 deletions(-) diff --git a/tests/expectations/execution/implicit_option_wrapping.out b/tests/expectations/execution/implicit_option_wrapping.out index 5c2d978434a..782f63f151b 100644 --- a/tests/expectations/execution/implicit_option_wrapping.out +++ b/tests/expectations/execution/implicit_option_wrapping.out @@ -56,10 +56,9 @@ function complex_implicit_return: cast r3 into r4 as Foo; cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; - cast r6 into r7 as Wrapper; - assert.eq r7.arr[0u32].is_some true; - assert.eq r7.arr[0u32].val.x.is_some true; - output r7.arr[0u32].val.x.val as u8.private; + assert.eq r6[0u32].is_some true; + assert.eq r6[0u32].val.x.is_some true; + output r6[0u32].val.x.val as u8.private; function complex_implicit_argument: cast false 0u8 into r0 as Optional__3aph2JMPtnA; @@ -69,10 +68,9 @@ function complex_implicit_argument: cast r3 into r4 as Foo; cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; - cast r6 into r7 as Wrapper; - assert.eq r7.arr[0u32].is_some true; - ternary r7.arr[0u32].val.x.is_some r7.arr[0u32].val.x.val 42u8 into r8; - output r8 as u8.private; + assert.eq r6[0u32].is_some true; + ternary r6[0u32].val.x.is_some r6[0u32].val.x.val 42u8 into r7; + output r7 as u8.private; function complex_implicit_ternary: input r0 as boolean.private; @@ -83,30 +81,27 @@ function complex_implicit_ternary: cast r4 into r5 as Foo; cast false r5 into r6 as Optional__DH9PtMwOkLt; cast r3 r6 into r7 as [Optional__DH9PtMwOkLt; 2u32]; - cast r7 into r8 as Wrapper; - cast false 0u8 into r9 as Optional__3aph2JMPtnA; - cast r9 into r10 as Foo; - cast false r10 into r11 as Optional__DH9PtMwOkLt; - cast r11 r11 into r12 as [Optional__DH9PtMwOkLt; 2u32]; - cast r12 into r13 as Wrapper; - ternary r0 r8.arr[0u32].val.x.is_some r13.arr[0u32].val.x.is_some into r14; - ternary r0 r8.arr[0u32].val.x.val r13.arr[0u32].val.x.val into r15; - cast r14 r15 into r16 as Optional__3aph2JMPtnA; - cast r16 into r17 as Foo; - ternary r0 r8.arr[0u32].is_some r13.arr[0u32].is_some into r18; - cast r18 r17 into r19 as Optional__DH9PtMwOkLt; - ternary r0 r8.arr[1u32].val.x.is_some r13.arr[1u32].val.x.is_some into r20; - ternary r0 r8.arr[1u32].val.x.val r13.arr[1u32].val.x.val into r21; - cast r20 r21 into r22 as Optional__3aph2JMPtnA; - cast r22 into r23 as Foo; - ternary r0 r8.arr[1u32].is_some r13.arr[1u32].is_some into r24; - cast r24 r23 into r25 as Optional__DH9PtMwOkLt; - cast r19 r25 into r26 as [Optional__DH9PtMwOkLt; 2u32]; - cast r26 into r27 as Wrapper; + cast false 0u8 into r8 as Optional__3aph2JMPtnA; + cast r8 into r9 as Foo; + cast false r9 into r10 as Optional__DH9PtMwOkLt; + cast r10 r10 into r11 as [Optional__DH9PtMwOkLt; 2u32]; + ternary r0 r7[0u32].val.x.is_some r11[0u32].val.x.is_some into r12; + ternary r0 r7[0u32].val.x.val r11[0u32].val.x.val into r13; + cast r12 r13 into r14 as Optional__3aph2JMPtnA; + cast r14 into r15 as Foo; + ternary r0 r7[0u32].is_some r11[0u32].is_some into r16; + cast r16 r15 into r17 as Optional__DH9PtMwOkLt; + ternary r0 r7[1u32].val.x.is_some r11[1u32].val.x.is_some into r18; + ternary r0 r7[1u32].val.x.val r11[1u32].val.x.val into r19; + cast r18 r19 into r20 as Optional__3aph2JMPtnA; + cast r20 into r21 as Foo; + ternary r0 r7[1u32].is_some r11[1u32].is_some into r22; + cast r22 r21 into r23 as Optional__DH9PtMwOkLt; + cast r17 r23 into r24 as [Optional__DH9PtMwOkLt; 2u32]; assert.eq r0 true; - assert.eq r27.arr[0u32].is_some true; - ternary r27.arr[0u32].val.x.is_some r27.arr[0u32].val.x.val 69u8 into r28; - output r28 as u8.private; + assert.eq r24[0u32].is_some true; + ternary r24[0u32].val.x.is_some r24[0u32].val.x.val 69u8 into r25; + output r25 as u8.private; function complex_implicit_reassignment: cast true 7u8 into r0 as Optional__3aph2JMPtnA; @@ -116,10 +111,9 @@ function complex_implicit_reassignment: cast r3 into r4 as Foo; cast false r4 into r5 as Optional__DH9PtMwOkLt; cast r2 r5 into r6 as [Optional__DH9PtMwOkLt; 2u32]; - cast r6 into r7 as Wrapper; - assert.eq r7.arr[0u32].is_some true; - assert.eq r7.arr[0u32].val.x.is_some true; - output r7.arr[0u32].val.x.val as u8.private; + assert.eq r6[0u32].is_some true; + assert.eq r6[0u32].val.x.is_some true; + output r6[0u32].val.x.val as u8.private; function complex_array_wrapping: cast true 1u8 into r0 as Optional__3aph2JMPtnA; diff --git a/tests/expectations/execution/libraries/lib_fn_cross_lib_with_struct.out b/tests/expectations/execution/libraries/lib_fn_cross_lib_with_struct.out index 9cb814a09f2..60941ae4f7f 100644 --- a/tests/expectations/execution/libraries/lib_fn_cross_lib_with_struct.out +++ b/tests/expectations/execution/libraries/lib_fn_cross_lib_with_struct.out @@ -11,11 +11,10 @@ function compute: input r3 as u32.private; add r0 r2 into r4; add r1 r3 into r5; - cast r4 r5 into r6 as Point__7VbTm7beYPk; - mul r6.x r6.x into r7; - mul r6.y r6.y into r8; - add r7 r8 into r9; - output r9 as u32.private; + mul r4 r4 into r6; + mul r5 r5 into r7; + add r6 r7 into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/libraries/lib_fn_struct_call_chain.out b/tests/expectations/execution/libraries/lib_fn_struct_call_chain.out index 9cb814a09f2..60941ae4f7f 100644 --- a/tests/expectations/execution/libraries/lib_fn_struct_call_chain.out +++ b/tests/expectations/execution/libraries/lib_fn_struct_call_chain.out @@ -11,11 +11,10 @@ function compute: input r3 as u32.private; add r0 r2 into r4; add r1 r3 into r5; - cast r4 r5 into r6 as Point__7VbTm7beYPk; - mul r6.x r6.x into r7; - mul r6.y r6.y into r8; - add r7 r8 into r9; - output r9 as u32.private; + mul r4 r4 into r6; + mul r5 r5 into r7; + add r6 r7 into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/libraries/lib_fn_with_struct.out b/tests/expectations/execution/libraries/lib_fn_with_struct.out index 9cb814a09f2..60941ae4f7f 100644 --- a/tests/expectations/execution/libraries/lib_fn_with_struct.out +++ b/tests/expectations/execution/libraries/lib_fn_with_struct.out @@ -11,11 +11,10 @@ function compute: input r3 as u32.private; add r0 r2 into r4; add r1 r3 into r5; - cast r4 r5 into r6 as Point__7VbTm7beYPk; - mul r6.x r6.x into r7; - mul r6.y r6.y into r8; - add r7 r8 into r9; - output r9 as u32.private; + mul r4 r4 into r6; + mul r5 r5 into r7; + add r6 r7 into r8; + output r8 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/optional_types.out b/tests/expectations/execution/optional_types.out index 282ec028aa9..605430c45ae 100644 --- a/tests/expectations/execution/optional_types.out +++ b/tests/expectations/execution/optional_types.out @@ -156,8 +156,8 @@ function optional_struct_field: output 123u16 as u16.private; function optional_struct: - cast 5u8 into r0 as MyStruct; - output r0.x as u8.private; + assert.eq true true; + output 5u8 as u8.private; function array_of_optional_structs: cast 10u8 into r0 as Foo; @@ -187,14 +187,11 @@ function nested_optional_structs: cast r14 into r15 as Wrapper; cast false r15 into r16 as Optional__90gnFMeDKTp; cast r9 r16 into r17 as [Optional__90gnFMeDKTp; 2u32]; - cast true r17 into r18 as Optional__4aWy0bP6UHu; - cast r18 into r19 as Container; - assert.eq r19.wrappers.is_some true; - assert.eq r19.wrappers.val[0u32].is_some true; - assert.eq r19.wrappers.val[0u32].val.arr.is_some true; - assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].is_some true; - assert.eq r19.wrappers.val[0u32].val.arr.val[0u32].val.val.is_some true; - output r19.wrappers.val[0u32].val.arr.val[0u32].val.val.val as u8.private; + assert.eq r17[0u32].is_some true; + assert.eq r17[0u32].val.arr.is_some true; + assert.eq r17[0u32].val.arr.val[0u32].is_some true; + assert.eq r17[0u32].val.arr.val[0u32].val.val.is_some true; + output r17[0u32].val.arr.val[0u32].val.val.val as u8.private; function tuples_with_optional_elements: output 650u32 as u32.private; @@ -206,24 +203,22 @@ function optional_misc_primitive_types: output 2scalar as scalar.private; function optional_address: - cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r0 as Optional__6wU7KHJhSvv; - cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta r0 into r1 as AddrStruct; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r0 as address; + cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r1 as address; cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r2 as address; - cast aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r3 as address; output aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta as address.private; + output r0 as address.private; + output r1 as address.private; output r2 as address.private; - output r1.a as address.private; - output r3 as address.private; function optional_signature: - cast false sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r0 as Optional__I4L6GJTpfLe; - cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj r0 into r1 as SigStruct; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r0 as signature; + cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r1 as signature; cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r2 as signature; - cast sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj into r3 as signature; output sign195m229jvzr0wmnshj6f8gwplhkrkhjumgjmad553r997u7pjfgpfz4j2w0c9lp53mcqqdsmut2g3a2zuvgst85w38hv273mwjec3sqjsv9w6uglcy58gjh7x3l55z68zsf24kx7a73ctp8x8klhuw7l2p4s3aq8um5jp304js7qcnwdqj56q5r5088tyvxsgektun0rnmvtsuxpe6sj as signature.private; + output r0 as signature.private; + output r1 as signature.private; output r2 as signature.private; - output r1.a as signature.private; - output r3 as signature.private; constructor: assert.eq edition 0u16; From 6eb2f333c7d279414a56a3006c3ab562f6bf8040 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 03:09:43 +0800 Subject: [PATCH 46/65] Refresh remaining ternary execution snapshots --- .../execution/various_storage_types.out | 110 +++++++++--------- .../execution/various_storage_types_none.out | 92 ++++++--------- .../expectations/execution/view_aggregate.out | 25 ++-- .../execution/view_storage_and_vector.out | 6 +- 4 files changed, 103 insertions(+), 130 deletions(-) diff --git a/tests/expectations/execution/various_storage_types.out b/tests/expectations/execution/various_storage_types.out index ca2f8ba920e..04913195574 100644 --- a/tests/expectations/execution/various_storage_types.out +++ b/tests/expectations/execution/various_storage_types.out @@ -95,21 +95,20 @@ finalize unsigned_integers: contains counter_u32__[false] into r4; get.or_use counter_u32__[false] 0u32 into r5; ternary r4 r5 0u32 into r6; - ternary r4 r6 0u32 into r7; - add r7 5u32 into r8; - set r8 into counter_u32__[false]; - contains counter_u32__[false] into r9; - get.or_use counter_u32__[false] 0u32 into r10; - ternary r9 r10 0u32 into r11; - assert.eq r9 true; - is.eq r11 15u32 into r12; - assert.eq r12 true; - contains counter_u32__[false] into r13; - get.or_use counter_u32__[false] 0u32 into r14; - ternary r13 r14 0u32 into r15; - ternary r13 r15 99u32 into r16; - is.eq r16 15u32 into r17; - assert.eq r17 true; + add r6 5u32 into r7; + set r7 into counter_u32__[false]; + contains counter_u32__[false] into r8; + get.or_use counter_u32__[false] 0u32 into r9; + ternary r8 r9 0u32 into r10; + assert.eq r8 true; + is.eq r10 15u32 into r11; + assert.eq r11 true; + contains counter_u32__[false] into r12; + get.or_use counter_u32__[false] 0u32 into r13; + ternary r12 r13 0u32 into r14; + ternary r12 r14 99u32 into r15; + is.eq r15 15u32 into r16; + assert.eq r16 true; function signed_integers: async signed_integers into r0; @@ -126,21 +125,20 @@ finalize signed_integers: contains counter_i32__[false] into r4; get.or_use counter_i32__[false] 0i32 into r5; ternary r4 r5 0i32 into r6; - ternary r4 r6 0i32 into r7; - sub r7 3i32 into r8; - set r8 into counter_i32__[false]; - contains counter_i32__[false] into r9; - get.or_use counter_i32__[false] 0i32 into r10; - ternary r9 r10 0i32 into r11; - assert.eq r9 true; - is.eq r11 -8i32 into r12; - assert.eq r12 true; - contains counter_i32__[false] into r13; - get.or_use counter_i32__[false] 0i32 into r14; - ternary r13 r14 0i32 into r15; - ternary r13 r15 1i32 into r16; - is.eq r16 -8i32 into r17; - assert.eq r17 true; + sub r6 3i32 into r7; + set r7 into counter_i32__[false]; + contains counter_i32__[false] into r8; + get.or_use counter_i32__[false] 0i32 into r9; + ternary r8 r9 0i32 into r10; + assert.eq r8 true; + is.eq r10 -8i32 into r11; + assert.eq r11 true; + contains counter_i32__[false] into r12; + get.or_use counter_i32__[false] 0i32 into r13; + ternary r12 r13 0i32 into r14; + ternary r12 r14 1i32 into r15; + is.eq r15 -8i32 into r16; + assert.eq r16 true; function primitive_types: async primitive_types into r0; @@ -203,9 +201,8 @@ finalize primitive_types: contains field_val__[false] into r33; get.or_use field_val__[false] 0field into r34; ternary r33 r34 0field into r35; - ternary r33 r35 0field into r36; - is.eq r36 21field into r37; - assert.eq r37 true; + is.eq r35 21field into r36; + assert.eq r36 true; function structs_and_arrays: async structs_and_arrays into r0; @@ -321,30 +318,29 @@ finalize structs_and_arrays: assert.eq r93 true; is.eq r92[2u32].y 6field into r94; assert.eq r94 true; - cast r92[1u32].x r92[1u32].y into r95 as Point; - add r95.x 10field into r96; - cast r96 r92[1u32].y into r97 as Point; - cast r92[0u32] r97 r92[2u32] into r98 as [Point; 3u32]; - set r98 into points_array__[false]; - contains points_array__[false] into r99; - cast 0field 0field into r100 as Point; - cast r100 r100 r100 into r101 as [Point; 3u32]; - get.or_use points_array__[false] r101 into r102; - cast 0field 0field into r103 as Point; - cast r103 r103 r103 into r104 as [Point; 3u32]; - ternary r99 r102[0u32].x r104[0u32].x into r105; - ternary r99 r102[0u32].y r104[0u32].y into r106; - cast r105 r106 into r107 as Point; - ternary r99 r102[1u32].x r104[1u32].x into r108; - ternary r99 r102[1u32].y r104[1u32].y into r109; - cast r108 r109 into r110 as Point; - ternary r99 r102[2u32].x r104[2u32].x into r111; - ternary r99 r102[2u32].y r104[2u32].y into r112; - cast r111 r112 into r113 as Point; - cast r107 r110 r113 into r114 as [Point; 3u32]; - assert.eq r99 true; - is.eq r114[1u32].x 13field into r115; - assert.eq r115 true; + add r92[1u32].x 10field into r95; + cast r95 r92[1u32].y into r96 as Point; + cast r92[0u32] r96 r92[2u32] into r97 as [Point; 3u32]; + set r97 into points_array__[false]; + contains points_array__[false] into r98; + cast 0field 0field into r99 as Point; + cast r99 r99 r99 into r100 as [Point; 3u32]; + get.or_use points_array__[false] r100 into r101; + cast 0field 0field into r102 as Point; + cast r102 r102 r102 into r103 as [Point; 3u32]; + ternary r98 r101[0u32].x r103[0u32].x into r104; + ternary r98 r101[0u32].y r103[0u32].y into r105; + cast r104 r105 into r106 as Point; + ternary r98 r101[1u32].x r103[1u32].x into r107; + ternary r98 r101[1u32].y r103[1u32].y into r108; + cast r107 r108 into r109 as Point; + ternary r98 r101[2u32].x r103[2u32].x into r110; + ternary r98 r101[2u32].y r103[2u32].y into r111; + cast r110 r111 into r112 as Point; + cast r106 r109 r112 into r113 as [Point; 3u32]; + assert.eq r98 true; + is.eq r113[1u32].x 13field into r114; + assert.eq r114 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/various_storage_types_none.out b/tests/expectations/execution/various_storage_types_none.out index 19405e67d0b..5edd0cab4e2 100644 --- a/tests/expectations/execution/various_storage_types_none.out +++ b/tests/expectations/execution/various_storage_types_none.out @@ -136,39 +136,38 @@ finalize primitives_none_behavior: contains flag__[false] into r21; get.or_use flag__[false] false into r22; ternary r21 r22 false into r23; - ternary r21 r23 false into r24; - is.eq r24 false into r25; - assert.eq r25 true; + is.eq r23 false into r24; + assert.eq r24 true; remove scalar_val__[false]; remove field_val__[false]; - contains scalar_val__[false] into r26; - get.or_use scalar_val__[false] 0scalar into r27; - ternary r26 r27 0scalar into r28; - cast r26 r28 into r29 as Optional__9y0TjJOC4Nk; - cast false 0scalar into r30 as Optional__9y0TjJOC4Nk; - is.eq r29 r30 into r31; - assert.eq r31 true; - contains field_val__[false] into r32; - get.or_use field_val__[false] 0field into r33; - ternary r32 r33 0field into r34; - cast r32 r34 into r35 as Optional__7o6su2Uhzht; - cast false 0field into r36 as Optional__7o6su2Uhzht; - is.eq r35 r36 into r37; - assert.eq r37 true; + contains scalar_val__[false] into r25; + get.or_use scalar_val__[false] 0scalar into r26; + ternary r25 r26 0scalar into r27; + cast r25 r27 into r28 as Optional__9y0TjJOC4Nk; + cast false 0scalar into r29 as Optional__9y0TjJOC4Nk; + is.eq r28 r29 into r30; + assert.eq r30 true; + contains field_val__[false] into r31; + get.or_use field_val__[false] 0field into r32; + ternary r31 r32 0field into r33; + cast r31 r33 into r34 as Optional__7o6su2Uhzht; + cast false 0field into r35 as Optional__7o6su2Uhzht; + is.eq r34 r35 into r36; + assert.eq r36 true; set 1scalar into scalar_val__[false]; set 5field into field_val__[false]; - contains scalar_val__[false] into r38; - get.or_use scalar_val__[false] 0scalar into r39; - ternary r38 r39 0scalar into r40; - assert.eq r38 true; - is.eq r40 1scalar into r41; + contains scalar_val__[false] into r37; + get.or_use scalar_val__[false] 0scalar into r38; + ternary r37 r38 0scalar into r39; + assert.eq r37 true; + is.eq r39 1scalar into r40; + assert.eq r40 true; + contains field_val__[false] into r41; + get.or_use field_val__[false] 0field into r42; + ternary r41 r42 0field into r43; assert.eq r41 true; - contains field_val__[false] into r42; - get.or_use field_val__[false] 0field into r43; - ternary r42 r43 0field into r44; - assert.eq r42 true; - is.eq r44 5field into r45; - assert.eq r45 true; + is.eq r43 5field into r44; + assert.eq r44 true; function arrays_none_behavior: async arrays_none_behavior into r0; @@ -234,34 +233,17 @@ finalize structs_none_behavior: cast false r4 into r5 as Optional__CrW6ZMYLUhu; is.eq r2 r5 into r6; assert.eq r6 true; - cast 0field 0field into r7 as Point; - cast r7.x r7.y into r8 as Point; - cast 0u8 r8 into r9 as Container; - is.eq r9.id 0u8 into r10; - assert.eq r10 true; - cast 5field 10field into r11 as Point; - cast 1u8 r11 into r12 as Container; - is.eq r11.x 5field into r13; - assert.eq r13 true; - is.eq r12.point.y 10field into r14; + cast 9field 9field into r7 as Point; + cast 9u8 r7 into r8 as Container; + set r8 into container__[false]; + contains container__[false] into r9; + cast 0field 0field into r10 as Point; + cast 0u8 r10 into r11 as Container; + get.or_use container__[false] r11 into r12; + ternary r9 r12.point.x 0field into r13; + assert.eq r9 true; + is.eq r13 9field into r14; assert.eq r14 true; - cast 9field 9field into r15 as Point; - cast 9u8 r15 into r16 as Container; - set r16 into container__[false]; - contains container__[false] into r17; - cast 0field 0field into r18 as Point; - cast 0u8 r18 into r19 as Container; - get.or_use container__[false] r19 into r20; - cast 0field 0field into r21 as Point; - cast 0u8 r21 into r22 as Container; - ternary r17 r20.point.x r22.point.x into r23; - ternary r17 r20.point.y r22.point.y into r24; - cast r23 r24 into r25 as Point; - ternary r17 r20.id r22.id into r26; - cast r26 r25 into r27 as Container; - assert.eq r17 true; - is.eq r27.point.x 9field into r28; - assert.eq r28 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/view_aggregate.out b/tests/expectations/execution/view_aggregate.out index db8b51f22e5..6ea5d3332ab 100644 --- a/tests/expectations/execution/view_aggregate.out +++ b/tests/expectations/execution/view_aggregate.out @@ -25,20 +25,17 @@ view sum_first_three: lt 0u32 r0 into r1; get.or_use entries__[0u32] 0u64 into r2; ternary r1 r2 0u64 into r3; - ternary r1 r3 0u64 into r4; - get.or_use entries__len__[false] 0u32 into r5; - lt 1u32 r5 into r6; - get.or_use entries__[1u32] 0u64 into r7; - ternary r6 r7 0u64 into r8; - ternary r6 r8 0u64 into r9; - add r4 r9 into r10; - get.or_use entries__len__[false] 0u32 into r11; - lt 2u32 r11 into r12; - get.or_use entries__[2u32] 0u64 into r13; - ternary r12 r13 0u64 into r14; - ternary r12 r14 0u64 into r15; - add r10 r15 into r16; - output r16 as u64.public; + get.or_use entries__len__[false] 0u32 into r4; + lt 1u32 r4 into r5; + get.or_use entries__[1u32] 0u64 into r6; + ternary r5 r6 0u64 into r7; + add r3 r7 into r8; + get.or_use entries__len__[false] 0u32 into r9; + lt 2u32 r9 into r10; + get.or_use entries__[2u32] 0u64 into r11; + ternary r10 r11 0u64 into r12; + add r8 r12 into r13; + output r13 as u64.public; view weighted_balance: input r0 as address.public; diff --git a/tests/expectations/execution/view_storage_and_vector.out b/tests/expectations/execution/view_storage_and_vector.out index 4a444f17930..1593c158bcc 100644 --- a/tests/expectations/execution/view_storage_and_vector.out +++ b/tests/expectations/execution/view_storage_and_vector.out @@ -28,8 +28,7 @@ view current_owner: contains owner__[false] into r0; get.or_use owner__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r1; ternary r0 r1 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r2; - ternary r0 r2 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r3; - output r3 as address.public; + output r2 as address.public; view entry_count: get.or_use entries__len__[false] 0u32 into r0; @@ -41,8 +40,7 @@ view entry_at: lt r0 r1 into r2; get.or_use entries__[r0] 0u64 into r3; ternary r2 r3 0u64 into r4; - ternary r2 r4 0u64 into r5; - output r5 as u64.public; + output r4 as u64.public; view entry_at_oob: input r0 as u32.public; From a827263e5cc19949a272c5f98b3d5c057aa61fe1 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 03:21:32 +0800 Subject: [PATCH 47/65] Refresh ternary pass snapshots --- .../composite_alias_field_forwarding.out | 1 + .../ssa_const_propagation/nested_composite_forwarding.out | 4 ++-- .../ssa_const_propagation/nested_ternary_absorption.out | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index d76e95f663f..61f3ab573f4 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,3 +15,4 @@ program test.aleo { return $var$6; } } + diff --git a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out index 8d63439a6b8..e9a4c4f4fc7 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_composite_forwarding.out @@ -13,8 +13,8 @@ program test.aleo { let i$#1 = test.aleo::Inner { v: 42u32 }; let o$#2 = test.aleo::Outer { inner: i$#1 }; let $var$3 = i$#1; - let $var$4 = $var$3.v; - return $var$4; + let $var$4 = 42u32; + return 42u32; } } diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 01698b2727e..126d90b2d54 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,3 +23,4 @@ program test.aleo { return $var$21; } } + From be0c81b48ccd0742a22c67e5f61fa224b2fa2d31 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 03:33:58 +0800 Subject: [PATCH 48/65] Refresh ABI CLI expectations --- tests/expectations/cli/test_abi_comprehensive/STDOUT | 10 +++++----- .../contents/build/abi_test/abi.json | 2 +- .../contents/build/abi_test/abi_test.aleo | 8 +++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/expectations/cli/test_abi_comprehensive/STDOUT b/tests/expectations/cli/test_abi_comprehensive/STDOUT index 64f05f28a05..4597a63928c 100644 --- a/tests/expectations/cli/test_abi_comprehensive/STDOUT +++ b/tests/expectations/cli/test_abi_comprehensive/STDOUT @@ -2,7 +2,7 @@ ⚠️ No endpoint specified, defaulting to 'https://api.explorer.provable.com/v1'. Leo 🔨 Compiling 'abi_test.aleo' - Leo The program checksum is: '[189u8, 121u8, 73u8, 247u8, 71u8, 59u8, 160u8, 253u8, 67u8, 23u8, 171u8, 84u8, 70u8, 200u8, 152u8, 65u8, 151u8, 2u8, 112u8, 52u8, 238u8, 132u8, 87u8, 96u8, 188u8, 176u8, 252u8, 164u8, 179u8, 157u8, 50u8, 189u8]'. + Leo The program checksum is: '[173u8, 22u8, 222u8, 0u8, 244u8, 255u8, 90u8, 153u8, 118u8, 178u8, 6u8, 200u8, 134u8, 104u8, 114u8, 76u8, 22u8, 210u8, 31u8, 171u8, 31u8, 75u8, 23u8, 79u8, 49u8, 55u8, 38u8, 68u8, 106u8, 34u8, 134u8, 174u8]'. Leo `single_primitive` function checksum is: '[254u8, 116u8, 136u8, 108u8, 147u8, 170u8, 6u8, 194u8, 208u8, 248u8, 149u8, 8u8, 201u8, 219u8, 159u8, 150u8, 177u8, 3u8, 16u8, 42u8, 81u8, 97u8, 216u8, 1u8, 242u8, 217u8, 232u8, 103u8, 194u8, 196u8, 13u8, 117u8]'. Leo `multi_input` function checksum is: '[38u8, 55u8, 47u8, 136u8, 27u8, 204u8, 61u8, 24u8, 138u8, 108u8, 154u8, 149u8, 115u8, 175u8, 167u8, 41u8, 76u8, 16u8, 106u8, 118u8, 158u8, 178u8, 219u8, 78u8, 82u8, 35u8, 7u8, 237u8, 154u8, 50u8, 23u8, 177u8]'. Leo `multi_output` function checksum is: '[54u8, 229u8, 225u8, 245u8, 4u8, 96u8, 230u8, 173u8, 142u8, 152u8, 212u8, 92u8, 128u8, 54u8, 53u8, 90u8, 113u8, 139u8, 194u8, 31u8, 1u8, 70u8, 30u8, 199u8, 107u8, 73u8, 127u8, 177u8, 253u8, 112u8, 131u8, 156u8]'. @@ -19,9 +19,9 @@ Leo `update_balance` function checksum is: '[26u8, 173u8, 136u8, 218u8, 50u8, 83u8, 52u8, 154u8, 58u8, 222u8, 59u8, 82u8, 242u8, 149u8, 30u8, 78u8, 10u8, 137u8, 148u8, 186u8, 13u8, 157u8, 194u8, 80u8, 220u8, 168u8, 250u8, 155u8, 52u8, 234u8, 171u8, 226u8]'. Leo `get_balance` function checksum is: '[60u8, 39u8, 55u8, 93u8, 164u8, 106u8, 158u8, 53u8, 139u8, 1u8, 123u8, 93u8, 17u8, 63u8, 252u8, 207u8, 19u8, 170u8, 90u8, 218u8, 45u8, 151u8, 221u8, 216u8, 10u8, 208u8, 9u8, 163u8, 152u8, 6u8, 239u8, 215u8]'. Leo `echo_point` function checksum is: '[213u8, 253u8, 222u8, 75u8, 87u8, 228u8, 163u8, 218u8, 157u8, 245u8, 119u8, 211u8, 203u8, 238u8, 98u8, 52u8, 85u8, 114u8, 188u8, 151u8, 159u8, 254u8, 81u8, 95u8, 86u8, 228u8, 103u8, 88u8, 85u8, 150u8, 105u8, 144u8]'. - Leo `current_counter` function checksum is: '[181u8, 12u8, 66u8, 207u8, 160u8, 202u8, 97u8, 140u8, 182u8, 16u8, 185u8, 160u8, 217u8, 223u8, 18u8, 179u8, 37u8, 66u8, 0u8, 77u8, 231u8, 29u8, 84u8, 191u8, 81u8, 153u8, 85u8, 230u8, 248u8, 200u8, 104u8, 112u8]'. - Leo `counters` function checksum is: '[219u8, 184u8, 138u8, 247u8, 57u8, 19u8, 29u8, 3u8, 141u8, 74u8, 74u8, 116u8, 148u8, 8u8, 196u8, 221u8, 250u8, 219u8, 81u8, 129u8, 35u8, 13u8, 74u8, 252u8, 163u8, 29u8, 41u8, 132u8, 170u8, 129u8, 56u8, 195u8]'. - Leo Program size: 3.97 KB / 2000.00 KB + Leo `current_counter` function checksum is: '[149u8, 19u8, 1u8, 106u8, 97u8, 135u8, 254u8, 231u8, 180u8, 107u8, 112u8, 74u8, 8u8, 114u8, 103u8, 74u8, 18u8, 78u8, 150u8, 87u8, 232u8, 11u8, 34u8, 204u8, 153u8, 80u8, 103u8, 124u8, 232u8, 144u8, 212u8, 115u8]'. + Leo `counters` function checksum is: '[135u8, 143u8, 248u8, 127u8, 104u8, 206u8, 45u8, 196u8, 65u8, 42u8, 154u8, 83u8, 102u8, 161u8, 190u8, 120u8, 238u8, 188u8, 92u8, 116u8, 11u8, 248u8, 30u8, 129u8, 4u8, 149u8, 239u8, 151u8, 77u8, 76u8, 250u8, 195u8]'. + Leo Program size: 3.90 KB / 2000.00 KB Leo ✅ Compiled 'abi_test.aleo' into Aleo instructions. Leo ✅ Generated ABI for program 'abi_test.aleo'. @@ -933,4 +933,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json index 691457ca374..b7c41dec2dc 100644 --- a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json +++ b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json @@ -905,4 +905,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo index b876862e395..ae58936a954 100644 --- a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo +++ b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi_test.aleo @@ -165,17 +165,15 @@ view current_counter: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - ternary r0 r2 0u32 into r3; - output r3 as u32.public; + output r2 as u32.public; view counters: contains counter__[false] into r0; get.or_use counter__[false] 0u32 into r1; ternary r0 r1 0u32 into r2; - ternary r0 r2 0u32 into r3; - add r3 1u32 into r4; + add r2 1u32 into r3; + output r2 as u32.public; output r3 as u32.public; - output r4 as u32.public; constructor: assert.eq edition 0u16; From cc859e4b3c3262324dd32e1deb30799d7d0ffe44 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 03:43:54 +0800 Subject: [PATCH 49/65] Preserve ABI expectation EOF format --- tests/expectations/cli/test_abi_comprehensive/STDOUT | 2 +- .../cli/test_abi_comprehensive/contents/build/abi_test/abi.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/expectations/cli/test_abi_comprehensive/STDOUT b/tests/expectations/cli/test_abi_comprehensive/STDOUT index 4597a63928c..0c2d8f5d73a 100644 --- a/tests/expectations/cli/test_abi_comprehensive/STDOUT +++ b/tests/expectations/cli/test_abi_comprehensive/STDOUT @@ -933,4 +933,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json index b7c41dec2dc..691457ca374 100644 --- a/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json +++ b/tests/expectations/cli/test_abi_comprehensive/contents/build/abi_test/abi.json @@ -905,4 +905,4 @@ ] } ] -} +} \ No newline at end of file From 6620dd69a19fec42f5bef410ba0c3fd9247a1d07 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 03:56:10 +0800 Subject: [PATCH 50/65] Refresh stacked external submodule expectations --- .../cli/test_external_program_submodule/STDOUT | 6 +++--- .../consumer/build/consumer/consumer.aleo | 17 ++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/expectations/cli/test_external_program_submodule/STDOUT b/tests/expectations/cli/test_external_program_submodule/STDOUT index 7e238c82b26..774847217dd 100644 --- a/tests/expectations/cli/test_external_program_submodule/STDOUT +++ b/tests/expectations/cli/test_external_program_submodule/STDOUT @@ -3,14 +3,14 @@ ⚠️ No endpoint specified, defaulting to 'https://api.explorer.provable.com/v1'. Leo 🔨 Compiling 'consumer.aleo' - Leo The program checksum is: '[180u8, 223u8, 5u8, 182u8, 121u8, 236u8, 70u8, 205u8, 63u8, 169u8, 165u8, 193u8, 163u8, 145u8, 151u8, 8u8, 17u8, 113u8, 67u8, 189u8, 228u8, 154u8, 198u8, 1u8, 132u8, 217u8, 135u8, 148u8, 97u8, 216u8, 215u8, 171u8]'. + Leo The program checksum is: '[170u8, 54u8, 59u8, 92u8, 191u8, 165u8, 77u8, 177u8, 113u8, 133u8, 39u8, 13u8, 178u8, 180u8, 79u8, 111u8, 4u8, 169u8, 86u8, 225u8, 51u8, 37u8, 92u8, 112u8, 222u8, 115u8, 95u8, 132u8, 168u8, 255u8, 29u8, 89u8]'. Leo `identity` function checksum is: '[170u8, 157u8, 157u8, 245u8, 252u8, 78u8, 220u8, 128u8, 37u8, 138u8, 27u8, 16u8, 46u8, 243u8, 235u8, 127u8, 229u8, 131u8, 38u8, 221u8, 155u8, 32u8, 49u8, 132u8, 170u8, 51u8, 204u8, 86u8, 172u8, 62u8, 54u8, 93u8]'. Leo `make_white` function checksum is: '[18u8, 89u8, 241u8, 223u8, 59u8, 216u8, 151u8, 241u8, 116u8, 66u8, 1u8, 70u8, 96u8, 207u8, 27u8, 219u8, 148u8, 78u8, 121u8, 203u8, 67u8, 33u8, 241u8, 188u8, 61u8, 249u8, 169u8, 186u8, 43u8, 215u8, 156u8, 83u8]'. Leo `sum_of_white` function checksum is: '[156u8, 217u8, 238u8, 187u8, 192u8, 165u8, 81u8, 123u8, 234u8, 49u8, 13u8, 250u8, 73u8, 24u8, 226u8, 148u8, 222u8, 29u8, 205u8, 243u8, 19u8, 145u8, 189u8, 181u8, 101u8, 1u8, 62u8, 85u8, 136u8, 185u8, 124u8, 131u8]'. Leo `average` function checksum is: '[23u8, 229u8, 222u8, 134u8, 204u8, 67u8, 108u8, 113u8, 65u8, 142u8, 210u8, 220u8, 59u8, 69u8, 161u8, 193u8, 172u8, 154u8, 76u8, 163u8, 20u8, 113u8, 179u8, 67u8, 164u8, 9u8, 125u8, 82u8, 114u8, 208u8, 126u8, 63u8]'. - Leo `blend_twice` function checksum is: '[189u8, 127u8, 116u8, 233u8, 28u8, 144u8, 89u8, 118u8, 98u8, 227u8, 74u8, 19u8, 78u8, 26u8, 110u8, 33u8, 238u8, 30u8, 58u8, 163u8, 169u8, 50u8, 16u8, 180u8, 140u8, 107u8, 77u8, 116u8, 31u8, 0u8, 175u8, 39u8]'. + Leo `blend_twice` function checksum is: '[172u8, 193u8, 66u8, 11u8, 87u8, 26u8, 227u8, 158u8, 92u8, 237u8, 169u8, 73u8, 11u8, 179u8, 118u8, 144u8, 135u8, 168u8, 57u8, 102u8, 70u8, 27u8, 73u8, 40u8, 204u8, 235u8, 211u8, 60u8, 33u8, 228u8, 153u8, 93u8]'. Leo `channel_count` function checksum is: '[156u8, 188u8, 52u8, 11u8, 86u8, 4u8, 86u8, 79u8, 104u8, 198u8, 54u8, 168u8, 91u8, 18u8, 245u8, 214u8, 75u8, 247u8, 234u8, 65u8, 28u8, 117u8, 161u8, 54u8, 216u8, 120u8, 65u8, 42u8, 53u8, 163u8, 120u8, 10u8]'. - Leo Program size: 1.69 KB / 2000.00 KB + Leo Program size: 1.62 KB / 2000.00 KB Leo ✅ Compiled 'consumer.aleo' into Aleo instructions. Leo Import 'provider.aleo': checksum = '[65u8, 143u8, 101u8, 10u8, 122u8, 113u8, 65u8, 0u8, 200u8, 13u8, 10u8, 147u8, 182u8, 18u8, 16u8, 101u8, 135u8, 136u8, 47u8, 202u8, 209u8, 17u8, 150u8, 249u8, 134u8, 116u8, 3u8, 5u8, 53u8, 167u8, 16u8, 6u8]' Leo ✅ Generated ABI for program 'consumer.aleo'. diff --git a/tests/expectations/cli/test_external_program_submodule/contents/consumer/build/consumer/consumer.aleo b/tests/expectations/cli/test_external_program_submodule/contents/consumer/build/consumer/consumer.aleo index 49c11cbbc02..fd031e50d23 100644 --- a/tests/expectations/cli/test_external_program_submodule/contents/consumer/build/consumer/consumer.aleo +++ b/tests/expectations/cli/test_external_program_submodule/contents/consumer/build/consumer/consumer.aleo @@ -36,15 +36,14 @@ function blend_twice: div r5 2u32 into r6; add r0.b r1.b into r7; div r7 2u32 into r8; - cast r4 r6 r8 into r9 as provider.aleo/Color__F3VqkSOxTDS; - add r9.r r2.r into r10; - div r10 2u32 into r11; - add r9.g r2.g into r12; - div r12 2u32 into r13; - add r9.b r2.b into r14; - div r14 2u32 into r15; - cast r11 r13 r15 into r16 as provider.aleo/Color__F3VqkSOxTDS; - output r16 as provider.aleo/Color__F3VqkSOxTDS.private; + add r4 r2.r into r9; + div r9 2u32 into r10; + add r6 r2.g into r11; + div r11 2u32 into r12; + add r8 r2.b into r13; + div r13 2u32 into r14; + cast r10 r12 r14 into r15 as provider.aleo/Color__F3VqkSOxTDS; + output r15 as provider.aleo/Color__F3VqkSOxTDS.private; function channel_count: output 3u32 as u32.private; From 8b524bc17ef653e4027e368555eac50e8df47963 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 04:07:35 +0800 Subject: [PATCH 51/65] Refresh stacked storage CLI output --- tests/expectations/cli/test_storage_from_unit_test/STDOUT | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/expectations/cli/test_storage_from_unit_test/STDOUT b/tests/expectations/cli/test_storage_from_unit_test/STDOUT index ca48475c22d..04883fb1440 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/STDOUT +++ b/tests/expectations/cli/test_storage_from_unit_test/STDOUT @@ -2,14 +2,14 @@ ⚠️ No endpoint specified, defaulting to 'https://api.explorer.provable.com/v1'. Leo 🔨 Compiling 'storage_demo.aleo' - Leo Program size: 5.37 KB / 2000.00 KB + Leo Program size: 5.34 KB / 2000.00 KB Leo ✅ Compiled 'storage_demo.aleo' into Aleo instructions. Leo ✅ Generated ABI for program 'storage_demo.aleo'. Leo 🔨 Compiling 'test_storage_demo.aleo' - Leo Program size: 18.28 KB / 2000.00 KB + Leo Program size: 17.84 KB / 2000.00 KB Leo ✅ Compiled 'test_storage_demo.aleo' into Aleo instructions. - Leo Import 'storage_demo.aleo': checksum = '[181u8, 196u8, 11u8, 13u8, 176u8, 224u8, 84u8, 194u8, 122u8, 47u8, 204u8, 224u8, 175u8, 181u8, 20u8, 6u8, 165u8, 4u8, 170u8, 248u8, 93u8, 190u8, 224u8, 136u8, 197u8, 69u8, 42u8, 144u8, 52u8, 166u8, 103u8, 25u8]' + Leo Import 'storage_demo.aleo': checksum = '[22u8, 242u8, 155u8, 40u8, 152u8, 209u8, 122u8, 107u8, 100u8, 5u8, 201u8, 166u8, 116u8, 95u8, 138u8, 5u8, 51u8, 176u8, 77u8, 72u8, 134u8, 244u8, 123u8, 145u8, 4u8, 12u8, 115u8, 110u8, 67u8, 128u8, 201u8, 115u8]' Leo Loading the ledger from storage... Leo Loading the ledger from storage... Leo Loading the ledger from storage... From 5f29d48094900f16b387aa44a3ee79ebaafcfa40 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 04:21:28 +0800 Subject: [PATCH 52/65] Refresh stacked storage Aleo output --- .../contents/build/storage_demo/storage_demo.aleo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo b/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo index 1c12a7a6b24..5cfe41ec7bb 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo +++ b/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo @@ -82,9 +82,8 @@ finalize bump_counter: contains counter__[false] into r0; get.or_use counter__[false] 0u64 into r1; ternary r0 r1 0u64 into r2; - ternary r0 r2 0u64 into r3; - add r3 1u64 into r4; - set r4 into counter__[false]; + add r2 1u64 into r3; + set r3 into counter__[false]; function clear_counter: async clear_counter into r0; @@ -140,6 +139,7 @@ finalize set_pivot: function set_point: input r0 as Point.private; + async set_point r0 into r1; output r1 as storage_demo.aleo/set_point.future; From 9ec2094ca84de2c10ab0ea770b32f88381d52e1c Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 04:32:24 +0800 Subject: [PATCH 53/65] Refresh stacked storage test Aleo output --- .../test_storage_demo/test_storage_demo.aleo | 118 ++++++++---------- 1 file changed, 53 insertions(+), 65 deletions(-) diff --git a/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo b/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo index 2e580fea711..2055c8f1d9b 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo +++ b/tests/expectations/cli/test_storage_from_unit_test/contents/build/test_storage_demo/test_storage_demo.aleo @@ -49,49 +49,44 @@ finalize unset_singletons_default: contains storage_demo.aleo/flag__[false] into r0; get.or_use storage_demo.aleo/flag__[false] false into r1; ternary r0 r1 false into r2; - ternary r0 r2 false into r3; - is.eq r3 false into r4; - assert.eq r4 true; - contains storage_demo.aleo/counter__[false] into r5; - get.or_use storage_demo.aleo/counter__[false] 0u64 into r6; - ternary r5 r6 0u64 into r7; - ternary r5 r7 0u64 into r8; - is.eq r8 0u64 into r9; - assert.eq r9 true; - contains storage_demo.aleo/tiny__[false] into r10; - get.or_use storage_demo.aleo/tiny__[false] 0u8 into r11; - ternary r10 r11 0u8 into r12; - ternary r10 r12 0u8 into r13; - is.eq r13 0u8 into r14; - assert.eq r14 true; - contains storage_demo.aleo/signed__[false] into r15; - get.or_use storage_demo.aleo/signed__[false] 0i64 into r16; - ternary r15 r16 0i64 into r17; - ternary r15 r17 0i64 into r18; - is.eq r18 0i64 into r19; + is.eq r2 false into r3; + assert.eq r3 true; + contains storage_demo.aleo/counter__[false] into r4; + get.or_use storage_demo.aleo/counter__[false] 0u64 into r5; + ternary r4 r5 0u64 into r6; + is.eq r6 0u64 into r7; + assert.eq r7 true; + contains storage_demo.aleo/tiny__[false] into r8; + get.or_use storage_demo.aleo/tiny__[false] 0u8 into r9; + ternary r8 r9 0u8 into r10; + is.eq r10 0u8 into r11; + assert.eq r11 true; + contains storage_demo.aleo/signed__[false] into r12; + get.or_use storage_demo.aleo/signed__[false] 0i64 into r13; + ternary r12 r13 0i64 into r14; + is.eq r14 0i64 into r15; + assert.eq r15 true; + contains storage_demo.aleo/marker__[false] into r16; + get.or_use storage_demo.aleo/marker__[false] 0field into r17; + ternary r16 r17 0field into r18; + is.eq r18 0field into r19; assert.eq r19 true; - contains storage_demo.aleo/marker__[false] into r20; - get.or_use storage_demo.aleo/marker__[false] 0field into r21; - ternary r20 r21 0field into r22; - ternary r20 r22 0field into r23; - is.eq r23 0field into r24; - assert.eq r24 true; - contains storage_demo.aleo/quad__[false] into r25; - cast 0u32 0u32 0u32 0u32 into r26 as [u32; 4u32]; - get.or_use storage_demo.aleo/quad__[false] r26 into r27; - ternary r25 r27[0u32] r26[0u32] into r28; - ternary r25 r27[1u32] r26[1u32] into r29; - ternary r25 r27[2u32] r26[2u32] into r30; - ternary r25 r27[3u32] r26[3u32] into r31; - cast r28 r29 r30 r31 into r32 as [u32; 4u32]; - cast 0u32 0u32 0u32 0u32 into r33 as [u32; 4u32]; - ternary r25 r32[0u32] 0u32 into r34; - ternary r25 r32[1u32] 0u32 into r35; - ternary r25 r32[2u32] 0u32 into r36; - ternary r25 r32[3u32] 0u32 into r37; - cast r34 r35 r36 r37 into r38 as [u32; 4u32]; - is.eq r38 r33 into r39; - assert.eq r39 true; + contains storage_demo.aleo/quad__[false] into r20; + cast 0u32 0u32 0u32 0u32 into r21 as [u32; 4u32]; + get.or_use storage_demo.aleo/quad__[false] r21 into r22; + ternary r20 r22[0u32] r21[0u32] into r23; + ternary r20 r22[1u32] r21[1u32] into r24; + ternary r20 r22[2u32] r21[2u32] into r25; + ternary r20 r22[3u32] r21[3u32] into r26; + cast r23 r24 r25 r26 into r27 as [u32; 4u32]; + cast 0u32 0u32 0u32 0u32 into r28 as [u32; 4u32]; + ternary r20 r27[0u32] 0u32 into r29; + ternary r20 r27[1u32] 0u32 into r30; + ternary r20 r27[2u32] 0u32 into r31; + ternary r20 r27[3u32] 0u32 into r32; + cast r29 r30 r31 r32 into r33 as [u32; 4u32]; + is.eq r33 r28 into r34; + assert.eq r34 true; function set_and_read_flag: call storage_demo.aleo/set_flag true into r0; @@ -125,9 +120,8 @@ finalize set_and_read_counter: contains storage_demo.aleo/counter__[false] into r5; get.or_use storage_demo.aleo/counter__[false] 0u64 into r6; ternary r5 r6 0u64 into r7; - ternary r5 r7 0u64 into r8; - is.eq r8 42u64 into r9; - assert.eq r9 true; + is.eq r7 42u64 into r8; + assert.eq r8 true; function bump_counter_from_unset: call storage_demo.aleo/bump_counter into r0; @@ -176,9 +170,8 @@ finalize clear_counter_resets_default: contains storage_demo.aleo/counter__[false] into r2; get.or_use storage_demo.aleo/counter__[false] 0u64 into r3; ternary r2 r3 0u64 into r4; - ternary r2 r4 0u64 into r5; - is.eq r5 0u64 into r6; - assert.eq r6 true; + is.eq r4 0u64 into r5; + assert.eq r5 true; function set_and_read_tiny: call storage_demo.aleo/set_tiny 255u8 into r0; @@ -269,15 +262,13 @@ finalize set_and_read_point: contains storage_demo.aleo/point__[false] into r1; cast 0i64 0i64 into r2 as storage_demo.aleo/Point; get.or_use storage_demo.aleo/point__[false] r2 into r3; - cast 0i64 0i64 into r4 as storage_demo.aleo/Point; - ternary r1 r3.x r4.x into r5; - ternary r1 r3.y r4.y into r6; - cast r5 r6 into r7 as storage_demo.aleo/Point; + ternary r1 r3.x 0i64 into r4; + ternary r1 r3.y 0i64 into r5; assert.eq r1 true; - is.eq r7.x -5i64 into r8; - assert.eq r8 true; - is.eq r7.y 9i64 into r9; - assert.eq r9 true; + is.eq r4 -5i64 into r6; + assert.eq r6 true; + is.eq r5 9i64 into r7; + assert.eq r7 true; function set_and_read_quad: cast 1u32 2u32 3u32 4u32 into r0 as [u32; 4u32]; @@ -318,9 +309,8 @@ finalize vector_starts_empty: lt 0u32 r2 into r3; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r4; ternary r3 r4 0u32 into r5; - ternary r3 r5 0u32 into r6; - is.eq r6 0u32 into r7; - assert.eq r7 true; + is.eq r5 0u32 into r6; + assert.eq r6 true; function push_then_len_and_get: call storage_demo.aleo/push_history 10u32 into r0; @@ -364,9 +354,8 @@ finalize push_then_len_and_get: lt 3u32 r20 into r21; get.or_use storage_demo.aleo/history__[3u32] 0u32 into r22; ternary r21 r22 0u32 into r23; - ternary r21 r23 0u32 into r24; - is.eq r24 0u32 into r25; - assert.eq r25 true; + is.eq r23 0u32 into r24; + assert.eq r24 true; function pop_drops_last_element: call storage_demo.aleo/push_history 7u32 into r0; @@ -491,9 +480,8 @@ finalize clear_resets_length: lt 0u32 r5 into r6; get.or_use storage_demo.aleo/history__[0u32] 0u32 into r7; ternary r6 r7 0u32 into r8; - ternary r6 r8 0u32 into r9; - is.eq r9 0u32 into r10; - assert.eq r10 true; + is.eq r8 0u32 into r9; + assert.eq r9 true; function unwrap_unset_singleton_halts: async unwrap_unset_singleton_halts into r0; From f1379c8bb7d2dd6745d1a464744e021307b02326 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 04:52:05 +0800 Subject: [PATCH 54/65] Normalize stacked storage Aleo spacing --- .../contents/build/storage_demo/storage_demo.aleo | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo b/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo index 5cfe41ec7bb..36b8f75af81 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo +++ b/tests/expectations/cli/test_storage_from_unit_test/contents/build/storage_demo/storage_demo.aleo @@ -139,7 +139,6 @@ finalize set_pivot: function set_point: input r0 as Point.private; - async set_point r0 into r1; output r1 as storage_demo.aleo/set_point.future; From 8e24a6f97673e4e45070a73e5b60291bdf5837ee Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 10:32:52 +0800 Subject: [PATCH 55/65] Normalize SSA ternary expectation EOFs --- .../ssa_const_propagation/composite_alias_field_forwarding.out | 1 - .../passes/ssa_const_propagation/nested_ternary_absorption.out | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index 61f3ab573f4..d76e95f663f 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,4 +15,3 @@ program test.aleo { return $var$6; } } - diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 126d90b2d54..01698b2727e 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,4 +23,3 @@ program test.aleo { return $var$21; } } - From 2be1222904ee3f2e40b5bc224d7ce3fe776f9c24 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 10:40:52 +0800 Subject: [PATCH 56/65] Revert "Normalize SSA ternary expectation EOFs" This reverts commit 8f8b0632ebd4c9c1fc64700b351064f15bb54bf7. --- .../ssa_const_propagation/composite_alias_field_forwarding.out | 1 + .../passes/ssa_const_propagation/nested_ternary_absorption.out | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index d76e95f663f..61f3ab573f4 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,3 +15,4 @@ program test.aleo { return $var$6; } } + diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 01698b2727e..126d90b2d54 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,3 +23,4 @@ program test.aleo { return $var$21; } } + From 169b815aab48a7d04363d98b1fcd2c38f9a54592 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 22 Jun 2026 22:37:36 +0800 Subject: [PATCH 57/65] Address CSE and SSA const propagation review --- .../common_subexpression_elimination/ast.rs | 14 +++---- .../visitor.rs | 41 +++++++++++-------- .../passes/src/ssa_const_propagation/ast.rs | 4 +- .../src/ssa_const_propagation/visitor.rs | 4 +- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/crates/passes/src/common_subexpression_elimination/ast.rs b/crates/passes/src/common_subexpression_elimination/ast.rs index e08fc4dc72f..eb2ecc1555b 100644 --- a/crates/passes/src/common_subexpression_elimination/ast.rs +++ b/crates/passes/src/common_subexpression_elimination/ast.rs @@ -25,9 +25,9 @@ impl AstReconstructor for CommonSubexpressionEliminatingVisitor<'_> { fn reconstruct_expression(&mut self, input: Expression, _additional: &()) -> (Expression, Self::AdditionalOutput) { // We simply forward every expression to `try_expr` rather than using the individual reconstruct // functions from the `AstReconstructor` trait. - let original = input.clone(); - let expression = self.try_expr(input, None).map(|(expression, _)| expression).unwrap_or(original); - (expression, Default::default()) + let mut input = input; + self.try_expr(&mut input, None); + (input, Default::default()) } fn reconstruct_block(&mut self, mut block: Block) -> (Block, Self::AdditionalOutput) { @@ -40,24 +40,20 @@ impl AstReconstructor for CommonSubexpressionEliminatingVisitor<'_> { fn reconstruct_definition(&mut self, mut input: DefinitionStatement) -> (Statement, Self::AdditionalOutput) { match input.place { DefinitionPlace::Single(place) => { - let original = input.value.clone(); - if let Some((value, definition_not_needed)) = self.try_expr(input.value, Some(place.name)) { + if let Some(definition_not_needed) = self.try_expr(&mut input.value, Some(place.name)) { if definition_not_needed { // We don't need this definition - everywhere its variable is referred to, we'll map it to some other // Path. (Statement::dummy(), Default::default()) } else { - input.value = value; (input.into(), Default::default()) } } else { - input.value = original; (input.into(), Default::default()) } } DefinitionPlace::Multiple(_) => { - let original = input.value.clone(); - input.value = self.try_expr(input.value, None).map(|(expression, _)| expression).unwrap_or(original); + self.try_expr(&mut input.value, None); (input.into(), Default::default()) } } diff --git a/crates/passes/src/common_subexpression_elimination/visitor.rs b/crates/passes/src/common_subexpression_elimination/visitor.rs index 684251b3bda..cf60aa4105f 100644 --- a/crates/passes/src/common_subexpression_elimination/visitor.rs +++ b/crates/passes/src/common_subexpression_elimination/visitor.rs @@ -134,11 +134,15 @@ impl CommonSubexpressionEliminatingVisitor<'_> { /// /// - `place` If this expression is the right hand side of a definition, `place` is the left hand side, /// - /// Returns (transformed expression, place_not_needed). `place_not_needed` is true iff it has been mapped to + /// Mutates `expression` in place while probing it. `None` means the whole + /// expression is not CSE-trackable, but any rewritten atom operands must be + /// preserved so deleted aliases are not reintroduced. + /// + /// Returns `place_not_needed`, which is true iff `place` has been mapped to /// another path, and thus its definition is no longer needed. - pub fn try_expr(&mut self, mut expression: Expression, place: Option) -> Option<(Expression, bool)> { + pub fn try_expr(&mut self, expression: &mut Expression, place: Option) -> Option { let span = expression.span(); - let expr: Expr = match &mut expression { + let expr: Expr = match expression { Expression::ArrayAccess(array_access) => { let array = self.try_atom(&mut array_access.array)?; let index = self.try_atom(&mut array_access.index)?; @@ -202,7 +206,7 @@ impl CommonSubexpressionEliminatingVisitor<'_> { for arg in &mut intrinsic.arguments { self.try_atom(arg)?; } - return Some((expression, false)); + return Some(false); } Expression::Call(call) => { @@ -210,17 +214,17 @@ impl CommonSubexpressionEliminatingVisitor<'_> { for arg in &mut call.arguments { self.try_atom(arg)?; } - return Some((expression, false)); + return Some(false); } Expression::Cast(cast) => { self.try_atom(&mut cast.expression)?; - return Some((expression, false)); + return Some(false); } Expression::MemberAccess(member_access) => { self.try_atom(&mut member_access.inner)?; - return Some((expression, false)); + return Some(false); } Expression::Composite(composite_expression) => { @@ -229,7 +233,7 @@ impl CommonSubexpressionEliminatingVisitor<'_> { self.try_atom(expr)?; } } - return Some((expression, false)); + return Some(false); } Expression::Tuple(tuple_expression) => { @@ -238,9 +242,12 @@ impl CommonSubexpressionEliminatingVisitor<'_> { tuple_expression.elements = tuple_expression .elements .drain(..) - .map(|expr| self.try_expr(expr, None).map(|x| x.0)) - .collect::>>()?; - return Some((expression, false)); + .map(|mut expr| { + self.try_expr(&mut expr, None); + expr + }) + .collect::>(); + return Some(false); } Expression::TupleAccess(_) => panic!("Tuple access expressions should not exist in this pass."), @@ -258,11 +265,11 @@ impl CommonSubexpressionEliminatingVisitor<'_> { } DynamicOpKind::Read { .. } => {} } - return Some((expression, false)); + return Some(false); } Expression::Async(_) | Expression::Err(_) | Expression::Unit(_) => { - return Some((expression, false)); + return Some(false); } }; @@ -278,9 +285,11 @@ impl CommonSubexpressionEliminatingVisitor<'_> { // We were defining a new variable, whose right hand side is already defined, so map // this variable to the previous variable. self.scopes.last_mut().unwrap().expressions.insert(Atom::Path(vec![place]).into(), name); - return Some((Path::from(identifier).to_local().into(), true)); + *expression = Path::from(identifier).to_local().into(); + return Some(true); } - return Some((Path::from(identifier).to_local().into(), false)); + *expression = Path::from(identifier).to_local().into(); + return Some(false); } } @@ -289,6 +298,6 @@ impl CommonSubexpressionEliminatingVisitor<'_> { self.scopes.last_mut().unwrap().expressions.insert(expr, place); } - Some((expression, false)) + Some(false) } } diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index b770259d54f..1a41a4a0a50 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -71,10 +71,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { if let Expression::Path(path) = &input.inner && let Some(original_name) = path.try_local_symbol() { - if !self.forward_direct_composites { + let name = self.resolve_composite_alias(original_name); + if !self.forward_direct_composites && name == original_name { return (input.into(), None); } - let name = self.resolve_composite_alias(original_name); let Some(fields) = self.atom_fielded_composites.get(&name) else { return (input.into(), None); }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index a8a79f68b82..fb1921427bb 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -18,7 +18,7 @@ use crate::CompilerState; use leo_ast::{Expression, FromStrRadix, Literal, LiteralVariant, Location, Node, NodeID, const_eval::Value}; use leo_errors::Formatted; -use leo_span::{Span, Symbol}; +use leo_span::{Span, Symbol, with_session_globals}; use indexmap::IndexMap; @@ -64,7 +64,7 @@ pub(super) fn is_optional_wrapper_type(ty: &leo_ast::Type) -> bool { matches!( ty, leo_ast::Type::Composite(composite) - if composite.path.identifier().name.to_string().ends_with('?') + if with_session_globals(|sg| composite.path.identifier().name.as_str(sg, |s| s.ends_with('?'))) ) } From 70324812c9cdff1459202a8b3fe88f692aef2705 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Thu, 25 Jun 2026 13:33:33 +0800 Subject: [PATCH 58/65] Add ternary peephole absorption regression --- .../compiler/peephole/ternary_absorption.out | 27 +++++++++++++++++++ .../composite_alias_field_forwarding.out | 1 - .../nested_ternary_absorption.out | 1 - .../compiler/peephole/ternary_absorption.leo | 16 +++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 tests/expectations/compiler/peephole/ternary_absorption.out create mode 100644 tests/tests/compiler/peephole/ternary_absorption.leo diff --git a/tests/expectations/compiler/peephole/ternary_absorption.out b/tests/expectations/compiler/peephole/ternary_absorption.out new file mode 100644 index 00000000000..557ececf738 --- /dev/null +++ b/tests/expectations/compiler/peephole/ternary_absorption.out @@ -0,0 +1,27 @@ +program test.aleo; + +function true_branch: + input r0 as boolean.private; + input r1 as u32.private; + input r2 as u32.private; + ternary r0 r1 r2 into r3; + output r3 as u32.private; + +function false_branch: + input r0 as boolean.private; + input r1 as u32.private; + input r2 as u32.private; + ternary r0 r1 r2 into r3; + output r3 as u32.private; + +function different_condition: + input r0 as boolean.private; + input r1 as boolean.private; + input r2 as u32.private; + input r3 as u32.private; + ternary r1 r2 r3 into r4; + ternary r0 r4 r3 into r5; + output r5 as u32.private; + +constructor: + assert.eq edition 0u16; diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index 61f3ab573f4..d76e95f663f 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,4 +15,3 @@ program test.aleo { return $var$6; } } - diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 126d90b2d54..01698b2727e 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,4 +23,3 @@ program test.aleo { return $var$21; } } - diff --git a/tests/tests/compiler/peephole/ternary_absorption.leo b/tests/tests/compiler/peephole/ternary_absorption.leo new file mode 100644 index 00000000000..6a4006088b4 --- /dev/null +++ b/tests/tests/compiler/peephole/ternary_absorption.leo @@ -0,0 +1,16 @@ +program test.aleo { + fn true_branch(cond: bool, a: u32, b: u32) -> u32 { + return cond ? (cond ? a : b) : b; + } + + fn false_branch(cond: bool, a: u32, b: u32) -> u32 { + return cond ? a : (cond ? a : b); + } + + fn different_condition(cond: bool, other: bool, a: u32, b: u32) -> u32 { + return cond ? (other ? a : b) : b; + } + + @noupgrade + constructor() {} +} From 1ed453279c66f05c69829353d47f49c360cf88a8 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Thu, 25 Jun 2026 13:49:10 +0800 Subject: [PATCH 59/65] Restore SSA pass expectation EOFs --- .../ssa_const_propagation/composite_alias_field_forwarding.out | 1 + .../passes/ssa_const_propagation/nested_ternary_absorption.out | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index d76e95f663f..61f3ab573f4 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -15,3 +15,4 @@ program test.aleo { return $var$6; } } + diff --git a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out index 01698b2727e..126d90b2d54 100644 --- a/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out +++ b/tests/expectations/passes/ssa_const_propagation/nested_ternary_absorption.out @@ -23,3 +23,4 @@ program test.aleo { return $var$21; } } + From 019402c85873b44103f19d7158fa38a4f69ea367 Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Fri, 26 Jun 2026 16:26:26 +0800 Subject: [PATCH 60/65] Constrain ternary peephole absorption operands --- .../passes/src/peephole_optimization/mod.rs | 49 ++++++++++++++++++- .../composite_alias_field_forwarding.out | 19 ++++++- .../composite_alias_field_forwarding.leo | 13 +++++ 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/crates/passes/src/peephole_optimization/mod.rs b/crates/passes/src/peephole_optimization/mod.rs index 6e20085e4e1..c7ad663d77d 100644 --- a/crates/passes/src/peephole_optimization/mod.rs +++ b/crates/passes/src/peephole_optimization/mod.rs @@ -108,6 +108,10 @@ fn is_literal(expr: &AleoExpr) -> bool { ) } +fn is_ternary_absorption_operand(expr: &AleoExpr) -> bool { + matches!(expr, AleoExpr::Reg(_)) || is_literal(expr) +} + // Identity operation folding /// If `stmt` is an identity operation, returns references to (dest_register, aliased_expr). @@ -456,7 +460,12 @@ fn fold_redundant_ternaries(stmts: &mut [AleoStmt]) { *if_false = inner_false.clone(); } - ternaries.insert(dest.clone(), (condition.clone(), if_true.clone(), if_false.clone())); + if is_ternary_absorption_operand(condition) + && is_ternary_absorption_operand(if_true) + && is_ternary_absorption_operand(if_false) + { + ternaries.insert(dest.clone(), (condition.clone(), if_true.clone(), if_false.clone())); + } } } } @@ -1122,3 +1131,41 @@ fn renumber_registers(stmts: &mut [AleoStmt], num_inputs: usize) { } } } + +#[cfg(test)] +mod tests { + use super::*; + + fn reg(index: u64) -> AleoExpr { + AleoExpr::Reg(AleoReg::R(index)) + } + + fn reg_dest(index: u64) -> AleoReg { + AleoReg::R(index) + } + + #[test] + fn redundant_ternary_absorption_uses_atom_operands() { + let mut stmts = vec![ + AleoStmt::Ternary(reg(0), reg(1), reg(2), reg_dest(3)), + AleoStmt::Ternary(reg(0), reg(3), reg(2), reg_dest(4)), + ]; + + fold_redundant_ternaries(&mut stmts); + + assert_eq!(stmts[1], AleoStmt::Ternary(reg(0), reg(1), reg(2), reg_dest(4))); + } + + #[test] + fn redundant_ternary_absorption_ignores_non_atom_operands() { + let member = AleoExpr::MemberAccess(Box::new(reg(1)), "field".to_string()); + let mut stmts = vec![ + AleoStmt::Ternary(reg(0), member, reg(2), reg_dest(3)), + AleoStmt::Ternary(reg(0), reg(3), reg(2), reg_dest(4)), + ]; + + fold_redundant_ternaries(&mut stmts); + + assert_eq!(stmts[1], AleoStmt::Ternary(reg(0), reg(3), reg(2), reg_dest(4))); + } +} diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index 61f3ab573f4..ea8ad90978f 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -14,5 +14,22 @@ program test.aleo { let $var$6 = $var$4 + $var$5; return $var$6; } + fn alias_chain(p$$7: u32, q$$8: u32) -> u32 { + let s$#9 = test.aleo::Pair { a: p$$7, b: q$$8 }; + let alias1$#10 = s$#9; + let alias2$#11 = alias1$#10; + let $var$12 = p$$7; + let $var$13 = q$$8; + let $var$14 = $var$12 + $var$13; + return $var$14; + } + fn fallible_field(p$$15: u32, q$$16: u32) -> u32 { + let $var$17 = p$$15 / q$$16; + let s$#18 = test.aleo::Pair { a: $var$17, b: q$$16 }; + let alias$#19 = s$#18; + let $var$20 = $var$17; + let $var$21 = q$$16; + let $var$22 = $var$20 + $var$21; + return $var$22; + } } - diff --git a/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo b/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo index 82f3e69762f..30d3ea689f4 100644 --- a/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo +++ b/tests/tests/passes/ssa_const_propagation/composite_alias_field_forwarding.leo @@ -12,4 +12,17 @@ program test.aleo { let alias: Pair = s; return alias.a + alias.b; } + + fn alias_chain(p: u32, q: u32) -> u32 { + let s: Pair = Pair { a: p, b: q }; + let alias1: Pair = s; + let alias2: Pair = alias1; + return alias2.a + alias2.b; + } + + fn fallible_field(p: u32, q: u32) -> u32 { + let s: Pair = Pair { a: p / q, b: q }; + let alias: Pair = s; + return alias.a + alias.b; + } } From 41835fbb1de2ffc63c5c08831c82abf3dd50f47f Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Fri, 26 Jun 2026 16:49:00 +0800 Subject: [PATCH 61/65] Update ternary absorption expectations --- .../compiler/storage/aggregates.out | 190 +++++++++--------- .../compiler/storage/external_storage.out | 171 ++++++++-------- .../composite_alias_field_forwarding.out | 1 + 3 files changed, 183 insertions(+), 179 deletions(-) diff --git a/tests/expectations/compiler/storage/aggregates.out b/tests/expectations/compiler/storage/aggregates.out index 3fba34480b9..6908c83aa9d 100644 --- a/tests/expectations/compiler/storage/aggregates.out +++ b/tests/expectations/compiler/storage/aggregates.out @@ -185,100 +185,102 @@ finalize check2: get.or_use point__[false] r1 into r2; ternary r0 r2.x 0field into r3; ternary r0 r2.y 0field into r4; - is.eq r3 1field into r5; - assert.eq r5 true; - is.eq r4 2field into r6; - assert.eq r6 true; - contains points__[false] into r7; - cast 0field 0field into r8 as Point; - cast r8 r8 into r9 as [Point; 2u32]; - get.or_use points__[false] r9 into r10; - cast 0field 0field into r11 as Point; - cast r11 r11 into r12 as [Point; 2u32]; - ternary r7 r10[0u32].x r12[0u32].x into r13; - ternary r7 r10[0u32].y r12[0u32].y into r14; - cast r13 r14 into r15 as Point; - ternary r7 r10[1u32].x r12[1u32].x into r16; - ternary r7 r10[1u32].y r12[1u32].y into r17; - cast r16 r17 into r18 as Point; - cast r15 r18 into r19 as [Point; 2u32]; - cast 0field 0field into r20 as Point; - cast 0field 0field into r21 as Point; - cast r20 r21 into r22 as [Point; 2u32]; - ternary r7 r19[0u32].x r22[0u32].x into r23; - ternary r7 r19[0u32].y r22[0u32].y into r24; - cast r23 r24 into r25 as Point; - ternary r7 r19[1u32].x r22[1u32].x into r26; - ternary r7 r19[1u32].y r22[1u32].y into r27; - cast r26 r27 into r28 as Point; - cast r25 r28 into r29 as [Point; 2u32]; - is.eq r29[0u32].x 10field into r30; - assert.eq r30 true; - is.eq r29[1u32].y 40field into r31; - assert.eq r31 true; - contains stats__[false] into r32; - cast 0u32 0u32 0u32 into r33 as [u32; 3u32]; - cast r33 false into r34 as Stats; - get.or_use stats__[false] r34 into r35; - ternary r32 r35.values[0u32] r33[0u32] into r36; - ternary r32 r35.values[1u32] r33[1u32] into r37; - ternary r32 r35.values[2u32] r33[2u32] into r38; - cast r36 r37 r38 into r39 as [u32; 3u32]; - ternary r32 r35.active false into r40; - cast 0u32 0u32 0u32 into r41 as [u32; 3u32]; - cast r41 false into r42 as Stats; - ternary r32 r39[0u32] r42.values[0u32] into r43; - ternary r32 r39[1u32] r42.values[1u32] into r44; - ternary r32 r39[2u32] r42.values[2u32] into r45; - cast r43 r44 r45 into r46 as [u32; 3u32]; - ternary r32 r40 r42.active into r47; - is.eq r46[2u32] 15u32 into r48; - assert.eq r48 true; - is.eq r47 true into r49; - assert.eq r49 true; - contains arr_u32__[false] into r50; - get.or_use arr_u32__[false] r33 into r51; - ternary r50 r51[0u32] r33[0u32] into r52; - ternary r50 r51[1u32] r33[1u32] into r53; - ternary r50 r51[2u32] r33[2u32] into r54; - cast r52 r53 r54 into r55 as [u32; 3u32]; - ternary r50 r55[0u32] 0u32 into r56; - ternary r50 r55[1u32] 0u32 into r57; - ternary r50 r55[2u32] 0u32 into r58; - cast r56 r57 r58 into r59 as [u32; 3u32]; - is.eq r59[1u32] 8u32 into r60; - assert.eq r60 true; - contains arr_bool__[false] into r61; - cast false false into r62 as [boolean; 2u32]; - get.or_use arr_bool__[false] r62 into r63; - ternary r61 r63[0u32] r62[0u32] into r64; - ternary r61 r63[1u32] r62[1u32] into r65; - cast r64 r65 into r66 as [boolean; 2u32]; - ternary r61 r66[0u32] false into r67; - ternary r61 r66[1u32] false into r68; - cast r67 r68 into r69 as [boolean; 2u32]; - is.eq r69[0u32] true into r70; - assert.eq r70 true; - contains nested__[false] into r71; - cast 0u8 0u8 into r72 as [u8; 2u32]; - cast r72 r72 into r73 as [[u8; 2u32]; 2u32]; - get.or_use nested__[false] r73 into r74; - ternary r71 r74[0u32][0u32] r73[0u32][0u32] into r75; - ternary r71 r74[0u32][1u32] r73[0u32][1u32] into r76; - cast r75 r76 into r77 as [u8; 2u32]; - ternary r71 r74[1u32][0u32] r73[1u32][0u32] into r78; - ternary r71 r74[1u32][1u32] r73[1u32][1u32] into r79; - cast r78 r79 into r80 as [u8; 2u32]; - cast r77 r80 into r81 as [[u8; 2u32]; 2u32]; - ternary r71 r81[0u32][0u32] 0u8 into r82; - ternary r71 r81[0u32][1u32] 0u8 into r83; - cast r82 r83 into r84 as [u8; 2u32]; - ternary r71 r81[1u32][0u32] 0u8 into r85; - ternary r71 r81[1u32][1u32] 0u8 into r86; - cast r85 r86 into r87 as [u8; 2u32]; - cast r84 r87 into r88 as [[u8; 2u32]; 2u32]; - is.eq r88[1u32][1u32] 4u8 into r89; - assert.eq r89 true; + ternary r0 r3 0field into r5; + ternary r0 r4 0field into r6; + is.eq r5 1field into r7; + assert.eq r7 true; + is.eq r6 2field into r8; + assert.eq r8 true; + contains points__[false] into r9; + cast 0field 0field into r10 as Point; + cast r10 r10 into r11 as [Point; 2u32]; + get.or_use points__[false] r11 into r12; + cast 0field 0field into r13 as Point; + cast r13 r13 into r14 as [Point; 2u32]; + ternary r9 r12[0u32].x r14[0u32].x into r15; + ternary r9 r12[0u32].y r14[0u32].y into r16; + cast r15 r16 into r17 as Point; + ternary r9 r12[1u32].x r14[1u32].x into r18; + ternary r9 r12[1u32].y r14[1u32].y into r19; + cast r18 r19 into r20 as Point; + cast r17 r20 into r21 as [Point; 2u32]; + cast 0field 0field into r22 as Point; + cast 0field 0field into r23 as Point; + cast r22 r23 into r24 as [Point; 2u32]; + ternary r9 r21[0u32].x r24[0u32].x into r25; + ternary r9 r21[0u32].y r24[0u32].y into r26; + cast r25 r26 into r27 as Point; + ternary r9 r21[1u32].x r24[1u32].x into r28; + ternary r9 r21[1u32].y r24[1u32].y into r29; + cast r28 r29 into r30 as Point; + cast r27 r30 into r31 as [Point; 2u32]; + is.eq r31[0u32].x 10field into r32; + assert.eq r32 true; + is.eq r31[1u32].y 40field into r33; + assert.eq r33 true; + contains stats__[false] into r34; + cast 0u32 0u32 0u32 into r35 as [u32; 3u32]; + cast r35 false into r36 as Stats; + get.or_use stats__[false] r36 into r37; + ternary r34 r37.values[0u32] r35[0u32] into r38; + ternary r34 r37.values[1u32] r35[1u32] into r39; + ternary r34 r37.values[2u32] r35[2u32] into r40; + cast r38 r39 r40 into r41 as [u32; 3u32]; + ternary r34 r37.active false into r42; + cast 0u32 0u32 0u32 into r43 as [u32; 3u32]; + cast r43 false into r44 as Stats; + ternary r34 r41[0u32] r44.values[0u32] into r45; + ternary r34 r41[1u32] r44.values[1u32] into r46; + ternary r34 r41[2u32] r44.values[2u32] into r47; + cast r45 r46 r47 into r48 as [u32; 3u32]; + ternary r34 r42 r44.active into r49; + is.eq r48[2u32] 15u32 into r50; + assert.eq r50 true; + is.eq r49 true into r51; + assert.eq r51 true; + contains arr_u32__[false] into r52; + get.or_use arr_u32__[false] r35 into r53; + ternary r52 r53[0u32] r35[0u32] into r54; + ternary r52 r53[1u32] r35[1u32] into r55; + ternary r52 r53[2u32] r35[2u32] into r56; + cast r54 r55 r56 into r57 as [u32; 3u32]; + ternary r52 r57[0u32] 0u32 into r58; + ternary r52 r57[1u32] 0u32 into r59; + ternary r52 r57[2u32] 0u32 into r60; + cast r58 r59 r60 into r61 as [u32; 3u32]; + is.eq r61[1u32] 8u32 into r62; + assert.eq r62 true; + contains arr_bool__[false] into r63; + cast false false into r64 as [boolean; 2u32]; + get.or_use arr_bool__[false] r64 into r65; + ternary r63 r65[0u32] r64[0u32] into r66; + ternary r63 r65[1u32] r64[1u32] into r67; + cast r66 r67 into r68 as [boolean; 2u32]; + ternary r63 r68[0u32] false into r69; + ternary r63 r68[1u32] false into r70; + cast r69 r70 into r71 as [boolean; 2u32]; + is.eq r71[0u32] true into r72; + assert.eq r72 true; + contains nested__[false] into r73; + cast 0u8 0u8 into r74 as [u8; 2u32]; + cast r74 r74 into r75 as [[u8; 2u32]; 2u32]; + get.or_use nested__[false] r75 into r76; + ternary r73 r76[0u32][0u32] r75[0u32][0u32] into r77; + ternary r73 r76[0u32][1u32] r75[0u32][1u32] into r78; + cast r77 r78 into r79 as [u8; 2u32]; + ternary r73 r76[1u32][0u32] r75[1u32][0u32] into r80; + ternary r73 r76[1u32][1u32] r75[1u32][1u32] into r81; + cast r80 r81 into r82 as [u8; 2u32]; + cast r79 r82 into r83 as [[u8; 2u32]; 2u32]; + ternary r73 r83[0u32][0u32] 0u8 into r84; + ternary r73 r83[0u32][1u32] 0u8 into r85; + cast r84 r85 into r86 as [u8; 2u32]; + ternary r73 r83[1u32][0u32] 0u8 into r87; + ternary r73 r83[1u32][1u32] 0u8 into r88; + cast r87 r88 into r89 as [u8; 2u32]; + cast r86 r89 into r90 as [[u8; 2u32]; 2u32]; + is.eq r90[1u32][1u32] 4u8 into r91; + assert.eq r91 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/compiler/storage/external_storage.out b/tests/expectations/compiler/storage/external_storage.out index 8bf5fe2dd61..37a49801c55 100644 --- a/tests/expectations/compiler/storage/external_storage.out +++ b/tests/expectations/compiler/storage/external_storage.out @@ -430,92 +430,93 @@ finalize check_fallback: cast 0field 0field into r17 as child.aleo/Point; get.or_use child.aleo/point__[false] r17 into r18; ternary r16 r18.x 0field into r19; - is.eq r19 0field into r20; - assert.eq r20 true; - contains child.aleo/points__[false] into r21; - cast 0field 0field into r22 as child.aleo/Point; - cast r22 r22 into r23 as [child.aleo/Point; 2u32]; - get.or_use child.aleo/points__[false] r23 into r24; - cast 0field 0field into r25 as child.aleo/Point; - cast r25 r25 into r26 as [child.aleo/Point; 2u32]; - ternary r21 r24[0u32].x r26[0u32].x into r27; - ternary r21 r24[0u32].y r26[0u32].y into r28; - cast r27 r28 into r29 as child.aleo/Point; - ternary r21 r24[1u32].x r26[1u32].x into r30; - ternary r21 r24[1u32].y r26[1u32].y into r31; - cast r30 r31 into r32 as child.aleo/Point; - cast r29 r32 into r33 as [child.aleo/Point; 2u32]; - cast 0field 0field into r34 as child.aleo/Point; + ternary r16 r19 0field into r20; + is.eq r20 0field into r21; + assert.eq r21 true; + contains child.aleo/points__[false] into r22; + cast 0field 0field into r23 as child.aleo/Point; + cast r23 r23 into r24 as [child.aleo/Point; 2u32]; + get.or_use child.aleo/points__[false] r24 into r25; + cast 0field 0field into r26 as child.aleo/Point; + cast r26 r26 into r27 as [child.aleo/Point; 2u32]; + ternary r22 r25[0u32].x r27[0u32].x into r28; + ternary r22 r25[0u32].y r27[0u32].y into r29; + cast r28 r29 into r30 as child.aleo/Point; + ternary r22 r25[1u32].x r27[1u32].x into r31; + ternary r22 r25[1u32].y r27[1u32].y into r32; + cast r31 r32 into r33 as child.aleo/Point; + cast r30 r33 into r34 as [child.aleo/Point; 2u32]; cast 0field 0field into r35 as child.aleo/Point; - cast r34 r35 into r36 as [child.aleo/Point; 2u32]; - ternary r21 r33[0u32].x r36[0u32].x into r37; - ternary r21 r33[0u32].y r36[0u32].y into r38; - cast r37 r38 into r39 as child.aleo/Point; - ternary r21 r33[1u32].x r36[1u32].x into r40; - ternary r21 r33[1u32].y r36[1u32].y into r41; - cast r40 r41 into r42 as child.aleo/Point; - cast r39 r42 into r43 as [child.aleo/Point; 2u32]; - is.eq r43[0u32].x 0field into r44; - assert.eq r44 true; - contains child.aleo/stats__[false] into r45; - cast 0u32 0u32 0u32 into r46 as [u32; 3u32]; - cast r46 false into r47 as child.aleo/Stats; - get.or_use child.aleo/stats__[false] r47 into r48; - ternary r45 r48.active false into r49; - cast 0u32 0u32 0u32 into r50 as [u32; 3u32]; - cast r50 false into r51 as child.aleo/Stats; - ternary r45 r49 r51.active into r52; - is.eq r52 false into r53; - assert.eq r53 true; - contains child.aleo/arr_u32__[false] into r54; - get.or_use child.aleo/arr_u32__[false] r46 into r55; - ternary r54 r55[0u32] r46[0u32] into r56; - ternary r54 r55[1u32] r46[1u32] into r57; - ternary r54 r55[2u32] r46[2u32] into r58; - cast r56 r57 r58 into r59 as [u32; 3u32]; - ternary r54 r59[0u32] 0u32 into r60; - ternary r54 r59[1u32] 0u32 into r61; - ternary r54 r59[2u32] 0u32 into r62; - cast r60 r61 r62 into r63 as [u32; 3u32]; - is.eq r63[1u32] 0u32 into r64; - assert.eq r64 true; - contains child.aleo/arr_bool__[false] into r65; - cast false false into r66 as [boolean; 2u32]; - get.or_use child.aleo/arr_bool__[false] r66 into r67; - ternary r65 r67[0u32] r66[0u32] into r68; - ternary r65 r67[1u32] r66[1u32] into r69; - cast r68 r69 into r70 as [boolean; 2u32]; - ternary r65 r70[0u32] false into r71; - ternary r65 r70[1u32] false into r72; - cast r71 r72 into r73 as [boolean; 2u32]; - is.eq r73[1u32] false into r74; - assert.eq r74 true; - contains child.aleo/nested__[false] into r75; - cast 0u8 0u8 into r76 as [u8; 2u32]; - cast r76 r76 into r77 as [[u8; 2u32]; 2u32]; - get.or_use child.aleo/nested__[false] r77 into r78; - ternary r75 r78[0u32][0u32] r77[0u32][0u32] into r79; - ternary r75 r78[0u32][1u32] r77[0u32][1u32] into r80; - cast r79 r80 into r81 as [u8; 2u32]; - ternary r75 r78[1u32][0u32] r77[1u32][0u32] into r82; - ternary r75 r78[1u32][1u32] r77[1u32][1u32] into r83; - cast r82 r83 into r84 as [u8; 2u32]; - cast r81 r84 into r85 as [[u8; 2u32]; 2u32]; - ternary r75 r85[0u32][0u32] 0u8 into r86; - ternary r75 r85[0u32][1u32] 0u8 into r87; - cast r86 r87 into r88 as [u8; 2u32]; - ternary r75 r85[1u32][0u32] 0u8 into r89; - ternary r75 r85[1u32][1u32] 0u8 into r90; - cast r89 r90 into r91 as [u8; 2u32]; - cast r88 r91 into r92 as [[u8; 2u32]; 2u32]; - is.eq r92[0u32][0u32] 0u8 into r93; - assert.eq r93 true; - contains child.aleo/counter__[false] into r94; - get.or_use child.aleo/counter__[false] 0u8 into r95; - ternary r94 r95 0u8 into r96; - ternary r94 r96 123u8 into r97; - is.eq r97 123u8 into r98; - assert.eq r98 true; + cast 0field 0field into r36 as child.aleo/Point; + cast r35 r36 into r37 as [child.aleo/Point; 2u32]; + ternary r22 r34[0u32].x r37[0u32].x into r38; + ternary r22 r34[0u32].y r37[0u32].y into r39; + cast r38 r39 into r40 as child.aleo/Point; + ternary r22 r34[1u32].x r37[1u32].x into r41; + ternary r22 r34[1u32].y r37[1u32].y into r42; + cast r41 r42 into r43 as child.aleo/Point; + cast r40 r43 into r44 as [child.aleo/Point; 2u32]; + is.eq r44[0u32].x 0field into r45; + assert.eq r45 true; + contains child.aleo/stats__[false] into r46; + cast 0u32 0u32 0u32 into r47 as [u32; 3u32]; + cast r47 false into r48 as child.aleo/Stats; + get.or_use child.aleo/stats__[false] r48 into r49; + ternary r46 r49.active false into r50; + cast 0u32 0u32 0u32 into r51 as [u32; 3u32]; + cast r51 false into r52 as child.aleo/Stats; + ternary r46 r50 r52.active into r53; + is.eq r53 false into r54; + assert.eq r54 true; + contains child.aleo/arr_u32__[false] into r55; + get.or_use child.aleo/arr_u32__[false] r47 into r56; + ternary r55 r56[0u32] r47[0u32] into r57; + ternary r55 r56[1u32] r47[1u32] into r58; + ternary r55 r56[2u32] r47[2u32] into r59; + cast r57 r58 r59 into r60 as [u32; 3u32]; + ternary r55 r60[0u32] 0u32 into r61; + ternary r55 r60[1u32] 0u32 into r62; + ternary r55 r60[2u32] 0u32 into r63; + cast r61 r62 r63 into r64 as [u32; 3u32]; + is.eq r64[1u32] 0u32 into r65; + assert.eq r65 true; + contains child.aleo/arr_bool__[false] into r66; + cast false false into r67 as [boolean; 2u32]; + get.or_use child.aleo/arr_bool__[false] r67 into r68; + ternary r66 r68[0u32] r67[0u32] into r69; + ternary r66 r68[1u32] r67[1u32] into r70; + cast r69 r70 into r71 as [boolean; 2u32]; + ternary r66 r71[0u32] false into r72; + ternary r66 r71[1u32] false into r73; + cast r72 r73 into r74 as [boolean; 2u32]; + is.eq r74[1u32] false into r75; + assert.eq r75 true; + contains child.aleo/nested__[false] into r76; + cast 0u8 0u8 into r77 as [u8; 2u32]; + cast r77 r77 into r78 as [[u8; 2u32]; 2u32]; + get.or_use child.aleo/nested__[false] r78 into r79; + ternary r76 r79[0u32][0u32] r78[0u32][0u32] into r80; + ternary r76 r79[0u32][1u32] r78[0u32][1u32] into r81; + cast r80 r81 into r82 as [u8; 2u32]; + ternary r76 r79[1u32][0u32] r78[1u32][0u32] into r83; + ternary r76 r79[1u32][1u32] r78[1u32][1u32] into r84; + cast r83 r84 into r85 as [u8; 2u32]; + cast r82 r85 into r86 as [[u8; 2u32]; 2u32]; + ternary r76 r86[0u32][0u32] 0u8 into r87; + ternary r76 r86[0u32][1u32] 0u8 into r88; + cast r87 r88 into r89 as [u8; 2u32]; + ternary r76 r86[1u32][0u32] 0u8 into r90; + ternary r76 r86[1u32][1u32] 0u8 into r91; + cast r90 r91 into r92 as [u8; 2u32]; + cast r89 r92 into r93 as [[u8; 2u32]; 2u32]; + is.eq r93[0u32][0u32] 0u8 into r94; + assert.eq r94 true; + contains child.aleo/counter__[false] into r95; + get.or_use child.aleo/counter__[false] 0u8 into r96; + ternary r95 r96 0u8 into r97; + ternary r95 r97 123u8 into r98; + is.eq r98 123u8 into r99; + assert.eq r99 true; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out index ea8ad90978f..1fd3b9a5f1b 100644 --- a/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out +++ b/tests/expectations/passes/ssa_const_propagation/composite_alias_field_forwarding.out @@ -33,3 +33,4 @@ program test.aleo { return $var$22; } } + From 6ad3d402b462d299587c23f9923352cbf83e2ed4 Mon Sep 17 00:00:00 2001 From: Kuhai9801 <165563006+Kuhai9801@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:20:32 +0800 Subject: [PATCH 62/65] Tighten atom-only ternary absorption cleanup --- crates/compiler/src/compiler.rs | 5 ++ .../passes/src/peephole_optimization/mod.rs | 47 +++++++++++++++---- .../src/ssa_const_propagation/visitor.rs | 5 +- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index 4fffc0695e2..c9f3af7e50d 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -454,6 +454,11 @@ impl Compiler { self.do_pass::(SsaFormingInput { rename_defs: false })?; + // The final SSA pass can introduce local aliases around atom-fielded + // composites. Run a late cleanup before CSE/DCE, leaving direct + // composite field forwarding to the earlier pass. + self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; + self.do_pass::(())?; self.do_pass::(())?; diff --git a/crates/passes/src/peephole_optimization/mod.rs b/crates/passes/src/peephole_optimization/mod.rs index c7ad663d77d..6e3864f0fbd 100644 --- a/crates/passes/src/peephole_optimization/mod.rs +++ b/crates/passes/src/peephole_optimization/mod.rs @@ -96,16 +96,33 @@ fn is_true(expr: &AleoExpr) -> bool { matches!(expr, AleoExpr::Bool(true)) } -/// Returns true if the expression is a literal (not a register or composite expression). +/// Returns true if the expression is a generated-Aleo literal. fn is_literal(expr: &AleoExpr) -> bool { - !matches!( - expr, + match expr { + AleoExpr::Address(_) + | AleoExpr::Identifier(_) + | AleoExpr::Bool(_) + | AleoExpr::Field(_) + | AleoExpr::Group(_) + | AleoExpr::Signature(_) + | AleoExpr::Scalar(_) + | AleoExpr::String(_) + | AleoExpr::U8(_) + | AleoExpr::U16(_) + | AleoExpr::U32(_) + | AleoExpr::U64(_) + | AleoExpr::U128(_) + | AleoExpr::I8(_) + | AleoExpr::I16(_) + | AleoExpr::I32(_) + | AleoExpr::I64(_) + | AleoExpr::I128(_) => true, AleoExpr::Reg(_) - | AleoExpr::Tuple(_) - | AleoExpr::ArrayAccess(_, _) - | AleoExpr::MemberAccess(_, _) - | AleoExpr::RawName(_) - ) + | AleoExpr::Tuple(_) + | AleoExpr::ArrayAccess(_, _) + | AleoExpr::MemberAccess(_, _) + | AleoExpr::RawName(_) => false, + } } fn is_ternary_absorption_operand(expr: &AleoExpr) -> bool { @@ -1156,6 +1173,20 @@ mod tests { assert_eq!(stmts[1], AleoStmt::Ternary(reg(0), reg(1), reg(2), reg_dest(4))); } + #[test] + fn redundant_ternary_absorption_uses_literal_operands() { + let one = AleoExpr::U8(1); + let two = AleoExpr::U8(2); + let mut stmts = vec![ + AleoStmt::Ternary(reg(0), one.clone(), two.clone(), reg_dest(3)), + AleoStmt::Ternary(reg(0), reg(3), two.clone(), reg_dest(4)), + ]; + + fold_redundant_ternaries(&mut stmts); + + assert_eq!(stmts[1], AleoStmt::Ternary(reg(0), one, two, reg_dest(4))); + } + #[test] fn redundant_ternary_absorption_ignores_non_atom_operands() { let member = AleoExpr::MemberAccess(Box::new(reg(1)), "field".to_string()); diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index fb1921427bb..42720eda52b 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -123,7 +123,10 @@ impl SsaConstPropagationVisitor<'_> { } pub(super) fn resolve_composite_alias(&self, mut name: Symbol) -> Symbol { - while let Some(alias) = self.aliases.get(&name).copied() { + for _ in 0..self.aliases.len() { + let Some(alias) = self.aliases.get(&name).copied() else { + break; + }; if alias == name { break; } From 5e91c38d843c078400fda1021a669f4905197628 Mon Sep 17 00:00:00 2001 From: Kuhai9801 <165563006+Kuhai9801@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:36:33 +0800 Subject: [PATCH 63/65] Narrow late SSA const propagation cleanup --- crates/compiler/src/compiler.rs | 5 ++- .../passes/src/ssa_const_propagation/ast.rs | 41 +++++++++++++++++++ .../passes/src/ssa_const_propagation/mod.rs | 4 +- .../src/ssa_const_propagation/visitor.rs | 2 + 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/crates/compiler/src/compiler.rs b/crates/compiler/src/compiler.rs index c9f3af7e50d..8d04a6cf719 100644 --- a/crates/compiler/src/compiler.rs +++ b/crates/compiler/src/compiler.rs @@ -457,7 +457,10 @@ impl Compiler { // The final SSA pass can introduce local aliases around atom-fielded // composites. Run a late cleanup before CSE/DCE, leaving direct // composite field forwarding to the earlier pass. - self.do_pass::(SsaConstPropagationInput { forward_direct_composites: false })?; + self.do_pass::(SsaConstPropagationInput { + forward_direct_composites: false, + propagate_constants: false, + })?; self.do_pass::(())?; diff --git a/crates/passes/src/ssa_const_propagation/ast.rs b/crates/passes/src/ssa_const_propagation/ast.rs index 1a41a4a0a50..215cf885d0f 100644 --- a/crates/passes/src/ssa_const_propagation/ast.rs +++ b/crates/passes/src/ssa_const_propagation/ast.rs @@ -38,6 +38,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { /// Reconstruct a path expression. If the path refers to a variable that has /// a constant value, replace it with that constant. fn reconstruct_path(&mut self, input: Path, _additional: &()) -> (Expression, Self::AdditionalOutput) { + if !self.propagate_constants { + return (input.into(), None); + } + // In SSA form, paths should refer to local variables (or composite members). // Check if this variable has a constant value. let identifier_name = input.identifier().name; @@ -95,6 +99,9 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { // which restricts to `Path`/`Literal`. _ => unreachable!("atom_fielded_composites fields must be Path or Literal"), }; + if !self.propagate_constants { + return (atom, None); + } return (atom, opt_value); } @@ -103,6 +110,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { /// Reconstruct a literal expression and convert it to a Value. fn reconstruct_literal(&mut self, mut input: Literal, _additional: &()) -> (Expression, Self::AdditionalOutput) { + if !self.propagate_constants { + return (input.into(), None); + } + let type_info = self.state.type_table.get(&input.id()); // If this is an optional, then unwrap it first. @@ -150,6 +161,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { let (left, lhs_opt_value) = self.reconstruct_expression(input.left, &()); let (right, rhs_opt_value) = self.reconstruct_expression(input.right, &()); + if !self.propagate_constants { + return (BinaryExpression { left, right, ..input }.into(), None); + } + // Full constant folding: both operands are known constants. if let (Some(lhs_value), Some(rhs_value)) = (&lhs_opt_value, &rhs_opt_value) { match const_eval::evaluate_binary( @@ -350,6 +365,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { let span = input.span; let (receiver, opt_value) = self.reconstruct_expression(input.receiver, &()); + if !self.propagate_constants { + return (UnaryExpression { receiver, ..input }.into(), None); + } + if let Some(value) = opt_value { // We were able to evaluate the operand, so we can evaluate the expression. match const_eval::evaluate_unary(span, input.op, &value, &self.state.type_table.get(&input_id)) { @@ -394,6 +413,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { let (if_true, if_true_value) = self.reconstruct_expression(input.if_true, &()); let (if_false, if_false_value) = self.reconstruct_expression(input.if_false, &()); + if !self.propagate_constants { + return (TernaryExpression { condition: cond, if_true, if_false, ..input }.into(), None); + } + match cond_value.and_then(|v| v.try_into().ok()) { Some(true) if expression_can_be_discarded(&if_false, self.state) => { self.changed = true; @@ -497,6 +520,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { let (array, array_opt) = self.reconstruct_expression(input.array, &()); let (index, index_opt) = self.reconstruct_expression(input.index, &()); + if !self.propagate_constants { + return (ArrayAccess { array, index, ..input }.into(), None); + } + if let Some(index_value) = index_opt && let Some(array_value) = array_opt { @@ -537,6 +564,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { self.changed = true; } + if !self.propagate_constants { + return (input.into(), None); + } + if values.len() == input.elements.len() { (input.into(), Some(Value::make_array(values.into_iter()))) } else { @@ -572,6 +603,10 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { self.changed = true; } + if !self.propagate_constants { + return (input.into(), None); + } + let opt_value = if values.len() == input.elements.len() { Some(Value::make_tuple(values)) } else { None }; (input.into(), opt_value) @@ -663,6 +698,12 @@ impl AstReconstructor for SsaConstPropagationVisitor<'_> { fn reconstruct_conditional(&mut self, conditional: ConditionalStatement) -> (Statement, Self::AdditionalOutput) { let (condition, condition_value) = self.reconstruct_expression(conditional.condition, &()); + if !self.propagate_constants { + let then = self.reconstruct_block(conditional.then).0; + let otherwise = conditional.otherwise.map(|s| Box::new(self.reconstruct_statement(*s).0)); + return (ConditionalStatement { condition, then, otherwise, ..conditional }.into(), None); + } + match condition_value.and_then(|v| v.try_into().ok()) { Some(true) => { self.changed = true; diff --git a/crates/passes/src/ssa_const_propagation/mod.rs b/crates/passes/src/ssa_const_propagation/mod.rs index 943a5e1577d..0d5399a6794 100644 --- a/crates/passes/src/ssa_const_propagation/mod.rs +++ b/crates/passes/src/ssa_const_propagation/mod.rs @@ -39,11 +39,12 @@ pub struct SsaConstPropagation; pub struct SsaConstPropagationInput { pub forward_direct_composites: bool, + pub propagate_constants: bool, } impl Default for SsaConstPropagationInput { fn default() -> Self { - Self { forward_direct_composites: true } + Self { forward_direct_composites: true, propagate_constants: true } } } @@ -64,6 +65,7 @@ impl Pass for SsaConstPropagation { atom_fielded_composites: Default::default(), aliases: Default::default(), forward_direct_composites: input.forward_direct_composites, + propagate_constants: input.propagate_constants, ternaries: Default::default(), changed: false, }; diff --git a/crates/passes/src/ssa_const_propagation/visitor.rs b/crates/passes/src/ssa_const_propagation/visitor.rs index 42720eda52b..13e9d77a53a 100644 --- a/crates/passes/src/ssa_const_propagation/visitor.rs +++ b/crates/passes/src/ssa_const_propagation/visitor.rs @@ -39,6 +39,8 @@ pub struct SsaConstPropagationVisitor<'a> { pub aliases: IndexMap, /// Whether direct `x.field` accesses can be forwarded, or only accesses through aliases. pub forward_direct_composites: bool, + /// Whether to perform the general constant and identity propagation rewrites. + pub propagate_constants: bool, /// Maps local variables bound to atom-only ternaries so later redundant /// ternaries over the same condition can be absorbed. pub ternaries: IndexMap, From 570fae9fd09cbdddf5c98c142f2ca75e07815f06 Mon Sep 17 00:00:00 2001 From: Kuhai9801 <165563006+Kuhai9801@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:51:49 +0800 Subject: [PATCH 64/65] Update generic struct forwarding expectations --- .../lib_submodule_generic_struct.out | 3 +- .../execution/generics_in_modules.out | 50 +++++++++---------- .../lib_submodule_generic_struct.out | 3 +- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/tests/expectations/compiler/libraries/lib_submodule_generic_struct.out b/tests/expectations/compiler/libraries/lib_submodule_generic_struct.out index 9fa506eef23..0d6a612fbb0 100644 --- a/tests/expectations/compiler/libraries/lib_submodule_generic_struct.out +++ b/tests/expectations/compiler/libraries/lib_submodule_generic_struct.out @@ -5,8 +5,7 @@ struct Buffer__81ZwGzLxqlH: function main: cast 7u32 7u32 7u32 into r0 as [u32; 3u32]; - cast r0 into r1 as Buffer__81ZwGzLxqlH; - output r1.data[0u32] as u32.private; + output r0[0u32] as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/generics_in_modules.out b/tests/expectations/execution/generics_in_modules.out index 73cca7ff8b0..a03d499ee7e 100644 --- a/tests/expectations/execution/generics_in_modules.out +++ b/tests/expectations/execution/generics_in_modules.out @@ -16,32 +16,30 @@ function main: cast 0u32 1u32 2u32 into r0 as [u32; 3u32]; cast 1u32 2u32 3u32 into r1 as [u32; 3u32]; cast r0 r1 into r2 as [[u32; 3u32]; 2u32]; - cast r2 into r3 as Matrix__1cjGkfvo5TZ; - cast r3.values[0u32][0u32] r3.values[0u32][1u32] r3.values[0u32][2u32] into r4 as [u32; 3u32]; - cast r3.values[1u32][0u32] r3.values[1u32][1u32] r3.values[1u32][2u32] into r5 as [u32; 3u32]; - cast r4 r5 into r6 as [[u32; 3u32]; 2u32]; - add r6[0u32][0u32] 1u32 into r7; - cast r7 r3.values[0u32][1u32] r3.values[0u32][2u32] into r8 as [u32; 3u32]; - cast r8 r5 into r9 as [[u32; 3u32]; 2u32]; - add r9[0u32][1u32] 1u32 into r10; - cast r7 r10 r3.values[0u32][2u32] into r11 as [u32; 3u32]; - cast r11 r5 into r12 as [[u32; 3u32]; 2u32]; - add r12[0u32][2u32] 1u32 into r13; - cast r7 r10 r13 into r14 as [u32; 3u32]; - cast r14 r5 into r15 as [[u32; 3u32]; 2u32]; - add r15[1u32][0u32] 1u32 into r16; - cast r16 r3.values[1u32][1u32] r3.values[1u32][2u32] into r17 as [u32; 3u32]; - cast r14 r17 into r18 as [[u32; 3u32]; 2u32]; - add r18[1u32][1u32] 1u32 into r19; - cast r16 r19 r3.values[1u32][2u32] into r20 as [u32; 3u32]; - cast r14 r20 into r21 as [[u32; 3u32]; 2u32]; - add r21[1u32][2u32] 1u32 into r22; - cast r16 r19 r22 into r23 as [u32; 3u32]; - cast r14 r23 into r24 as [[u32; 3u32]; 2u32]; - cast 0u32 10u32 20u32 30u32 into r25 as [u32; 4u32]; - cast r25 into r26 as InnerGeneric__JgC4Y0wyi7O; - add r24[0u32][1u32] r26.data[3u32] into r27; - output r27 as u32.private; + cast r2[0u32][0u32] r2[0u32][1u32] r2[0u32][2u32] into r3 as [u32; 3u32]; + cast r2[1u32][0u32] r2[1u32][1u32] r2[1u32][2u32] into r4 as [u32; 3u32]; + cast r3 r4 into r5 as [[u32; 3u32]; 2u32]; + add r5[0u32][0u32] 1u32 into r6; + cast r6 r2[0u32][1u32] r2[0u32][2u32] into r7 as [u32; 3u32]; + cast r7 r4 into r8 as [[u32; 3u32]; 2u32]; + add r8[0u32][1u32] 1u32 into r9; + cast r6 r9 r2[0u32][2u32] into r10 as [u32; 3u32]; + cast r10 r4 into r11 as [[u32; 3u32]; 2u32]; + add r11[0u32][2u32] 1u32 into r12; + cast r6 r9 r12 into r13 as [u32; 3u32]; + cast r13 r4 into r14 as [[u32; 3u32]; 2u32]; + add r14[1u32][0u32] 1u32 into r15; + cast r15 r2[1u32][1u32] r2[1u32][2u32] into r16 as [u32; 3u32]; + cast r13 r16 into r17 as [[u32; 3u32]; 2u32]; + add r17[1u32][1u32] 1u32 into r18; + cast r15 r18 r2[1u32][2u32] into r19 as [u32; 3u32]; + cast r13 r19 into r20 as [[u32; 3u32]; 2u32]; + add r20[1u32][2u32] 1u32 into r21; + cast r15 r18 r21 into r22 as [u32; 3u32]; + cast r13 r22 into r23 as [[u32; 3u32]; 2u32]; + cast 0u32 10u32 20u32 30u32 into r24 as [u32; 4u32]; + add r23[0u32][1u32] r24[3u32] into r25; + output r25 as u32.private; constructor: assert.eq edition 0u16; diff --git a/tests/expectations/execution/libraries/lib_submodule_generic_struct.out b/tests/expectations/execution/libraries/lib_submodule_generic_struct.out index b158c50c232..f9545af16b6 100644 --- a/tests/expectations/execution/libraries/lib_submodule_generic_struct.out +++ b/tests/expectations/execution/libraries/lib_submodule_generic_struct.out @@ -5,8 +5,7 @@ struct Buffer__81ZwGzLxqlH: function main: cast 7u32 7u32 7u32 into r0 as [u32; 3u32]; - cast r0 into r1 as Buffer__81ZwGzLxqlH; - output r1.data[0u32] as u32.private; + output r0[0u32] as u32.private; constructor: assert.eq edition 0u16; From dfae367dcc20e08f60e8a1996f39a05fd575508a Mon Sep 17 00:00:00 2001 From: "Cyne Jarvis J. Zarceno" Date: Mon, 29 Jun 2026 23:10:54 +0800 Subject: [PATCH 65/65] Update struct update nested expectation --- .../expectations/compiler/structs/struct_update_nested.out | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/expectations/compiler/structs/struct_update_nested.out b/tests/expectations/compiler/structs/struct_update_nested.out index bda5b28b390..c9db339e9d9 100644 --- a/tests/expectations/compiler/structs/struct_update_nested.out +++ b/tests/expectations/compiler/structs/struct_update_nested.out @@ -11,10 +11,9 @@ struct Outer: function main: input r0 as Outer.private; input r1 as u32.private; - cast r1 r0.inner.b into r2 as Inner; - add r2.a r2.b into r3; - add r3 r0.tag into r4; - output r4 as u32.private; + add r1 r0.inner.b into r2; + add r2 r0.tag into r3; + output r3 as u32.private; constructor: assert.eq edition 0u16;