diff --git a/Cargo.lock b/Cargo.lock
index 1abdfd4f66b..2cb298bd499 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -766,7 +766,7 @@ version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34"
dependencies = [
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -1457,7 +1457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -2164,7 +2164,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
dependencies = [
"hermit-abi",
"libc",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -2919,7 +2919,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -3318,7 +3318,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
- "windows-sys 0.60.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -3670,7 +3670,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -3729,7 +3729,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -4170,8 +4170,7 @@ dependencies = [
[[package]]
name = "snarkvm"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd43c5dc721398f60bd4e9f15cef51bb8b10ab5699443d2ae6e116bc9d569bdb"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"dotenvy",
@@ -4191,8 +4190,7 @@ dependencies = [
[[package]]
name = "snarkvm-algorithms"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71391e6d41b7c9e1e3e702f53a72ef8a8aa87e480576e4794fdc48a6ccf76e44"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -4219,8 +4217,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d265ef0f4603215dbb055fa8e0d4002aedf071eb3e817f78605ed0ac8d76b5c6"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-account",
"snarkvm-circuit-algorithms",
@@ -4234,8 +4231,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-account"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84d1b2bcebc71fbb181f36ce4e9dda131425a7d3124bb0899c6f5f8ede4de5f4"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-network",
"snarkvm-circuit-types",
@@ -4245,8 +4241,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-algorithms"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9b0ca6b622ca924812c282c4af1f5900c1582b392b08f9a0fab1ddea12032d2"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-types",
"snarkvm-console-algorithms",
@@ -4256,8 +4251,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-collections"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba683043b9a29c4ec902951ca038aee57b5baab1c873682b35fe44ced88d34ed"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-algorithms",
"snarkvm-circuit-types",
@@ -4267,8 +4261,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-environment"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92a5b2ee3698fb6f30ec418f42f2c76bc112f456c16be4f467972d2f6414bfae"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"indexmap",
@@ -4288,14 +4281,12 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-environment-witness"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54f9297db3916e80ab3d234b020489c466951790e49c02358a42b8c3d4e4efd4"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
[[package]]
name = "snarkvm-circuit-network"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2cfe787dfa985f9440023f2092655b8a3b7a39cc001d8f49e55316ff3bae813c"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-algorithms",
"snarkvm-circuit-collections",
@@ -4306,8 +4297,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-program"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c62e77c12f69e61cb51ca03d11c516b0f620566fb50d85d05aa0a9eb25da79c"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-account",
"snarkvm-circuit-algorithms",
@@ -4321,8 +4311,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1435b136e2c7b7343de81395dc3be6586e32e9b115df2185731198693d4ff864"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-address",
@@ -4337,8 +4326,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-address"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "073dcdefeba03189e1ccc1048f9ef4e193dcfae15265bb8ac99c10b490b16b7f"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@@ -4351,8 +4339,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-boolean"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e8a9923b0860feab7f4bc582b6d943c2b4657856cf2bbd9a771c2402437e456"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-console-types-boolean",
@@ -4361,8 +4348,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-field"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "677799ebe3769c916bab7bf8b1bfff39d344028ca6877dacc8398df201b72401"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@@ -4372,8 +4358,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-group"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53ef111c07dbba0b6b8ced0f8997bb83e7f26ea7f32ef985b18adcd490eb8d7c"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@@ -4385,8 +4370,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-integers"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffe4e31d4961333859313bd80f931a812df9a1486a9f9de68797be657ae0c47d"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@@ -4398,8 +4382,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-scalar"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a9596b7bc9d807ba2c8a12498968011c16c1cdd6056dcc15523112b1877da4c"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@@ -4410,8 +4393,7 @@ dependencies = [
[[package]]
name = "snarkvm-circuit-types-string"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fd0fbfa75b4fa7620644fd9d9f0eeb34bba10f50c1d6669fb0c29e1355d2d48"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean",
@@ -4423,8 +4405,7 @@ dependencies = [
[[package]]
name = "snarkvm-console"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f2c7135997bd289c4833ccea44b660f0eb4463e27bf6daf0af0b7c92e08cc17"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-account",
"snarkvm-console-algorithms",
@@ -4437,8 +4418,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-account"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9344d174c15d2897b5178e1245c8371e79efe033017ce95aac7897bf6f120a7"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"bs58",
"snarkvm-console-network",
@@ -4449,8 +4429,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-algorithms"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45e03658558fcd7d9a07c3ccabda3345f392c6eb49b4eb239321a902ea02f968"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"blake2s_simd",
"hex",
@@ -4466,8 +4445,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-collections"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50cb811b5cbc266602aab5087771788c955e883b8234f5cbf828ea9eba0af2ab"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"parking_lot",
@@ -4480,8 +4458,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-network"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30e140132e6c203a911d1eb540fa2449a50fd3fc01a989e715fcdc78a0d1dcb4"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"enum-iterator",
@@ -4501,8 +4478,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-network-environment"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d6d8a938b2ea5368a4e1bcbfbaf5406de4cf4776259ac404db31a0ad4469187"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"bech32",
@@ -4520,8 +4496,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-program"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09c83b58cddd528096528972e89e87bae93a96393e195e8f42efee42c1d01c46"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"enum-iterator",
"enum_index",
@@ -4542,8 +4517,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc3bfba455ea0d06fb30fb76f09e5a0cf2f561287efdc4fd13d2ae1f9a31373e"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-address",
@@ -4558,8 +4532,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-address"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8d7593a5a7be012670bd5f25951c58e33ab61660926f4b7a17151838f454291"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@@ -4570,8 +4543,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-boolean"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4effc5da9957abfeef3eb3c11990ec02172cb334cc525aafa71e16d1b8bb598"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
]
@@ -4579,8 +4551,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-field"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63a32ff8db10684a25cdba8868d667b3512612065b91606a8c323813116732d5"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@@ -4590,8 +4561,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-group"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00684faf1e2128e3168b6384a9cc910d61b4ea8c61a24f5e3cabdc11bffaf389"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@@ -4602,8 +4572,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-integers"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9d6695fae259623bad0cf3ef83f2ef631460dfc96ee4c4734ccc8fd51c9fe98"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@@ -4614,8 +4583,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-scalar"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d581ca16b44162d4d73b6abc99ad513c35f76e4e1a2fba9579af979ca86f3cc5"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@@ -4626,8 +4594,7 @@ dependencies = [
[[package]]
name = "snarkvm-console-types-string"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ce69dc5368ece183938f2e80e242176bb3b10981813f4a1207a351409fec214"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console-network-environment",
"snarkvm-console-types-boolean",
@@ -4638,8 +4605,7 @@ dependencies = [
[[package]]
name = "snarkvm-curves"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86429f2af060974ee91deb525daa86b7ce95c62d981ab32d0d7542fe998431d1"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"rand 0.10.1",
"rustc_version",
@@ -4652,8 +4618,7 @@ dependencies = [
[[package]]
name = "snarkvm-fields"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d03ad8f583bee8ac19e0648e9b327960748b780748fa7ab9b57de595d085f26"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -4670,11 +4635,11 @@ dependencies = [
[[package]]
name = "snarkvm-ledger"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcbd3ba89c54e84a74027255b2edfab7eb1044c7609c0e89edb06fa650545e07"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
+ "cfg-if",
"indexmap",
"lru",
"parking_lot",
@@ -4700,8 +4665,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-authority"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a10d21327b85caf5ec94d15a4848ddfdcbf0e8f050a7b8dc22446a5f7119a2c"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"rand 0.10.1",
@@ -4713,8 +4677,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-block"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16533468e48ce58b9bac93b83faa009ea3e8cde92694e1f74b1dec0dd1efca3d"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"indexmap",
@@ -4738,8 +4701,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-committee"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ff9aeb8757f15c7dd698265b6f2bdaab850f7737337a59d3c3589537bceac95"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"indexmap",
"rayon",
@@ -4751,8 +4713,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c4ae3bff93a459ab5a85db3ad12f394d643d28abf6e32cdd40274ceb1ba9eae"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-ledger-narwhal-batch-certificate",
"snarkvm-ledger-narwhal-batch-header",
@@ -4765,8 +4726,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-batch-certificate"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4806d55f70a9252bfa6eb1233fc4fac07e51d9208a08df0868a6d5799f900297"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"indexmap",
"rayon",
@@ -4779,8 +4739,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-batch-header"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66e8a4f3f0e81bfb3acc5db3eb00b367dcbb6a9aeda823813af1e7e96c1db6a2"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"indexmap",
"rayon",
@@ -4792,8 +4751,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-data"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2708ffd18723b9739ce2b30df8037d30b47f1c10f668f7f3979740a0c09f3f8"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"bytes",
"serde_json",
@@ -4804,8 +4762,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-subdag"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b73f616ff9e8b650f7f9707ffe1e9c6b1dd1d0acd9ff8614861ace3424421ab7"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"indexmap",
"rayon",
@@ -4820,8 +4777,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-transmission"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f6afce387ff6055a01ff3218f8b22f471e2f9c5fcbe633820b676c6196216bc"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"bytes",
"serde_json",
@@ -4834,8 +4790,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-narwhal-transmission-id"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "860101cbe832fb5246f062c0aacc4c2117bf51cbc2787783c08ff120d39fcf7f"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"snarkvm-console",
"snarkvm-ledger-puzzle",
@@ -4844,8 +4799,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-puzzle"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0baaeefec2b0fc7df7afffc9644dd343d028fe1c94874382ce7448231c9fa88"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -4865,8 +4819,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-puzzle-epoch"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55f7f30fbb625063d36575505c01563b27dbe7237369ce487b0a6ab8e655b599"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -4888,8 +4841,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-query"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d63f5f02b2ed55802aa7bd753f06093817dca26ce9add6335a7d6d4beb9b9039"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"async-trait",
@@ -4906,8 +4858,7 @@ dependencies = [
[[package]]
name = "snarkvm-ledger-store"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34f83232d79e9ece01d84c571e9b6ea7e6dbd4217853ec7d4e6bd6be621a1ce5"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std-storage",
"anyhow",
@@ -4934,8 +4885,7 @@ dependencies = [
[[package]]
name = "snarkvm-parameters"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6953e5b2092ebd763ff3406b50976565ccf8e6768b6956dcb9e9cae65dcb79"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -4960,8 +4910,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db919cb726fdef30913f758ddd14dc8fc9881bfaf00ed2c1edc9d71794091232"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -4995,8 +4944,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-error"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1105ae1de382800f35a25eb8f625cdc228668eb46877a9f513a15f61435e9a2a"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"anyhow",
"snarkvm-circuit-environment",
@@ -5008,8 +4956,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-process"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4660400b8f689f4ecb166fc6d33cf2c9050249e2e8b6a68cef74bf6277ee261b"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"colored 3.1.1",
@@ -5035,8 +4982,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-program"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "508e4f3e0275ad282c21f3b8a126639ebe7446bbb44f271d38197f431733c466"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"enum-iterator",
"indexmap",
@@ -5057,8 +5003,7 @@ dependencies = [
[[package]]
name = "snarkvm-synthesizer-snark"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdaa14705a5077479175389272f5681b6e258c0e5c0f41aa670c3b544d02d2f5"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"bincode",
"serde_json",
@@ -5071,8 +5016,7 @@ dependencies = [
[[package]]
name = "snarkvm-utilities"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7a8f158c1c74f748262e24e5c5835d6144ac8487f05fb67edede4366d1be93d"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"aleo-std",
"anyhow",
@@ -5095,8 +5039,7 @@ dependencies = [
[[package]]
name = "snarkvm-utilities-derives"
version = "4.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b004c0e85a52c4ced0a6880e9715d966bdc4d4cd722bf2ddaac99134eb1a9c2b"
+source = "git+https://github.com/ProvableHQ/snarkVM?branch=mohammadfawaz%2Fcomplex_ternary#7e3e71e3891dac06497a956378292e0d05975802"
dependencies = [
"proc-macro2",
"quote 1.0.45",
@@ -5280,7 +5223,7 @@ dependencies = [
"getrandom 0.4.2",
"once_cell",
"rustix",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -6038,7 +5981,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -6123,7 +6066,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-targets 0.52.6",
+ "windows-targets",
]
[[package]]
@@ -6132,16 +6075,7 @@ version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
- "windows-targets 0.52.6",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.60.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
-dependencies = [
- "windows-targets 0.53.5",
+ "windows-targets",
]
[[package]]
@@ -6159,31 +6093,14 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
- "windows_aarch64_gnullvm 0.52.6",
- "windows_aarch64_msvc 0.52.6",
- "windows_i686_gnu 0.52.6",
- "windows_i686_gnullvm 0.52.6",
- "windows_i686_msvc 0.52.6",
- "windows_x86_64_gnu 0.52.6",
- "windows_x86_64_gnullvm 0.52.6",
- "windows_x86_64_msvc 0.52.6",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.53.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
-dependencies = [
- "windows-link",
- "windows_aarch64_gnullvm 0.53.1",
- "windows_aarch64_msvc 0.53.1",
- "windows_i686_gnu 0.53.1",
- "windows_i686_gnullvm 0.53.1",
- "windows_i686_msvc 0.53.1",
- "windows_x86_64_gnu 0.53.1",
- "windows_x86_64_gnullvm 0.53.1",
- "windows_x86_64_msvc 0.53.1",
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
]
[[package]]
@@ -6192,96 +6109,48 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
-
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
-
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
-[[package]]
-name = "windows_i686_gnu"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
-
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
-[[package]]
-name = "windows_i686_gnullvm"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
-
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
-[[package]]
-name = "windows_i686_msvc"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
-
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
-
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
-
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
-
[[package]]
name = "wit-bindgen"
version = "0.51.0"
diff --git a/Cargo.toml b/Cargo.toml
index 4e437afb22b..7cab2bc74bd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,14 +69,15 @@ serial_test = "3.1"
sha2 = "0.11"
similar = "3.1"
# We enable "test_consensus_heights" to give developers freedom to set custom consensus version upgrade heights and "test_targets" because the devnode's genesis block was created with the same feature flag.
-# Uses the published `4.7.1` release, which ships V15 `view fn` support (snarkVM PRs #3238, #3257, #3253).
+# Pinned to the `mohammadfawaz/complex_ternary` branch (snarkVM PR #3222), rebased on staging so it
+# ships V15 `view fn` support (snarkVM PRs #3238, #3257, #3253) alongside the aggregate `ternary` opcodes.
# `history` is required to compile `Process::evaluate_view_with_history`, the public-facing view entry point.
-snarkvm = { version = "4.7.1", features = [ "test_consensus_heights", "dev_skip_checks", "test_targets", "history" ] }
-# Wasm-friendly snarkVM subsets pinned at the same version as the umbrella crate; used by
+snarkvm = { git = "https://github.com/ProvableHQ/snarkVM", branch = "mohammadfawaz/complex_ternary", features = [ "test_consensus_heights", "dev_skip_checks", "test_targets", "history" ] }
+# Wasm-friendly snarkVM subsets pinned at the same branch as the umbrella crate; used by
# `leo-ast` and `leo-disassembler` on `wasm32-unknown-unknown` where the full `snarkvm`
# crate pulls in native-only ledger/package code.
-snarkvm-console = { version = "4.7.1", default-features = false, features = [ "account", "program", "types", "dev_skip_checks", "test_consensus_heights", "test_targets", "wasm" ] }
-snarkvm-synthesizer-program = { version = "4.7.1", features = [ "wasm" ] }
+snarkvm-console = { git = "https://github.com/ProvableHQ/snarkVM", branch = "mohammadfawaz/complex_ternary", default-features = false, features = [ "account", "program", "types", "dev_skip_checks", "test_consensus_heights", "test_targets", "wasm" ] }
+snarkvm-synthesizer-program = { git = "https://github.com/ProvableHQ/snarkVM", branch = "mohammadfawaz/complex_ternary", features = [ "wasm" ] }
sys-info = "0.9"
tempfile = "3.20"
thiserror = "2.0"
diff --git a/crates/passes/src/flattening/ast.rs b/crates/passes/src/flattening/ast.rs
index 865d5c40fc4..549c97fa621 100644
--- a/crates/passes/src/flattening/ast.rs
+++ b/crates/passes/src/flattening/ast.rs
@@ -52,21 +52,17 @@ impl AstReconstructor for FlatteningVisitor<'_> {
(CompositeExpression { members, ..input }.into(), statements)
}
- /// Reconstructs ternary expressions over arrays, composites, and tuples, accumulating any statements that are generated.
- /// This is necessary because Aleo instructions does not support ternary expressions over composite data types.
- /// For example, the ternary expression `cond ? (a, b) : (c, d)` is flattened into the following:
+ /// Reconstructs ternary expressions. Tuple operands are destructured element-wise and record
+ /// operands are destructured field-wise, since the Aleo `ternary` instruction only accepts
+ /// plaintext operands. Ternaries over literal, array, and plaintext struct types are left
+ /// intact; `ConsensusVersion::V15` accepts these as direct operands (snarkVM PR #3222).
+ ///
+ /// Example: `cond ? (a, b) : (c, d)` flattens to:
/// ```leo
/// let var$0 = cond ? a : c;
/// let var$1 = cond ? b : d;
/// (var$0, var$1)
/// ```
- /// For composites, the ternary expression `cond ? a : b`, where `a` and `b` are both composites `Foo { bar: u8, baz: u8 }`, is flattened into the following:
- /// ```leo
- /// let var$0 = cond ? a.bar : b.bar;
- /// let var$1 = cond ? a.baz : b.baz;
- /// let var$2 = Foo { bar: var$0, baz: var$1 };
- /// var$2
- /// ```
fn reconstruct_ternary(
&mut self,
input: TernaryExpression,
@@ -94,39 +90,32 @@ impl AstReconstructor for FlatteningVisitor<'_> {
}
match &if_true_type {
- Type::Array(if_true_type) => self.ternary_array(
- if_true_type,
- &input.condition,
- &as_identifier(input.if_true),
- &as_identifier(input.if_false),
- ),
- Type::Composite(if_true_type) => {
- let composite_location = if_true_type.path.expect_global_location();
- // Get the composite definitions.
- let composite_path = if_true_type.path.clone();
- let if_true_type = self
- .state
- .symbol_table
- .lookup_struct(self.program, composite_location)
- .or_else(|| self.state.symbol_table.lookup_record(self.program, composite_location))
- .expect("This definition should exist")
- .clone();
-
- self.ternary_composite(
- &composite_path,
- &if_true_type,
- &input.condition,
- &as_identifier(input.if_true),
- &as_identifier(input.if_false),
- )
- }
Type::Tuple(if_true_type) => {
self.ternary_tuple(if_true_type, &input.condition, &input.if_true, &input.if_false)
}
+ Type::Composite(composite_type) => {
+ // The Aleo `ternary` instruction accepts plaintext structs but not records, so we
+ // destructure record ternaries field-wise and leave struct ternaries intact.
+ let composite_location = composite_type.path.expect_global_location();
+ if let Some(record) = self.state.symbol_table.lookup_record(self.program, composite_location) {
+ let composite_path = composite_type.path.clone();
+ let record = record.clone();
+ self.ternary_composite(
+ &composite_path,
+ &record,
+ &input.condition,
+ &as_identifier(input.if_true),
+ &as_identifier(input.if_false),
+ )
+ } else {
+ assert!(matches!(&input.if_true, Expression::Path(..)));
+ assert!(matches!(&input.if_false, Expression::Path(..)));
+
+ (input.into(), Default::default())
+ }
+ }
_ => {
- // There's nothing to be done - SSA has guaranteed that `if_true` and `if_false` are identifiers,
- // so there's not even any point in reconstructing them.
-
+ // SSA guarantees both branches are identifiers, so nothing else needs rewriting.
assert!(matches!(&input.if_true, Expression::Path(..)));
assert!(matches!(&input.if_false, Expression::Path(..)));
diff --git a/crates/passes/src/flattening/mod.rs b/crates/passes/src/flattening/mod.rs
index a433697e865..87512ec6fd1 100644
--- a/crates/passes/src/flattening/mod.rs
+++ b/crates/passes/src/flattening/mod.rs
@@ -15,10 +15,22 @@
// along with the Leo library. If not, see .
//! The flattening pass traverses the AST after the SSA pass and converts into a sequential code.
-//! The pass flattens `ConditionalStatement`s into a sequence of `AssignStatement`s.
-//! The pass rewrites `ReturnStatement`s into `AssignStatement`s and consolidates the returned values as a single `ReturnStatement` at the end of the function.
-//! The pass rewrites ternary expressions over composite data types, into ternary expressions over the individual fields of the composite data type, followed by an expression constructing the composite data type.
-//! Note that this transformation is not applied to async functions.
+//!
+//! In transition (offchain) functions the pass:
+//! - Flattens `ConditionalStatement`s into a sequence of `AssignStatement`s guarded by ternaries.
+//! - Rewrites `ReturnStatement`s into `AssignStatement`s and consolidates the returned values into
+//! a single `ReturnStatement` at the end of the function.
+//! - Guards asserts with the active path condition and any early-return guard.
+//!
+//! In finalize (onchain) functions the pass preserves `ConditionalStatement`s, `ReturnStatement`s,
+//! and `AssertStatement`s verbatim, since finalize code can use Aleo branch instructions directly.
+//!
+//! In both contexts the pass rewrites ternary expressions whose branches are tuples into
+//! per-element ternary expressions and ternaries over records into per-field ternaries followed
+//! by a composite init, since the Aleo `ternary` instruction only accepts plaintext operands.
+//! Ternaries over literal, array, and plaintext struct types are left intact;
+//! `ConsensusVersion::V15` accepts these as direct operands of the `ternary` instruction
+//! (snarkVM PR #3222).
//!
//! Consider the following Leo code, output by the SSA pass.
//! ```leo
diff --git a/crates/passes/src/flattening/visitor.rs b/crates/passes/src/flattening/visitor.rs
index d6b6354d86f..8b25a56e696 100644
--- a/crates/passes/src/flattening/visitor.rs
+++ b/crates/passes/src/flattening/visitor.rs
@@ -17,9 +17,6 @@
use crate::CompilerState;
use leo_ast::{
- ArrayAccess,
- ArrayExpression,
- ArrayType,
AstReconstructor,
BinaryExpression,
BinaryOperation,
@@ -30,7 +27,6 @@ use leo_ast::{
CompositeType,
Expression,
Identifier,
- IntegerType,
Literal,
Member,
MemberAccess,
@@ -364,95 +360,7 @@ impl FlatteningVisitor<'_> {
}
}
- // For use in `ternary_array`.
- fn make_array_access_definition(
- &mut self,
- i: usize,
- identifier: Identifier,
- array_type: &ArrayType,
- ) -> (Identifier, Statement) {
- let index =
- Literal::integer(IntegerType::U32, i.to_string(), Default::default(), self.state.node_builder.next_id());
- self.state.type_table.insert(index.id(), Type::Integer(IntegerType::U32));
- let access: Expression = ArrayAccess {
- array: Path::from(identifier).to_local().into(),
- index: index.into(),
- span: Default::default(),
- id: self.state.node_builder.next_id(),
- }
- .into();
- self.state.type_table.insert(access.id(), array_type.element_type().clone());
- self.unique_simple_definition(access)
- }
-
- pub fn ternary_array(
- &mut self,
- array: &ArrayType,
- condition: &Expression,
- first: &Identifier,
- second: &Identifier,
- ) -> (Expression, Vec) {
- // Initialize a vector to accumulate any statements generated.
- let mut statements = Vec::new();
- // For each array element, construct a new ternary expression.
- let elements = (0..array.length.as_u32().expect("length should be known at this point") as usize)
- .map(|i| {
- // Create an assignment statement for the first access expression.
- let (first, stmt) = self.make_array_access_definition(i, *first, array);
- statements.push(stmt);
- // Create an assignment statement for the second access expression.
- let (second, stmt) = self.make_array_access_definition(i, *second, array);
- statements.push(stmt);
-
- // Recursively reconstruct the ternary expression.
- let ternary = TernaryExpression {
- condition: condition.clone(),
- // Access the member of the first expression.
- if_true: Path::from(first).to_local().into(),
- // Access the member of the second expression.
- if_false: Path::from(second).to_local().into(),
- span: Default::default(),
- id: self.state.node_builder.next_id(),
- };
- self.state.type_table.insert(ternary.id(), array.element_type().clone());
-
- let (expression, stmts) = self.reconstruct_ternary(ternary, &());
-
- // Accumulate any statements generated.
- statements.extend(stmts);
-
- expression
- })
- .collect();
-
- // Construct the array expression.
- let (expr, stmts) = self.reconstruct_array(
- ArrayExpression {
- elements,
- span: Default::default(),
- id: {
- // Create a node ID for the array expression.
- let id = self.state.node_builder.next_id();
- // Set the type of the node ID.
- self.state.type_table.insert(id, Type::Array(array.clone()));
- id
- },
- },
- &(),
- );
-
- // Accumulate any statements generated.
- statements.extend(stmts);
-
- // Create a new assignment statement for the array expression.
- let (identifier, statement) = self.unique_simple_definition(expr);
-
- statements.push(statement);
-
- (Path::from(identifier).to_local().into(), statements)
- }
-
- // For use in `ternary_composite`.
+ /// Construct an access expression `inner.name` bound to a fresh identifier.
fn make_composite_access_definition(
&mut self,
inner: Identifier,
@@ -470,6 +378,9 @@ impl FlatteningVisitor<'_> {
self.unique_simple_definition(expr)
}
+ /// Destructure a ternary over a composite (record) type into per-field ternaries followed by a
+ /// composite init. This is only used for records — plaintext structs are passed to the Aleo
+ /// `ternary` instruction directly.
pub fn ternary_composite(
&mut self,
composite_path: &Path,
@@ -478,9 +389,7 @@ impl FlatteningVisitor<'_> {
first: &Identifier,
second: &Identifier,
) -> (Expression, Vec) {
- // Initialize a vector to accumulate any statements generated.
let mut statements = Vec::new();
- // For each composite member, construct a new ternary expression.
let members = composite
.members
.iter()
@@ -489,7 +398,6 @@ impl FlatteningVisitor<'_> {
statements.push(stmt);
let (second, stmt) = self.make_composite_access_definition(*second, *identifier, type_.clone());
statements.push(stmt);
- // Recursively reconstruct the ternary expression.
let ternary = TernaryExpression {
condition: condition.clone(),
if_true: Path::from(first).to_local().into(),
@@ -499,8 +407,6 @@ impl FlatteningVisitor<'_> {
};
self.state.type_table.insert(ternary.id(), type_.clone());
let (expression, stmts) = self.reconstruct_ternary(ternary, &());
-
- // Accumulate any statements generated.
statements.extend(stmts);
CompositeFieldInitializer {
@@ -515,19 +421,14 @@ impl FlatteningVisitor<'_> {
let (expr, stmts) = self.reconstruct_composite_init(
CompositeExpression {
path: composite_path.clone(),
- const_arguments: Vec::new(), // All const arguments should have been resolved by now
+ const_arguments: Vec::new(),
members,
span: Default::default(),
id: {
- // Create a new node ID for the comopsite expression.
let id = self.state.node_builder.next_id();
- // Set the type of the node ID.
self.state.type_table.insert(
id,
- Type::Composite(CompositeType {
- path: composite_path.clone(),
- const_arguments: Vec::new(), // all const generics should have been resolved by now
- }),
+ Type::Composite(CompositeType { path: composite_path.clone(), const_arguments: Vec::new() }),
);
id
},
@@ -535,12 +436,9 @@ impl FlatteningVisitor<'_> {
&(),
);
- // Accumulate any statements generated.
statements.extend(stmts);
- // Create a new assignment statement for the composite expression.
let (identifier, statement) = self.unique_simple_definition(expr);
-
statements.push(statement);
(Path::from(identifier).to_local().into(), statements)
diff --git a/tests/expectations/compiler/array/array_write.out b/tests/expectations/compiler/array/array_write.out
index f419a0a9be6..2af91f74057 100644
--- a/tests/expectations/compiler/array/array_write.out
+++ b/tests/expectations/compiler/array/array_write.out
@@ -53,12 +53,11 @@ function with_tuples:
function in_conditional:
input r0 as T.private;
input r1 as boolean.private;
- ternary r1 1u8 r0.x into r2;
- ternary r1 r0.z.x 2u8 into r3;
- ternary r1 r0.z.y 3u32 into r4;
- cast r3 r4 into r5 as S;
- cast r2 r0.y r5 into r6 as T;
- output r6 as T.private;
+ cast 2u8 3u32 into r2 as S;
+ ternary r1 1u8 r0.x into r3;
+ ternary r1 r0.z r2 into r4;
+ cast r3 r0.y r4 into r5 as T;
+ output r5 as T.private;
function f_record:
async f_record into r0;
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..d35069c5981 100644
--- a/tests/expectations/compiler/cei/blind_storage_read_in_helper.out
+++ b/tests/expectations/compiler/cei/blind_storage_read_in_helper.out
@@ -51,10 +51,11 @@ finalize do_work:
await r0;
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];
+ cast true r2 into r3 as Optional__JzunLORyB8U;
+ cast false 0u32 into r4 as Optional__JzunLORyB8U;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u32 into r6;
+ set r6 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..f78270ab281 100644
--- a/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out
+++ b/tests/expectations/compiler/cei/class2_storage_stale_read_warn.out
@@ -47,12 +47,13 @@ finalize do_work:
input r1 as u32.public;
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;
+ cast true r3 into r4 as Optional__JzunLORyB8U;
+ cast false 0u32 into r5 as Optional__JzunLORyB8U;
+ ternary r2 r4 r5 into r6;
+ ternary r6.is_some r6.val 0u32 into r7;
await r0;
- add r6 r1 into r7;
- set r7 into counter__[false];
+ add r7 r1 into r8;
+ set r8 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..f69f63445e7 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
@@ -33,11 +33,12 @@ function bump:
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];
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u32 into r5;
+ add r5 1u32 into r6;
+ set r6 into dep_counter__[false];
constructor:
assert.eq edition 0u16;
@@ -63,10 +64,11 @@ finalize do_work:
await r0;
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];
+ cast true r2 into r3 as Optional__JzunLORyB8U;
+ cast false 0u32 into r4 as Optional__JzunLORyB8U;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u32 into r6;
+ set r6 into my_counter__[false];
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/compiler/examples/tictactoe.out b/tests/expectations/compiler/examples/tictactoe.out
index f1505ab85fd..1fe2e2b2f9a 100644
--- a/tests/expectations/compiler/examples/tictactoe.out
+++ b/tests/expectations/compiler/examples/tictactoe.out
@@ -149,33 +149,9 @@ 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 r71 r71 into r76;
+ ternary r75 2u8 0u8 into r77;
+ ternary r72 r71 r76 into r78;
+ ternary r72 1u8 r77 into r79;
+ output r78 as Board.private;
+ output r79 as u8.private;
diff --git a/tests/expectations/compiler/expression/cast_coersion.out b/tests/expectations/compiler/expression/cast_coersion.out
index 530160a0a01..4678207894d 100644
--- a/tests/expectations/compiler/expression/cast_coersion.out
+++ b/tests/expectations/compiler/expression/cast_coersion.out
@@ -12,9 +12,7 @@ function main:
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;
+ ternary r0 r4 r4 into r8;
+ ternary r0 r5 r7 into r9;
+ output r8 as foo.private;
output r9 as foo.private;
- output r11 as foo.private;
diff --git a/tests/expectations/compiler/function/flatten_arrays.out b/tests/expectations/compiler/function/flatten_arrays.out
index 3e74af1f268..1bf8b5db13a 100644
--- a/tests/expectations/compiler/function/flatten_arrays.out
+++ b/tests/expectations/compiler/function/flatten_arrays.out
@@ -17,16 +17,8 @@ closure foo:
cast r8 r9 into r10 as [u8; 2u32];
cast r10 into r11 as Data;
cast r5 r11 into r12 as [Data; 2u32];
- ternary r6 r7[0u32].data[0u32] r12[0u32].data[0u32] into r13;
- ternary r6 r7[0u32].data[1u32] r12[0u32].data[1u32] into r14;
- cast r13 r14 into r15 as [u8; 2u32];
- cast r15 into r16 as Data;
- ternary r6 r7[1u32].data[0u32] r12[1u32].data[0u32] into r17;
- ternary r6 r7[1u32].data[1u32] r12[1u32].data[1u32] into r18;
- cast r17 r18 into r19 as [u8; 2u32];
- cast r19 into r20 as Data;
- cast r16 r20 into r21 as [Data; 2u32];
- output r21 as [Data; 2u32];
+ ternary r6 r7 r12 into r13;
+ output r13 as [Data; 2u32];
function bar:
input r0 as boolean.private;
@@ -37,22 +29,6 @@ function bar:
call foo r4[0u32].data[0u32] r4[1u32].data[1u32] into r5;
call foo r4[1u32].data[0u32] r4[0u32].data[1u32] into r6;
call foo r4[0u32].data[1u32] r4[1u32].data[0u32] into r7;
- ternary r1 r6[0u32].data[0u32] r7[0u32].data[0u32] into r8;
- ternary r1 r6[0u32].data[1u32] r7[0u32].data[1u32] into r9;
- cast r8 r9 into r10 as [u8; 2u32];
- cast r10 into r11 as Data;
- ternary r1 r6[1u32].data[0u32] r7[1u32].data[0u32] into r12;
- ternary r1 r6[1u32].data[1u32] r7[1u32].data[1u32] into r13;
- cast r12 r13 into r14 as [u8; 2u32];
- cast r14 into r15 as Data;
- cast r11 r15 into r16 as [Data; 2u32];
- ternary r0 r5[0u32].data[0u32] r16[0u32].data[0u32] into r17;
- ternary r0 r5[0u32].data[1u32] r16[0u32].data[1u32] into r18;
- cast r17 r18 into r19 as [u8; 2u32];
- cast r19 into r20 as Data;
- ternary r0 r5[1u32].data[0u32] r16[1u32].data[0u32] into r21;
- ternary r0 r5[1u32].data[1u32] r16[1u32].data[1u32] into r22;
- cast r21 r22 into r23 as [u8; 2u32];
- cast r23 into r24 as Data;
- cast r20 r24 into r25 as [Data; 2u32];
- output r25 as [Data; 2u32].private;
+ ternary r1 r6 r7 into r8;
+ ternary r0 r5 r8 into r9;
+ output r9 as [Data; 2u32].private;
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 ca0f1e2e88d..c54d6d8eebe 100644
--- a/tests/expectations/compiler/function/flatten_inlined_tuples_of_structs.out
+++ b/tests/expectations/compiler/function/flatten_inlined_tuples_of_structs.out
@@ -16,16 +16,12 @@ closure foo:
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;
+ ternary r4 r0 r5 into r7;
+ ternary r4 r1 r6 into r8;
+ ternary r4 r3 r3 into r9;
+ output r7 as u8;
+ output r8 as u8;
+ output r9 as Data;
function bar:
input r0 as boolean.private;
@@ -38,18 +34,10 @@ function bar:
call foo r6.a r5 into r13 r14 r15;
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 r15 into r18;
+ ternary r0 r7 r16 into r19;
+ ternary r0 r8 r17 into r20;
+ ternary r0 r9 r18 into r21;
+ output r19 as u8.private;
+ output r20 as u8.private;
+ output r21 as Data.private;
diff --git a/tests/expectations/compiler/function/flatten_test.out b/tests/expectations/compiler/function/flatten_test.out
index 0fa5eeed10e..43ad235b59a 100644
--- a/tests/expectations/compiler/function/flatten_test.out
+++ b/tests/expectations/compiler/function/flatten_test.out
@@ -73,190 +73,67 @@ function main:
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;
- 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;
+ cast r9 r3.r2 r3.r3 into r10 as Board;
+ is.eq r2 2u8 into r11;
+ and r4 r11 into r12;
+ is.eq r3.r1.e2 0u8 into r13;
+ and r12 r13 into r14;
+ cast r3.r1.e1 r0 r3.r1.e3 into r15 as Row;
+ cast r15 r3.r2 r3.r3 into r16 as Board;
+ is.eq r2 3u8 into r17;
+ and r4 r17 into r18;
+ is.eq r3.r1.e3 0u8 into r19;
+ and r18 r19 into r20;
+ cast r3.r1.e1 r3.r1.e2 r0 into r21 as Row;
+ cast r21 r3.r2 r3.r3 into r22 as Board;
+ is.eq r1 2u8 into r23;
+ and r23 r5 into r24;
+ is.eq r3.r2.e1 0u8 into r25;
+ and r24 r25 into r26;
+ cast r0 r3.r2.e2 r3.r2.e3 into r27 as Row;
+ cast r3.r1 r27 r3.r3 into r28 as Board;
+ and r23 r11 into r29;
+ is.eq r3.r2.e2 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;
+ cast r3.r2.e1 r0 r3.r2.e3 into r32 as Row;
+ cast r3.r1 r32 r3.r3 into r33 as Board;
+ and r23 r17 into r34;
+ is.eq r3.r2.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;
+ cast r3.r2.e1 r3.r2.e2 r0 into r37 as Row;
+ cast r3.r1 r37 r3.r3 into r38 as Board;
+ is.eq r1 3u8 into r39;
+ and r39 r5 into r40;
+ is.eq r3.r3.e1 0u8 into r41;
+ and r40 r41 into r42;
+ cast r0 r3.r3.e2 r3.r3.e3 into r43 as Row;
+ cast r3.r1 r3.r2 r43 into r44 as Board;
+ and r39 r11 into r45;
+ is.eq r3.r3.e2 0u8 into r46;
+ and r45 r46 into r47;
+ cast r3.r3.e1 r0 r3.r3.e3 into r48 as Row;
+ cast r3.r1 r3.r2 r48 into r49 as Board;
+ and r39 r17 into r50;
+ is.eq r3.r3.e3 0u8 into r51;
+ and r50 r51 into r52;
+ cast r3.r3.e1 r3.r3.e2 r0 into r53 as Row;
+ cast r3.r1 r3.r2 r53 into r54 as Board;
+ ternary r52 r54 r3 into r55;
+ ternary r47 r49 r55 into r56;
+ ternary r42 r44 r56 into r57;
+ ternary r36 r38 r57 into r58;
+ ternary r31 r33 r58 into r59;
+ ternary r26 r28 r59 into r60;
+ ternary r20 r22 r60 into r61;
+ ternary r14 r16 r61 into r62;
+ ternary r8 r10 r62 into r63;
+ call win r63 1u8 into r64;
+ not r64 into r65;
+ call win r63 2u8 into r66;
+ and r65 r66 into r67;
+ ternary r67 r63 r63 into r68;
+ ternary r67 2u8 0u8 into r69;
+ ternary r64 r63 r68 into r70;
+ ternary r64 1u8 r69 into r71;
+ output r70 as Board.private;
+ output r71 as u8.private;
diff --git a/tests/expectations/compiler/function/flatten_tuples_of_structs.out b/tests/expectations/compiler/function/flatten_tuples_of_structs.out
index ca0f1e2e88d..c54d6d8eebe 100644
--- a/tests/expectations/compiler/function/flatten_tuples_of_structs.out
+++ b/tests/expectations/compiler/function/flatten_tuples_of_structs.out
@@ -16,16 +16,12 @@ closure foo:
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;
+ ternary r4 r0 r5 into r7;
+ ternary r4 r1 r6 into r8;
+ ternary r4 r3 r3 into r9;
+ output r7 as u8;
+ output r8 as u8;
+ output r9 as Data;
function bar:
input r0 as boolean.private;
@@ -38,18 +34,10 @@ function bar:
call foo r6.a r5 into r13 r14 r15;
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 r15 into r18;
+ ternary r0 r7 r16 into r19;
+ ternary r0 r8 r17 into r20;
+ ternary r0 r9 r18 into r21;
+ output r19 as u8.private;
+ output r20 as u8.private;
+ output r21 as Data.private;
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..f5ae6f57994 100644
--- a/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out
+++ b/tests/expectations/compiler/libraries/aleo_stub_struct_in_storage.out
@@ -17,13 +17,12 @@ 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;
- cast r0 r6 into r7 as Optional__99uEaDA8ual;
- assert.eq r7.is_some true;
- assert.eq r7.val.x r7.val.x;
+ cast true r2 into r3 as Optional__99uEaDA8ual;
+ cast 0u32 0u32 into r4 as base.aleo/Data;
+ cast false r4 into r5 as Optional__99uEaDA8ual;
+ ternary r0 r3 r5 into r6;
+ assert.eq r6.is_some true;
+ assert.eq r6.val.x r6.val.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..64854f21082 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,18 +29,14 @@ 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;
- 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;
+ cast true r4 into r5 as Optional__9frvj8law46;
+ cast 0u32 into r6 as Atom__Dnr7ZcA2EXI;
+ cast r6 0u32 into r7 as Core__6z1xuJtF5OT;
+ cast r7 0u32 into r8 as Capsule__CKJ9uYgKLhI;
+ cast false r8 into r9 as Optional__9frvj8law46;
+ ternary r0 r5 r9 into r10;
+ assert.eq r10.is_some true;
+ assert.eq r10.val.c.a.n r10.val.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..3f2fa4e51bb 100644
--- a/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out
+++ b/tests/expectations/compiler/libraries/leo_stub_struct_in_storage.out
@@ -32,13 +32,12 @@ 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;
- cast r0 r6 into r7 as Optional__99uEaDA8ual;
- assert.eq r7.is_some true;
- assert.eq r7.val.x r7.val.x;
+ cast true r2 into r3 as Optional__99uEaDA8ual;
+ cast 0u32 0u32 into r4 as base.aleo/Data;
+ cast false r4 into r5 as Optional__99uEaDA8ual;
+ ternary r0 r3 r5 into r6;
+ assert.eq r6.is_some true;
+ assert.eq r6.val.x r6.val.x;
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..b99af697fcd 100644
--- a/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out
+++ b/tests/expectations/compiler/libraries/lib_nested_struct_in_storage.out
@@ -26,17 +26,13 @@ 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;
- 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;
+ cast true r3 into r4 as Optional__93SfMrvy3aW;
+ cast 0u32 0u32 into r5 as Point__7VbTm7beYPk;
+ cast r5 0u32 0u32 into r6 as Rect__2UBYikAziAq;
+ cast false r6 into r7 as Optional__93SfMrvy3aW;
+ ternary r0 r4 r7 into r8;
+ assert.eq r8.is_some true;
+ assert.eq r8.val.top_left.x r8.val.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..82ce164c2ab 100644
--- a/tests/expectations/compiler/libraries/lib_struct_in_storage.out
+++ b/tests/expectations/compiler/libraries/lib_struct_in_storage.out
@@ -23,16 +23,12 @@ 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;
- cast r0 r9 into r10 as Optional__An66AtVsP75;
- assert.eq r10.is_some true;
- assert.eq r10.val.decimals 8u8;
+ cast true r2 into r3 as Optional__An66AtVsP75;
+ cast 0u128 0u128 0u8 0u128 0u128 into r4 as TokenInfo__CxbbwT70PGX;
+ cast false r4 into r5 as Optional__An66AtVsP75;
+ ternary r0 r3 r5 into r6;
+ assert.eq r6.is_some true;
+ assert.eq r6.val.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..86350aaf017 100644
--- a/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out
+++ b/tests/expectations/compiler/libraries/lib_struct_optional_local_binding.out
@@ -12,10 +12,9 @@ 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;
+ cast 0u32 0u32 into r3 as Point__7VbTm7beYPk;
+ ternary r2.is_some r2.val r3 into r4;
+ output r4.x 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..c336e701cf5 100644
--- a/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out
+++ b/tests/expectations/compiler/libraries/lib_submodule_struct_in_storage.out
@@ -20,15 +20,14 @@ 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;
- 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;
+ cast true r2 into r3 as Optional__6BCOGVZlT0d;
+ cast 0u32 0u32 into r4 as Rect__ANLpT5iOmJt;
+ cast false r4 into r5 as Optional__6BCOGVZlT0d;
+ ternary r0 r3 r5 into r6;
+ assert.eq r6.is_some true;
+ mul r6.val.width r6.val.height into r7;
+ mul r6.val.width r6.val.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..96d9b688eb9 100644
--- a/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out
+++ b/tests/expectations/compiler/libraries/nested_lib_struct_in_storage.out
@@ -26,19 +26,14 @@ 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 true r4 into r5 as Optional__93SfMrvy3aW;
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;
- 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;
+ cast 0u32 0u32 into r7 as Point__7VbTm7beYPk;
+ cast r6 r7 into r8 as Rect__yHB5zqEAd9;
+ cast false r8 into r9 as Optional__93SfMrvy3aW;
+ ternary r0 r5 r9 into r10;
+ assert.eq r10.is_some true;
+ assert.eq r10.val.top_left.x r10.val.top_left.x;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/compiler/option/implicit_wrapping.out b/tests/expectations/compiler/option/implicit_wrapping.out
index 586e33621f4..8e3605064e5 100644
--- a/tests/expectations/compiler/option/implicit_wrapping.out
+++ b/tests/expectations/compiler/option/implicit_wrapping.out
@@ -34,10 +34,11 @@ function basic_implicit_argument:
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;
+ cast true 10u8 into r1 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r2 as Optional__3aph2JMPtnA;
+ ternary r0 r1 r2 into r3;
+ assert.eq r3.is_some true;
+ output r3.val as u8.private;
function basic_implicit_reassignment:
cast true 99u8 into r0 as Optional__3aph2JMPtnA;
@@ -87,33 +88,21 @@ function complex_implicit_ternary:
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 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;
+ cast true r8 into r9 as Optional__90gnFMeDKTp;
+ cast false 0u8 into r10 as Optional__3aph2JMPtnA;
+ cast r10 into r11 as Foo;
+ cast false r11 into r12 as Optional__DH9PtMwOkLt;
+ cast r12 r12 into r13 as [Optional__DH9PtMwOkLt; 2u32];
+ cast r13 into r14 as Wrapper;
+ cast false r14 into r15 as Optional__90gnFMeDKTp;
+ ternary r0 r9 r15 into r16;
+ assert.eq r16.is_some true;
+ assert.eq r16.val.arr[0u32].is_some true;
+ assert.eq r16.val.arr[0u32].val.x.is_some true;
+ assert.eq r16.val.arr[1u32].is_some true;
+ assert.eq r16.val.arr[1u32].val.x.is_some true;
+ cast r16.val.arr[0u32].val.x.val r16.val.arr[1u32].val.x.val into r17 as [u8; 2u32];
+ output r17 as [u8; 2u32].private;
function complex_implicit_reassignment:
cast true 7u8 into r0 as Optional__3aph2JMPtnA;
diff --git a/tests/expectations/compiler/option/in_modules.out b/tests/expectations/compiler/option/in_modules.out
index ee216698057..081e8a464f4 100644
--- a/tests/expectations/compiler/option/in_modules.out
+++ b/tests/expectations/compiler/option/in_modules.out
@@ -34,10 +34,11 @@ function basic_implicit_argument:
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;
+ cast true 10u8 into r1 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r2 as Optional__3aph2JMPtnA;
+ ternary r0 r1 r2 into r3;
+ assert.eq r3.is_some true;
+ output r3.val as u8.private;
function basic_implicit_reassignment:
cast true 99u8 into r0 as Optional__3aph2JMPtnA;
@@ -57,15 +58,13 @@ function complex_implicit_return:
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;
+ cast r9 into r10 as Foo__JLzIT8VEyGW;
+ ternary r8.val.arr[1u32].is_some r8.val.arr[1u32].val r10 into r11;
+ cast r8.val.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;
@@ -92,38 +91,24 @@ function complex_implicit_ternary:
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 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;
+ cast true r8 into r9 as Optional__7J0YWbeOZxr;
+ cast false 0u8 into r10 as Optional__3aph2JMPtnA;
+ cast r10 into r11 as Foo__JLzIT8VEyGW;
+ cast false r11 into r12 as Optional__4x5ZWv8vmos;
+ cast r12 r12 into r13 as [Optional__4x5ZWv8vmos; 2u32];
+ cast r13 into r14 as Wrapper__6VZ6TvN0ax;
+ cast false r14 into r15 as Optional__7J0YWbeOZxr;
+ ternary r0 r9 r15 into r16;
+ assert.eq r16.is_some true;
+ assert.eq r16.val.arr[0u32].is_some true;
+ cast false 0u8 into r17 as Optional__3aph2JMPtnA;
+ cast r17 into r18 as Foo__JLzIT8VEyGW;
+ ternary r16.val.arr[1u32].is_some r16.val.arr[1u32].val r18 into r19;
+ cast r16.val.arr[0u32].val.x r19.x into r20 as [Optional__3aph2JMPtnA; 2u32];
+ ternary r20[0u32].is_some r20[0u32].val 0u8 into r21;
+ ternary r20[1u32].is_some r20[1u32].val 0u8 into r22;
+ cast r21 r22 into r23 as [u8; 2u32];
+ output r23 as [u8; 2u32].private;
function complex_implicit_reassignment:
cast true 7u8 into r0 as Optional__3aph2JMPtnA;
@@ -152,31 +137,23 @@ function complex_array_wrapping:
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 r7 into r8 as Foo__JLzIT8VEyGW;
+ ternary r6.val[0u32].arr[1u32].is_some r6.val[0u32].arr[1u32].val r8 into r9;
+ cast r6.val[0u32].arr[0u32].val.x r9.x into r10 as [Optional__3aph2JMPtnA; 2u32];
+ cast false 0u8 into r11 as Optional__3aph2JMPtnA;
+ cast r11 into r12 as Foo__JLzIT8VEyGW;
+ ternary r6.val[1u32].arr[0u32].is_some r6.val[1u32].arr[0u32].val r12 into r13;
+ cast false 0u8 into r14 as Optional__3aph2JMPtnA;
+ cast r14 into r15 as Foo__JLzIT8VEyGW;
+ ternary r6.val[1u32].arr[1u32].is_some r6.val[1u32].arr[1u32].val r15 into r16;
+ cast r13.x r16.x into r17 as [Optional__3aph2JMPtnA; 2u32];
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;
+ cast r18 into r19 as Foo__JLzIT8VEyGW;
+ ternary r6.val[2u32].arr[1u32].is_some r6.val[2u32].arr[1u32].val r19 into r20;
+ cast r6.val[2u32].arr[0u32].val.x r20.x into r21 as [Optional__3aph2JMPtnA; 2u32];
+ cast r10 r17 r21 into r22 as [[Optional__3aph2JMPtnA; 2u32]; 3u32];
+ ternary r22[0u32][0u32].is_some r22[0u32][0u32].val 0u8 into r23;
+ output r23 as u8.private;
function complex_array_access:
cast true 10u8 into r0 as Optional__3aph2JMPtnA;
@@ -209,28 +186,20 @@ function complex_array_access:
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;
- 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 r26 into r27 as Foo__JLzIT8VEyGW;
+ ternary r25.val[0u32].arr[1u32].is_some r25.val[0u32].arr[1u32].val r27 into r28;
+ cast r25.val[0u32].arr[0u32].val.x r28.x into r29 as [Optional__3aph2JMPtnA; 2u32];
+ cast false 0u8 into r30 as Optional__3aph2JMPtnA;
+ cast r30 into r31 as Foo__JLzIT8VEyGW;
+ ternary r25.val[1u32].arr[1u32].is_some r25.val[1u32].arr[1u32].val r31 into r32;
+ cast r25.val[1u32].arr[0u32].val.x r32.x into r33 as [Optional__3aph2JMPtnA; 2u32];
+ cast false 0u8 into r34 as Optional__3aph2JMPtnA;
+ cast r34 into r35 as Foo__JLzIT8VEyGW;
+ ternary r25.val[2u32].arr[0u32].is_some r25.val[2u32].arr[0u32].val r35 into r36;
+ cast false 0u8 into r37 as Optional__3aph2JMPtnA;
+ cast r37 into r38 as Foo__JLzIT8VEyGW;
+ ternary r25.val[2u32].arr[1u32].is_some r25.val[2u32].arr[1u32].val r38 into r39;
+ cast r36.x r39.x into r40 as [Optional__3aph2JMPtnA; 2u32];
+ cast r29 r33 r40 into r41 as [[Optional__3aph2JMPtnA; 2u32]; 3u32];
+ assert.eq r41[1u32][0u32].is_some true;
+ output r41[1u32][0u32].val as u8.private;
diff --git a/tests/expectations/compiler/option/unwrap_or_deep.out b/tests/expectations/compiler/option/unwrap_or_deep.out
index 4cfb0fe0d15..44cf39a42ce 100644
--- a/tests/expectations/compiler/option/unwrap_or_deep.out
+++ b/tests/expectations/compiler/option/unwrap_or_deep.out
@@ -57,66 +57,23 @@ function unwrap_or_deep:
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 r19 into r20 as Container;
+ ternary r10.is_some r10.val r20 into r21;
+ cast true r12 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 r27 into r28;
+ cast true r12 into r29 as Optional__AqOs5VODSRH;
+ cast r29 into r30 as [Optional__AqOs5VODSRH; 1u32];
+ cast true r30 into r31 as Optional__FVD6sPKEWr0;
+ cast r31 into r32 as Wrapper;
+ ternary r28[0u32].is_some r28[0u32].val r32 into r33;
+ cast true r12 into r34 as Optional__AqOs5VODSRH;
+ cast r34 into r35 as [Optional__AqOs5VODSRH; 1u32];
+ ternary r33.arr.is_some r33.arr.val r35 into r36;
+ ternary r36[0u32].is_some r36[0u32].val r12 into r37;
+ ternary r37.val.is_some r37.val.val 99u8 into r38;
+ output r38 as u8.private;
diff --git a/tests/expectations/compiler/storage/aggregates.out b/tests/expectations/compiler/storage/aggregates.out
index 6bf2aaa773c..e34b4160a38 100644
--- a/tests/expectations/compiler/storage/aggregates.out
+++ b/tests/expectations/compiler/storage/aggregates.out
@@ -99,91 +99,73 @@ 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;
- cast r0 r6 into r7 as Optional__7G49nMxvEkY;
- assert.eq r7.is_some true;
- is.eq r7.val.x 1field into r8;
+ cast true r2 into r3 as Optional__7G49nMxvEkY;
+ cast 0field 0field into r4 as Point;
+ cast false r4 into r5 as Optional__7G49nMxvEkY;
+ ternary r0 r3 r5 into r6;
+ assert.eq r6.is_some true;
+ is.eq r6.val.x 1field into r7;
+ assert.eq r7 true;
+ is.eq r6.val.y 2field into r8;
assert.eq r8 true;
- is.eq r7.val.y 2field into r9;
- 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;
+ 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 true r12 into r13 as Optional__CIFHV93i7jy;
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;
- 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;
+ cast false r15 into r16 as Optional__CIFHV93i7jy;
+ ternary r9 r13 r16 into r17;
+ assert.eq r17.is_some true;
+ is.eq r17.val[0u32].x 10field into r18;
+ assert.eq r18 true;
+ is.eq r17.val[1u32].y 40field into r19;
+ assert.eq r19 true;
+ contains stats__[false] into r20;
+ cast 0u32 0u32 0u32 into r21 as [u32; 3u32];
+ cast r21 false into r22 as Stats;
+ get.or_use stats__[false] r22 into r23;
+ cast true r23 into r24 as Optional__Lq45m8HPNtd;
+ cast r21 false into r25 as Stats;
+ cast false r25 into r26 as Optional__Lq45m8HPNtd;
+ ternary r20 r24 r26 into r27;
+ assert.eq r27.is_some true;
+ is.eq r27.val.values[1u32] 10u32 into r28;
+ assert.eq r28 true;
+ is.eq r27.val.active true into r29;
+ assert.eq r29 true;
+ contains arr_u32__[false] into r30;
+ get.or_use arr_u32__[false] r21 into r31;
+ cast true r31 into r32 as Optional__44OvQX0aUQS;
+ cast false r21 into r33 as Optional__44OvQX0aUQS;
+ ternary r30 r32 r33 into r34;
+ assert.eq r34.is_some true;
+ is.eq r34.val[2u32] 9u32 into r35;
+ assert.eq r35 true;
+ contains arr_bool__[false] into r36;
+ cast false false into r37 as [boolean; 2u32];
+ get.or_use arr_bool__[false] r37 into r38;
+ cast true r38 into r39 as Optional__1QRp3ZHeoMr;
+ cast false r37 into r40 as Optional__1QRp3ZHeoMr;
+ ternary r36 r39 r40 into r41;
+ assert.eq r41.is_some true;
+ is.eq r41.val[0u32] true into r42;
+ assert.eq r42 true;
+ is.eq r41.val[1u32] false into r43;
+ assert.eq r43 true;
+ contains nested__[false] into r44;
+ cast 0u8 0u8 into r45 as [u8; 2u32];
+ cast r45 r45 into r46 as [[u8; 2u32]; 2u32];
+ get.or_use nested__[false] r46 into r47;
+ cast true r47 into r48 as Optional__BYnjU42CUEm;
+ cast false r46 into r49 as Optional__BYnjU42CUEm;
+ ternary r44 r48 r49 into r50;
+ assert.eq r50.is_some true;
+ is.eq r50.val[0u32][1u32] 2u8 into r51;
+ assert.eq r51 true;
+ is.eq r50.val[1u32][0u32] 3u8 into r52;
+ assert.eq r52 true;
function check2:
async check2 into r0;
@@ -193,116 +175,78 @@ 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;
- 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;
- 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;
+ cast true r2 into r3 as Optional__7G49nMxvEkY;
+ cast 0field 0field into r4 as Point;
+ cast false r4 into r5 as Optional__7G49nMxvEkY;
+ ternary r0 r3 r5 into r6;
+ cast 0field 0field into r7 as Point;
+ ternary r6.is_some r6.val r7 into r8;
+ is.eq r8.x 1field into r9;
+ assert.eq r9 true;
+ is.eq r8.y 2field into r10;
+ assert.eq r10 true;
+ contains points__[false] into r11;
+ cast 0field 0field into r12 as Point;
+ cast r12 r12 into r13 as [Point; 2u32];
+ get.or_use points__[false] r13 into r14;
+ cast true r14 into r15 as Optional__CIFHV93i7jy;
+ cast 0field 0field into r16 as Point;
+ cast r16 r16 into r17 as [Point; 2u32];
+ cast false r17 into r18 as Optional__CIFHV93i7jy;
+ ternary r11 r15 r18 into r19;
+ cast 0field 0field into r20 as Point;
+ cast 0field 0field into r21 as Point;
+ cast r20 r21 into r22 as [Point; 2u32];
+ ternary r19.is_some r19.val r22 into r23;
+ is.eq r23[0u32].x 10field into r24;
+ assert.eq r24 true;
+ is.eq r23[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 true r29 into r30 as Optional__Lq45m8HPNtd;
+ cast r27 false into r31 as Stats;
+ cast false r31 into r32 as Optional__Lq45m8HPNtd;
+ ternary r26 r30 r32 into r33;
+ cast 0u32 0u32 0u32 into r34 as [u32; 3u32];
+ cast r34 false into r35 as Stats;
+ ternary r33.is_some r33.val r35 into r36;
+ is.eq r36.values[2u32] 15u32 into r37;
assert.eq r37 true;
- is.eq r36[1u32].y 40field into r38;
+ is.eq r36.active true 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 arr_u32__[false] into r39;
+ get.or_use arr_u32__[false] r27 into r40;
+ cast true r40 into r41 as Optional__44OvQX0aUQS;
+ cast false r27 into r42 as Optional__44OvQX0aUQS;
+ ternary r39 r41 r42 into r43;
+ ternary r43.is_some r43.val r34 into r44;
+ is.eq r44[1u32] 8u32 into r45;
+ assert.eq r45 true;
+ contains arr_bool__[false] into r46;
+ cast false false into r47 as [boolean; 2u32];
+ get.or_use arr_bool__[false] r47 into r48;
+ cast true r48 into r49 as Optional__1QRp3ZHeoMr;
+ cast false r47 into r50 as Optional__1QRp3ZHeoMr;
+ ternary r46 r49 r50 into r51;
+ cast false false into r52 as [boolean; 2u32];
+ ternary r51.is_some r51.val r52 into r53;
+ is.eq r53[0u32] true into r54;
+ assert.eq r54 true;
+ contains nested__[false] into r55;
+ cast 0u8 0u8 into r56 as [u8; 2u32];
+ cast r56 r56 into r57 as [[u8; 2u32]; 2u32];
+ get.or_use nested__[false] r57 into r58;
+ cast true r58 into r59 as Optional__BYnjU42CUEm;
+ cast false r57 into r60 as Optional__BYnjU42CUEm;
+ ternary r55 r59 r60 into r61;
+ cast 0u8 0u8 into r62 as [u8; 2u32];
+ cast r62 r62 into r63 as [[u8; 2u32]; 2u32];
+ ternary r61.is_some r61.val r63 into r64;
+ is.eq r64[1u32][1u32] 4u8 into r65;
+ assert.eq r65 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..8fcc1be0d63 100644
--- a/tests/expectations/compiler/storage/counter_storage.out
+++ b/tests/expectations/compiler/storage/counter_storage.out
@@ -22,18 +22,20 @@ function increment:
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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u32 into r5;
+ add r5 1u32 into r6;
+ set r6 into counter__[false];
+ contains counter__[false] into r7;
+ get.or_use counter__[false] 0u32 into r8;
+ cast true r8 into r9 as Optional__JzunLORyB8U;
+ cast false 0u32 into r10 as Optional__JzunLORyB8U;
+ ternary r7 r9 r10 into r11;
+ assert.eq r11.is_some true;
+ is.eq r11.val r6 into r12;
+ assert.eq r12 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..bee94bba239 100644
--- a/tests/expectations/compiler/storage/external_storage.out
+++ b/tests/expectations/compiler/storage/external_storage.out
@@ -167,257 +167,232 @@ function check_initialized:
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 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;
- 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;
- 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;
-
-function check_wiped:
- async check_wiped into r0;
- output r0 as test.aleo/check_wiped.future;
-
-finalize check_wiped:
- 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;
- cast false false into r4 as Optional__ATAkdHctJwx;
- is.eq r3 r4 into r5;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val true 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;
- cast false 0scalar into r10 as Optional__9y0TjJOC4Nk;
- is.eq r9 r10 into r11;
+ cast true r7 into r8 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r9 as Optional__9y0TjJOC4Nk;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val 1scalar 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;
- cast false 0field into r16 as Optional__7o6su2Uhzht;
- is.eq r15 r16 into r17;
+ cast true r13 into r14 as Optional__7o6su2Uhzht;
+ cast false 0field into r15 as Optional__7o6su2Uhzht;
+ ternary r12 r14 r15 into r16;
+ assert.eq r16.is_some true;
+ is.eq r16.val 42field 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;
- cast false 0group into r22 as Optional__9SsWRr2WG5s;
- is.eq r21 r22 into r23;
+ cast true r19 into r20 as Optional__9SsWRr2WG5s;
+ cast false 0group into r21 as Optional__9SsWRr2WG5s;
+ ternary r18 r20 r21 into r22;
+ assert.eq r22.is_some true;
+ is.eq r22.val 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;
+ cast true r26 into r27 as Optional__7G49nMxvEkY;
+ cast 0field 0field into r28 as child.aleo/Point;
+ cast false r28 into r29 as Optional__7G49nMxvEkY;
+ ternary r24 r27 r29 into r30;
+ assert.eq r30.is_some true;
+ is.eq r30.val.x 1field into r31;
+ assert.eq r31 true;
+ is.eq r30.val.y 2field into r32;
+ assert.eq r32 true;
+ contains child.aleo/points__[false] into r33;
+ cast 0field 0field into r34 as child.aleo/Point;
+ cast r34 r34 into r35 as [child.aleo/Point; 2u32];
+ get.or_use child.aleo/points__[false] r35 into r36;
+ cast true r36 into r37 as Optional__CIFHV93i7jy;
+ cast 0field 0field into r38 as child.aleo/Point;
+ cast r38 r38 into r39 as [child.aleo/Point; 2u32];
+ cast false r39 into r40 as Optional__CIFHV93i7jy;
+ ternary r33 r37 r40 into r41;
+ assert.eq r41.is_some true;
+ is.eq r41.val[0u32].x 10field into r42;
+ assert.eq r42 true;
+ is.eq r41.val[1u32].y 40field into r43;
+ assert.eq r43 true;
+ contains child.aleo/stats__[false] into r44;
+ cast 0u32 0u32 0u32 into r45 as [u32; 3u32];
+ cast r45 false into r46 as child.aleo/Stats;
+ get.or_use child.aleo/stats__[false] r46 into r47;
+ cast true r47 into r48 as Optional__Lq45m8HPNtd;
+ cast r45 false into r49 as child.aleo/Stats;
+ cast false r49 into r50 as Optional__Lq45m8HPNtd;
+ ternary r44 r48 r50 into r51;
+ assert.eq r51.is_some true;
+ is.eq r51.val.values[1u32] 10u32 into r52;
+ assert.eq r52 true;
+ is.eq r51.val.active true into r53;
+ assert.eq r53 true;
+ contains child.aleo/arr_u32__[false] into r54;
+ get.or_use child.aleo/arr_u32__[false] r45 into r55;
+ cast true r55 into r56 as Optional__44OvQX0aUQS;
+ cast false r45 into r57 as Optional__44OvQX0aUQS;
+ ternary r54 r56 r57 into r58;
+ assert.eq r58.is_some true;
+ is.eq r58.val[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;
+ cast true r62 into r63 as Optional__1QRp3ZHeoMr;
+ cast false r61 into r64 as Optional__1QRp3ZHeoMr;
+ ternary r60 r63 r64 into r65;
+ assert.eq r65.is_some true;
+ is.eq r65.val[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;
+ cast true r70 into r71 as Optional__BYnjU42CUEm;
+ cast false r69 into r72 as Optional__BYnjU42CUEm;
+ ternary r67 r71 r72 into r73;
+ assert.eq r73.is_some true;
+ is.eq r73.val[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;
+ cast true r76 into r77 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r78 as Optional__3aph2JMPtnA;
+ ternary r75 r77 r78 into r79;
+ assert.eq r79.is_some true;
+ is.eq r79.val 9u8 into r80;
+ assert.eq r80 true;
+ get.or_use child.aleo/vec__len__[false] 0u32 into r81;
+ lt 2u32 r81 into r82;
+ get.or_use child.aleo/vec__[2u32] 0u8 into r83;
+ cast true r83 into r84 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r85 as Optional__3aph2JMPtnA;
+ ternary r82 r84 r85 into r86;
+ assert.eq r86.is_some true;
+ is.eq r86.val 70u8 into r87;
+ assert.eq r87 true;
+
+function check_wiped:
+ async check_wiped into r0;
+ output r0 as test.aleo/check_wiped.future;
+
+finalize check_wiped:
+ contains child.aleo/flag__[false] into r0;
+ get.or_use child.aleo/flag__[false] false into r1;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ cast false false into r5 as Optional__ATAkdHctJwx;
+ is.eq r4 r5 into r6;
+ assert.eq r6 true;
+ contains child.aleo/scalar_val__[false] into r7;
+ get.or_use child.aleo/scalar_val__[false] 0scalar into r8;
+ cast true r8 into r9 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r10 as Optional__9y0TjJOC4Nk;
+ ternary r7 r9 r10 into r11;
+ cast false 0scalar into r12 as Optional__9y0TjJOC4Nk;
+ is.eq r11 r12 into r13;
+ assert.eq r13 true;
+ contains child.aleo/field_val__[false] into r14;
+ get.or_use child.aleo/field_val__[false] 0field into r15;
+ cast true r15 into r16 as Optional__7o6su2Uhzht;
+ cast false 0field into r17 as Optional__7o6su2Uhzht;
+ ternary r14 r16 r17 into r18;
+ cast false 0field into r19 as Optional__7o6su2Uhzht;
+ is.eq r18 r19 into r20;
+ assert.eq r20 true;
+ contains child.aleo/group_val__[false] into r21;
+ get.or_use child.aleo/group_val__[false] 0group into r22;
+ cast true r22 into r23 as Optional__9SsWRr2WG5s;
+ cast false 0group into r24 as Optional__9SsWRr2WG5s;
+ ternary r21 r23 r24 into r25;
+ cast false 0group into r26 as Optional__9SsWRr2WG5s;
+ is.eq r25 r26 into r27;
+ assert.eq r27 true;
+ contains child.aleo/point__[false] into r28;
+ cast 0field 0field into r29 as child.aleo/Point;
+ get.or_use child.aleo/point__[false] r29 into r30;
+ cast true 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;
+ ternary r28 r31 r33 into r34;
+ cast 0field 0field into r35 as child.aleo/Point;
+ cast false r35 into r36 as Optional__7G49nMxvEkY;
+ is.eq r34 r36 into r37;
+ assert.eq r37 true;
+ contains child.aleo/points__[false] 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;
+ get.or_use child.aleo/points__[false] r40 into r41;
+ cast true r41 into r42 as Optional__CIFHV93i7jy;
+ cast 0field 0field into r43 as child.aleo/Point;
+ cast r43 r43 into r44 as [child.aleo/Point; 2u32];
+ cast false r44 into r45 as Optional__CIFHV93i7jy;
+ ternary r38 r42 r45 into r46;
+ cast 0field 0field into r47 as child.aleo/Point;
+ cast r47 r47 into r48 as [child.aleo/Point; 2u32];
+ cast false r48 into r49 as Optional__CIFHV93i7jy;
+ is.eq r46 r49 into r50;
+ assert.eq r50 true;
+ contains child.aleo/stats__[false] into r51;
+ cast 0u32 0u32 0u32 into r52 as [u32; 3u32];
+ cast r52 false into r53 as child.aleo/Stats;
+ get.or_use child.aleo/stats__[false] r53 into r54;
+ cast true r54 into r55 as Optional__Lq45m8HPNtd;
+ cast r52 false into r56 as child.aleo/Stats;
+ cast false r56 into r57 as Optional__Lq45m8HPNtd;
+ ternary r51 r55 r57 into r58;
+ cast r52 false into r59 as child.aleo/Stats;
+ cast false r59 into r60 as Optional__Lq45m8HPNtd;
+ is.eq r58 r60 into r61;
+ assert.eq r61 true;
+ contains child.aleo/arr_u32__[false] into r62;
+ get.or_use child.aleo/arr_u32__[false] r52 into r63;
+ cast true r63 into r64 as Optional__44OvQX0aUQS;
+ cast false r52 into r65 as Optional__44OvQX0aUQS;
+ ternary r62 r64 r65 into r66;
+ cast false r52 into r67 as Optional__44OvQX0aUQS;
+ is.eq r66 r67 into r68;
+ assert.eq r68 true;
+ contains child.aleo/arr_bool__[false] into r69;
+ cast false false into r70 as [boolean; 2u32];
+ get.or_use child.aleo/arr_bool__[false] r70 into r71;
+ cast true r71 into r72 as Optional__1QRp3ZHeoMr;
+ cast false r70 into r73 as Optional__1QRp3ZHeoMr;
+ ternary r69 r72 r73 into r74;
+ cast false r70 into r75 as Optional__1QRp3ZHeoMr;
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;
+ contains child.aleo/nested__[false] into r77;
+ cast 0u8 0u8 into r78 as [u8; 2u32];
+ cast r78 r78 into r79 as [[u8; 2u32]; 2u32];
+ get.or_use child.aleo/nested__[false] r79 into r80;
+ cast true r80 into r81 as Optional__BYnjU42CUEm;
+ cast false r79 into r82 as Optional__BYnjU42CUEm;
+ ternary r77 r81 r82 into r83;
+ cast false r79 into r84 as Optional__BYnjU42CUEm;
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;
- 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;
+ contains child.aleo/counter__[false] into r86;
+ get.or_use child.aleo/counter__[false] 0u8 into r87;
+ cast true r87 into r88 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r89 as Optional__3aph2JMPtnA;
+ ternary r86 r88 r89 into r90;
+ cast false 0u8 into r91 as Optional__3aph2JMPtnA;
+ is.eq r90 r91 into r92;
+ assert.eq r92 true;
+ get.or_use child.aleo/vec__len__[false] 0u32 into r93;
+ is.eq r93 0u32 into r94;
+ assert.eq r94 true;
function check_fallback:
async check_fallback into r0;
@@ -426,146 +401,113 @@ function check_fallback:
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;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val false into r5;
+ is.eq r5 false into r6;
+ assert.eq r6 true;
+ contains child.aleo/scalar_val__[false] into r7;
+ get.or_use child.aleo/scalar_val__[false] 0scalar into r8;
+ cast true r8 into r9 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r10 as Optional__9y0TjJOC4Nk;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val 0scalar into r12;
+ is.eq r12 0scalar into r13;
+ assert.eq r13 true;
+ contains child.aleo/field_val__[false] into r14;
+ get.or_use child.aleo/field_val__[false] 0field into r15;
+ cast true r15 into r16 as Optional__7o6su2Uhzht;
+ cast false 0field into r17 as Optional__7o6su2Uhzht;
+ ternary r14 r16 r17 into r18;
+ ternary r18.is_some r18.val 0field into r19;
+ is.eq r19 0field into r20;
+ assert.eq r20 true;
+ contains child.aleo/group_val__[false] into r21;
+ get.or_use child.aleo/group_val__[false] 0group into r22;
+ cast true r22 into r23 as Optional__9SsWRr2WG5s;
+ cast false 0group into r24 as Optional__9SsWRr2WG5s;
+ ternary r21 r23 r24 into r25;
+ ternary r25.is_some r25.val 0group into r26;
+ is.eq r26 0group into r27;
+ assert.eq r27 true;
+ contains child.aleo/point__[false] into r28;
+ cast 0field 0field into r29 as child.aleo/Point;
+ get.or_use child.aleo/point__[false] r29 into r30;
+ cast true r30 into r31 as Optional__7G49nMxvEkY;
+ cast 0field 0field into r32 as child.aleo/Point;
+ cast false r32 into r33 as Optional__7G49nMxvEkY;
+ ternary r28 r31 r33 into r34;
+ cast 0field 0field into r35 as child.aleo/Point;
+ ternary r34.is_some r34.val r35 into r36;
+ is.eq r36.x 0field into r37;
+ assert.eq r37 true;
+ contains child.aleo/points__[false] into r38;
+ cast 0field 0field into r39 as child.aleo/Point;
+ cast r39 r39 into r40 as [child.aleo/Point; 2u32];
+ get.or_use child.aleo/points__[false] r40 into r41;
+ cast true r41 into r42 as Optional__CIFHV93i7jy;
+ cast 0field 0field into r43 as child.aleo/Point;
+ cast r43 r43 into r44 as [child.aleo/Point; 2u32];
+ cast false r44 into r45 as Optional__CIFHV93i7jy;
+ ternary r38 r42 r45 into r46;
+ cast 0field 0field into r47 as child.aleo/Point;
+ cast 0field 0field into r48 as child.aleo/Point;
+ cast r47 r48 into r49 as [child.aleo/Point; 2u32];
+ ternary r46.is_some r46.val r49 into r50;
+ is.eq r50[0u32].x 0field 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;
+ cast true r55 into r56 as Optional__Lq45m8HPNtd;
+ cast r53 false into r57 as child.aleo/Stats;
+ cast false r57 into r58 as Optional__Lq45m8HPNtd;
+ ternary r52 r56 r58 into r59;
+ cast 0u32 0u32 0u32 into r60 as [u32; 3u32];
+ cast r60 false into r61 as child.aleo/Stats;
+ ternary r59.is_some r59.val r61 into r62;
+ is.eq r62.active false into r63;
+ assert.eq r63 true;
+ contains child.aleo/arr_u32__[false] into r64;
+ get.or_use child.aleo/arr_u32__[false] r53 into r65;
+ cast true r65 into r66 as Optional__44OvQX0aUQS;
+ cast false r53 into r67 as Optional__44OvQX0aUQS;
+ ternary r64 r66 r67 into r68;
+ ternary r68.is_some r68.val r60 into r69;
+ is.eq r69[1u32] 0u32 into r70;
+ assert.eq r70 true;
+ contains child.aleo/arr_bool__[false] into r71;
+ cast false false into r72 as [boolean; 2u32];
+ get.or_use child.aleo/arr_bool__[false] r72 into r73;
+ cast true r73 into r74 as Optional__1QRp3ZHeoMr;
+ cast false r72 into r75 as Optional__1QRp3ZHeoMr;
+ ternary r71 r74 r75 into r76;
+ cast false false into r77 as [boolean; 2u32];
+ ternary r76.is_some r76.val r77 into r78;
+ is.eq r78[1u32] false into r79;
+ assert.eq r79 true;
+ contains child.aleo/nested__[false] into r80;
+ cast 0u8 0u8 into r81 as [u8; 2u32];
+ cast r81 r81 into r82 as [[u8; 2u32]; 2u32];
+ get.or_use child.aleo/nested__[false] r82 into r83;
+ cast true r83 into r84 as Optional__BYnjU42CUEm;
+ cast false r82 into r85 as Optional__BYnjU42CUEm;
+ ternary r80 r84 r85 into r86;
+ cast 0u8 0u8 into r87 as [u8; 2u32];
+ cast r87 r87 into r88 as [[u8; 2u32]; 2u32];
+ ternary r86.is_some r86.val r88 into r89;
+ is.eq r89[0u32][0u32] 0u8 into r90;
+ assert.eq r90 true;
+ contains child.aleo/counter__[false] into r91;
+ get.or_use child.aleo/counter__[false] 0u8 into r92;
+ cast true r92 into r93 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r94 as Optional__3aph2JMPtnA;
+ ternary r91 r93 r94 into r95;
+ ternary r95.is_some r95.val 123u8 into r96;
+ is.eq r96 123u8 into r97;
+ assert.eq r97 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..ab3583f80a9 100644
--- a/tests/expectations/compiler/storage/external_storage_multi_deps.out
+++ b/tests/expectations/compiler/storage/external_storage_multi_deps.out
@@ -40,11 +40,12 @@ finalize init:
set true into flag__[false];
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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val 99u32 into r5;
+ assert.eq r5 true;
function wipe:
async wipe into r0;
@@ -54,11 +55,12 @@ finalize wipe:
remove flag__[false];
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;
- cast false 0u32 into r4 as Optional__JzunLORyB8U;
- is.eq r3 r4 into r5;
- assert.eq r5 true;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ cast false 0u32 into r5 as Optional__JzunLORyB8U;
+ is.eq r4 r5 into r6;
+ assert.eq r6 true;
constructor:
assert.eq edition 0u16;
@@ -87,18 +89,20 @@ finalize init:
set 7u8 into counter__[false];
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;
- 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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val 99u32 into r5;
+ assert.eq r5 true;
+ contains mid1.aleo/flag__[false] into r6;
+ get.or_use mid1.aleo/flag__[false] false into r7;
+ cast true r7 into r8 as Optional__ATAkdHctJwx;
+ cast false false into r9 as Optional__ATAkdHctJwx;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val true into r11;
+ assert.eq r11 true;
function wipe:
async wipe into r0;
@@ -108,11 +112,12 @@ finalize wipe:
remove counter__[false];
contains mid1.aleo/flag__[false] into r0;
get.or_use mid1.aleo/flag__[false] false into r1;
- ternary r0 r1 false into r2;
- cast r0 r2 into r3 as Optional__ATAkdHctJwx;
- cast false false into r4 as Optional__ATAkdHctJwx;
- is.eq r3 r4 into r5;
- assert.eq r5 true;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ cast false false into r5 as Optional__ATAkdHctJwx;
+ is.eq r4 r5 into r6;
+ assert.eq r6 true;
constructor:
assert.eq edition 0u16;
@@ -141,25 +146,28 @@ function test_initialized:
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 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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val 99u32 into r5;
+ assert.eq r5 true;
+ contains mid1.aleo/flag__[false] into r6;
+ get.or_use mid1.aleo/flag__[false] false into r7;
+ cast true r7 into r8 as Optional__ATAkdHctJwx;
+ cast false false into r9 as Optional__ATAkdHctJwx;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val true into r11;
+ assert.eq r11 true;
+ contains mid2.aleo/counter__[false] into r12;
+ get.or_use mid2.aleo/counter__[false] 0u8 into r13;
+ cast true r13 into r14 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r15 as Optional__3aph2JMPtnA;
+ ternary r12 r14 r15 into r16;
+ assert.eq r16.is_some true;
+ is.eq r16.val 7u8 into r17;
+ assert.eq r17 true;
function test_fallback:
async test_fallback into r0;
@@ -168,25 +176,28 @@ function test_fallback:
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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u32 into r5;
+ is.eq r5 0u32 into r6;
+ assert.eq r6 true;
+ contains mid1.aleo/flag__[false] into r7;
+ get.or_use mid1.aleo/flag__[false] false into r8;
+ cast true r8 into r9 as Optional__ATAkdHctJwx;
+ cast false false into r10 as Optional__ATAkdHctJwx;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val false into r12;
+ is.eq r12 false into r13;
+ assert.eq r13 true;
+ contains mid2.aleo/counter__[false] into r14;
+ get.or_use mid2.aleo/counter__[false] 0u8 into r15;
+ cast true r15 into r16 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r17 as Optional__3aph2JMPtnA;
+ ternary r14 r16 r17 into r18;
+ ternary r18.is_some r18.val 11u8 into r19;
+ is.eq r19 11u8 into r20;
+ assert.eq r20 true;
function test_none:
async test_none into r0;
@@ -195,25 +206,28 @@ function test_none:
finalize test_none:
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;
- cast false 0u32 into r4 as Optional__JzunLORyB8U;
- is.eq r3 r4 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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ cast false 0u32 into r5 as Optional__JzunLORyB8U;
+ is.eq r4 r5 into r6;
+ assert.eq r6 true;
+ contains mid1.aleo/flag__[false] into r7;
+ get.or_use mid1.aleo/flag__[false] false into r8;
+ cast true r8 into r9 as Optional__ATAkdHctJwx;
cast false false into r10 as Optional__ATAkdHctJwx;
- is.eq r9 r10 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;
- cast false 0u8 into r16 as Optional__3aph2JMPtnA;
- is.eq r15 r16 into r17;
- assert.eq r17 true;
+ ternary r7 r9 r10 into r11;
+ cast false false into r12 as Optional__ATAkdHctJwx;
+ is.eq r11 r12 into r13;
+ assert.eq r13 true;
+ contains mid2.aleo/counter__[false] into r14;
+ get.or_use mid2.aleo/counter__[false] 0u8 into r15;
+ cast true r15 into r16 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r17 as Optional__3aph2JMPtnA;
+ ternary r14 r16 r17 into r18;
+ cast false 0u8 into r19 as Optional__3aph2JMPtnA;
+ is.eq r18 r19 into r20;
+ assert.eq r20 true;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/compiler/storage/long_names.out b/tests/expectations/compiler/storage/long_names.out
index a12cc499089..f259ef2c3bd 100644
--- a/tests/expectations/compiler/storage/long_names.out
+++ b/tests/expectations/compiler/storage/long_names.out
@@ -27,7 +27,8 @@ finalize foo:
set r1 into some_verrry_l__len__5biJXePTdHq[false];
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];
+ cast true r3 into r4 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r5 as Optional__3aph2JMPtnA;
+ ternary r2 r4 r5 into r6;
+ assert.eq r6.is_some true;
+ set r6.val into some_verrry_long_s__F3Lfva7X0lK[r0];
diff --git a/tests/expectations/compiler/storage/primitives.out b/tests/expectations/compiler/storage/primitives.out
index 26ee4bdfe3d..375f49cfeaf 100644
--- a/tests/expectations/compiler/storage/primitives.out
+++ b/tests/expectations/compiler/storage/primitives.out
@@ -69,80 +69,90 @@ function check1:
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 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;
- 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;
- 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;
- 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;
- 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;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val 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;
+ cast true r7 into r8 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r9 as Optional__9y0TjJOC4Nk;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val 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;
+ cast true r13 into r14 as Optional__7o6su2Uhzht;
+ cast false 0field into r15 as Optional__7o6su2Uhzht;
+ ternary r12 r14 r15 into r16;
+ assert.eq r16.is_some true;
+ is.eq r16.val 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;
+ cast true r19 into r20 as Optional__9SsWRr2WG5s;
+ cast false 0group into r21 as Optional__9SsWRr2WG5s;
+ ternary r18 r20 r21 into r22;
+ assert.eq r22.is_some true;
+ is.eq r22.val 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;
+ cast true r25 into r26 as Optional__6wU7KHJhSvv;
+ cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r27 as Optional__6wU7KHJhSvv;
+ ternary r24 r26 r27 into r28;
+ assert.eq r28.is_some true;
+ is.eq r28.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r29;
assert.eq r29 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;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val false into r5;
+ is.eq r5 true into r6;
+ assert.eq r6 true;
+ contains scalar_val__[false] into r7;
+ get.or_use scalar_val__[false] 0scalar into r8;
+ cast true r8 into r9 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r10 as Optional__9y0TjJOC4Nk;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val 0scalar into r12;
+ is.eq r12 1scalar into r13;
+ assert.eq r13 true;
+ contains field_val__[false] into r14;
+ get.or_use field_val__[false] 0field into r15;
+ cast true r15 into r16 as Optional__7o6su2Uhzht;
+ cast false 0field into r17 as Optional__7o6su2Uhzht;
+ ternary r14 r16 r17 into r18;
+ ternary r18.is_some r18.val 0field into r19;
+ is.eq r19 42field into r20;
+ assert.eq r20 true;
+ contains group_val__[false] into r21;
+ get.or_use group_val__[false] 0group into r22;
+ cast true r22 into r23 as Optional__9SsWRr2WG5s;
+ cast false 0group into r24 as Optional__9SsWRr2WG5s;
+ ternary r21 r23 r24 into r25;
+ ternary r25.is_some r25.val 0group into r26;
+ is.eq r26 0group into r27;
+ assert.eq r27 true;
+ contains addr_val__[false] into r28;
+ get.or_use addr_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r29;
+ cast true r29 into r30 as Optional__6wU7KHJhSvv;
+ cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r31 as Optional__6wU7KHJhSvv;
+ ternary r28 r30 r31 into r32;
+ ternary r32.is_some r32.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r33;
+ is.eq r33 aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r34;
+ assert.eq r34 true;
+
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/compiler/storage/signed.out b/tests/expectations/compiler/storage/signed.out
index 9de078a0a89..63c747f300c 100644
--- a/tests/expectations/compiler/storage/signed.out
+++ b/tests/expectations/compiler/storage/signed.out
@@ -69,80 +69,90 @@ function check1:
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 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;
- 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;
- 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;
- 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;
- 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;
+ cast true r1 into r2 as Optional__LDaTFs7R9lV;
+ cast false 0i8 into r3 as Optional__LDaTFs7R9lV;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val -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;
+ cast true r7 into r8 as Optional__29g5iOancAc;
+ cast false 0i16 into r9 as Optional__29g5iOancAc;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val -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;
+ cast true r13 into r14 as Optional__CI2lf3EvJat;
+ cast false 0i32 into r15 as Optional__CI2lf3EvJat;
+ ternary r12 r14 r15 into r16;
+ assert.eq r16.is_some true;
+ is.eq r16.val -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;
+ cast true r19 into r20 as Optional__GfbJUku6XoG;
+ cast false 0i64 into r21 as Optional__GfbJUku6XoG;
+ ternary r18 r20 r21 into r22;
+ assert.eq r22.is_some true;
+ is.eq r22.val -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;
+ cast true r25 into r26 as Optional__KL3cDgKUnaT;
+ cast false 0i128 into r27 as Optional__KL3cDgKUnaT;
+ ternary r24 r26 r27 into r28;
+ assert.eq r28.is_some true;
+ is.eq r28.val -5i128 into r29;
assert.eq r29 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;
+ cast true r1 into r2 as Optional__LDaTFs7R9lV;
+ cast false 0i8 into r3 as Optional__LDaTFs7R9lV;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0i8 into r5;
+ is.eq r5 -1i8 into r6;
+ assert.eq r6 true;
+ contains counter_i16__[false] into r7;
+ get.or_use counter_i16__[false] 0i16 into r8;
+ cast true r8 into r9 as Optional__29g5iOancAc;
+ cast false 0i16 into r10 as Optional__29g5iOancAc;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val 0i16 into r12;
+ is.eq r12 -2i16 into r13;
+ assert.eq r13 true;
+ contains counter_i32__[false] into r14;
+ get.or_use counter_i32__[false] 0i32 into r15;
+ cast true r15 into r16 as Optional__CI2lf3EvJat;
+ cast false 0i32 into r17 as Optional__CI2lf3EvJat;
+ ternary r14 r16 r17 into r18;
+ ternary r18.is_some r18.val 0i32 into r19;
+ is.eq r19 -3i32 into r20;
+ assert.eq r20 true;
+ contains counter_i64__[false] into r21;
+ get.or_use counter_i64__[false] 0i64 into r22;
+ cast true r22 into r23 as Optional__GfbJUku6XoG;
+ cast false 0i64 into r24 as Optional__GfbJUku6XoG;
+ ternary r21 r23 r24 into r25;
+ ternary r25.is_some r25.val 0i64 into r26;
+ is.eq r26 -4i64 into r27;
+ assert.eq r27 true;
+ contains counter_i128__[false] into r28;
+ get.or_use counter_i128__[false] 0i128 into r29;
+ cast true r29 into r30 as Optional__KL3cDgKUnaT;
+ cast false 0i128 into r31 as Optional__KL3cDgKUnaT;
+ ternary r28 r30 r31 into r32;
+ ternary r32.is_some r32.val 0i128 into r33;
+ is.eq r33 -5i128 into r34;
+ assert.eq r34 true;
+
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/compiler/storage/unsigned.out b/tests/expectations/compiler/storage/unsigned.out
index 8bfcc49d83e..82a52615287 100644
--- a/tests/expectations/compiler/storage/unsigned.out
+++ b/tests/expectations/compiler/storage/unsigned.out
@@ -69,80 +69,90 @@ function check1:
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 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;
- 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;
- 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;
- 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;
- 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;
+ cast true r1 into r2 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r3 as Optional__3aph2JMPtnA;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val 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;
+ cast true r7 into r8 as Optional__H2QyNyZ20sa;
+ cast false 0u16 into r9 as Optional__H2QyNyZ20sa;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val 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;
+ cast true r13 into r14 as Optional__JzunLORyB8U;
+ cast false 0u32 into r15 as Optional__JzunLORyB8U;
+ ternary r12 r14 r15 into r16;
+ assert.eq r16.is_some true;
+ is.eq r16.val 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;
+ cast true r19 into r20 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r21 as Optional__DmN5CQ9hzeK;
+ ternary r18 r20 r21 into r22;
+ assert.eq r22.is_some true;
+ is.eq r22.val 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;
+ cast true r25 into r26 as Optional__6A9ZdhLQa8N;
+ cast false 0u128 into r27 as Optional__6A9ZdhLQa8N;
+ ternary r24 r26 r27 into r28;
+ assert.eq r28.is_some true;
+ is.eq r28.val 5u128 into r29;
assert.eq r29 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;
+ cast true r1 into r2 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r3 as Optional__3aph2JMPtnA;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u8 into r5;
+ is.eq r5 1u8 into r6;
+ assert.eq r6 true;
+ contains counter_u16__[false] into r7;
+ get.or_use counter_u16__[false] 0u16 into r8;
+ cast true r8 into r9 as Optional__H2QyNyZ20sa;
+ cast false 0u16 into r10 as Optional__H2QyNyZ20sa;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val 0u16 into r12;
+ is.eq r12 2u16 into r13;
+ assert.eq r13 true;
+ contains counter_u32__[false] into r14;
+ get.or_use counter_u32__[false] 0u32 into r15;
+ cast true r15 into r16 as Optional__JzunLORyB8U;
+ cast false 0u32 into r17 as Optional__JzunLORyB8U;
+ ternary r14 r16 r17 into r18;
+ ternary r18.is_some r18.val 0u32 into r19;
+ is.eq r19 3u32 into r20;
+ assert.eq r20 true;
+ contains counter_u64__[false] into r21;
+ get.or_use counter_u64__[false] 0u64 into r22;
+ cast true r22 into r23 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r24 as Optional__DmN5CQ9hzeK;
+ ternary r21 r23 r24 into r25;
+ ternary r25.is_some r25.val 0u64 into r26;
+ is.eq r26 4u64 into r27;
+ assert.eq r27 true;
+ contains counter_u128__[false] into r28;
+ get.or_use counter_u128__[false] 0u128 into r29;
+ cast true r29 into r30 as Optional__6A9ZdhLQa8N;
+ cast false 0u128 into r31 as Optional__6A9ZdhLQa8N;
+ ternary r28 r30 r31 into r32;
+ ternary r32.is_some r32.val 0u128 into r33;
+ is.eq r33 5u128 into r34;
+ assert.eq r34 true;
+
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/compiler/storage/vector_ops.out b/tests/expectations/compiler/storage/vector_ops.out
index 59a960c5a2b..06ff8e0eedc 100644
--- a/tests/expectations/compiler/storage/vector_ops.out
+++ b/tests/expectations/compiler/storage/vector_ops.out
@@ -37,11 +37,12 @@ finalize pop:
ternary r1 r2 r0 into r3;
set r3 into vec__len__[false];
get.or_use vec__[r2] 0u8 into r4;
- ternary r1 r4 0u8 into r5;
- cast r1 r5 into r6 as Optional__3aph2JMPtnA;
- cast false 0u8 into r7 as Optional__3aph2JMPtnA;
- is.neq r6 r7 into r8;
- assert.eq r8 true;
+ cast true r4 into r5 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r6 as Optional__3aph2JMPtnA;
+ ternary r1 r5 r6 into r7;
+ cast false 0u8 into r8 as Optional__3aph2JMPtnA;
+ is.neq r7 r8 into r9;
+ assert.eq r9 true;
function get:
async get into r0;
@@ -51,11 +52,12 @@ finalize get:
get.or_use vec__len__[false] 0u32 into r0;
lt 3u32 r0 into r1;
get.or_use vec__[3u32] 0u8 into r2;
- ternary r1 r2 0u8 into r3;
- cast r1 r3 into r4 as Optional__3aph2JMPtnA;
- cast false 0u8 into r5 as Optional__3aph2JMPtnA;
- is.neq r4 r5 into r6;
- assert.eq r6 true;
+ cast true r2 into r3 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r4 as Optional__3aph2JMPtnA;
+ ternary r1 r3 r4 into r5;
+ cast false 0u8 into r6 as Optional__3aph2JMPtnA;
+ is.neq r5 r6 into r7;
+ assert.eq r7 true;
function set:
async set into r0;
diff --git a/tests/expectations/compiler/ternary/array_of_structs_ternary.out b/tests/expectations/compiler/ternary/array_of_structs_ternary.out
new file mode 100644
index 00000000000..516eb6f8eda
--- /dev/null
+++ b/tests/expectations/compiler/ternary/array_of_structs_ternary.out
@@ -0,0 +1,20 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+ z as u32;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as [Point; 4u32].private;
+ input r2 as [Point; 4u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [Point; 4u32].private;
+
+function select_element:
+ input r0 as boolean.private;
+ input r1 as [Point; 4u32].private;
+ input r2 as [Point; 4u32].private;
+ ternary r0 r1[0u32] r2[1u32] into r3;
+ output r3 as Point.private;
diff --git a/tests/expectations/compiler/ternary/array_ternary.out b/tests/expectations/compiler/ternary/array_ternary.out
new file mode 100644
index 00000000000..05f7a5dda05
--- /dev/null
+++ b/tests/expectations/compiler/ternary/array_ternary.out
@@ -0,0 +1,29 @@
+program test.aleo;
+
+function select_u32:
+ input r0 as boolean.private;
+ input r1 as [u32; 8u32].private;
+ input r2 as [u32; 8u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [u32; 8u32].private;
+
+function select_bool:
+ input r0 as boolean.private;
+ input r1 as [boolean; 4u32].private;
+ input r2 as [boolean; 4u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [boolean; 4u32].private;
+
+function select_field:
+ input r0 as boolean.private;
+ input r1 as [field; 3u32].private;
+ input r2 as [field; 3u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [field; 3u32].private;
+
+function select_nested:
+ input r0 as boolean.private;
+ input r1 as [[u8; 2u32]; 3u32].private;
+ input r2 as [[u8; 2u32]; 3u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [[u8; 2u32]; 3u32].private;
diff --git a/tests/expectations/compiler/ternary/finalize_array_of_structs_ternary.out b/tests/expectations/compiler/ternary/finalize_array_of_structs_ternary.out
new file mode 100644
index 00000000000..84c6bf27590
--- /dev/null
+++ b/tests/expectations/compiler/ternary/finalize_array_of_structs_ternary.out
@@ -0,0 +1,24 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+ z as u32;
+
+mapping arr:
+ key as u32.public;
+ value as [Point; 3u32].public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as [Point; 3u32].private;
+ input r2 as [Point; 3u32].private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as [Point; 3u32].public;
+ input r2 as [Point; 3u32].public;
+ ternary r0 r1 r2 into r3;
+ set r3 into arr[0u32];
diff --git a/tests/expectations/compiler/ternary/finalize_array_ternary.out b/tests/expectations/compiler/ternary/finalize_array_ternary.out
new file mode 100644
index 00000000000..fcc4bb8097a
--- /dev/null
+++ b/tests/expectations/compiler/ternary/finalize_array_ternary.out
@@ -0,0 +1,19 @@
+program test.aleo;
+
+mapping arr:
+ key as u32.public;
+ value as [u32; 4u32].public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as [u32; 4u32].private;
+ input r2 as [u32; 4u32].private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as [u32; 4u32].public;
+ input r2 as [u32; 4u32].public;
+ ternary r0 r1 r2 into r3;
+ set r3 into arr[0u32];
diff --git a/tests/expectations/compiler/ternary/finalize_nested_struct_ternary.out b/tests/expectations/compiler/ternary/finalize_nested_struct_ternary.out
new file mode 100644
index 00000000000..235fa6a28ec
--- /dev/null
+++ b/tests/expectations/compiler/ternary/finalize_nested_struct_ternary.out
@@ -0,0 +1,28 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+
+struct Segment:
+ lo as Point;
+ hi as Point;
+ tag as u32;
+
+mapping segs:
+ key as u32.public;
+ value as Segment.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as Segment.private;
+ input r2 as Segment.private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as Segment.public;
+ input r2 as Segment.public;
+ ternary r0 r1 r2 into r3;
+ set r3 into segs[0u32];
diff --git a/tests/expectations/compiler/ternary/finalize_primitive_ternary.out b/tests/expectations/compiler/ternary/finalize_primitive_ternary.out
new file mode 100644
index 00000000000..0e2832541bc
--- /dev/null
+++ b/tests/expectations/compiler/ternary/finalize_primitive_ternary.out
@@ -0,0 +1,39 @@
+program test.aleo;
+
+mapping u32_map:
+ key as u32.public;
+ value as u32.public;
+
+mapping field_map:
+ key as u32.public;
+ value as field.public;
+
+mapping addr_map:
+ key as u32.public;
+ value as address.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as u32.private;
+ input r2 as u32.private;
+ input r3 as field.private;
+ input r4 as field.private;
+ input r5 as address.private;
+ input r6 as address.private;
+ async update r0 r1 r2 r3 r4 r5 r6 into r7;
+ output r7 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as u32.public;
+ input r2 as u32.public;
+ input r3 as field.public;
+ input r4 as field.public;
+ input r5 as address.public;
+ input r6 as address.public;
+ ternary r0 r1 r2 into r7;
+ ternary r0 r3 r4 into r8;
+ ternary r0 r5 r6 into r9;
+ set r7 into u32_map[0u32];
+ set r8 into field_map[0u32];
+ set r9 into addr_map[0u32];
diff --git a/tests/expectations/compiler/ternary/finalize_struct_ternary.out b/tests/expectations/compiler/ternary/finalize_struct_ternary.out
new file mode 100644
index 00000000000..f5b0a213b0d
--- /dev/null
+++ b/tests/expectations/compiler/ternary/finalize_struct_ternary.out
@@ -0,0 +1,24 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+ z as u32;
+
+mapping points:
+ key as u32.public;
+ value as Point.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as Point.private;
+ input r2 as Point.private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as Point.public;
+ input r2 as Point.public;
+ ternary r0 r1 r2 into r3;
+ set r3 into points[0u32];
diff --git a/tests/expectations/compiler/ternary/identifier_ternary.out b/tests/expectations/compiler/ternary/identifier_ternary.out
new file mode 100644
index 00000000000..361541a67bf
--- /dev/null
+++ b/tests/expectations/compiler/ternary/identifier_ternary.out
@@ -0,0 +1,13 @@
+program test.aleo;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as identifier.private;
+ input r2 as identifier.private;
+ ternary r0 r1 r2 into r3;
+ output r3 as identifier.private;
+
+function select_literal:
+ input r0 as boolean.private;
+ ternary r0 'foo' 'bar' into r1;
+ output r1 as identifier.private;
diff --git a/tests/expectations/compiler/ternary/nested_struct_ternary.out b/tests/expectations/compiler/ternary/nested_struct_ternary.out
new file mode 100644
index 00000000000..1778e89a02d
--- /dev/null
+++ b/tests/expectations/compiler/ternary/nested_struct_ternary.out
@@ -0,0 +1,24 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+
+struct Segment:
+ lo as Point;
+ hi as Point;
+ tag as u32;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as Segment.private;
+ input r2 as Segment.private;
+ ternary r0 r1 r2 into r3;
+ output r3 as Segment.private;
+
+function select_inner:
+ input r0 as boolean.private;
+ input r1 as Segment.private;
+ input r2 as Segment.private;
+ ternary r0 r1.lo r2.hi into r3;
+ output r3 as Point.private;
diff --git a/tests/expectations/compiler/ternary/record_ternary.out b/tests/expectations/compiler/ternary/record_ternary.out
new file mode 100644
index 00000000000..660b09a3369
--- /dev/null
+++ b/tests/expectations/compiler/ternary/record_ternary.out
@@ -0,0 +1,14 @@
+program test.aleo;
+
+record Token:
+ owner as address.private;
+ amount as u64.private;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as Token.record;
+ input r2 as Token.record;
+ ternary r0 r1.owner r2.owner into r3;
+ ternary r0 r1.amount r2.amount into r4;
+ cast r3 r4 into r5 as Token.record;
+ output r5 as Token.record;
diff --git a/tests/expectations/compiler/ternary/struct_ternary.out b/tests/expectations/compiler/ternary/struct_ternary.out
new file mode 100644
index 00000000000..3659617e19e
--- /dev/null
+++ b/tests/expectations/compiler/ternary/struct_ternary.out
@@ -0,0 +1,13 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+ z as u32;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as Point.private;
+ input r2 as Point.private;
+ ternary r0 r1 r2 into r3;
+ output r3 as Point.private;
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..8f330d93d48 100644
--- a/tests/expectations/compiler/view/view_uses_storage_and_vector.out
+++ b/tests/expectations/compiler/view/view_uses_storage_and_vector.out
@@ -27,10 +27,11 @@ function dummy:
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;
+ cast true r1 into r2 as Optional__6wU7KHJhSvv;
+ cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r3 as Optional__6wU7KHJhSvv;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9 into r5;
+ output r5 as address.public;
view entry_count:
get.or_use entries__len__[false] 0u32 into r0;
@@ -41,10 +42,11 @@ view entry_at:
get.or_use entries__len__[false] 0u32 into r1;
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;
+ cast true r3 into r4 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r5 as Optional__DmN5CQ9hzeK;
+ ternary r2 r4 r5 into r6;
+ ternary r6.is_some r6.val 0u64 into r7;
+ output r7 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..1ea183efcfe 100644
--- a/tests/expectations/execution/array_write.out
+++ b/tests/expectations/execution/array_write.out
@@ -10,36 +10,23 @@ function some_assignments:
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;
+ cast 50u32 60u32 70u32 into r5 as [u32; 3u32];
+ ternary r0 r5 r4.y into r6;
+ cast 20u32 r4.y[1u32] r4.y[2u32] into r7 as [u32; 3u32];
+ cast r4.x r7 into r8 as S;
+ ternary r0 r4 r8 into r9;
+ ternary r1 20u32 r4.y[0u32] into r10;
+ ternary r1 30u32 r4.x into r11;
+ ternary r1 r6 r4.y into r12;
+ cast r10 r4.y[1u32] r4.y[2u32] into r13 as [u32; 3u32];
+ cast r4.x r13 into r14 as S;
+ ternary r1 r9 r14 into r15;
+ cast r11 r12 into r16 as S;
+ cast r11 r12 into r17 as S;
+ cast r11 r12 into r18 as S;
+ cast r11 r12 into r19 as S;
+ cast r2 1u32 2u32 r15.x r15.y[0u32] r15.y[1u32] r15.y[2u32] r16.x r17.y[0u32] r18.y[1u32] r19.y[2u32] into r20 as [u32; 11u32];
+ output r20 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..d58c175fe7e 100644
--- a/tests/expectations/execution/cast_coersion.out
+++ b/tests/expectations/execution/cast_coersion.out
@@ -12,12 +12,10 @@ function main:
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;
+ ternary r0 r4 r4 into r8;
+ ternary r0 r5 r7 into r9;
+ output r8 as foo.private;
output r9 as foo.private;
- output r11 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 39191a8780d..76810cdf05c 100644
--- a/tests/expectations/execution/complex_vector.out
+++ b/tests/expectations/execution/complex_vector.out
@@ -75,57 +75,60 @@ finalize test_vector_primitives_behavior:
get.or_use ids__len__[false] 0u32 into r12;
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;
+ cast true r14 into r15 as Optional__JzunLORyB8U;
+ cast false 0u32 into r16 as Optional__JzunLORyB8U;
+ ternary r13 r15 r16 into r17;
+ assert.eq r17.is_some true;
+ is.eq r17.val 20u32 into r18;
assert.eq r18 true;
- get.or_use ids__len__[false] 0u32 into r19;
- lt r0 r19 into r20;
- assert.eq r20 true;
+ assert.eq r17.is_some true;
+ is.eq r17.val 20u32 into r19;
+ assert.eq r19 true;
+ get.or_use ids__len__[false] 0u32 into r20;
+ lt r0 r20 into r21;
+ assert.eq r21 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;
+ get.or_use ids__len__[false] 0u32 into r22;
+ lt r0 r22 into r23;
+ get.or_use ids__[r0] 0u32 into r24;
+ cast true r24 into r25 as Optional__JzunLORyB8U;
+ cast false 0u32 into r26 as Optional__JzunLORyB8U;
+ ternary r23 r25 r26 into r27;
+ assert.eq r27.is_some true;
+ is.eq r27.val r1 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;
+ get.or_use ids__len__[false] 0u32 into r29;
+ lt 2u32 r29 into r30;
+ assert.eq r30 true;
+ get ids__[2u32] into r31;
+ sub r29 1u32 into r32;
+ get ids__[r32] into r33;
+ set r33 into ids__[2u32];
+ set r32 into ids__len__[false];
+ is.eq r31 30u32 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 r35 2u32 into r36;
+ assert.eq r36 true;
+ get.or_use ids__len__[false] 0u32 into r37;
+ gt r37 0u32 into r38;
+ sub.w r37 1u32 into r39;
+ ternary r38 r39 r37 into r40;
+ set r40 into ids__len__[false];
+ get.or_use ids__[r39] 0u32 into r41;
+ cast true r41 into r42 as Optional__JzunLORyB8U;
+ cast false 0u32 into r43 as Optional__JzunLORyB8U;
+ ternary r38 r42 r43 into r44;
+ assert.eq r44.is_some true;
+ is.eq r44.val r1 into r45;
+ assert.eq r45 true;
+ get.or_use ids__len__[false] 0u32 into r46;
+ is.eq r46 1u32 into r47;
+ assert.eq r47 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 r48;
+ is.eq r48 0u32 into r49;
+ assert.eq r49 true;
function test_vector_structs_behavior:
input r0 as u32.private;
@@ -154,41 +157,39 @@ 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;
- 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 true r14 into r15 as Optional__7G49nMxvEkY;
+ cast 0field 0field into r16 as Point;
+ cast false r16 into r17 as Optional__7G49nMxvEkY;
+ ternary r12 r15 r17 into r18;
+ assert.eq r18.is_some true;
+ add r18.val.x r18.val.y into r19;
+ is.eq r19 3field into r20;
+ add r18.val.x r18.val.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 true r30 into r31 as Optional__7G49nMxvEkY;
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;
+ cast false r32 into r33 as Optional__7G49nMxvEkY;
+ ternary r28 r31 r33 into r34;
+ assert.eq r34.is_some true;
+ is.eq r34.val.x 9field into r35;
+ assert.eq r35 true;
+ is.eq r34.val.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;
@@ -225,60 +226,46 @@ 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;
- 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;
+ cast true r22 into r23 as Optional__CrW6ZMYLUhu;
+ cast 0field 0field into r24 as Point;
+ cast r24 r24 into r25 as [Point; 2u32];
+ cast 0u32 r25 into r26 as Container;
+ cast false r26 into r27 as Optional__CrW6ZMYLUhu;
+ ternary r18 r23 r27 into r28;
+ assert.eq r28.is_some true;
+ is.eq r28.val.id 1u32 into r29;
+ is.eq r28.val.id 2u32 into r30;
+ or r29 r30 into r31;
+ assert.eq r31 true;
+ get.or_use containers__len__[false] 0u32 into r32;
+ lt r0 r32 into r33;
+ assert.eq r33 true;
+ cast 999field 999field into r34 as Point;
+ cast 33field 33field into r35 as Point;
+ cast r34 r35 into r36 as [Point; 2u32];
+ cast 99u32 r36 into r37 as Container;
+ set r37 into containers__[r0];
+ get.or_use containers__len__[false] 0u32 into r38;
+ lt r0 r38 into r39;
+ cast 0field 0field into r40 as Point;
+ cast r40 r40 into r41 as [Point; 2u32];
+ cast 0u32 r41 into r42 as Container;
+ get.or_use containers__[r0] r42 into r43;
+ cast true r43 into r44 as Optional__CrW6ZMYLUhu;
+ cast 0field 0field into r45 as Point;
+ cast r45 r45 into r46 as [Point; 2u32];
+ cast 0u32 r46 into r47 as Container;
+ cast false r47 into r48 as Optional__CrW6ZMYLUhu;
+ ternary r39 r44 r48 into r49;
+ assert.eq r49.is_some true;
+ is.eq r49.val.id 99u32 into r50;
+ assert.eq r50 true;
+ is.eq r49.val.points[0u32].x 999field into r51;
+ assert.eq r51 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 r52;
+ is.eq r52 0u32 into r53;
+ assert.eq r53 true;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/execution/counter_storage.out b/tests/expectations/execution/counter_storage.out
index 39283d63b43..440169a96f3 100644
--- a/tests/expectations/execution/counter_storage.out
+++ b/tests/expectations/execution/counter_storage.out
@@ -22,18 +22,20 @@ function increment:
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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u32 into r5;
+ add r5 1u32 into r6;
+ set r6 into counter__[false];
+ contains counter__[false] into r7;
+ get.or_use counter__[false] 0u32 into r8;
+ cast true r8 into r9 as Optional__JzunLORyB8U;
+ cast false 0u32 into r10 as Optional__JzunLORyB8U;
+ ternary r7 r9 r10 into r11;
+ assert.eq r11.is_some true;
+ is.eq r11.val r6 into r12;
+ assert.eq r12 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..829179b7301 100644
--- a/tests/expectations/execution/dynamic_call_future.out
+++ b/tests/expectations/execution/dynamic_call_future.out
@@ -18,11 +18,12 @@ finalize increment:
input r0 as u32.public;
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];
+ cast true r2 into r3 as Optional__JzunLORyB8U;
+ cast false 0u32 into r4 as Optional__JzunLORyB8U;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u32 into r6;
+ add r6 r0 into r7;
+ set r7 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..e7b5570041d 100644
--- a/tests/expectations/execution/dynamic_call_future_with_extra_args.out
+++ b/tests/expectations/execution/dynamic_call_future_with_extra_args.out
@@ -45,11 +45,12 @@ finalize main:
await r0;
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];
+ cast true r3 into r4 as Optional__JzunLORyB8U;
+ cast false 0u32 into r5 as Optional__JzunLORyB8U;
+ ternary r2 r4 r5 into r6;
+ ternary r6.is_some r6.val 0u32 into r7;
+ add r7 r1 into r8;
+ set r8 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 9f363623326..741ac93f0a2 100644
--- a/tests/expectations/execution/dynamic_call_multiple_same_target.out
+++ b/tests/expectations/execution/dynamic_call_multiple_same_target.out
@@ -20,11 +20,12 @@ finalize compute:
input r0 as u32.public;
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];
+ cast true r2 into r3 as Optional__JzunLORyB8U;
+ cast false 0u32 into r4 as Optional__JzunLORyB8U;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u32 into r6;
+ add r6 r0 into r7;
+ set r7 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..829179b7301 100644
--- a/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out
+++ b/tests/expectations/execution/dynamic_dispatch_intrinsic_future.out
@@ -18,11 +18,12 @@ finalize increment:
input r0 as u32.public;
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];
+ cast true r2 into r3 as Optional__JzunLORyB8U;
+ cast false 0u32 into r4 as Optional__JzunLORyB8U;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u32 into r6;
+ add r6 r0 into r7;
+ set r7 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..41a27a44f9e 100644
--- a/tests/expectations/execution/dynamic_storage_interface.out
+++ b/tests/expectations/execution/dynamic_storage_interface.out
@@ -25,15 +25,16 @@ finalize bump:
input r0 as u64.public;
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];
+ cast true r2 into r3 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r4 as Optional__DmN5CQ9hzeK;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u64 into r6;
+ add r6 1u64 into r7;
+ set r7 into counter__[false];
+ get.or_use entries__len__[false] 0u32 into r8;
+ add r8 1u32 into r9;
+ set r9 into entries__len__[false];
+ set r0 into entries__[r8];
function check_counter:
input r0 as field.private;
@@ -46,10 +47,11 @@ finalize check_counter:
input r1 as u64.public;
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;
+ cast true r3 into r4 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r5 as Optional__DmN5CQ9hzeK;
+ ternary r2 r4 r5 into r6;
+ assert.eq r6.is_some true;
+ assert.eq r6.val r1;
function check_entry:
input r0 as field.private;
@@ -65,10 +67,11 @@ finalize check_entry:
get.or_use.dynamic r0 'aleo' 'entries__len__'[false] 0u32 into r3 as u32;
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;
+ cast true r5 into r6 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r7 as Optional__DmN5CQ9hzeK;
+ ternary r4 r6 r7 into r8;
+ assert.eq r8.is_some true;
+ assert.eq r8.val r2;
function check_entry_oob:
input r0 as field.private;
@@ -82,11 +85,12 @@ finalize check_entry_oob:
get.or_use.dynamic r0 'aleo' 'entries__len__'[false] 0u32 into r2 as u32;
lt r1 r2 into r3;
get.or_use.dynamic r0 'aleo' 'entries__'[r1] 0u64 into r4 as u64;
- ternary r3 r4 0u64 into r5;
- cast r3 r5 into r6 as Optional__DmN5CQ9hzeK;
- cast false 0u64 into r7 as Optional__DmN5CQ9hzeK;
- is.eq r6 r7 into r8;
- assert.eq r8 true;
+ cast true r4 into r5 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r6 as Optional__DmN5CQ9hzeK;
+ ternary r3 r5 r6 into r7;
+ cast false 0u64 into r8 as Optional__DmN5CQ9hzeK;
+ is.eq r7 r8 into r9;
+ assert.eq r9 true;
function check_len:
input r0 as field.private;
diff --git a/tests/expectations/execution/external_storage.out b/tests/expectations/execution/external_storage.out
index 6b9736b4137..fc69823b46e 100644
--- a/tests/expectations/execution/external_storage.out
+++ b/tests/expectations/execution/external_storage.out
@@ -15,11 +15,12 @@ function c:
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];
+ cast true r1 into r2 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r3 as Optional__DmN5CQ9hzeK;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u64 into r5;
+ add r5 1u64 into r6;
+ set r6 into count__[false];
constructor:
assert.eq edition 0u16;
@@ -41,11 +42,12 @@ function d:
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];
+ cast true r1 into r2 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r3 as Optional__DmN5CQ9hzeK;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val 0u64 into r5;
+ add r5 2u64 into r6;
+ set r6 into count__[false];
constructor:
assert.eq edition 0u16;
@@ -75,37 +77,42 @@ finalize b:
await r1;
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 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;
+ cast true r3 into r4 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r5 as Optional__DmN5CQ9hzeK;
+ ternary r2 r4 r5 into r6;
+ assert.eq r6.is_some true;
+ is.eq r6.val 1u64 into r7;
+ assert.eq r7 true;
+ contains one_program.aleo/count__[false] into r8;
+ get.or_use one_program.aleo/count__[false] 0u64 into r9;
+ cast true r9 into r10 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r11 as Optional__DmN5CQ9hzeK;
+ ternary r8 r10 r11 into r12;
+ assert.eq r12.is_some true;
+ is.eq r12.val 2u64 into r13;
+ assert.eq r13 true;
+ contains zero_program.aleo/count__[false] into r14;
+ get.or_use zero_program.aleo/count__[false] 0u64 into r15;
+ cast true r15 into r16 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r17 as Optional__DmN5CQ9hzeK;
+ ternary r14 r16 r17 into r18;
+ assert.eq r18.is_some true;
+ contains one_program.aleo/count__[false] into r19;
+ get.or_use one_program.aleo/count__[false] 0u64 into r20;
+ cast true r20 into r21 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r22 as Optional__DmN5CQ9hzeK;
+ ternary r19 r21 r22 into r23;
+ assert.eq r23.is_some true;
+ add r18.val r23.val into r24;
+ set r24 into count__[false];
+ contains count__[false] into r25;
+ get.or_use count__[false] 0u64 into r26;
+ cast true r26 into r27 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r28 as Optional__DmN5CQ9hzeK;
+ ternary r25 r27 r28 into r29;
+ assert.eq r29.is_some true;
+ is.eq r29.val 3u64 into r30;
+ assert.eq r30 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..ae6c6556d15 100644
--- a/tests/expectations/execution/external_storage_vector.out
+++ b/tests/expectations/execution/external_storage_vector.out
@@ -93,78 +93,87 @@ finalize combine:
get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r6;
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;
- assert.eq r56 true;
+ cast true r8 into r9 as Optional__JzunLORyB8U;
+ cast false 0u32 into r10 as Optional__JzunLORyB8U;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val 0u32 into r12;
+ get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r13;
+ lt 0u32 r13 into r14;
+ get.or_use vec_program_b.aleo/numbers__[0u32] 0u32 into r15;
+ cast true r15 into r16 as Optional__JzunLORyB8U;
+ cast false 0u32 into r17 as Optional__JzunLORyB8U;
+ ternary r14 r16 r17 into r18;
+ ternary r18.is_some r18.val 0u32 into r19;
+ get.or_use sum_vec__len__[false] 0u32 into r20;
+ add r20 1u32 into r21;
+ set r21 into sum_vec__len__[false];
+ add r12 r19 into r22;
+ set r22 into sum_vec__[r20];
+ get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r23;
+ lt 1u32 r23 into r24;
+ get.or_use vec_program_a.aleo/numbers__[1u32] 0u32 into r25;
+ cast true r25 into r26 as Optional__JzunLORyB8U;
+ cast false 0u32 into r27 as Optional__JzunLORyB8U;
+ ternary r24 r26 r27 into r28;
+ ternary r28.is_some r28.val 0u32 into r29;
+ get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r30;
+ lt 1u32 r30 into r31;
+ get.or_use vec_program_b.aleo/numbers__[1u32] 0u32 into r32;
+ cast true r32 into r33 as Optional__JzunLORyB8U;
+ cast false 0u32 into r34 as Optional__JzunLORyB8U;
+ ternary r31 r33 r34 into r35;
+ ternary r35.is_some r35.val 0u32 into r36;
+ get.or_use sum_vec__len__[false] 0u32 into r37;
+ add r37 1u32 into r38;
+ set r38 into sum_vec__len__[false];
+ add r29 r36 into r39;
+ set r39 into sum_vec__[r37];
+ get.or_use vec_program_a.aleo/numbers__len__[false] 0u32 into r40;
+ lt 2u32 r40 into r41;
+ get.or_use vec_program_a.aleo/numbers__[2u32] 0u32 into r42;
+ cast true r42 into r43 as Optional__JzunLORyB8U;
+ cast false 0u32 into r44 as Optional__JzunLORyB8U;
+ ternary r41 r43 r44 into r45;
+ ternary r45.is_some r45.val 0u32 into r46;
+ get.or_use vec_program_b.aleo/numbers__len__[false] 0u32 into r47;
+ lt 2u32 r47 into r48;
+ get.or_use vec_program_b.aleo/numbers__[2u32] 0u32 into r49;
+ cast true r49 into r50 as Optional__JzunLORyB8U;
+ cast false 0u32 into r51 as Optional__JzunLORyB8U;
+ ternary r48 r50 r51 into r52;
+ ternary r52.is_some r52.val 0u32 into r53;
+ get.or_use sum_vec__len__[false] 0u32 into r54;
+ add r54 1u32 into r55;
+ set r55 into sum_vec__len__[false];
+ add r46 r53 into r56;
+ set r56 into sum_vec__[r54];
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;
+ lt 0u32 r57 into r58;
+ get.or_use sum_vec__[0u32] 0u32 into r59;
+ cast true r59 into r60 as Optional__JzunLORyB8U;
+ cast false 0u32 into r61 as Optional__JzunLORyB8U;
+ ternary r58 r60 r61 into r62;
+ assert.eq r62.is_some true;
+ is.eq r62.val 11u32 into r63;
+ assert.eq r63 true;
+ get.or_use sum_vec__len__[false] 0u32 into r64;
+ lt 1u32 r64 into r65;
+ get.or_use sum_vec__[1u32] 0u32 into r66;
+ cast true r66 into r67 as Optional__JzunLORyB8U;
+ cast false 0u32 into r68 as Optional__JzunLORyB8U;
+ ternary r65 r67 r68 into r69;
+ assert.eq r69.is_some true;
+ is.eq r69.val 22u32 into r70;
+ assert.eq r70 true;
+ get.or_use sum_vec__len__[false] 0u32 into r71;
+ lt 2u32 r71 into r72;
+ get.or_use sum_vec__[2u32] 0u32 into r73;
+ cast true r73 into r74 as Optional__JzunLORyB8U;
+ cast false 0u32 into r75 as Optional__JzunLORyB8U;
+ ternary r72 r74 r75 into r76;
+ assert.eq r76.is_some true;
+ is.eq r76.val 3u32 into r77;
+ assert.eq r77 true;
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..3fe7ede3187 100644
--- a/tests/expectations/execution/flattened_function_and_inline_matches.out
+++ b/tests/expectations/execution/flattened_function_and_inline_matches.out
@@ -19,16 +19,12 @@ closure foo:
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;
+ ternary r5 r0 r8 into r10;
+ ternary r5 r1 r9 into r11;
+ ternary r5 r4 r4 into r12;
+ output r10 as u8;
+ output r11 as u8;
+ output r12 as Data;
function bar:
input r0 as boolean.private;
@@ -43,21 +39,13 @@ function bar:
call foo r8.a r7 r8 into r15 r16 r17;
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 r17 into r20;
+ ternary r0 r9 r18 into r21;
+ ternary r0 r10 r19 into r22;
+ ternary r0 r11 r20 into r23;
+ output r21 as u8.private;
+ output r22 as u8.private;
+ output r23 as Data.private;
closure floo:
input r0 as u8;
@@ -70,16 +58,12 @@ closure floo:
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;
+ ternary r5 r0 r8 into r10;
+ ternary r5 r1 r9 into r11;
+ ternary r5 r4 r4 into r12;
+ output r10 as u8;
+ output r11 as u8;
+ output r12 as Data;
function blar:
input r0 as boolean.private;
@@ -94,21 +78,13 @@ function blar:
call floo r8.a r7 r8 into r15 r16 r17;
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 r17 into r20;
+ ternary r0 r9 r18 into r21;
+ ternary r0 r10 r19 into r22;
+ ternary r0 r11 r20 into r23;
+ output r21 as u8.private;
+ output r22 as u8.private;
+ output r23 as Data.private;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/execution/implicit_option_wrapping.out b/tests/expectations/execution/implicit_option_wrapping.out
index a34ae737c30..5f0a1797423 100644
--- a/tests/expectations/execution/implicit_option_wrapping.out
+++ b/tests/expectations/execution/implicit_option_wrapping.out
@@ -37,10 +37,11 @@ function basic_implicit_argument:
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;
+ cast true 10u8 into r1 as Optional__3aph2JMPtnA;
+ cast false 0u8 into r2 as Optional__3aph2JMPtnA;
+ ternary r0 r1 r2 into r3;
+ ternary r3.is_some r3.val 42u8 into r4;
+ output r4 as u8.private;
function basic_implicit_reassignment:
cast false 0u8 into r0 as Optional__3aph2JMPtnA;
@@ -92,30 +93,18 @@ function complex_implicit_ternary:
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 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;
+ cast true r8 into r9 as Optional__90gnFMeDKTp;
+ cast false 0u8 into r10 as Optional__3aph2JMPtnA;
+ cast r10 into r11 as Foo;
+ cast false r11 into r12 as Optional__DH9PtMwOkLt;
+ cast r12 r12 into r13 as [Optional__DH9PtMwOkLt; 2u32];
+ cast r13 into r14 as Wrapper;
+ cast false r14 into r15 as Optional__90gnFMeDKTp;
+ ternary r0 r9 r15 into r16;
+ assert.eq r16.is_some true;
+ assert.eq r16.val.arr[0u32].is_some true;
+ ternary r16.val.arr[0u32].val.x.is_some r16.val.arr[0u32].val.x.val 69u8 into r17;
+ output r17 as u8.private;
function complex_implicit_reassignment:
cast true 7u8 into r0 as Optional__3aph2JMPtnA;
diff --git a/tests/expectations/execution/simple_vector.out b/tests/expectations/execution/simple_vector.out
index 72e78202fc8..c81b66932c8 100644
--- a/tests/expectations/execution/simple_vector.out
+++ b/tests/expectations/execution/simple_vector.out
@@ -38,101 +38,107 @@ finalize test_vector_ops:
get.or_use vec__len__[false] 0u32 into r10;
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;
+ cast true r12 into r13 as Optional__JzunLORyB8U;
+ cast false 0u32 into r14 as Optional__JzunLORyB8U;
+ ternary r11 r13 r14 into r15;
+ assert.eq r15.is_some true;
+ is.eq r15.val 20u32 into r16;
+ assert.eq r16 true;
+ get.or_use vec__len__[false] 0u32 into r17;
+ lt 1u32 r17 into r18;
+ assert.eq r18 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;
- assert.eq r23 true;
- get.or_use vec__len__[false] 0u32 into r24;
- lt 0u32 r24 into r25;
+ get.or_use vec__len__[false] 0u32 into r19;
+ lt 1u32 r19 into r20;
+ get.or_use vec__[1u32] 0u32 into r21;
+ cast true r21 into r22 as Optional__JzunLORyB8U;
+ cast false 0u32 into r23 as Optional__JzunLORyB8U;
+ ternary r20 r22 r23 into r24;
+ assert.eq r24.is_some true;
+ is.eq r24.val 25u32 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;
- assert.eq r29 true;
- get.or_use vec__len__[false] 0u32 into r30;
- is.eq r30 2u32 into r31;
+ get.or_use vec__len__[false] 0u32 into r26;
+ lt 0u32 r26 into r27;
+ assert.eq r27 true;
+ get vec__[0u32] into r28;
+ sub r26 1u32 into r29;
+ get vec__[r29] into r30;
+ set r30 into vec__[0u32];
+ set r29 into vec__len__[false];
+ is.eq r28 10u32 into r31;
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 r32 2u32 into r33;
+ assert.eq r33 true;
+ get.or_use vec__len__[false] 0u32 into r34;
+ lt 0u32 r34 into r35;
+ get.or_use vec__[0u32] 0u32 into r36;
+ cast true r36 into r37 as Optional__JzunLORyB8U;
+ cast false 0u32 into r38 as Optional__JzunLORyB8U;
+ ternary r35 r37 r38 into r39;
+ assert.eq r39.is_some true;
+ is.eq r39.val 30u32 into r40;
+ assert.eq r40 true;
+ get.or_use vec__len__[false] 0u32 into r41;
+ lt 1u32 r41 into r42;
+ get.or_use vec__[1u32] 0u32 into r43;
+ cast true r43 into r44 as Optional__JzunLORyB8U;
+ cast false 0u32 into r45 as Optional__JzunLORyB8U;
+ ternary r42 r44 r45 into r46;
+ assert.eq r46.is_some true;
+ is.eq r46.val 25u32 into r47;
+ assert.eq r47 true;
+ get.or_use vec__len__[false] 0u32 into r48;
+ gt r48 0u32 into r49;
+ sub.w r48 1u32 into r50;
+ ternary r49 r50 r48 into r51;
+ set r51 into vec__len__[false];
+ get.or_use vec__[r50] 0u32 into r52;
+ cast true r52 into r53 as Optional__JzunLORyB8U;
+ cast false 0u32 into r54 as Optional__JzunLORyB8U;
+ ternary r49 r53 r54 into r55;
+ assert.eq r55.is_some true;
+ is.eq r55.val 25u32 into r56;
+ assert.eq r56 true;
+ get.or_use vec__len__[false] 0u32 into r57;
+ is.eq r57 1u32 into r58;
+ assert.eq r58 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;
+ get.or_use vec__len__[false] 0u32 into r59;
+ is.eq r59 0u32 into r60;
+ assert.eq r60 true;
+ get.or_use vec__len__[false] 0u32 into r61;
+ gt r61 0u32 into r62;
+ sub.w r61 1u32 into r63;
+ ternary r62 r63 r61 into r64;
+ set r64 into vec__len__[false];
+ get.or_use vec__[r63] 0u32 into r65;
+ cast true r65 into r66 as Optional__JzunLORyB8U;
+ cast false 0u32 into r67 as Optional__JzunLORyB8U;
+ ternary r62 r66 r67 into r68;
+ cast false 0u32 into r69 as Optional__JzunLORyB8U;
+ is.eq r68 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];
+ get.or_use vec__len__[false] 0u32 into r71;
+ add r71 1u32 into r72;
set r72 into vec__len__[false];
- is.eq r71 99u32 into r74;
+ set 99u32 into vec__[r71];
+ get.or_use vec__len__[false] 0u32 into r73;
+ is.eq r73 1u32 into r74;
assert.eq r74 true;
get.or_use vec__len__[false] 0u32 into r75;
- is.eq r75 0u32 into r76;
+ lt 0u32 r75 into r76;
assert.eq r76 true;
+ get vec__[0u32] into r77;
+ sub r75 1u32 into r78;
+ get vec__[r78] into r79;
+ set r79 into vec__[0u32];
+ set r78 into vec__len__[false];
+ is.eq r77 99u32 into r80;
+ assert.eq r80 true;
+ get.or_use vec__len__[false] 0u32 into r81;
+ is.eq r81 0u32 into r82;
+ assert.eq r82 true;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/execution/ternary_array.out b/tests/expectations/execution/ternary_array.out
new file mode 100644
index 00000000000..993af0287c3
--- /dev/null
+++ b/tests/expectations/execution/ternary_array.out
@@ -0,0 +1,36 @@
+program test.aleo;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as [u32; 4u32].private;
+ input r2 as [u32; 4u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [u32; 4u32].private;
+
+function select_element:
+ input r0 as boolean.private;
+ input r1 as [u32; 4u32].private;
+ input r2 as [u32; 4u32].private;
+ ternary r0 r1[0u32] r2[3u32] into r3;
+ output r3 as u32.private;
+
+constructor:
+ assert.eq edition 0u16;
+status: success
+output: [
+ 1u32,
+ 2u32,
+ 3u32,
+ 4u32
+]
+status: success
+output: [
+ 10u32,
+ 20u32,
+ 30u32,
+ 40u32
+]
+status: success
+output: 1u32
+status: success
+output: 40u32
diff --git a/tests/expectations/execution/ternary_array_of_structs.out b/tests/expectations/execution/ternary_array_of_structs.out
new file mode 100644
index 00000000000..44058a2f918
--- /dev/null
+++ b/tests/expectations/execution/ternary_array_of_structs.out
@@ -0,0 +1,19 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as [Point; 3u32].private;
+ input r2 as [Point; 3u32].private;
+ ternary r0 r1 r2 into r3;
+ output r3 as [Point; 3u32].private;
+
+constructor:
+ assert.eq edition 0u16;
+status: failed: Process authorization failed: Stack authorization failed: 'test.aleo/select' expects 3 inputs, but 0 were provided.
+output: ()
+status: failed: Process authorization failed: Stack authorization failed: 'test.aleo/select' expects 3 inputs, but 0 were provided.
+output: ()
diff --git a/tests/expectations/execution/ternary_finalize_array.out b/tests/expectations/execution/ternary_finalize_array.out
new file mode 100644
index 00000000000..6de88771eef
--- /dev/null
+++ b/tests/expectations/execution/ternary_finalize_array.out
@@ -0,0 +1,102 @@
+program test.aleo;
+
+mapping arr:
+ key as u32.public;
+ value as [u32; 4u32].public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as [u32; 4u32].private;
+ input r2 as [u32; 4u32].private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as [u32; 4u32].public;
+ input r2 as [u32; 4u32].public;
+ ternary r0 r1 r2 into r3;
+ set r3 into arr[0u32];
+
+constructor:
+ assert.eq edition 0u16;
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au10pkk9kruqcf4wwkcgw327yt2kjcwfs4324exruzd865sdjvfn5psfrprm9",
+ "program": "test.aleo",
+ "function": "update",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "5788076078069325365116526170890381083335655384248901206797311585743413226660field",
+ "value": "ciphertext1qyqpa9vxnk3z7l38whhy7qdy96sar0q0let7k9jymvm4f9tzqym3wzgaljc78"
+ },
+ {
+ "type": "private",
+ "id": "2772775864247200453411464693947812117095033892747925378532858849340441754520field",
+ "value": "ciphertext1qgqts45068tgcyeqafaatyek9gqp80tn839aezl4m7klygrmat0mxremaywvylewhh3gv2rp38h57094fqgmsha630ea2dxxltt755kpzyzk3hdr"
+ },
+ {
+ "type": "private",
+ "id": "5628137406336727663608351670973541703385044726613665502081358600494333603784field",
+ "value": "ciphertext1qgq9rrs868qp0lzwnjwk3xxgfy3hkz4j7udaxnlnk7kcx0ly0cr0gr74l4aylue5p0qtxl7ukkjk04jdh76lvkly3n30gzctjpuk8efppq4xugqa"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "2810703563601415641321075707897325322383171494030428241788733997897175125430field",
+ "value": "{\n program_id: test.aleo,\n function_name: update,\n arguments: [\n true,\n [\n 1u32,\n 2u32,\n 3u32,\n 4u32\n],\n [\n 10u32,\n 20u32,\n 30u32,\n 40u32\n]\n ]\n}"
+ }
+ ],
+ "tpk": "5460101671977983421557592666570386705801849939677836799006538765561915017623group",
+ "tcm": "728412264949564638132993146697805541764296730203779013289928905175905438777field",
+ "scm": "8070038252336801788430955234770168017245981837685970604500139303656345480593field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au1zsvzxs3eplgxqdd7gx86cfsf9ypwhyvfgnh4r9vt457703n8jypsgw4xgq",
+ "program": "test.aleo",
+ "function": "update",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "2221428585244985451873723737591253065723921376234299971954892218879294788517field",
+ "value": "ciphertext1qyqfgg8q6efhuuqfzk4g9efc3h0lhu07jv0qdm75504xru2yedrfspqaenqlx"
+ },
+ {
+ "type": "private",
+ "id": "6523637845731324951602491677738999559696408535802899856812729345829708975362field",
+ "value": "ciphertext1qgqgnmlxmlkmdnl3ja470urckllpj2c7el87ml6nvuhx25ump5yskqut50ytg33400q62tguz53zfq7xrt6xs9k836857z9mqac9zzxnp5jdevn0"
+ },
+ {
+ "type": "private",
+ "id": "2485160534285848027854918305107064764806239545302231616168485060604714999861field",
+ "value": "ciphertext1qgqt57u9aaqf06xzh3hktl66fdwt6augqtge7gfcmqz8we20hj90zrd69uh6tdh0v5fxlh8xu7t6xa6k9fd2yslfujfw0yp9un8e3hjdpq9wrdu0"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "146678646694763250793441139482343291849496384427062094287613698019575858696field",
+ "value": "{\n program_id: test.aleo,\n function_name: update,\n arguments: [\n false,\n [\n 1u32,\n 2u32,\n 3u32,\n 4u32\n],\n [\n 10u32,\n 20u32,\n 30u32,\n 40u32\n]\n ]\n}"
+ }
+ ],
+ "tpk": "932902105444239517980596565691908870668917795454138192289088332646102103453group",
+ "tcm": "4534045528378062984919568849257618109414740950022974037600860386185923697801field",
+ "scm": "919245366506739687912770902847963156737622134026017456623407014687413152843field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
diff --git a/tests/expectations/execution/ternary_finalize_array_of_structs.out b/tests/expectations/execution/ternary_finalize_array_of_structs.out
new file mode 100644
index 00000000000..b4ad7c9d44e
--- /dev/null
+++ b/tests/expectations/execution/ternary_finalize_array_of_structs.out
@@ -0,0 +1,34 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+
+mapping arr:
+ key as u32.public;
+ value as [Point; 2u32].public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as [Point; 2u32].private;
+ input r2 as [Point; 2u32].private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as [Point; 2u32].public;
+ input r2 as [Point; 2u32].public;
+ ternary r0 r1 r2 into r3;
+ set r3 into arr[0u32];
+
+constructor:
+ assert.eq edition 0u16;
+verified: false
+status: none
+null
+
+verified: false
+status: none
+null
+
diff --git a/tests/expectations/execution/ternary_finalize_identifier.out b/tests/expectations/execution/ternary_finalize_identifier.out
new file mode 100644
index 00000000000..7d3a4e5e2a0
--- /dev/null
+++ b/tests/expectations/execution/ternary_finalize_identifier.out
@@ -0,0 +1,172 @@
+program test.aleo;
+
+mapping names:
+ key as u32.public;
+ value as identifier.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as identifier.private;
+ input r2 as identifier.private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as identifier.public;
+ input r2 as identifier.public;
+ ternary r0 r1 r2 into r3;
+ set r3 into names[0u32];
+
+function update_literal:
+ input r0 as boolean.private;
+ async update_literal r0 into r1;
+ output r1 as test.aleo/update_literal.future;
+
+finalize update_literal:
+ input r0 as boolean.public;
+ ternary r0 'foo' 'bar' into r1;
+ set r1 into names[1u32];
+
+constructor:
+ assert.eq edition 0u16;
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au18dmq4yq7yq52jd2j5jnda083wcy8wchkhhfgd74je9lgx6kpvggqqcrggu",
+ "program": "test.aleo",
+ "function": "update",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "5788076078069325365116526170890381083335655384248901206797311585743413226660field",
+ "value": "ciphertext1qyqpa9vxnk3z7l38whhy7qdy96sar0q0let7k9jymvm4f9tzqym3wzgaljc78"
+ },
+ {
+ "type": "private",
+ "id": "1439167525809218038861059171294104004931701877514313288705905391682328193196field",
+ "value": "ciphertext1qgqwkd5n2ksy6pd9a94atyek3t799wnth39dezm46xk7wqrmul0mxrumukwt7aewhn3gd6rq38h57094fqgmsha630ea2dxxltt755kpzyp78k7q"
+ },
+ {
+ "type": "private",
+ "id": "3086305753584772711529993081983385260117771717085432739114549546104471270698field",
+ "value": "ciphertext1qgqggmstt9hw3520nt7k0xxg4y0mkpa27utdxnmn4xkhs8lyvqr0gre4ltaye6e5q8qtx07ukkjk04jdh76lvkly3n30gzctjpuk8efppqwu9qvu"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "7663441313080116302254941342758659087589520569601872676628792557379351735924field",
+ "value": "{\n program_id: test.aleo,\n function_name: update,\n arguments: [\n true,\n 'alpha',\n 'beta'\n ]\n}"
+ }
+ ],
+ "tpk": "5460101671977983421557592666570386705801849939677836799006538765561915017623group",
+ "tcm": "728412264949564638132993146697805541764296730203779013289928905175905438777field",
+ "scm": "8070038252336801788430955234770168017245981837685970604500139303656345480593field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au13atr3mgq7yc0nqq820fs2e3tmvtvmujjeydj3ev27sm8l9s5esys3pgapx",
+ "program": "test.aleo",
+ "function": "update",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "2221428585244985451873723737591253065723921376234299971954892218879294788517field",
+ "value": "ciphertext1qyqfgg8q6efhuuqfzk4g9efc3h0lhu07jv0qdm75504xru2yedrfspqaenqlx"
+ },
+ {
+ "type": "private",
+ "id": "7148906806245412098911345256793871777679254639842982517998475286166744420731field",
+ "value": "ciphertext1qgqtenl2vwmh0stkjad70urczla4j2qkfl87ml7ntqh95vumpgyskqltnayty0340tq6tmgmz53zfq7xrt6xs9k836857z9mqac9zzxnp5xtvyae"
+ },
+ {
+ "type": "private",
+ "id": "4974773412765112117847163655229793432441089271813374637587150605471268928887field",
+ "value": "ciphertext1qgqw6kufwlhx00krht8kfl664dv06ayqqtxf7gdceyzxc320n690zrg69jh69th0tvfxl88xu7t6xa6k9fd2yslfujfw0yp9un8e3hjdpqlxrtsu"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "2745742251460194601565371754835101058398739823658794460657734538432232701173field",
+ "value": "{\n program_id: test.aleo,\n function_name: update,\n arguments: [\n false,\n 'alpha',\n 'beta'\n ]\n}"
+ }
+ ],
+ "tpk": "932902105444239517980596565691908870668917795454138192289088332646102103453group",
+ "tcm": "4534045528378062984919568849257618109414740950022974037600860386185923697801field",
+ "scm": "919245366506739687912770902847963156737622134026017456623407014687413152843field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au1aq7h6ya507j5m0qyepk7s0fgf8h6auf9k8sck89wl4ld3dvpkupsutqj4q",
+ "program": "test.aleo",
+ "function": "update_literal",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "1164466250655422358970072755651215377893413288091016670138383573126770161633field",
+ "value": "ciphertext1qyq9kf4fy4s0ptm3px83t5ue2487wj8y0k5xwflq2z7l9xg6mgcg7psy2shz9"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "6141879647953646560591059325726904458397671724178618260143738878248300463324field",
+ "value": "{\n program_id: test.aleo,\n function_name: update_literal,\n arguments: [\n true\n ]\n}"
+ }
+ ],
+ "tpk": "4435182414136183130262225239916202916754973933386625330210643288715243337617group",
+ "tcm": "850142209754567944166319722250339409916042600529796761178314418357457776240field",
+ "scm": "6880818639492575671344261738303779886148232533224264415621330306086981058639field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au1wauev3nea4kfnzhtvtvwacsg98xaztlsq7q2zqyrk3xt6vg0syqs3srqug",
+ "program": "test.aleo",
+ "function": "update_literal",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "7797948029680443844685245907087613415608275199424837997072284275895424518815field",
+ "value": "ciphertext1qyq2a8leff4teege7sk05p25f506zhj5pzryvpu0qk2cxkttvku9uzq40rs04"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "4206319376157558231921524447582982241224298521948954338139959569651443173168field",
+ "value": "{\n program_id: test.aleo,\n function_name: update_literal,\n arguments: [\n false\n ]\n}"
+ }
+ ],
+ "tpk": "2522887999940374826698654126645535027810075514268095352773581615775304946572group",
+ "tcm": "1804215531425177261902248378301676324038494384555044966602196492783038681001field",
+ "scm": "3550506856681924294077270970505890072867776518575635158053618611174190675462field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
diff --git a/tests/expectations/execution/ternary_finalize_nested_struct.out b/tests/expectations/execution/ternary_finalize_nested_struct.out
new file mode 100644
index 00000000000..7e16ea6d712
--- /dev/null
+++ b/tests/expectations/execution/ternary_finalize_nested_struct.out
@@ -0,0 +1,39 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+
+struct Segment:
+ lo as Point;
+ hi as Point;
+ tag as u32;
+
+mapping segs:
+ key as u32.public;
+ value as Segment.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as Segment.private;
+ input r2 as Segment.private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as Segment.public;
+ input r2 as Segment.public;
+ ternary r0 r1 r2 into r3;
+ set r3 into segs[0u32];
+
+constructor:
+ assert.eq edition 0u16;
+verified: false
+status: none
+null
+
+verified: false
+status: none
+null
+
diff --git a/tests/expectations/execution/ternary_finalize_primitives.out b/tests/expectations/execution/ternary_finalize_primitives.out
new file mode 100644
index 00000000000..3b6074326b5
--- /dev/null
+++ b/tests/expectations/execution/ternary_finalize_primitives.out
@@ -0,0 +1,50 @@
+program test.aleo;
+
+mapping u32_map:
+ key as u32.public;
+ value as u32.public;
+
+mapping field_map:
+ key as u32.public;
+ value as field.public;
+
+mapping addr_map:
+ key as u32.public;
+ value as address.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as u32.private;
+ input r2 as u32.private;
+ input r3 as field.private;
+ input r4 as field.private;
+ input r5 as address.private;
+ input r6 as address.private;
+ async update r0 r1 r2 r3 r4 r5 r6 into r7;
+ output r7 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as u32.public;
+ input r2 as u32.public;
+ input r3 as field.public;
+ input r4 as field.public;
+ input r5 as address.public;
+ input r6 as address.public;
+ ternary r0 r1 r2 into r7;
+ ternary r0 r3 r4 into r8;
+ ternary r0 r5 r6 into r9;
+ set r7 into u32_map[0u32];
+ set r8 into field_map[0u32];
+ set r9 into addr_map[0u32];
+
+constructor:
+ assert.eq edition 0u16;
+verified: false
+status: none
+null
+
+verified: false
+status: none
+null
+
diff --git a/tests/expectations/execution/ternary_finalize_struct.out b/tests/expectations/execution/ternary_finalize_struct.out
new file mode 100644
index 00000000000..e0ecc416835
--- /dev/null
+++ b/tests/expectations/execution/ternary_finalize_struct.out
@@ -0,0 +1,107 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+ z as u32;
+
+mapping points:
+ key as u32.public;
+ value as Point.public;
+
+function update:
+ input r0 as boolean.private;
+ input r1 as Point.private;
+ input r2 as Point.private;
+ async update r0 r1 r2 into r3;
+ output r3 as test.aleo/update.future;
+
+finalize update:
+ input r0 as boolean.public;
+ input r1 as Point.public;
+ input r2 as Point.public;
+ ternary r0 r1 r2 into r3;
+ set r3 into points[0u32];
+
+constructor:
+ assert.eq edition 0u16;
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au1zegv5snn3j0rz9y794d2dfn3emvy475wqhclskr3d8mv4dfezu8q9nlsdr",
+ "program": "test.aleo",
+ "function": "update",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "5788076078069325365116526170890381083335655384248901206797311585743413226660field",
+ "value": "ciphertext1qyqpa9vxnk3z7l38whhy7qdy96sar0q0let7k9jymvm4f9tzqym3wzgaljc78"
+ },
+ {
+ "type": "private",
+ "id": "8012994327075155355954502487739930006825886795324491107372556624443042910555field",
+ "value": "ciphertext1qgqtgan0h0hmk5sh7a4atsah50ulc79733htu0kpwrv7pchqjwdqsqymu4wv7aewhn3gd6rq38h57094fqgmsha630ea2dxxltt755kpzyuqzfws"
+ },
+ {
+ "type": "private",
+ "id": "6330390621912511164473154253003699640886843381595964125250500981067664019105field",
+ "value": "ciphertext1qgqymth8htv5vw6x88lx0jzfcvwxt3huc7atjq4lfrvhzq22phq5szekl2a9e6e5q8qtx07ukkjk04jdh76lvkly3n30gzctjpuk8efppqe706eu"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "8295767687606704316542738259843150342389746357175977727669612846775402516063field",
+ "value": "{\n program_id: test.aleo,\n function_name: update,\n arguments: [\n true,\n {\n x: 1u32,\n y: 2u32,\n z: 3u32\n},\n {\n x: 10u32,\n y: 20u32,\n z: 30u32\n}\n ]\n}"
+ }
+ ],
+ "tpk": "5460101671977983421557592666570386705801849939677836799006538765561915017623group",
+ "tcm": "728412264949564638132993146697805541764296730203779013289928905175905438777field",
+ "scm": "8070038252336801788430955234770168017245981837685970604500139303656345480593field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
+verified: true
+status: accepted
+{
+ "transitions": [
+ {
+ "id": "au1j44rgp5sv7usp3zfhpfmmdky4a3ldv65ck8tzxtj0y5n7zc3acqqr6k3dm",
+ "program": "test.aleo",
+ "function": "update",
+ "inputs": [
+ {
+ "type": "private",
+ "id": "2221428585244985451873723737591253065723921376234299971954892218879294788517field",
+ "value": "ciphertext1qyqfgg8q6efhuuqfzk4g9efc3h0lhu07jv0qdm75504xru2yedrfspqaenqlx"
+ },
+ {
+ "type": "private",
+ "id": "6943650824126578117594137055490118154207178813406525151276041070929574502599field",
+ "value": "ciphertext1qgqgvr78eyrxvg8n54d70u8c5739m6qc2a87al7ntzc0ssvmz55skphtnuyvy0340tq6tmgmz53zfq7xrt6xs9k836857z9mqac9zzxnp5h0z8mg"
+ },
+ {
+ "type": "private",
+ "id": "3353006865580847565572238867684827988665827194185416063168874026194827177943field",
+ "value": "ciphertext1qgqtdxm9m9vuvfa6t8gxgt7uc326wv7n6fhcd4qrdycx2fa4ffz5vzgm93hm9th0tvfxl88xu7t6xa6k9fd2yslfujfw0yp9un8e3hjdpqwtaaz6"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "future",
+ "id": "3039053206297800367751182040637302311305642427428001047446192019781707454202field",
+ "value": "{\n program_id: test.aleo,\n function_name: update,\n arguments: [\n false,\n {\n x: 1u32,\n y: 2u32,\n z: 3u32\n},\n {\n x: 10u32,\n y: 20u32,\n z: 30u32\n}\n ]\n}"
+ }
+ ],
+ "tpk": "932902105444239517980596565691908870668917795454138192289088332646102103453group",
+ "tcm": "4534045528378062984919568849257618109414740950022974037600860386185923697801field",
+ "scm": "919245366506739687912770902847963156737622134026017456623407014687413152843field"
+ }
+ ],
+ "global_state_root": "sr1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gk0xu"
+}
+
diff --git a/tests/expectations/execution/ternary_identifier.out b/tests/expectations/execution/ternary_identifier.out
new file mode 100644
index 00000000000..ee585bb8e38
--- /dev/null
+++ b/tests/expectations/execution/ternary_identifier.out
@@ -0,0 +1,24 @@
+program test.aleo;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as identifier.private;
+ input r2 as identifier.private;
+ ternary r0 r1 r2 into r3;
+ output r3 as identifier.private;
+
+function select_literal:
+ input r0 as boolean.private;
+ ternary r0 'foo' 'bar' into r1;
+ output r1 as identifier.private;
+
+constructor:
+ assert.eq edition 0u16;
+status: success
+output: 'foo'
+status: success
+output: 'bar'
+status: success
+output: 'foo'
+status: success
+output: 'bar'
diff --git a/tests/expectations/execution/ternary_nested_struct.out b/tests/expectations/execution/ternary_nested_struct.out
new file mode 100644
index 00000000000..43511da991b
--- /dev/null
+++ b/tests/expectations/execution/ternary_nested_struct.out
@@ -0,0 +1,24 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+
+struct Segment:
+ lo as Point;
+ hi as Point;
+ tag as u32;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as Segment.private;
+ input r2 as Segment.private;
+ ternary r0 r1 r2 into r3;
+ output r3 as Segment.private;
+
+constructor:
+ assert.eq edition 0u16;
+status: failed: Process authorization failed: Stack authorization failed: 'test.aleo/select' expects 3 inputs, but 0 were provided.
+output: ()
+status: failed: Process authorization failed: Stack authorization failed: 'test.aleo/select' expects 3 inputs, but 0 were provided.
+output: ()
diff --git a/tests/expectations/execution/ternary_primitives.out b/tests/expectations/execution/ternary_primitives.out
new file mode 100644
index 00000000000..783a227b773
--- /dev/null
+++ b/tests/expectations/execution/ternary_primitives.out
@@ -0,0 +1,27 @@
+program test.aleo;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as u32.private;
+ input r2 as u32.private;
+ input r3 as boolean.private;
+ input r4 as boolean.private;
+ input r5 as field.private;
+ input r6 as field.private;
+ input r7 as address.private;
+ input r8 as address.private;
+ ternary r0 r1 r2 into r9;
+ ternary r0 r3 r4 into r10;
+ ternary r0 r5 r6 into r11;
+ ternary r0 r7 r8 into r12;
+ output r9 as u32.private;
+ output r10 as boolean.private;
+ output r11 as field.private;
+ output r12 as address.private;
+
+constructor:
+ assert.eq edition 0u16;
+status: failed: Process authorization failed: Stack authorization failed: 'test.aleo/select' expects 9 inputs, but 0 were provided.
+output: ()
+status: failed: Process authorization failed: Stack authorization failed: 'test.aleo/select' expects 9 inputs, but 0 were provided.
+output: ()
diff --git a/tests/expectations/execution/ternary_record.out b/tests/expectations/execution/ternary_record.out
new file mode 100644
index 00000000000..ccddcb3cfb5
--- /dev/null
+++ b/tests/expectations/execution/ternary_record.out
@@ -0,0 +1,31 @@
+program test.aleo;
+
+record Token:
+ owner as address.private;
+ amount as u64.private;
+
+function mint_and_select:
+ input r0 as boolean.private;
+ input r1 as u64.private;
+ input r2 as u64.private;
+ ternary r0 self.signer self.signer into r3;
+ ternary r0 r1 r2 into r4;
+ cast r3 r4 into r5 as Token.record;
+ output r5 as Token.record;
+
+constructor:
+ assert.eq edition 0u16;
+status: success
+output: {
+ owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
+ amount: 5u64.private,
+ _nonce: 8218867679990633212833661036399141430271176731424338343548727700581834261256group.public,
+ _version: 1u8.public
+}
+status: success
+output: {
+ owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,
+ amount: 50u64.private,
+ _nonce: 8218867679990633212833661036399141430271176731424338343548727700581834261256group.public,
+ _version: 1u8.public
+}
diff --git a/tests/expectations/execution/ternary_struct.out b/tests/expectations/execution/ternary_struct.out
new file mode 100644
index 00000000000..b170d4f251a
--- /dev/null
+++ b/tests/expectations/execution/ternary_struct.out
@@ -0,0 +1,20 @@
+program test.aleo;
+
+struct Point:
+ x as u32;
+ y as u32;
+ z as u32;
+
+function select:
+ input r0 as boolean.private;
+ input r1 as Point.private;
+ input r2 as Point.private;
+ ternary r0 r1 r2 into r3;
+ output r3 as Point.private;
+
+constructor:
+ assert.eq edition 0u16;
+status: success
+output: {x: 1u32, y: 2u32, z: 3u32}
+status: success
+output: {x: 10u32, y: 20u32, z: 30u32}
diff --git a/tests/expectations/execution/various_storage_types.out b/tests/expectations/execution/various_storage_types.out
index cd00b3ff6f8..32bb8e61cbf 100644
--- a/tests/expectations/execution/various_storage_types.out
+++ b/tests/expectations/execution/various_storage_types.out
@@ -88,32 +88,36 @@ finalize unsigned_integers:
set 10u32 into counter_u32__[false];
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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val 10u32 into r5;
+ assert.eq r5 true;
+ contains counter_u32__[false] into r6;
+ get.or_use counter_u32__[false] 0u32 into r7;
+ cast true r7 into r8 as Optional__JzunLORyB8U;
+ cast false 0u32 into r9 as Optional__JzunLORyB8U;
+ ternary r6 r8 r9 into r10;
+ ternary r10.is_some r10.val 0u32 into r11;
+ add r11 5u32 into r12;
+ set r12 into counter_u32__[false];
+ contains counter_u32__[false] into r13;
+ get.or_use counter_u32__[false] 0u32 into r14;
+ cast true r14 into r15 as Optional__JzunLORyB8U;
+ cast false 0u32 into r16 as Optional__JzunLORyB8U;
+ ternary r13 r15 r16 into r17;
+ assert.eq r17.is_some true;
+ is.eq r17.val 15u32 into r18;
+ assert.eq r18 true;
+ contains counter_u32__[false] into r19;
+ get.or_use counter_u32__[false] 0u32 into r20;
+ cast true r20 into r21 as Optional__JzunLORyB8U;
+ cast false 0u32 into r22 as Optional__JzunLORyB8U;
+ ternary r19 r21 r22 into r23;
+ ternary r23.is_some r23.val 99u32 into r24;
+ is.eq r24 15u32 into r25;
+ assert.eq r25 true;
function signed_integers:
async signed_integers into r0;
@@ -123,32 +127,36 @@ finalize signed_integers:
set -5i32 into counter_i32__[false];
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;
+ cast true r1 into r2 as Optional__CI2lf3EvJat;
+ cast false 0i32 into r3 as Optional__CI2lf3EvJat;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val -5i32 into r5;
+ assert.eq r5 true;
+ contains counter_i32__[false] into r6;
+ get.or_use counter_i32__[false] 0i32 into r7;
+ cast true r7 into r8 as Optional__CI2lf3EvJat;
+ cast false 0i32 into r9 as Optional__CI2lf3EvJat;
+ ternary r6 r8 r9 into r10;
+ ternary r10.is_some r10.val 0i32 into r11;
+ sub r11 3i32 into r12;
+ set r12 into counter_i32__[false];
+ contains counter_i32__[false] into r13;
+ get.or_use counter_i32__[false] 0i32 into r14;
+ cast true r14 into r15 as Optional__CI2lf3EvJat;
+ cast false 0i32 into r16 as Optional__CI2lf3EvJat;
+ ternary r13 r15 r16 into r17;
+ assert.eq r17.is_some true;
+ is.eq r17.val -8i32 into r18;
+ assert.eq r18 true;
+ contains counter_i32__[false] into r19;
+ get.or_use counter_i32__[false] 0i32 into r20;
+ cast true r20 into r21 as Optional__CI2lf3EvJat;
+ cast false 0i32 into r22 as Optional__CI2lf3EvJat;
+ ternary r19 r21 r22 into r23;
+ ternary r23.is_some r23.val 1i32 into r24;
+ is.eq r24 -8i32 into r25;
+ assert.eq r25 true;
function primitive_types:
async primitive_types into r0;
@@ -162,67 +170,76 @@ finalize primitive_types:
set aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into address_val__[false];
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 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;
- 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;
- 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;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ assert.eq r4.is_some true;
+ is.eq r4.val true into r5;
+ assert.eq r5 true;
+ contains scalar_val__[false] into r6;
+ get.or_use scalar_val__[false] 0scalar into r7;
+ cast true r7 into r8 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r9 as Optional__9y0TjJOC4Nk;
+ ternary r6 r8 r9 into r10;
+ assert.eq r10.is_some true;
+ is.eq r10.val 2scalar into r11;
+ assert.eq r11 true;
+ contains field_val__[false] into r12;
+ get.or_use field_val__[false] 0field into r13;
+ cast true r13 into r14 as Optional__7o6su2Uhzht;
+ cast false 0field into r15 as Optional__7o6su2Uhzht;
+ ternary r12 r14 r15 into r16;
+ assert.eq r16.is_some true;
+ is.eq r16.val 21field into r17;
+ assert.eq r17 true;
+ contains group_val__[false] into r18;
+ get.or_use group_val__[false] 0group into r19;
+ cast true r19 into r20 as Optional__9SsWRr2WG5s;
+ cast false 0group into r21 as Optional__9SsWRr2WG5s;
+ ternary r18 r20 r21 into r22;
+ assert.eq r22.is_some true;
+ is.eq r22.val 0group into r23;
+ assert.eq r23 true;
+ contains address_val__[false] into r24;
+ get.or_use address_val__[false] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r25;
+ cast true r25 into r26 as Optional__6wU7KHJhSvv;
+ cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r27 as Optional__6wU7KHJhSvv;
+ ternary r24 r26 r27 into r28;
assert.eq r28.is_some true;
- not r28.val into r29;
- set r29 into flag__[false];
+ is.eq r28.val aleo10qerras5799u6k7rjtc9y3hcwxuykr45qra7x7dp6jgnc0923czqm0lgta into r29;
+ assert.eq r29 true;
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;
+ cast true r31 into r32 as Optional__ATAkdHctJwx;
+ cast false false into r33 as Optional__ATAkdHctJwx;
+ ternary r30 r32 r33 into r34;
+ assert.eq r34.is_some true;
+ not r34.val into r35;
+ set r35 into flag__[false];
+ contains flag__[false] into r36;
+ get.or_use flag__[false] false into r37;
+ cast true r37 into r38 as Optional__ATAkdHctJwx;
+ cast false false into r39 as Optional__ATAkdHctJwx;
+ ternary r36 r38 r39 into r40;
+ assert.eq r40.is_some true;
+ is.eq r40.val false into r41;
+ assert.eq r41 true;
+ contains flag__[false] into r42;
+ get.or_use flag__[false] false into r43;
+ cast true r43 into r44 as Optional__ATAkdHctJwx;
+ cast false false into r45 as Optional__ATAkdHctJwx;
+ ternary r42 r44 r45 into r46;
+ ternary r46.is_some r46.val true into r47;
+ is.eq r47 false into r48;
+ assert.eq r48 true;
+ contains field_val__[false] into r49;
+ get.or_use field_val__[false] 0field into r50;
+ cast true r50 into r51 as Optional__7o6su2Uhzht;
+ cast false 0field into r52 as Optional__7o6su2Uhzht;
+ ternary r49 r51 r52 into r53;
+ ternary r53.is_some r53.val 0field into r54;
+ is.eq r54 21field into r55;
+ assert.eq r55 true;
function structs_and_arrays:
async structs_and_arrays into r0;
@@ -246,126 +263,76 @@ finalize structs_and_arrays:
cast r11 0u8 into r12 as Container;
cast r12 r12 into r13 as [Container; 2u32];
get.or_use containers__[false] r13 into r14;
- cast 0field 0field into r15 as Point;
- cast r15 r15 into r16 as [Point; 2u32];
- cast r16 0u8 into r17 as Container;
- cast r17 r17 into r18 as [Container; 2u32];
- ternary r9 r14[0u32].points[0u32].x r18[0u32].points[0u32].x into r19;
- ternary r9 r14[0u32].points[0u32].y r18[0u32].points[0u32].y into r20;
- cast r19 r20 into r21 as Point;
- ternary r9 r14[0u32].points[1u32].x r18[0u32].points[1u32].x into r22;
- ternary r9 r14[0u32].points[1u32].y r18[0u32].points[1u32].y into r23;
- cast r22 r23 into r24 as Point;
- cast r21 r24 into r25 as [Point; 2u32];
- ternary r9 r14[0u32].label r18[0u32].label into r26;
- cast r25 r26 into r27 as Container;
- ternary r9 r14[1u32].points[0u32].x r18[1u32].points[0u32].x into r28;
- ternary r9 r14[1u32].points[0u32].y r18[1u32].points[0u32].y into r29;
- cast r28 r29 into r30 as Point;
- ternary r9 r14[1u32].points[1u32].x r18[1u32].points[1u32].x into r31;
- ternary r9 r14[1u32].points[1u32].y r18[1u32].points[1u32].y into r32;
- cast r31 r32 into r33 as Point;
- cast r30 r33 into r34 as [Point; 2u32];
- 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 r39 true;
- is.eq r38.val[1u32].points[0u32].y 6field into r40;
- assert.eq r40 true;
- is.eq r38.val[0u32].label 10u8 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;
- 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;
- 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;
- 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;
- 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 true r14 into r15 as Optional__FxQoVJO2IeJ;
+ cast 0field 0field into r16 as Point;
+ cast r16 r16 into r17 as [Point; 2u32];
+ cast r17 0u8 into r18 as Container;
+ cast r18 r18 into r19 as [Container; 2u32];
+ cast false r19 into r20 as Optional__FxQoVJO2IeJ;
+ ternary r9 r15 r20 into r21;
+ assert.eq r21.is_some true;
+ is.eq r21.val[0u32].points[0u32].x 1field into r22;
+ assert.eq r22 true;
+ is.eq r21.val[1u32].points[0u32].y 6field into r23;
+ assert.eq r23 true;
+ is.eq r21.val[0u32].label 10u8 into r24;
+ assert.eq r24 true;
+ is.eq r21.val[1u32].label 20u8 into r25;
+ assert.eq r25 true;
+ cast 9field r21.val[0u32].points[0u32].y into r26 as Point;
+ cast r26 r21.val[0u32].points[1u32] into r27 as [Point; 2u32];
+ cast r27 r21.val[0u32].label into r28 as Container;
+ cast r28 r21.val[1u32] into r29 as [Container; 2u32];
+ set r29 into containers__[false];
+ contains containers__[false] into r30;
+ cast 0field 0field into r31 as Point;
+ cast r31 r31 into r32 as [Point; 2u32];
+ cast r32 0u8 into r33 as Container;
+ cast r33 r33 into r34 as [Container; 2u32];
+ get.or_use containers__[false] r34 into r35;
+ cast true r35 into r36 as Optional__FxQoVJO2IeJ;
+ cast 0field 0field into r37 as Point;
+ cast r37 r37 into r38 as [Point; 2u32];
+ cast r38 0u8 into r39 as Container;
+ cast r39 r39 into r40 as [Container; 2u32];
+ cast false r40 into r41 as Optional__FxQoVJO2IeJ;
+ ternary r30 r36 r41 into r42;
+ assert.eq r42.is_some true;
+ is.eq r42.val[0u32].points[0u32].x 9field into r43;
+ assert.eq r43 true;
+ is.eq r42.val[1u32].points[0u32].x 5field into r44;
+ assert.eq r44 true;
+ contains points_array__[false] into r45;
+ cast 0field 0field into r46 as Point;
+ cast r46 r46 r46 into r47 as [Point; 3u32];
+ get.or_use points_array__[false] r47 into r48;
+ cast true r48 into r49 as Optional__E9UBDm0DXxP;
+ cast 0field 0field into r50 as Point;
+ cast r50 r50 r50 into r51 as [Point; 3u32];
+ cast false r51 into r52 as Optional__E9UBDm0DXxP;
+ ternary r45 r49 r52 into r53;
+ assert.eq r53.is_some true;
+ is.eq r53.val[0u32].x 1field into r54;
+ assert.eq r54 true;
+ is.eq r53.val[2u32].y 6field into r55;
+ assert.eq r55 true;
+ cast r53.val[1u32].x r53.val[1u32].y into r56 as Point;
+ add r56.x 10field into r57;
+ cast r57 r53.val[1u32].y into r58 as Point;
+ cast r53.val[0u32] r58 r53.val[2u32] into r59 as [Point; 3u32];
+ set r59 into points_array__[false];
+ contains points_array__[false] into r60;
+ cast 0field 0field into r61 as Point;
+ cast r61 r61 r61 into r62 as [Point; 3u32];
+ get.or_use points_array__[false] r62 into r63;
+ cast true r63 into r64 as Optional__E9UBDm0DXxP;
+ cast 0field 0field into r65 as Point;
+ cast r65 r65 r65 into r66 as [Point; 3u32];
+ cast false r66 into r67 as Optional__E9UBDm0DXxP;
+ ternary r60 r64 r67 into r68;
+ assert.eq r68.is_some true;
+ is.eq r68.val[1u32].x 13field into r69;
+ assert.eq r69 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 5bd0c42745b..46dfe3fe29c 100644
--- a/tests/expectations/execution/various_storage_types_none.out
+++ b/tests/expectations/execution/various_storage_types_none.out
@@ -67,41 +67,46 @@ function integers_none_behavior:
finalize integers_none_behavior:
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;
- cast false 0u32 into r4 as Optional__JzunLORyB8U;
- is.eq r3 r4 into r5;
- assert.eq r5 true;
- 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;
+ cast true r1 into r2 as Optional__JzunLORyB8U;
+ cast false 0u32 into r3 as Optional__JzunLORyB8U;
+ ternary r0 r2 r3 into r4;
+ cast false 0u32 into r5 as Optional__JzunLORyB8U;
+ is.eq r4 r5 into r6;
+ assert.eq r6 true;
+ contains counter_u32__[false] into r7;
+ get.or_use counter_u32__[false] 0u32 into r8;
+ cast true r8 into r9 as Optional__JzunLORyB8U;
+ cast false 0u32 into r10 as Optional__JzunLORyB8U;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val 99u32 into r12;
+ is.eq r12 99u32 into r13;
+ assert.eq r13 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 r14;
+ get.or_use counter_u32__[false] 0u32 into r15;
+ cast true r15 into r16 as Optional__JzunLORyB8U;
+ cast false 0u32 into r17 as Optional__JzunLORyB8U;
+ ternary r14 r16 r17 into r18;
+ assert.eq r18.is_some true;
+ is.eq r18.val 42u32 into r19;
+ assert.eq r19 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 r20;
+ get.or_use counter_u32__[false] 0u32 into r21;
+ cast true r21 into r22 as Optional__JzunLORyB8U;
+ cast false 0u32 into r23 as Optional__JzunLORyB8U;
+ ternary r20 r22 r23 into r24;
+ cast false 0u32 into r25 as Optional__JzunLORyB8U;
+ is.eq r24 r25 into r26;
+ assert.eq r26 true;
+ contains counter_u32__[false] into r27;
+ get.or_use counter_u32__[false] 0u32 into r28;
+ cast true r28 into r29 as Optional__JzunLORyB8U;
+ cast false 0u32 into r30 as Optional__JzunLORyB8U;
+ ternary r27 r29 r30 into r31;
+ ternary r31.is_some r31.val 7u32 into r32;
+ is.eq r32 7u32 into r33;
+ assert.eq r33 true;
function primitives_none_behavior:
async primitives_none_behavior into r0;
@@ -110,73 +115,82 @@ function primitives_none_behavior:
finalize primitives_none_behavior:
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;
- cast false false into r4 as Optional__ATAkdHctJwx;
- is.eq r3 r4 into r5;
- assert.eq r5 true;
- 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;
+ cast true r1 into r2 as Optional__ATAkdHctJwx;
+ cast false false into r3 as Optional__ATAkdHctJwx;
+ ternary r0 r2 r3 into r4;
+ cast false false into r5 as Optional__ATAkdHctJwx;
+ is.eq r4 r5 into r6;
+ assert.eq r6 true;
+ contains flag__[false] into r7;
+ get.or_use flag__[false] false into r8;
+ cast true r8 into r9 as Optional__ATAkdHctJwx;
+ cast false false into r10 as Optional__ATAkdHctJwx;
+ ternary r7 r9 r10 into r11;
+ ternary r11.is_some r11.val true into r12;
+ is.eq r12 true into r13;
+ assert.eq r13 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 r14;
+ get.or_use flag__[false] false into r15;
+ cast true r15 into r16 as Optional__ATAkdHctJwx;
+ cast false false into r17 as Optional__ATAkdHctJwx;
+ ternary r14 r16 r17 into r18;
+ assert.eq r18.is_some true;
+ is.eq r18.val false into r19;
+ assert.eq r19 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 r20;
+ get.or_use flag__[false] false into r21;
+ cast true r21 into r22 as Optional__ATAkdHctJwx;
+ cast false false into r23 as Optional__ATAkdHctJwx;
+ ternary r20 r22 r23 into r24;
+ cast false false into r25 as Optional__ATAkdHctJwx;
+ is.eq r24 r25 into r26;
+ assert.eq r26 true;
+ contains flag__[false] into r27;
+ get.or_use flag__[false] false into r28;
+ cast true r28 into r29 as Optional__ATAkdHctJwx;
+ cast false false into r30 as Optional__ATAkdHctJwx;
+ ternary r27 r29 r30 into r31;
+ ternary r31.is_some r31.val false into r32;
+ is.eq r32 false into r33;
+ assert.eq r33 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;
+ contains scalar_val__[false] into r34;
+ get.or_use scalar_val__[false] 0scalar into r35;
+ cast true r35 into r36 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r37 as Optional__9y0TjJOC4Nk;
+ ternary r34 r36 r37 into r38;
+ cast false 0scalar into r39 as Optional__9y0TjJOC4Nk;
is.eq r38 r39 into r40;
assert.eq r40 true;
+ contains field_val__[false] into r41;
+ get.or_use field_val__[false] 0field into r42;
+ cast true r42 into r43 as Optional__7o6su2Uhzht;
+ cast false 0field into r44 as Optional__7o6su2Uhzht;
+ ternary r41 r43 r44 into r45;
+ cast false 0field into r46 as Optional__7o6su2Uhzht;
+ is.eq r45 r46 into r47;
+ assert.eq r47 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;
- 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;
+ contains scalar_val__[false] into r48;
+ get.or_use scalar_val__[false] 0scalar into r49;
+ cast true r49 into r50 as Optional__9y0TjJOC4Nk;
+ cast false 0scalar into r51 as Optional__9y0TjJOC4Nk;
+ ternary r48 r50 r51 into r52;
+ assert.eq r52.is_some true;
+ is.eq r52.val 1scalar into r53;
+ assert.eq r53 true;
+ contains field_val__[false] into r54;
+ get.or_use field_val__[false] 0field into r55;
+ cast true r55 into r56 as Optional__7o6su2Uhzht;
+ cast false 0field into r57 as Optional__7o6su2Uhzht;
+ ternary r54 r56 r57 into r58;
+ assert.eq r58.is_some true;
+ is.eq r58.val 5field into r59;
+ assert.eq r59 true;
function arrays_none_behavior:
async arrays_none_behavior into r0;
@@ -216,19 +230,14 @@ finalize arrays_none_behavior:
cast 0field 0field into r23 as Point;
cast r23 r23 into r24 as [Point; 2u32];
get.or_use points__[false] r24 into r25;
- cast 0field 0field into r26 as Point;
- cast r26 r26 into r27 as [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 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 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;
+ cast true r25 into r26 as Optional__CIFHV93i7jy;
+ cast 0field 0field into r27 as Point;
+ cast r27 r27 into r28 as [Point; 2u32];
+ cast false r28 into r29 as Optional__CIFHV93i7jy;
+ ternary r22 r26 r29 into r30;
+ assert.eq r30.is_some true;
+ is.eq r30.val[1u32].x 9field into r31;
+ assert.eq r31 true;
function structs_none_behavior:
async structs_none_behavior into r0;
@@ -244,39 +253,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 0u8 r7 into r8 as Container;
+ ternary r2.is_some r2.val r8 into r9;
+ 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;
+ cast true r12 into r14 as Optional__CrW6ZMYLUhu;
+ assert.eq r14.is_some true;
+ is.eq r14.val.point.y 10field into r15;
+ assert.eq r15 true;
+ cast 9field 9field into r16 as Point;
+ cast 9u8 r16 into r17 as Container;
+ set r17 into container__[false];
+ contains container__[false] into r18;
+ cast 0field 0field into r19 as Point;
+ cast 0u8 r19 into r20 as Container;
+ get.or_use container__[false] r20 into r21;
+ cast true r21 into r22 as Optional__CrW6ZMYLUhu;
+ cast 0field 0field into r23 as Point;
+ cast 0u8 r23 into r24 as Container;
+ cast false r24 into r25 as Optional__CrW6ZMYLUhu;
+ ternary r18 r22 r25 into r26;
+ assert.eq r26.is_some true;
+ is.eq r26.val.point.x 9field into r27;
+ assert.eq r27 true;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/execution/vector_oob.out b/tests/expectations/execution/vector_oob.out
index 5ec39eb068d..4c3244ecd2a 100644
--- a/tests/expectations/execution/vector_oob.out
+++ b/tests/expectations/execution/vector_oob.out
@@ -24,11 +24,12 @@ finalize oob_get:
get.or_use vec__len__[false] 0u32 into r2;
lt 0u32 r2 into r3;
get.or_use vec__[0u32] 0u32 into r4;
- ternary r3 r4 0u32 into r5;
- cast r3 r5 into r6 as Optional__JzunLORyB8U;
- cast false 0u32 into r7 as Optional__JzunLORyB8U;
- is.eq r6 r7 into r8;
- assert.eq r8 true;
+ cast true r4 into r5 as Optional__JzunLORyB8U;
+ cast false 0u32 into r6 as Optional__JzunLORyB8U;
+ ternary r3 r5 r6 into r7;
+ cast false 0u32 into r8 as Optional__JzunLORyB8U;
+ is.eq r7 r8 into r9;
+ assert.eq r9 true;
function oob_set:
async oob_set into r0;
@@ -77,11 +78,12 @@ finalize oob_pop:
ternary r3 r4 r2 into r5;
set r5 into vec__len__[false];
get.or_use vec__[r4] 0u32 into r6;
- ternary r3 r6 0u32 into r7;
- cast r3 r7 into r8 as Optional__JzunLORyB8U;
- cast false 0u32 into r9 as Optional__JzunLORyB8U;
- is.eq r8 r9 into r10;
- assert.eq r10 true;
+ cast true r6 into r7 as Optional__JzunLORyB8U;
+ cast false 0u32 into r8 as Optional__JzunLORyB8U;
+ ternary r3 r7 r8 into r9;
+ cast false 0u32 into r10 as Optional__JzunLORyB8U;
+ is.eq r9 r10 into r11;
+ assert.eq r11 true;
constructor:
assert.eq edition 0u16;
diff --git a/tests/expectations/execution/view_aggregate.out b/tests/expectations/execution/view_aggregate.out
index d01f2590cbb..e9301c432ef 100644
--- a/tests/expectations/execution/view_aggregate.out
+++ b/tests/expectations/execution/view_aggregate.out
@@ -24,24 +24,27 @@ view sum_first_three:
get.or_use entries__len__[false] 0u32 into r0;
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;
+ cast true r2 into r3 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r4 as Optional__DmN5CQ9hzeK;
+ ternary r1 r3 r4 into r5;
+ ternary r5.is_some r5.val 0u64 into r6;
+ get.or_use entries__len__[false] 0u32 into r7;
+ lt 1u32 r7 into r8;
+ get.or_use entries__[1u32] 0u64 into r9;
+ cast true r9 into r10 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r11 as Optional__DmN5CQ9hzeK;
+ ternary r8 r10 r11 into r12;
+ ternary r12.is_some r12.val 0u64 into r13;
+ add r6 r13 into r14;
+ get.or_use entries__len__[false] 0u32 into r15;
+ lt 2u32 r15 into r16;
+ get.or_use entries__[2u32] 0u64 into r17;
+ cast true r17 into r18 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r19 as Optional__DmN5CQ9hzeK;
+ ternary r16 r18 r19 into r20;
+ ternary r20.is_some r20.val 0u64 into r21;
+ add r14 r21 into r22;
+ output r22 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..daba8c01d8f 100644
--- a/tests/expectations/execution/view_storage_and_vector.out
+++ b/tests/expectations/execution/view_storage_and_vector.out
@@ -27,10 +27,11 @@ function dummy:
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;
+ cast true r1 into r2 as Optional__6wU7KHJhSvv;
+ cast false aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r3 as Optional__6wU7KHJhSvv;
+ ternary r0 r2 r3 into r4;
+ ternary r4.is_some r4.val aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r5;
+ output r5 as address.public;
view entry_count:
get.or_use entries__len__[false] 0u32 into r0;
@@ -41,20 +42,22 @@ view entry_at:
get.or_use entries__len__[false] 0u32 into r1;
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;
+ cast true r3 into r4 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r5 as Optional__DmN5CQ9hzeK;
+ ternary r2 r4 r5 into r6;
+ ternary r6.is_some r6.val 0u64 into r7;
+ output r7 as u64.public;
view entry_at_oob:
input r0 as u32.public;
get.or_use entries__len__[false] 0u32 into r1;
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;
+ cast true r3 into r4 as Optional__DmN5CQ9hzeK;
+ cast false 0u64 into r5 as Optional__DmN5CQ9hzeK;
+ ternary r2 r4 r5 into r6;
+ ternary r6.is_some r6.val 99u64 into r7;
+ output r7 as u64.public;
constructor:
assert.eq edition 0u16;
diff --git a/tests/tests/compiler/ternary/array_of_structs_ternary.leo b/tests/tests/compiler/ternary/array_of_structs_ternary.leo
new file mode 100644
index 00000000000..60ce79dc063
--- /dev/null
+++ b/tests/tests/compiler/ternary/array_of_structs_ternary.leo
@@ -0,0 +1,15 @@
+struct Point {
+ x: u32,
+ y: u32,
+ z: u32,
+}
+
+program test.aleo {
+ fn select(s: bool, a: [Point; 4], b: [Point; 4]) -> [Point; 4] {
+ return s ? a : b;
+ }
+
+ fn select_element(s: bool, a: [Point; 4], b: [Point; 4]) -> Point {
+ return s ? a[0u32] : b[1u32];
+ }
+}
diff --git a/tests/tests/compiler/ternary/array_ternary.leo b/tests/tests/compiler/ternary/array_ternary.leo
new file mode 100644
index 00000000000..779dc992660
--- /dev/null
+++ b/tests/tests/compiler/ternary/array_ternary.leo
@@ -0,0 +1,17 @@
+program test.aleo {
+ fn select_u32(s: bool, a: [u32; 8], b: [u32; 8]) -> [u32; 8] {
+ return s ? a : b;
+ }
+
+ fn select_bool(s: bool, a: [bool; 4], b: [bool; 4]) -> [bool; 4] {
+ return s ? a : b;
+ }
+
+ fn select_field(s: bool, a: [field; 3], b: [field; 3]) -> [field; 3] {
+ return s ? a : b;
+ }
+
+ fn select_nested(s: bool, a: [[u8; 2]; 3], b: [[u8; 2]; 3]) -> [[u8; 2]; 3] {
+ return s ? a : b;
+ }
+}
diff --git a/tests/tests/compiler/ternary/finalize_array_of_structs_ternary.leo b/tests/tests/compiler/ternary/finalize_array_of_structs_ternary.leo
new file mode 100644
index 00000000000..8d0fa1d9174
--- /dev/null
+++ b/tests/tests/compiler/ternary/finalize_array_of_structs_ternary.leo
@@ -0,0 +1,16 @@
+struct Point {
+ x: u32,
+ y: u32,
+ z: u32,
+}
+
+program test.aleo {
+ mapping arr: u32 => [Point; 3];
+
+ fn update(s: bool, a: [Point; 3], b: [Point; 3]) -> Final {
+ return final {
+ let chosen: [Point; 3] = s ? a : b;
+ arr.set(0u32, chosen);
+ };
+ }
+}
diff --git a/tests/tests/compiler/ternary/finalize_array_ternary.leo b/tests/tests/compiler/ternary/finalize_array_ternary.leo
new file mode 100644
index 00000000000..a56335ed3e1
--- /dev/null
+++ b/tests/tests/compiler/ternary/finalize_array_ternary.leo
@@ -0,0 +1,10 @@
+program test.aleo {
+ mapping arr: u32 => [u32; 4];
+
+ fn update(s: bool, a: [u32; 4], b: [u32; 4]) -> Final {
+ return final {
+ let chosen: [u32; 4] = s ? a : b;
+ arr.set(0u32, chosen);
+ };
+ }
+}
diff --git a/tests/tests/compiler/ternary/finalize_nested_struct_ternary.leo b/tests/tests/compiler/ternary/finalize_nested_struct_ternary.leo
new file mode 100644
index 00000000000..5929e327dda
--- /dev/null
+++ b/tests/tests/compiler/ternary/finalize_nested_struct_ternary.leo
@@ -0,0 +1,21 @@
+struct Point {
+ x: u32,
+ y: u32,
+}
+
+struct Segment {
+ lo: Point,
+ hi: Point,
+ tag: u32,
+}
+
+program test.aleo {
+ mapping segs: u32 => Segment;
+
+ fn update(s: bool, a: Segment, b: Segment) -> Final {
+ return final {
+ let chosen: Segment = s ? a : b;
+ segs.set(0u32, chosen);
+ };
+ }
+}
diff --git a/tests/tests/compiler/ternary/finalize_primitive_ternary.leo b/tests/tests/compiler/ternary/finalize_primitive_ternary.leo
new file mode 100644
index 00000000000..f99aaaeb54e
--- /dev/null
+++ b/tests/tests/compiler/ternary/finalize_primitive_ternary.leo
@@ -0,0 +1,24 @@
+program test.aleo {
+ mapping u32_map: u32 => u32;
+ mapping field_map: u32 => field;
+ mapping addr_map: u32 => address;
+
+ fn update(
+ s: bool,
+ a_u32: u32,
+ b_u32: u32,
+ a_field: field,
+ b_field: field,
+ a_addr: address,
+ b_addr: address,
+ ) -> Final {
+ return final {
+ let chosen_u32: u32 = s ? a_u32 : b_u32;
+ let chosen_field: field = s ? a_field : b_field;
+ let chosen_addr: address = s ? a_addr : b_addr;
+ u32_map.set(0u32, chosen_u32);
+ field_map.set(0u32, chosen_field);
+ addr_map.set(0u32, chosen_addr);
+ };
+ }
+}
diff --git a/tests/tests/compiler/ternary/finalize_struct_ternary.leo b/tests/tests/compiler/ternary/finalize_struct_ternary.leo
new file mode 100644
index 00000000000..00090c0fa2a
--- /dev/null
+++ b/tests/tests/compiler/ternary/finalize_struct_ternary.leo
@@ -0,0 +1,16 @@
+struct Point {
+ x: u32,
+ y: u32,
+ z: u32,
+}
+
+program test.aleo {
+ mapping points: u32 => Point;
+
+ fn update(s: bool, a: Point, b: Point) -> Final {
+ return final {
+ let chosen: Point = s ? a : b;
+ points.set(0u32, chosen);
+ };
+ }
+}
diff --git a/tests/tests/compiler/ternary/identifier_ternary.leo b/tests/tests/compiler/ternary/identifier_ternary.leo
new file mode 100644
index 00000000000..5671c8f28eb
--- /dev/null
+++ b/tests/tests/compiler/ternary/identifier_ternary.leo
@@ -0,0 +1,9 @@
+program test.aleo {
+ fn select(s: bool, a: identifier, b: identifier) -> identifier {
+ return s ? a : b;
+ }
+
+ fn select_literal(s: bool) -> identifier {
+ return s ? 'foo' : 'bar';
+ }
+}
diff --git a/tests/tests/compiler/ternary/nested_struct_ternary.leo b/tests/tests/compiler/ternary/nested_struct_ternary.leo
new file mode 100644
index 00000000000..eb18de72fc9
--- /dev/null
+++ b/tests/tests/compiler/ternary/nested_struct_ternary.leo
@@ -0,0 +1,20 @@
+struct Point {
+ x: u32,
+ y: u32,
+}
+
+struct Segment {
+ lo: Point,
+ hi: Point,
+ tag: u32,
+}
+
+program test.aleo {
+ fn select(s: bool, a: Segment, b: Segment) -> Segment {
+ return s ? a : b;
+ }
+
+ fn select_inner(s: bool, a: Segment, b: Segment) -> Point {
+ return s ? a.lo : b.hi;
+ }
+}
diff --git a/tests/tests/compiler/ternary/record_ternary.leo b/tests/tests/compiler/ternary/record_ternary.leo
new file mode 100644
index 00000000000..d58abc6a3f0
--- /dev/null
+++ b/tests/tests/compiler/ternary/record_ternary.leo
@@ -0,0 +1,10 @@
+program test.aleo {
+ record Token {
+ owner: address,
+ amount: u64,
+ }
+
+ fn select(s: bool, a: Token, b: Token) -> Token {
+ return s ? a : b;
+ }
+}
diff --git a/tests/tests/compiler/ternary/struct_ternary.leo b/tests/tests/compiler/ternary/struct_ternary.leo
new file mode 100644
index 00000000000..6cea8169975
--- /dev/null
+++ b/tests/tests/compiler/ternary/struct_ternary.leo
@@ -0,0 +1,11 @@
+struct Point {
+ x: u32,
+ y: u32,
+ z: u32,
+}
+
+program test.aleo {
+ fn select(s: bool, a: Point, b: Point) -> Point {
+ return s ? a : b;
+ }
+}
diff --git a/tests/tests/execution/ternary_array.leo b/tests/tests/execution/ternary_array.leo
new file mode 100644
index 00000000000..17ce42ff3db
--- /dev/null
+++ b/tests/tests/execution/ternary_array.leo
@@ -0,0 +1,33 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "select"
+input = ["true", "[1u32, 2u32, 3u32, 4u32]", "[10u32, 20u32, 30u32, 40u32]"]
+[case]
+program = "test.aleo"
+function = "select"
+input = ["false", "[1u32, 2u32, 3u32, 4u32]", "[10u32, 20u32, 30u32, 40u32]"]
+[case]
+program = "test.aleo"
+function = "select_element"
+input = ["true", "[1u32, 2u32, 3u32, 4u32]", "[10u32, 20u32, 30u32, 40u32]"]
+[case]
+program = "test.aleo"
+function = "select_element"
+input = ["false", "[1u32, 2u32, 3u32, 4u32]", "[10u32, 20u32, 30u32, 40u32]"]
+*/
+
+program test.aleo {
+ fn select(s: bool, a: [u32; 4], b: [u32; 4]) -> [u32; 4] {
+ return s ? a : b;
+ }
+
+ fn select_element(s: bool, a: [u32; 4], b: [u32; 4]) -> u32 {
+ return s ? a[0u32] : b[3u32];
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_array_of_structs.leo b/tests/tests/execution/ternary_array_of_structs.leo
new file mode 100644
index 00000000000..fc60ebefffc
--- /dev/null
+++ b/tests/tests/execution/ternary_array_of_structs.leo
@@ -0,0 +1,34 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "select"
+input = [
+ "true",
+ "[{ x: 1u32, y: 2u32 }, { x: 3u32, y: 4u32 }, { x: 5u32, y: 6u32 }]",
+ "[{ x: 10u32, y: 20u32 }, { x: 30u32, y: 40u32 }, { x: 50u32, y: 60u32 }]",
+]
+[case]
+program = "test.aleo"
+function = "select"
+input = [
+ "false",
+ "[{ x: 1u32, y: 2u32 }, { x: 3u32, y: 4u32 }, { x: 5u32, y: 6u32 }]",
+ "[{ x: 10u32, y: 20u32 }, { x: 30u32, y: 40u32 }, { x: 50u32, y: 60u32 }]",
+]
+*/
+
+struct Point {
+ x: u32,
+ y: u32,
+}
+
+program test.aleo {
+ fn select(s: bool, a: [Point; 3], b: [Point; 3]) -> [Point; 3] {
+ return s ? a : b;
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_finalize_array.leo b/tests/tests/execution/ternary_finalize_array.leo
new file mode 100644
index 00000000000..ac59d248289
--- /dev/null
+++ b/tests/tests/execution/ternary_finalize_array.leo
@@ -0,0 +1,27 @@
+/*
+seed = 123456789
+min_height = 16
+
+[case]
+program = "test.aleo"
+function = "update"
+input = ["true", "[1u32, 2u32, 3u32, 4u32]", "[10u32, 20u32, 30u32, 40u32]"]
+[case]
+program = "test.aleo"
+function = "update"
+input = ["false", "[1u32, 2u32, 3u32, 4u32]", "[10u32, 20u32, 30u32, 40u32]"]
+*/
+
+program test.aleo {
+ mapping arr: u32 => [u32; 4];
+
+ fn update(s: bool, a: [u32; 4], b: [u32; 4]) -> Final {
+ return final {
+ let chosen: [u32; 4] = s ? a : b;
+ arr.set(0u32, chosen);
+ };
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_finalize_array_of_structs.leo b/tests/tests/execution/ternary_finalize_array_of_structs.leo
new file mode 100644
index 00000000000..bc58d03a71d
--- /dev/null
+++ b/tests/tests/execution/ternary_finalize_array_of_structs.leo
@@ -0,0 +1,40 @@
+/*
+seed = 123456789
+min_height = 16
+
+[case]
+program = "test.aleo"
+function = "update"
+input = [
+ "true",
+ "[{ x: 1u32, y: 2u32 }, { x: 3u32, y: 4u32 }]",
+ "[{ x: 10u32, y: 20u32 }, { x: 30u32, y: 40u32 }]",
+]
+[case]
+program = "test.aleo"
+function = "update"
+input = [
+ "false",
+ "[{ x: 1u32, y: 2u32 }, { x: 3u32, y: 4u32 }]",
+ "[{ x: 10u32, y: 20u32 }, { x: 30u32, y: 40u32 }]",
+]
+*/
+
+struct Point {
+ x: u32,
+ y: u32,
+}
+
+program test.aleo {
+ mapping arr: u32 => [Point; 2];
+
+ fn update(s: bool, a: [Point; 2], b: [Point; 2]) -> Final {
+ return final {
+ let chosen: [Point; 2] = s ? a : b;
+ arr.set(0u32, chosen);
+ };
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_finalize_identifier.leo b/tests/tests/execution/ternary_finalize_identifier.leo
new file mode 100644
index 00000000000..513d635c4c6
--- /dev/null
+++ b/tests/tests/execution/ternary_finalize_identifier.leo
@@ -0,0 +1,42 @@
+/*
+seed = 123456789
+min_height = 16
+
+[case]
+program = "test.aleo"
+function = "update"
+input = ["true", "'alpha'", "'beta'"]
+[case]
+program = "test.aleo"
+function = "update"
+input = ["false", "'alpha'", "'beta'"]
+[case]
+program = "test.aleo"
+function = "update_literal"
+input = ["true"]
+[case]
+program = "test.aleo"
+function = "update_literal"
+input = ["false"]
+*/
+
+program test.aleo {
+ mapping names: u32 => identifier;
+
+ fn update(s: bool, a: identifier, b: identifier) -> Final {
+ return final {
+ let chosen: identifier = s ? a : b;
+ names.set(0u32, chosen);
+ };
+ }
+
+ fn update_literal(s: bool) -> Final {
+ return final {
+ let chosen: identifier = s ? 'foo' : 'bar';
+ names.set(1u32, chosen);
+ };
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_finalize_nested_struct.leo b/tests/tests/execution/ternary_finalize_nested_struct.leo
new file mode 100644
index 00000000000..4b21b009f8e
--- /dev/null
+++ b/tests/tests/execution/ternary_finalize_nested_struct.leo
@@ -0,0 +1,46 @@
+/*
+seed = 123456789
+min_height = 16
+
+[case]
+program = "test.aleo"
+function = "update"
+input = [
+ "true",
+ "{ lo: { x: 1u32, y: 2u32 }, hi: { x: 3u32, y: 4u32 }, tag: 5u32 }",
+ "{ lo: { x: 10u32, y: 20u32 }, hi: { x: 30u32, y: 40u32 }, tag: 50u32 }",
+]
+[case]
+program = "test.aleo"
+function = "update"
+input = [
+ "false",
+ "{ lo: { x: 1u32, y: 2u32 }, hi: { x: 3u32, y: 4u32 }, tag: 5u32 }",
+ "{ lo: { x: 10u32, y: 20u32 }, hi: { x: 30u32, y: 40u32 }, tag: 50u32 }",
+]
+*/
+
+struct Point {
+ x: u32,
+ y: u32,
+}
+
+struct Segment {
+ lo: Point,
+ hi: Point,
+ tag: u32,
+}
+
+program test.aleo {
+ mapping segs: u32 => Segment;
+
+ fn update(s: bool, a: Segment, b: Segment) -> Final {
+ return final {
+ let chosen: Segment = s ? a : b;
+ segs.set(0u32, chosen);
+ };
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_finalize_primitives.leo b/tests/tests/execution/ternary_finalize_primitives.leo
new file mode 100644
index 00000000000..26da8360743
--- /dev/null
+++ b/tests/tests/execution/ternary_finalize_primitives.leo
@@ -0,0 +1,57 @@
+/*
+seed = 123456789
+min_height = 16
+
+[case]
+program = "test.aleo"
+function = "update"
+input = [
+ "true",
+ "7u32",
+ "99u32",
+ "1field",
+ "42field",
+ "aleo1l7ytv5jqjzpxtjqttl5z9mle8ujcpac9t6tkge5f4haah4pxas8sagzecd",
+ "aleo1dtpkpg3d653mdlzh6g028937qdgujecn5gw5tzh7ftcvyz7jxvfqw6t8p6",
+]
+[case]
+program = "test.aleo"
+function = "update"
+input = [
+ "false",
+ "7u32",
+ "99u32",
+ "1field",
+ "42field",
+ "aleo1l7ytv5jqjzpxtjqttl5z9mle8ujcpac9t6tkge5f4haah4pxas8sagzecd",
+ "aleo1dtpkpg3d653mdlzh6g028937qdgujecn5gw5tzh7ftcvyz7jxvfqw6t8p6",
+]
+*/
+
+program test.aleo {
+ mapping u32_map: u32 => u32;
+ mapping field_map: u32 => field;
+ mapping addr_map: u32 => address;
+
+ fn update(
+ s: bool,
+ a_u32: u32,
+ b_u32: u32,
+ a_field: field,
+ b_field: field,
+ a_addr: address,
+ b_addr: address,
+ ) -> Final {
+ return final {
+ let chosen_u32: u32 = s ? a_u32 : b_u32;
+ let chosen_field: field = s ? a_field : b_field;
+ let chosen_addr: address = s ? a_addr : b_addr;
+ u32_map.set(0u32, chosen_u32);
+ field_map.set(0u32, chosen_field);
+ addr_map.set(0u32, chosen_addr);
+ };
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_finalize_struct.leo b/tests/tests/execution/ternary_finalize_struct.leo
new file mode 100644
index 00000000000..88302921a6c
--- /dev/null
+++ b/tests/tests/execution/ternary_finalize_struct.leo
@@ -0,0 +1,33 @@
+/*
+seed = 123456789
+min_height = 16
+
+[case]
+program = "test.aleo"
+function = "update"
+input = ["true", "{ x: 1u32, y: 2u32, z: 3u32 }", "{ x: 10u32, y: 20u32, z: 30u32 }"]
+[case]
+program = "test.aleo"
+function = "update"
+input = ["false", "{ x: 1u32, y: 2u32, z: 3u32 }", "{ x: 10u32, y: 20u32, z: 30u32 }"]
+*/
+
+struct Point {
+ x: u32,
+ y: u32,
+ z: u32,
+}
+
+program test.aleo {
+ mapping points: u32 => Point;
+
+ fn update(s: bool, a: Point, b: Point) -> Final {
+ return final {
+ let chosen: Point = s ? a : b;
+ points.set(0u32, chosen);
+ };
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_identifier.leo b/tests/tests/execution/ternary_identifier.leo
new file mode 100644
index 00000000000..484cd339f7e
--- /dev/null
+++ b/tests/tests/execution/ternary_identifier.leo
@@ -0,0 +1,33 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "select"
+input = ["true", "'foo'", "'bar'"]
+[case]
+program = "test.aleo"
+function = "select"
+input = ["false", "'foo'", "'bar'"]
+[case]
+program = "test.aleo"
+function = "select_literal"
+input = ["true"]
+[case]
+program = "test.aleo"
+function = "select_literal"
+input = ["false"]
+*/
+
+program test.aleo {
+ fn select(s: bool, a: identifier, b: identifier) -> identifier {
+ return s ? a : b;
+ }
+
+ fn select_literal(s: bool) -> identifier {
+ return s ? 'foo' : 'bar';
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_nested_struct.leo b/tests/tests/execution/ternary_nested_struct.leo
new file mode 100644
index 00000000000..9a53fb9da51
--- /dev/null
+++ b/tests/tests/execution/ternary_nested_struct.leo
@@ -0,0 +1,40 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "select"
+input = [
+ "true",
+ "{ lo: { x: 1u32, y: 2u32 }, hi: { x: 3u32, y: 4u32 }, tag: 5u32 }",
+ "{ lo: { x: 10u32, y: 20u32 }, hi: { x: 30u32, y: 40u32 }, tag: 50u32 }",
+]
+[case]
+program = "test.aleo"
+function = "select"
+input = [
+ "false",
+ "{ lo: { x: 1u32, y: 2u32 }, hi: { x: 3u32, y: 4u32 }, tag: 5u32 }",
+ "{ lo: { x: 10u32, y: 20u32 }, hi: { x: 30u32, y: 40u32 }, tag: 50u32 }",
+]
+*/
+
+struct Point {
+ x: u32,
+ y: u32,
+}
+
+struct Segment {
+ lo: Point,
+ hi: Point,
+ tag: u32,
+}
+
+program test.aleo {
+ fn select(s: bool, a: Segment, b: Segment) -> Segment {
+ return s ? a : b;
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_primitives.leo b/tests/tests/execution/ternary_primitives.leo
new file mode 100644
index 00000000000..4caba384b99
--- /dev/null
+++ b/tests/tests/execution/ternary_primitives.leo
@@ -0,0 +1,55 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "select"
+input = [
+ "true",
+ "7u32",
+ "99u32",
+ "true",
+ "false",
+ "1field",
+ "42field",
+ "aleo1l7ytv5jqjzpxtjqttl5z9mle8ujcpac9t6tkge5f4haah4pxas8sagzecd",
+ "aleo1dtpkpg3d653mdlzh6g028937qdgujecn5gw5tzh7ftcvyz7jxvfqw6t8p6",
+]
+[case]
+program = "test.aleo"
+function = "select"
+input = [
+ "false",
+ "7u32",
+ "99u32",
+ "true",
+ "false",
+ "1field",
+ "42field",
+ "aleo1l7ytv5jqjzpxtjqttl5z9mle8ujcpac9t6tkge5f4haah4pxas8sagzecd",
+ "aleo1dtpkpg3d653mdlzh6g028937qdgujecn5gw5tzh7ftcvyz7jxvfqw6t8p6",
+]
+*/
+
+program test.aleo {
+ fn select(
+ s: bool,
+ a_u32: u32,
+ b_u32: u32,
+ a_bool: bool,
+ b_bool: bool,
+ a_field: field,
+ b_field: field,
+ a_addr: address,
+ b_addr: address,
+ ) -> (u32, bool, field, address) {
+ let p: u32 = s ? a_u32 : b_u32;
+ let q: bool = s ? a_bool : b_bool;
+ let r: field = s ? a_field : b_field;
+ let t: address = s ? a_addr : b_addr;
+ return (p, q, r, t);
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_record.leo b/tests/tests/execution/ternary_record.leo
new file mode 100644
index 00000000000..2ae8920affb
--- /dev/null
+++ b/tests/tests/execution/ternary_record.leo
@@ -0,0 +1,28 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "mint_and_select"
+input = ["true", "5u64", "50u64"]
+[case]
+program = "test.aleo"
+function = "mint_and_select"
+input = ["false", "5u64", "50u64"]
+*/
+
+program test.aleo {
+ record Token {
+ owner: address,
+ amount: u64,
+ }
+
+ fn mint_and_select(s: bool, a: u64, b: u64) -> Token {
+ let t1: Token = Token { owner: self.signer, amount: a };
+ let t2: Token = Token { owner: self.signer, amount: b };
+ return s ? t1 : t2;
+ }
+
+ @noupgrade
+ constructor() {}
+}
diff --git a/tests/tests/execution/ternary_struct.leo b/tests/tests/execution/ternary_struct.leo
new file mode 100644
index 00000000000..88c35a4f81a
--- /dev/null
+++ b/tests/tests/execution/ternary_struct.leo
@@ -0,0 +1,27 @@
+/*
+seed = 123456789
+
+[case]
+program = "test.aleo"
+function = "select"
+input = ["true", "{ x: 1u32, y: 2u32, z: 3u32 }", "{ x: 10u32, y: 20u32, z: 30u32 }"]
+[case]
+program = "test.aleo"
+function = "select"
+input = ["false", "{ x: 1u32, y: 2u32, z: 3u32 }", "{ x: 10u32, y: 20u32, z: 30u32 }"]
+*/
+
+struct Point {
+ x: u32,
+ y: u32,
+ z: u32,
+}
+
+program test.aleo {
+ fn select(s: bool, a: Point, b: Point) -> Point {
+ return s ? a : b;
+ }
+
+ @noupgrade
+ constructor() {}
+}