diff --git a/.circleci/config.yml b/.circleci/config.yml index 4dc51b709b..da084c94e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -158,6 +158,19 @@ jobs: export LEO=/home/circleci/project/project/bin/leo ./project/.circleci/leo-add-remove.sh + leo-check-constraints: + docker: + - image: cimg/rust:1.50.0 + resource_class: xlarge + steps: + - attach_workspace: + at: /home/circleci/project/ + - run: + name: leo check constraints for Pedersen Hash + command: | + export LEO=/home/circleci/project/project/bin/leo + ./project/.circleci/leo-check-constraints.sh + leo-login-logout: docker: - image: cimg/rust:1.51.0 @@ -219,6 +232,9 @@ workflows: - leo-add-remove: requires: - leo-executable + - leo-check-constraints: + requires: + - leo-executable - leo-login-logout: requires: - leo-executable diff --git a/.circleci/leo-check-constraints.sh b/.circleci/leo-check-constraints.sh new file mode 100755 index 0000000000..c1c686d74b --- /dev/null +++ b/.circleci/leo-check-constraints.sh @@ -0,0 +1,16 @@ +# leo new hello-world + +cd ./project/examples/pedersen-hash + +export PEDERSEN_HASH_CONSTRAINTS=1539; + +# line that we're searching for is: +# `Build Number of constraints - 1539` +export ACTUAL_CONSTRAINTS=$($LEO build | grep constraints | awk '{print $NF}') + +# if else expression with only else block +[[ PEDERSEN_HASH_CONSTRAINTS -eq ACTUAL_CONSTRAINTS ]] || { + echo >&2 "Number of constraints for Pedersen Hash is not $PEDERSEN_HASH_CONSTRAINTS"; + echo >&2 "Real number of constraints is $ACTUAL_CONSTRAINTS"; + exit 1; +} diff --git a/.circleci/leo-login-logout.sh b/.circleci/leo-login-logout.sh index 1353b18d72..c1fe2d067d 100755 --- a/.circleci/leo-login-logout.sh +++ b/.circleci/leo-login-logout.sh @@ -1,7 +1,15 @@ # leo login & logout -$LEO new my-app && cd my-app || exit 1 $LEO login -u "$ALEO_PM_USERNAME" -p "$ALEO_PM_PASSWORD" +$LEO new my-app && cd my-app || exit 1 + +cat Leo.toml + +# verify that in Leo.toml there's no line with [AUTHOR]; +# since CI does not allow showing credentials, we won't see it in the file; +# so the only way to test is to make sure that there's just no [AUTHOR] there +[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 0 ]] || exit 1 + $LEO add howard/silly-sudoku $LEO remove silly-sudoku $LEO logout diff --git a/.circleci/leo-new.sh b/.circleci/leo-new.sh index cb24618546..6f90b785dd 100755 --- a/.circleci/leo-new.sh +++ b/.circleci/leo-new.sh @@ -1,4 +1,9 @@ $LEO new hello-world ls -la cd hello-world && ls -la + +# verify that in Leo.toml there's a placeholder for author +# because at the time of calling `leo new` user is not logged in +[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 1 ]] || exit 1 + $LEO run diff --git a/.circleci/r b/.circleci/r new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.resources/release-version b/.resources/release-version index 8b3a0227b4..ec7b967829 100644 --- a/.resources/release-version +++ b/.resources/release-version @@ -1 +1 @@ -v1.3.0 \ No newline at end of file +v1.4.0 \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d4b0d14559..6ace978d46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "abnf" -version = "0.10.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8863e7db43447ad50376e19b0549343b72ad45cbd394b3fc8fe3ede961facc" +checksum = "96e669320c520d87931e752d603dd442b4709c73b1b8b1fcba838f9c5acc1791" dependencies = [ "abnf-core", "nom 6.1.2", @@ -87,6 +87,20 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "assert_cmd" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2475b58cd94eb4f70159f4fd8844ba3b807532fe3131b3373fae060bbe30396" +dependencies = [ + "bstr", + "doc-comment", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + [[package]] name = "atty" version = "0.2.14" @@ -138,11 +152,10 @@ checksum = "58946044516aa9dc922182e0d6e9d124a31aafe6b421614654eb27cf90cec09c" [[package]] name = "bincode" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "byteorder", "serde", ] @@ -602,6 +615,12 @@ dependencies = [ "syn 1.0.64", ] +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" + [[package]] name = "digest" version = "0.8.1" @@ -640,6 +659,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "dtoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" + [[package]] name = "either" version = "1.6.1" @@ -1241,7 +1272,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "leo-abnf" -version = "1.3.0" +version = "1.4.0" dependencies = [ "abnf", "anyhow", @@ -1249,7 +1280,7 @@ dependencies = [ [[package]] name = "leo-asg" -version = "1.3.0" +version = "1.4.0" dependencies = [ "criterion", "indexmap", @@ -1265,14 +1296,14 @@ dependencies = [ [[package]] name = "leo-asg-passes" -version = "1.3.0" +version = "1.4.0" dependencies = [ "leo-asg", ] [[package]] name = "leo-ast" -version = "1.3.0" +version = "1.4.0" dependencies = [ "anyhow", "criterion", @@ -1287,7 +1318,7 @@ dependencies = [ [[package]] name = "leo-compiler" -version = "1.3.0" +version = "1.4.0" dependencies = [ "bincode", "hex", @@ -1302,8 +1333,8 @@ dependencies = [ "leo-state", "num-bigint", "pest", - "rand", - "rand_core", + "rand 0.8.3", + "rand_core 0.6.2", "rand_xorshift", "serde", "sha2", @@ -1315,13 +1346,14 @@ dependencies = [ "snarkvm-r1cs", "snarkvm-utilities", "tempfile", + "tendril", "thiserror", "tracing", ] [[package]] name = "leo-imports" -version = "1.3.0" +version = "1.4.0" dependencies = [ "indexmap", "leo-asg", @@ -1333,7 +1365,7 @@ dependencies = [ [[package]] name = "leo-input" -version = "1.3.0" +version = "1.4.0" dependencies = [ "from-pest", "pest", @@ -1345,9 +1377,11 @@ dependencies = [ [[package]] name = "leo-lang" -version = "1.3.0" +version = "1.4.0" dependencies = [ + "ansi_term 0.12.1", "anyhow", + "assert_cmd", "clap", "colored", "console", @@ -1362,8 +1396,8 @@ dependencies = [ "leo-state", "leo-synthesizer", "notify", - "rand", - "rand_core", + "rand 0.8.3", + "rand_core 0.6.2", "reqwest", "rusty-hook", "self_update", @@ -1375,6 +1409,7 @@ dependencies = [ "snarkvm-r1cs", "snarkvm-utilities", "structopt", + "test_dir", "thiserror", "toml", "tracing", @@ -1384,11 +1419,11 @@ dependencies = [ [[package]] name = "leo-linter" -version = "1.3.0" +version = "1.4.0" [[package]] name = "leo-package" -version = "1.3.0" +version = "1.4.0" dependencies = [ "lazy_static", "serde", @@ -1401,14 +1436,16 @@ dependencies = [ [[package]] name = "leo-parser" -version = "1.3.0" +version = "1.4.0" dependencies = [ "criterion", "indexmap", "lazy_static", "leo-ast", + "leo-test-framework", "serde", "serde_json", + "serde_yaml", "tendril", "thiserror", "tracing", @@ -1416,13 +1453,13 @@ dependencies = [ [[package]] name = "leo-state" -version = "1.3.0" +version = "1.4.0" dependencies = [ "indexmap", "leo-ast", "leo-input", - "rand", - "rand_core", + "rand 0.8.3", + "rand_core 0.6.2", "rand_xorshift", "snarkvm-algorithms", "snarkvm-curves", @@ -1434,7 +1471,7 @@ dependencies = [ [[package]] name = "leo-synthesizer" -version = "1.3.0" +version = "1.4.0" dependencies = [ "num-bigint", "serde", @@ -1445,6 +1482,15 @@ dependencies = [ "snarkvm-r1cs", ] +[[package]] +name = "leo-test-framework" +version = "1.4.0" +dependencies = [ + "serde", + "serde_json", + "serde_yaml", +] + [[package]] name = "lexical-core" version = "0.7.5" @@ -1498,6 +1544,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + [[package]] name = "lock_api" version = "0.4.2" @@ -1725,9 +1777,9 @@ dependencies = [ [[package]] name = "notify" -version = "4.0.15" +version = "4.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd" +checksum = "2599080e87c9bd051ddb11b10074f4da7b1223298df65d4c2ec5bcf309af1533" dependencies = [ "bitflags", "filetime", @@ -2024,6 +2076,32 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +[[package]] +name = "predicates" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa" +dependencies = [ + "difference", + "predicates-core", +] + +[[package]] +name = "predicates-core" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" + +[[package]] +name = "predicates-tree" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2" +dependencies = [ + "predicates-core", + "treeline", +] + [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -2114,6 +2192,19 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + [[package]] name = "rand" version = "0.8.3" @@ -2121,9 +2212,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", - "rand_chacha", - "rand_core", - "rand_hc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", + "rand_hc 0.3.0", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -2133,7 +2234,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.2", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -2145,13 +2255,22 @@ dependencies = [ "getrandom 0.2.2", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "rand_hc" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core", + "rand_core 0.6.2", ] [[package]] @@ -2160,7 +2279,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core", + "rand_core 0.6.2", ] [[package]] @@ -2252,9 +2371,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" +checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124" dependencies = [ "base64", "bytes", @@ -2508,6 +2627,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" +dependencies = [ + "dtoa", + "linked-hash-map", + "serde", + "yaml-rust", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -2579,8 +2710,8 @@ dependencies = [ "derivative", "digest 0.9.0", "itertools 0.10.0", - "rand", - "rand_chacha", + "rand 0.8.3", + "rand_chacha 0.3.0", "rayon", "sha2", "smallvec", @@ -2599,7 +2730,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64610b135b8b1152439d5dfa4f745515933366082f08651961344aa0bb5abfca" dependencies = [ "derivative", - "rand", + "rand 0.8.3", "rand_xorshift", "rustc_version 0.3.3", "serde", @@ -2634,7 +2765,7 @@ dependencies = [ "derivative", "hex", "itertools 0.10.0", - "rand", + "rand 0.8.3", "snarkvm-algorithms", "snarkvm-curves", "snarkvm-fields", @@ -2655,7 +2786,7 @@ checksum = "8c49c69d02df11be58e07f626c9d6f5804c6dd4ccf42e425f2be8d79fe6e5bb7" dependencies = [ "bincode", "derivative", - "rand", + "rand 0.8.3", "rand_xorshift", "serde", "snarkvm-utilities", @@ -2690,7 +2821,7 @@ dependencies = [ "chrono", "hex", "once_cell", - "rand", + "rand 0.8.3", "serde", "sha2", "snarkvm-algorithms", @@ -2744,7 +2875,7 @@ dependencies = [ "bincode", "hex", "parking_lot", - "rand", + "rand 0.8.3", "rocksdb", "serde", "snarkvm-algorithms", @@ -2762,7 +2893,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c763843fa67a3aa4ce68173c8cd96b4f04aaa135a5792bc051c36eec0fe1cd73" dependencies = [ "bincode", - "rand", + "rand 0.8.3", "snarkvm-derives", "thiserror", ] @@ -2868,7 +2999,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand", + "rand 0.8.3", "redox_syscall 0.2.5", "remove_dir_all", "winapi 0.3.9", @@ -2904,6 +3035,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "test_dir" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e571ebf9127a9da821890a9fa8a8ef777fce3e0f959ff6949cf06ca8b736381d" +dependencies = [ + "rand 0.7.3", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -3116,6 +3256,12 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "treeline" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" + [[package]] name = "try-lock" version = "0.2.3" @@ -3233,6 +3379,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.3.2" @@ -3422,10 +3577,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] -name = "zip" -version = "0.5.10" +name = "yaml-rust" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8977234acab718eb2820494b2f96cbb16004c19dddf88b7445b27381450997" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "zip" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c83dc9b784d252127720168abd71ea82bf8c3d96b17dc565b5e2a02854f2b27" dependencies = [ "byteorder", "bzip2", diff --git a/Cargo.toml b/Cargo.toml index 2a16b49cdf..b85a76cb98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-lang" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "The Leo programming language" homepage = "https://aleo.org" @@ -37,36 +37,37 @@ members = [ "package", "parser", "state", - "synthesizer" + "synthesizer", + "test-framework" ] [dependencies.leo-ast] path = "./ast" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-compiler] path = "./compiler" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-imports] path = "./imports" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-input] path = "./input" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-package] path = "./package" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-state] path = "./state" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-synthesizer] path = "./synthesizer" -version = "1.3.0" +version = "1.4.0" [dependencies.snarkvm-algorithms] version = "0.2.2" @@ -111,7 +112,7 @@ version = "0.3.1" version = "1.4.0" [dependencies.notify] -version = "4.0.15" +version = "4.0.16" [dependencies.rand] version = "0.8" @@ -120,7 +121,7 @@ version = "0.8" version = "0.6.2" [dependencies.reqwest] -version = "0.11.2" +version = "0.11.3" features = [ "blocking", "json", "multipart" ] [dependencies.self_update] @@ -150,9 +151,18 @@ features = [ "fmt" ] [dependencies.zip] version = "0.5" +[target."cfg(windows)".dependencies.ansi_term] +version = "0.12.1" + [dev-dependencies.rusty-hook] version = "0.11.2" +[dev-dependencies.assert_cmd] +version = "1.0.3" + +[dev-dependencies.test_dir] +version = "0.1.0" + [features] default = [ ] ci_skip = [ "leo-compiler/ci_skip" ] diff --git a/README.md b/README.md index 6d0a7f321b..8f0dcf13ee 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,9 @@ This will generate an executable under the `./target/release` directory. To run Use the Leo CLI to create a new project ```bash -# create a new `hello_world` Leo project -leo new hello_world -cd hello_world +# create a new `hello-world` Leo project +leo new hello-world +cd hello-world # build & setup & prove & verify leo run @@ -113,6 +113,7 @@ Congratulations! You've just run your first Leo program. * [Hello World - Next Steps](https://developer.aleo.org/developer/getting_started/hello_world) * [Leo Language Documentation](https://developer.aleo.org/developer/language/layout) +* [Leo ABNF Grammar](./grammar/README.md) * [Leo CLI Documentation](https://developer.aleo.org/developer/cli/new) * [Homepage](https://developer.aleo.org/developer/getting_started/overview) diff --git a/asg-passes/Cargo.toml b/asg-passes/Cargo.toml index 217e53b17c..5c9a4a5566 100644 --- a/asg-passes/Cargo.toml +++ b/asg-passes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-asg-passes" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "The Leo programming language" homepage = "https://aleo.org" @@ -22,4 +22,4 @@ path = "src/lib.rs" [dependencies.leo-asg] path = "../asg" -version = "1.3.0" +version = "1.4.0" diff --git a/asg/Cargo.toml b/asg/Cargo.toml index 3ce2935526..dd0b7bfaf6 100644 --- a/asg/Cargo.toml +++ b/asg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-asg" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "ASG of the Leo programming language" homepage = "https://aleo.org" @@ -30,11 +30,11 @@ version = "1.6" version = "1.0" [dependencies.leo-ast] -version = "1.3.0" +version = "1.4.0" path = "../ast" [dependencies.leo-parser] -version = "1.3.0" +version = "1.4.0" path = "../parser" [dependencies.num-bigint] diff --git a/asg/src/checks/return_path.rs b/asg/src/checks/return_path.rs index 8a21f0514e..e0f73d3c0d 100644 --- a/asg/src/checks/return_path.rs +++ b/asg/src/checks/return_path.rs @@ -92,7 +92,7 @@ impl<'a> MonoidalReducerStatement<'a, BoolAnd> for ReturnPathReducer { if_true.append(if_false.unwrap_or(BoolAnd(false))) } - fn reduce_formatted_string(&mut self, input: &FormattedString, parameters: Vec) -> BoolAnd { + fn reduce_formatted_string(&mut self, input: &FormatString, parameters: Vec) -> BoolAnd { BoolAnd(false) } diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index ada5458e5c..d0ae36f32e 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -71,7 +71,7 @@ impl<'a> ExpressionNode<'a> for CallExpression<'a> { } fn is_mut_ref(&self) -> bool { - false + true } fn const_value(&self) -> Option { diff --git a/asg/src/expression/variable_ref.rs b/asg/src/expression/variable_ref.rs index b12363e38d..5e7ee39266 100644 --- a/asg/src/expression/variable_ref.rs +++ b/asg/src/expression/variable_ref.rs @@ -137,13 +137,6 @@ impl<'a> FromAst<'a, leo_ast::Identifier> for &'a Expression<'a> { expected_type: Option>, ) -> Result<&'a Expression<'a>, AsgConvertError> { let variable = if value.name.as_ref() == "input" { - if let Some(function) = scope.resolve_current_function() { - if !function.has_input { - return Err(AsgConvertError::unresolved_reference(&value.name, &value.span)); - } - } else { - return Err(AsgConvertError::unresolved_reference(&value.name, &value.span)); - } if let Some(input) = scope.resolve_input() { input.container } else { diff --git a/asg/src/prelude.rs b/asg/src/prelude.rs index e977fd137f..d4a2faffbc 100644 --- a/asg/src/prelude.rs +++ b/asg/src/prelude.rs @@ -29,7 +29,7 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result< r#" circuit Blake2s { function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return [0; 32] + return [0; 32]; } } "#, diff --git a/asg/src/program/function.rs b/asg/src/program/function.rs index a594aa107d..bf89b0020f 100644 --- a/asg/src/program/function.rs +++ b/asg/src/program/function.rs @@ -47,7 +47,6 @@ pub struct Function<'a> { pub id: u32, pub name: RefCell, pub output: Type<'a>, - pub has_input: bool, pub arguments: IndexMap>>, pub circuit: Cell>>, pub span: Option, @@ -77,16 +76,12 @@ impl<'a> Function<'a> { .transpose()? .unwrap_or_else(|| Type::Tuple(vec![])); let mut qualifier = FunctionQualifier::Static; - let mut has_input = false; let new_scope = scope.make_subscope(); let mut arguments = IndexMap::new(); { for input in value.input.iter() { match input { - FunctionInput::InputKeyword(_) => { - has_input = true; - } FunctionInput::SelfKeyword(_) => { qualifier = FunctionQualifier::SelfRef; } @@ -125,7 +120,6 @@ impl<'a> Function<'a> { id: scope.context.get_id(), name: RefCell::new(value.identifier.clone()), output, - has_input, arguments, circuit: Cell::new(None), body: Cell::new(None), diff --git a/asg/src/reducer/monoidal_director.rs b/asg/src/reducer/monoidal_director.rs index 28fbd31690..b0f97fec7b 100644 --- a/asg/src/reducer/monoidal_director.rs +++ b/asg/src/reducer/monoidal_director.rs @@ -225,7 +225,7 @@ impl<'a, T: Monoid, R: MonoidalReducerStatement<'a, T>> MonoidalDirector<'a, T, .reduce_conditional_statement(input, condition, if_true, if_false) } - pub fn reduce_formatted_string(&mut self, input: &FormattedString<'a>) -> T { + pub fn reduce_formatted_string(&mut self, input: &FormatString<'a>) -> T { let parameters = input .parameters .iter() diff --git a/asg/src/reducer/monoidal_reducer.rs b/asg/src/reducer/monoidal_reducer.rs index b06210cc4c..2a10604e1e 100644 --- a/asg/src/reducer/monoidal_reducer.rs +++ b/asg/src/reducer/monoidal_reducer.rs @@ -118,7 +118,7 @@ pub trait MonoidalReducerStatement<'a, T: Monoid>: MonoidalReducerExpression<'a, condition.append(if_true).append_option(if_false) } - fn reduce_formatted_string(&mut self, input: &FormattedString<'a>, parameters: Vec) -> T { + fn reduce_formatted_string(&mut self, input: &FormatString<'a>, parameters: Vec) -> T { T::default().append_all(parameters.into_iter()) } diff --git a/asg/src/reducer/reconstructing_director.rs b/asg/src/reducer/reconstructing_director.rs index 549c718937..239f1943c9 100644 --- a/asg/src/reducer/reconstructing_director.rs +++ b/asg/src/reducer/reconstructing_director.rs @@ -243,7 +243,7 @@ impl<'a, R: ReconstructingReducerStatement<'a>> ReconstructingDirector<'a, R> { .reduce_conditional_statement(input, condition, if_true, if_false) } - pub fn reduce_formatted_string(&mut self, input: FormattedString<'a>) -> FormattedString<'a> { + pub fn reduce_formatted_string(&mut self, input: FormatString<'a>) -> FormatString<'a> { let parameters = input .parameters .iter() diff --git a/asg/src/reducer/reconstructing_reducer.rs b/asg/src/reducer/reconstructing_reducer.rs index 3e38d4cc7a..1441c13a1d 100644 --- a/asg/src/reducer/reconstructing_reducer.rs +++ b/asg/src/reducer/reconstructing_reducer.rs @@ -274,10 +274,10 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a fn reduce_formatted_string( &mut self, - input: FormattedString<'a>, + input: FormatString<'a>, parameters: Vec<&'a Expression<'a>>, - ) -> FormattedString<'a> { - FormattedString { + ) -> FormatString<'a> { + FormatString { span: input.span, parts: input.parts, parameters: parameters.into_iter().map(Cell::new).collect(), @@ -293,7 +293,7 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a }) } - fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormattedString<'a>) -> Statement<'a> { + fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormatString<'a>) -> Statement<'a> { assert!(!matches!(input.function, ConsoleFunction::Assert(_))); Statement::Console(ConsoleStatement { parent: input.parent, diff --git a/asg/src/reducer/visitor.rs b/asg/src/reducer/visitor.rs index b0f4d3ee6a..8a87cf4700 100644 --- a/asg/src/reducer/visitor.rs +++ b/asg/src/reducer/visitor.rs @@ -120,7 +120,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> { Default::default() } - fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> VisitResult { + fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> VisitResult { Default::default() } diff --git a/asg/src/reducer/visitor_director.rs b/asg/src/reducer/visitor_director.rs index 9665f31053..78cfdd5d94 100644 --- a/asg/src/reducer/visitor_director.rs +++ b/asg/src/reducer/visitor_director.rs @@ -319,7 +319,7 @@ impl<'a, R: StatementVisitor<'a>> VisitorDirector<'a, R> { } } - pub fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> ConcreteVisitResult { + pub fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> ConcreteVisitResult { match self.visitor.visit_formatted_string(input) { VisitResult::VisitChildren => { for parameter in input.parameters.iter() { diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index b2a23878b6..b3842d3f30 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -70,13 +70,6 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { let (name, span) = (&statement.assignee.identifier.name, &statement.assignee.identifier.span); let variable = if name.as_ref() == "input" { - if let Some(function) = scope.resolve_current_function() { - if !function.has_input { - return Err(AsgConvertError::unresolved_reference(name, &span)); - } - } else { - return Err(AsgConvertError::unresolved_reference(name, &span)); - } if let Some(input) = scope.resolve_input() { input.container } else { diff --git a/asg/src/statement/console.rs b/asg/src/statement/console.rs index 5820abb579..5e47cb0012 100644 --- a/asg/src/statement/console.rs +++ b/asg/src/statement/console.rs @@ -15,14 +15,14 @@ // along with the Leo library. If not, see . use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type}; -use leo_ast::{ConsoleFunction as AstConsoleFunction, FormattedStringPart}; +use leo_ast::{ConsoleFunction as AstConsoleFunction, FormatStringPart}; use std::cell::Cell; // TODO (protryon): Refactor to not require/depend on span #[derive(Clone)] -pub struct FormattedString<'a> { - pub parts: Vec, +pub struct FormatString<'a> { + pub parts: Vec, pub parameters: Vec>>, pub span: Span, } @@ -30,9 +30,9 @@ pub struct FormattedString<'a> { #[derive(Clone)] pub enum ConsoleFunction<'a> { Assert(Cell<&'a Expression<'a>>), - Debug(FormattedString<'a>), - Error(FormattedString<'a>), - Log(FormattedString<'a>), + Debug(FormatString<'a>), + Error(FormatString<'a>), + Log(FormatString<'a>), } #[derive(Clone)] @@ -48,16 +48,16 @@ impl<'a> Node for ConsoleStatement<'a> { } } -impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> { +impl<'a> FromAst<'a, leo_ast::FormatString> for FormatString<'a> { fn from_ast( scope: &'a Scope<'a>, - value: &leo_ast::FormattedString, + value: &leo_ast::FormatString, _expected_type: Option>, ) -> Result { let expected_param_len = value .parts .iter() - .filter(|x| matches!(x, FormattedStringPart::Container)) + .filter(|x| matches!(x, FormatStringPart::Container)) .count(); if value.parameters.len() != expected_param_len { // + 1 for formatting string as to not confuse user @@ -71,7 +71,7 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> { for parameter in value.parameters.iter() { parameters.push(Cell::new(<&Expression<'a>>::from_ast(scope, parameter, None)?)); } - Ok(FormattedString { + Ok(FormatString { parts: value.parts.clone(), parameters, span: value.span.clone(), @@ -79,9 +79,9 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> { } } -impl<'a> Into for &FormattedString<'a> { - fn into(self) -> leo_ast::FormattedString { - leo_ast::FormattedString { +impl<'a> Into for &FormatString<'a> { + fn into(self) -> leo_ast::FormatString { + leo_ast::FormatString { parts: self.parts.clone(), parameters: self.parameters.iter().map(|e| e.get().into()).collect(), span: self.span.clone(), @@ -103,13 +103,13 @@ impl<'a> FromAst<'a, leo_ast::ConsoleStatement> for ConsoleStatement<'a> { <&Expression<'a>>::from_ast(scope, expression, Some(Type::Boolean.into()))?, )), AstConsoleFunction::Debug(formatted_string) => { - ConsoleFunction::Debug(FormattedString::from_ast(scope, formatted_string, None)?) + ConsoleFunction::Debug(FormatString::from_ast(scope, formatted_string, None)?) } AstConsoleFunction::Error(formatted_string) => { - ConsoleFunction::Error(FormattedString::from_ast(scope, formatted_string, None)?) + ConsoleFunction::Error(FormatString::from_ast(scope, formatted_string, None)?) } AstConsoleFunction::Log(formatted_string) => { - ConsoleFunction::Log(FormattedString::from_ast(scope, formatted_string, None)?) + ConsoleFunction::Log(FormatString::from_ast(scope, formatted_string, None)?) } }, }) diff --git a/asg/src/statement/iteration.rs b/asg/src/statement/iteration.rs index e6d97ca0a2..5e080acc75 100644 --- a/asg/src/statement/iteration.rs +++ b/asg/src/statement/iteration.rs @@ -54,7 +54,7 @@ impl<'a> FromAst<'a, leo_ast::IterationStatement> for &'a Statement<'a> { statement: &leo_ast::IterationStatement, _expected_type: Option>, ) -> Result { - let expected_index_type = Some(PartialType::Integer(None, Some(IntegerType::U32))); + let expected_index_type = Some(PartialType::Integer(Some(IntegerType::U32), None)); let start = <&Expression<'a>>::from_ast(scope, &statement.start, expected_index_type.clone())?; let stop = <&Expression<'a>>::from_ast(scope, &statement.stop, expected_index_type)?; diff --git a/asg/tests/fail/circuits/member_function_fail.leo b/asg/tests/fail/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/asg/tests/fail/circuits/member_function_fail.leo +++ b/asg/tests/fail/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_function_invalid.leo b/asg/tests/fail/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/asg/tests/fail/circuits/member_function_invalid.leo +++ b/asg/tests/fail/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_static_function_invalid.leo b/asg/tests/fail/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/asg/tests/fail/circuits/member_static_function_invalid.leo +++ b/asg/tests/fail/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_static_function_undefined.leo b/asg/tests/fail/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/asg/tests/fail/circuits/member_static_function_undefined.leo +++ b/asg/tests/fail/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/mod.rs b/asg/tests/fail/circuits/mod.rs index 38f1824755..4d343b25a0 100644 --- a/asg/tests/fail/circuits/mod.rs +++ b/asg/tests/fail/circuits/mod.rs @@ -55,7 +55,7 @@ fn test_mut_member_function_fail() { let program_string = r#" circuit Foo { function echo(mut self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/self_member_invalid.leo b/asg/tests/fail/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/asg/tests/fail/circuits/self_member_invalid.leo +++ b/asg/tests/fail/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/asg/tests/fail/circuits/self_member_undefined.leo b/asg/tests/fail/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/asg/tests/fail/circuits/self_member_undefined.leo +++ b/asg/tests/fail/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/asg/tests/fail/function/multiple_returns_fail.leo b/asg/tests/fail/function/multiple_returns_fail.leo index d4a8b36eac..daa773f2e8 100644 --- a/asg/tests/fail/function/multiple_returns_fail.leo +++ b/asg/tests/fail/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored + return 3i8; //returns } \ No newline at end of file diff --git a/asg/tests/fail/function/multiple_returns_fail_conditional.leo b/asg/tests/fail/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/asg/tests/fail/function/multiple_returns_fail_conditional.leo +++ b/asg/tests/fail/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/asg/tests/fail/function/multiple_returns_input_ambiguous.leo b/asg/tests/fail/function/multiple_returns_input_ambiguous.leo index 234375349b..363408e61e 100644 --- a/asg/tests/fail/function/multiple_returns_input_ambiguous.leo +++ b/asg/tests/fail/function/multiple_returns_input_ambiguous.leo @@ -1,7 +1,7 @@ function main(input) -> u32 { if input.registers.a == 0 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/asg/tests/fail/function/scope_fail.leo b/asg/tests/fail/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/asg/tests/fail/function/scope_fail.leo +++ b/asg/tests/fail/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/asg/tests/fail/statements/num_returns_fail.leo b/asg/tests/fail/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/asg/tests/fail/statements/num_returns_fail.leo +++ b/asg/tests/fail/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/asg/tests/pass/address/console_assert_pass.leo b/asg/tests/pass/address/console_assert_pass.leo index f17d7d8c05..214d01c4a8 100644 --- a/asg/tests/pass/address/console_assert_pass.leo +++ b/asg/tests/pass/address/console_assert_pass.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/asg/tests/pass/address/input.leo b/asg/tests/pass/address/input.leo index 29519f0334..506abb0fff 100644 --- a/asg/tests/pass/address/input.leo +++ b/asg/tests/pass/address/input.leo @@ -1,5 +1,5 @@ function main(owner: address) { - const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(owner == sender); } \ No newline at end of file diff --git a/asg/tests/pass/address/ternary.leo b/asg/tests/pass/address/ternary.leo index dc87153d2d..f29e13ab5d 100644 --- a/asg/tests/pass/address/ternary.leo +++ b/asg/tests/pass/address/ternary.leo @@ -1,6 +1,6 @@ function main(s: bool, c: address) { - const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r); + const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r; const r = s? a: b; diff --git a/asg/tests/pass/address/valid.leo b/asg/tests/pass/address/valid.leo index 18f1682526..6d693efe78 100644 --- a/asg/tests/pass/address/valid.leo +++ b/asg/tests/pass/address/valid.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; } \ No newline at end of file diff --git a/asg/tests/pass/array/registers.leo b/asg/tests/pass/array/registers.leo index fb8980868e..98d129207f 100644 --- a/asg/tests/pass/array/registers.leo +++ b/asg/tests/pass/array/registers.leo @@ -1,3 +1,3 @@ -function main(input) -> [u8; 3] { - return input.registers.r -} \ No newline at end of file +function main() -> [u8; 3] { + return input.registers.r; +} diff --git a/asg/tests/pass/boolean/output_register.leo b/asg/tests/pass/boolean/output_register.leo index fb01d41dbe..6273b0a1df 100644 --- a/asg/tests/pass/boolean/output_register.leo +++ b/asg/tests/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ -function main(input) -> bool { - return input.registers.r -} \ No newline at end of file +function main() -> bool { + return input.registers.r; +} diff --git a/asg/tests/pass/circuits/member_function.leo b/asg/tests/pass/circuits/member_function.leo index 4e50e97195..b7879b5bf7 100644 --- a/asg/tests/pass/circuits/member_function.leo +++ b/asg/tests/pass/circuits/member_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/member_function_nested.leo b/asg/tests/pass/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/asg/tests/pass/circuits/member_function_nested.leo +++ b/asg/tests/pass/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/asg/tests/pass/circuits/member_static_function.leo b/asg/tests/pass/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/asg/tests/pass/circuits/member_static_function.leo +++ b/asg/tests/pass/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/member_variable_and_function.leo b/asg/tests/pass/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/asg/tests/pass/circuits/member_variable_and_function.leo +++ b/asg/tests/pass/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/asg/tests/pass/circuits/mod.rs b/asg/tests/pass/circuits/mod.rs index ee2315b6f7..9936d9877d 100644 --- a/asg/tests/pass/circuits/mod.rs +++ b/asg/tests/pass/circuits/mod.rs @@ -49,7 +49,7 @@ fn test_mut_member_function() { let program_string = r#" circuit Foo { function echo(mut self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/pedersen_mock.leo b/asg/tests/pass/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/asg/tests/pass/circuits/pedersen_mock.leo +++ b/asg/tests/pass/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/asg/tests/pass/circuits/self_circuit.leo b/asg/tests/pass/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/asg/tests/pass/circuits/self_circuit.leo +++ b/asg/tests/pass/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/asg/tests/pass/circuits/self_member.leo b/asg/tests/pass/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/asg/tests/pass/circuits/self_member.leo +++ b/asg/tests/pass/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/asg/tests/pass/core/blake2s_input.leo b/asg/tests/pass/core/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/asg/tests/pass/core/blake2s_input.leo +++ b/asg/tests/pass/core/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/asg/tests/pass/form_ast.rs b/asg/tests/pass/form_ast.rs index 3a012d9e14..dfb72639b9 100644 --- a/asg/tests/pass/form_ast.rs +++ b/asg/tests/pass/form_ast.rs @@ -36,7 +36,7 @@ fn test_function_rename() { a += 1; } - return a + return a; } function main() { @@ -63,7 +63,7 @@ fn test_imports() { } function foo() -> u32 { - return 1u32 + return 1u32; } "#; imports diff --git a/asg/tests/pass/function/iteration.leo b/asg/tests/pass/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/asg/tests/pass/function/iteration.leo +++ b/asg/tests/pass/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/asg/tests/pass/function/iteration_repeated.leo b/asg/tests/pass/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/asg/tests/pass/function/iteration_repeated.leo +++ b/asg/tests/pass/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/asg/tests/pass/function/mod.rs b/asg/tests/pass/function/mod.rs index 3ae7434608..9f5a05f44a 100644 --- a/asg/tests/pass/function/mod.rs +++ b/asg/tests/pass/function/mod.rs @@ -32,7 +32,7 @@ fn test_iteration() { fn test_const_args() { let program_string = r#" function one(const value: u32) -> u32 { - return value + 1 + return value + 1; } function main() { @@ -52,7 +52,7 @@ fn test_const_args() { fn test_const_args_used() { let program_string = r#" function index(arr: [u8; 3], const value: u32) -> u8 { - return arr[value] + return arr[value]; } function main() { @@ -73,7 +73,7 @@ fn test_const_args_used() { fn test_const_args_fail() { let program_string = r#" function index(arr: [u8; 3], const value: u32) -> u8 { - return arr[value] + return arr[value]; } function main(x_value: u32) { diff --git a/asg/tests/pass/function/multiple_returns.leo b/asg/tests/pass/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/asg/tests/pass/function/multiple_returns.leo +++ b/asg/tests/pass/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/function/multiple_returns_main.leo b/asg/tests/pass/function/multiple_returns_main.leo index 0bc82e1e4b..8590cdd71e 100644 --- a/asg/tests/pass/function/multiple_returns_main.leo +++ b/asg/tests/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ -function main(input) -> (bool, bool) { - return (input.registers.a, input.registers.b) -} \ No newline at end of file +function main() -> (bool, bool) { + return (input.registers.a, input.registers.b); +} diff --git a/asg/tests/pass/function/newlines.leo b/asg/tests/pass/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/asg/tests/pass/function/newlines.leo +++ b/asg/tests/pass/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/asg/tests/pass/function/repeated.leo b/asg/tests/pass/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/asg/tests/pass/function/repeated.leo +++ b/asg/tests/pass/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/asg/tests/pass/function/return.leo b/asg/tests/pass/function/return.leo index 10c7138977..e839700ee3 100644 --- a/asg/tests/pass/function/return.leo +++ b/asg/tests/pass/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/asg/tests/pass/function/return_array_nested_pass.leo b/asg/tests/pass/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/asg/tests/pass/function/return_array_nested_pass.leo +++ b/asg/tests/pass/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/asg/tests/pass/function/return_array_tuple_pass.leo b/asg/tests/pass/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/asg/tests/pass/function/return_array_tuple_pass.leo +++ b/asg/tests/pass/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/asg/tests/pass/function/return_tuple.leo b/asg/tests/pass/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/asg/tests/pass/function/return_tuple.leo +++ b/asg/tests/pass/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/asg/tests/pass/function/return_tuple_conditional.leo b/asg/tests/pass/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/asg/tests/pass/function/return_tuple_conditional.leo +++ b/asg/tests/pass/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/asg/tests/pass/import/src/test-import.leo b/asg/tests/pass/import/src/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/asg/tests/pass/import/src/test-import.leo +++ b/asg/tests/pass/import/src/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/asg/tests/pass/input_files/program_input_and_program_state/access.leo b/asg/tests/pass/input_files/program_input_and_program_state/access.leo index ae1728c164..819f6c6c1e 100644 --- a/asg/tests/pass/input_files/program_input_and_program_state/access.leo +++ b/asg/tests/pass/input_files/program_input_and_program_state/access.leo @@ -1,4 +1,4 @@ -function main(input, data: [u8; 32]) { +function main(data: [u8; 32]) { console.assert(input.registers.value_balance == 0u64); console.assert(input.state.leaf_index == 0u32); diff --git a/asg/tests/pass/input_files/program_state/access_all.leo b/asg/tests/pass/input_files/program_state/access_all.leo index 2a60f218aa..bf85a3f722 100644 --- a/asg/tests/pass/input_files/program_state/access_all.leo +++ b/asg/tests/pass/input_files/program_state/access_all.leo @@ -1,4 +1,4 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); const expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; diff --git a/asg/tests/pass/input_files/program_state/access_state.leo b/asg/tests/pass/input_files/program_state/access_state.leo index 0e014aec54..a7afe50a5f 100644 --- a/asg/tests/pass/input_files/program_state/access_state.leo +++ b/asg/tests/pass/input_files/program_state/access_state.leo @@ -1,3 +1,3 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); } \ No newline at end of file diff --git a/asg/tests/pass/mutability/swap.leo b/asg/tests/pass/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/asg/tests/pass/mutability/swap.leo +++ b/asg/tests/pass/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/asg/tests/pass/statements/conditional/multiple_returns.leo b/asg/tests/pass/statements/conditional/multiple_returns.leo index b8dd869b47..f2b9e499c2 100644 --- a/asg/tests/pass/statements/conditional/multiple_returns.leo +++ b/asg/tests/pass/statements/conditional/multiple_returns.leo @@ -1,7 +1,7 @@ -function main(input) -> u32 { +function main() -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/asg/tests/pass/tuples/function.leo b/asg/tests/pass/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/asg/tests/pass/tuples/function.leo +++ b/asg/tests/pass/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/tuples/function_multiple.leo b/asg/tests/pass/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/asg/tests/pass/tuples/function_multiple.leo +++ b/asg/tests/pass/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/tuples/function_typed.leo b/asg/tests/pass/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/asg/tests/pass/tuples/function_typed.leo +++ b/asg/tests/pass/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/ast/Cargo.toml b/ast/Cargo.toml index e5c68b6240..852ff666e9 100644 --- a/ast/Cargo.toml +++ b/ast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-ast" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Core AST of the Leo programming language" homepage = "https://aleo.org" @@ -19,7 +19,7 @@ edition = "2018" [dependencies.leo-input] path = "../input" -version = "1.3.0" +version = "1.4.0" [dependencies.indexmap] version = "1.6.2" diff --git a/ast/src/common/mod.rs b/ast/src/common/mod.rs index e7bd108cd2..a1255ed0a0 100644 --- a/ast/src/common/mod.rs +++ b/ast/src/common/mod.rs @@ -23,9 +23,6 @@ pub use const_self_keyword::*; pub mod identifier; pub use identifier::*; -pub mod input_keyword; -pub use input_keyword::*; - pub mod mut_self_keyword; pub use mut_self_keyword::*; diff --git a/ast/src/reducer/errors.rs b/ast/src/errors/canonicalization.rs similarity index 94% rename from ast/src/reducer/errors.rs rename to ast/src/errors/canonicalization.rs index 0ed9d40942..febe7bd0f0 100644 --- a/ast/src/reducer/errors.rs +++ b/ast/src/errors/canonicalization.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{FormattedError, Span}; +use crate::{FormattedError, LeoError, Span}; #[derive(Debug, Error)] pub enum CanonicalizeError { @@ -22,6 +22,8 @@ pub enum CanonicalizeError { Error(#[from] FormattedError), } +impl LeoError for CanonicalizeError {} + impl CanonicalizeError { fn new_from_span(message: String, span: &Span) -> Self { CanonicalizeError::Error(FormattedError::new_from_span(message, span)) diff --git a/ast/src/common/input_keyword.rs b/ast/src/errors/combiner.rs similarity index 51% rename from ast/src/common/input_keyword.rs rename to ast/src/errors/combiner.rs index fecf89322e..5a1022db27 100644 --- a/ast/src/common/input_keyword.rs +++ b/ast/src/errors/combiner.rs @@ -14,31 +14,30 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Identifier, Node, Span}; +use crate::{FormattedError, LeoError, Span}; -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `input` keyword can view program register, record, and state values. -/// Values cannot be modified. The `input` keyword cannot be made mutable. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct InputKeyword { - pub identifier: Identifier, +#[derive(Debug, Error)] +pub enum CombinerError { + #[error("{}", _0)] + Error(#[from] FormattedError), } -impl fmt::Display for InputKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "input") - } -} +impl LeoError for CombinerError {} -impl Node for InputKeyword { - fn span(&self) -> &Span { - &self.identifier.span +impl CombinerError { + fn new_from_span(message: String, span: &Span) -> Self { + CombinerError::Error(FormattedError::new_from_span(message, span)) } - fn set_span(&mut self, span: Span) { - self.identifier.span = span; + pub fn asg_statement_not_block(span: &Span) -> Self { + let message = "AstStatement should be be a block".to_string(); + + Self::new_from_span(message, span) + } + + pub fn illegal_compound_array_range(span: &Span) -> Self { + let message = "Illegal compound assignement with array range".to_string(); + + Self::new_from_span(message, span) } } diff --git a/ast/src/errors/error.rs b/ast/src/errors/error.rs index 6f34ea3463..0cf34f5d25 100644 --- a/ast/src/errors/error.rs +++ b/ast/src/errors/error.rs @@ -75,11 +75,11 @@ fn underline(mut start: usize, mut end: usize) -> String { impl fmt::Display for FormattedError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let underline = underline(self.col_start - 1, self.col_stop - 1); + let underline = underline(self.col_start, self.col_stop); write!( f, - "{indent }--> {path}: {line_start}:{start}\n\ + "{indent }--> {path}:{line_start}:{start}\n\ {indent } |\n", indent = INDENT, path = &*self.path, @@ -99,7 +99,7 @@ impl fmt::Display for FormattedError { write!( f, - "{indent } | {underline}\n\ + "{indent } |{underline}\n\ {indent } |\n\ {indent } = {message}", indent = INDENT, @@ -121,8 +121,8 @@ fn test_error() { path: std::sync::Arc::new("file.leo".to_string()), line_start: 2, line_stop: 2, - col_start: 8, - col_stop: 9, + col_start: 9, + col_stop: 10, content: "let a = x;".into(), message: "undefined value `x`".to_string(), }; @@ -130,7 +130,7 @@ fn test_error() { assert_eq!( err.to_string(), vec![ - " --> file.leo: 2:8", + " --> file.leo:2:9", " |", " 2 | let a = x;", " | ^", diff --git a/ast/src/errors/mod.rs b/ast/src/errors/mod.rs index c998e0c485..88bfd8f2b4 100644 --- a/ast/src/errors/mod.rs +++ b/ast/src/errors/mod.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +pub mod canonicalization; +pub use canonicalization::*; + +pub mod combiner; +pub use combiner::*; + pub mod error; pub use error::*; +pub mod reducer; +pub use reducer::*; + pub trait LeoError {} diff --git a/ast/src/errors/reducer.rs b/ast/src/errors/reducer.rs new file mode 100644 index 0000000000..e8b582af85 --- /dev/null +++ b/ast/src/errors/reducer.rs @@ -0,0 +1,43 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use crate::{CanonicalizeError, CombinerError, FormattedError, LeoError, Span}; + +#[derive(Debug, Error)] +pub enum ReducerError { + #[error("{}", _0)] + Error(#[from] FormattedError), + + #[error("{}", _0)] + CanonicalizeError(#[from] CanonicalizeError), + + #[error("{}", _0)] + CombinerError(#[from] CombinerError), +} + +impl LeoError for ReducerError {} + +impl ReducerError { + fn new_from_span(message: String, span: &Span) -> Self { + ReducerError::Error(FormattedError::new_from_span(message, span)) + } + + pub fn impossible_console_assert_call(span: &Span) -> Self { + let message = "Console::Assert cannot be matched here, its handled in another case.".to_string(); + + Self::new_from_span(message, span) + } +} diff --git a/ast/src/functions/input/input_variable.rs b/ast/src/functions/input/input_variable.rs index fda2c11ab8..9f5d0575af 100644 --- a/ast/src/functions/input/input_variable.rs +++ b/ast/src/functions/input/input_variable.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ConstSelfKeyword, FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span}; +use crate::{ConstSelfKeyword, FunctionInputVariable, MutSelfKeyword, Node, SelfKeyword, Span}; use serde::{Deserialize, Serialize}; use std::fmt; @@ -22,7 +22,6 @@ use std::fmt; /// Enumerates the possible inputs to a function. #[derive(Clone, Serialize, Deserialize)] pub enum FunctionInput { - InputKeyword(InputKeyword), SelfKeyword(SelfKeyword), ConstSelfKeyword(ConstSelfKeyword), MutSelfKeyword(MutSelfKeyword), @@ -36,7 +35,6 @@ impl FunctionInput { /// pub fn is_self(&self) -> bool { match self { - FunctionInput::InputKeyword(_) => false, FunctionInput::SelfKeyword(_) => true, FunctionInput::ConstSelfKeyword(_) => true, FunctionInput::MutSelfKeyword(_) => true, @@ -50,7 +48,6 @@ impl FunctionInput { /// pub fn is_const_self(&self) -> bool { match self { - FunctionInput::InputKeyword(_) => false, FunctionInput::SelfKeyword(_) => false, FunctionInput::ConstSelfKeyword(_) => true, FunctionInput::MutSelfKeyword(_) => false, @@ -64,7 +61,6 @@ impl FunctionInput { /// pub fn is_mut_self(&self) -> bool { match self { - FunctionInput::InputKeyword(_) => false, FunctionInput::SelfKeyword(_) => false, FunctionInput::ConstSelfKeyword(_) => false, FunctionInput::MutSelfKeyword(_) => true, @@ -74,7 +70,6 @@ impl FunctionInput { fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - FunctionInput::InputKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::SelfKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::ConstSelfKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::MutSelfKeyword(keyword) => write!(f, "{}", keyword), @@ -99,7 +94,6 @@ impl PartialEq for FunctionInput { /// Returns true if `self == other`. Does not compare spans. fn eq(&self, other: &Self) -> bool { match (self, other) { - (FunctionInput::InputKeyword(_), FunctionInput::InputKeyword(_)) => true, (FunctionInput::SelfKeyword(_), FunctionInput::SelfKeyword(_)) => true, (FunctionInput::ConstSelfKeyword(_), FunctionInput::ConstSelfKeyword(_)) => true, (FunctionInput::MutSelfKeyword(_), FunctionInput::MutSelfKeyword(_)) => true, @@ -115,7 +109,6 @@ impl Node for FunctionInput { fn span(&self) -> &Span { use FunctionInput::*; match self { - InputKeyword(keyword) => &keyword.identifier.span, SelfKeyword(keyword) => &keyword.identifier.span, ConstSelfKeyword(keyword) => &keyword.identifier.span, MutSelfKeyword(keyword) => &keyword.identifier.span, @@ -126,7 +119,6 @@ impl Node for FunctionInput { fn set_span(&mut self, span: Span) { use FunctionInput::*; match self { - InputKeyword(keyword) => keyword.identifier.span = span, SelfKeyword(keyword) => keyword.identifier.span = span, ConstSelfKeyword(keyword) => keyword.identifier.span = span, MutSelfKeyword(keyword) => keyword.identifier.span = span, diff --git a/ast/src/lib.rs b/ast/src/lib.rs index c50b3021bc..7fab42c3be 100644 --- a/ast/src/lib.rs +++ b/ast/src/lib.rs @@ -71,7 +71,7 @@ pub use node::*; /// These data types form a tree that begins from a [`Program`] type root. /// /// A new [`Ast`] can be created from a [`Grammar`] generated by the pest parser in the `grammar` module. -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Ast { ast: Program, } @@ -83,7 +83,7 @@ impl Ast { } /// Mutates the program ast by preforming canonicalization on it. - pub fn canonicalize(&mut self) -> Result<(), CanonicalizeError> { + pub fn canonicalize(&mut self) -> Result<(), ReducerError> { self.ast = ReconstructingDirector::new(Canonicalizer::default()).reduce_program(self.as_repr())?; Ok(()) } diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 6cbd7ffe94..7237d88d69 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -25,11 +25,78 @@ use crate::*; pub struct Canonicalizer { // If we are in a circuit keep track of the circuit name. circuit_name: Option, + in_circuit: bool, +} + +impl Default for Canonicalizer { + fn default() -> Self { + Self { + circuit_name: None, + in_circuit: false, + } + } } impl Canonicalizer { - pub fn default() -> Self { - Self { circuit_name: None } + pub fn canonicalize_accesses( + &mut self, + start: Expression, + accesses: &[AssigneeAccess], + span: &Span, + ) -> Result, ReducerError> { + let mut left = Box::new(start); + + for access in accesses.iter() { + match self.canonicalize_assignee_access(&access) { + AssigneeAccess::ArrayIndex(index) => { + left = Box::new(Expression::ArrayAccess(ArrayAccessExpression { + array: left, + index: Box::new(index), + span: span.clone(), + })); + } + AssigneeAccess::Tuple(positive_number, _) => { + left = Box::new(Expression::TupleAccess(TupleAccessExpression { + tuple: left, + index: positive_number, + span: span.clone(), + })); + } + AssigneeAccess::Member(identifier) => { + left = Box::new(Expression::CircuitMemberAccess(CircuitMemberAccessExpression { + circuit: left, + name: identifier, + span: span.clone(), + })); + } + _ => return Err(ReducerError::from(CombinerError::illegal_compound_array_range(&span))), + } + } + + Ok(left) + } + + pub fn compound_operation_converstion( + &mut self, + operation: &AssignOperation, + ) -> Result { + match operation { + AssignOperation::Assign => unreachable!(), + AssignOperation::Add => Ok(BinaryOperation::Add), + AssignOperation::Sub => Ok(BinaryOperation::Sub), + AssignOperation::Mul => Ok(BinaryOperation::Mul), + AssignOperation::Div => Ok(BinaryOperation::Div), + AssignOperation::Pow => Ok(BinaryOperation::Pow), + AssignOperation::Or => Ok(BinaryOperation::Or), + AssignOperation::And => Ok(BinaryOperation::And), + AssignOperation::BitOr => Ok(BinaryOperation::BitOr), + AssignOperation::BitAnd => Ok(BinaryOperation::BitAnd), + AssignOperation::BitXor => Ok(BinaryOperation::BitXor), + AssignOperation::Shr => Ok(BinaryOperation::Shr), + AssignOperation::ShrSigned => Ok(BinaryOperation::ShrSigned), + AssignOperation::Shl => Ok(BinaryOperation::Shl), + AssignOperation::Mod => Ok(BinaryOperation::Mod), + } } fn is_self_type(&mut self, type_option: Option<&Type>) -> bool { @@ -324,7 +391,7 @@ impl Canonicalizer { .map(|parameter| self.canonicalize_expression(parameter)) .collect(); - let formatted = FormattedString { + let formatted = FormatString { parts: format.parts.clone(), parameters, span: format.span.clone(), @@ -380,17 +447,21 @@ impl Canonicalizer { } impl ReconstructingReducer for Canonicalizer { - fn reduce_type( - &mut self, - _type_: &Type, - new: Type, - in_circuit: bool, - span: &Span, - ) -> Result { + fn in_circuit(&self) -> bool { + self.in_circuit + } + + fn swap_in_circuit(&mut self) { + self.in_circuit = !self.in_circuit; + } + + fn reduce_type(&mut self, _type_: &Type, new: Type, span: &Span) -> Result { match new { Type::Array(type_, mut dimensions) => { if dimensions.is_zero() { - return Err(CanonicalizeError::invalid_array_dimension_size(span)); + return Err(ReducerError::from(CanonicalizeError::invalid_array_dimension_size( + span, + ))); } let mut next = Type::Array(type_, ArrayDimensions(vec![dimensions.remove_last().unwrap()])); @@ -407,7 +478,9 @@ impl ReconstructingReducer for Canonicalizer { Ok(array) } - Type::SelfType if !in_circuit => Err(CanonicalizeError::big_self_outside_of_circuit(span)), + Type::SelfType if !self.in_circuit => { + Err(ReducerError::from(CanonicalizeError::big_self_outside_of_circuit(span))) + } _ => Ok(new.clone()), } } @@ -416,10 +489,11 @@ impl ReconstructingReducer for Canonicalizer { &mut self, array_init: &ArrayInitExpression, element: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { if array_init.dimensions.is_zero() { - return Err(CanonicalizeError::invalid_array_dimension_size(&array_init.span)); + return Err(ReducerError::from(CanonicalizeError::invalid_array_dimension_size( + &array_init.span, + ))); } let element = Box::new(element); @@ -466,58 +540,39 @@ impl ReconstructingReducer for Canonicalizer { assign: &AssignStatement, assignee: Assignee, value: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { match value { + Expression::Binary(binary_expr) if assign.operation != AssignOperation::Assign => { + let left = self.canonicalize_accesses( + Expression::Identifier(assignee.identifier.clone()), + &assignee.accesses, + &assign.span, + )?; + let right = Box::new(Expression::Binary(binary_expr)); + let op = self.compound_operation_converstion(&assign.operation)?; + + let new_value = Expression::Binary(BinaryExpression { + left, + right, + op, + span: assign.span.clone(), + }); + + Ok(AssignStatement { + operation: AssignOperation::Assign, + assignee, + value: new_value, + span: assign.span.clone(), + }) + } Expression::Value(value_expr) if assign.operation != AssignOperation::Assign => { - let mut left = Box::new(Expression::Identifier(assignee.identifier.clone())); - - for access in assignee.accesses.iter().rev() { - match self.canonicalize_assignee_access(&access) { - AssigneeAccess::ArrayIndex(index) => { - left = Box::new(Expression::ArrayAccess(ArrayAccessExpression { - array: left, - index: Box::new(index), - span: assign.span.clone(), - })); - } - AssigneeAccess::Tuple(positive_number, _) => { - left = Box::new(Expression::TupleAccess(TupleAccessExpression { - tuple: left, - index: positive_number, - span: assign.span.clone(), - })); - } - AssigneeAccess::Member(identifier) => { - left = Box::new(Expression::CircuitMemberAccess(CircuitMemberAccessExpression { - circuit: left, - name: identifier, - span: assign.span.clone(), - })); - } - _ => unimplemented!(), // No reason for someone to compute ArrayRanges. - } - } - + let left = self.canonicalize_accesses( + Expression::Identifier(assignee.identifier.clone()), + &assignee.accesses, + &assign.span, + )?; let right = Box::new(Expression::Value(value_expr)); - - let op = match assign.operation { - AssignOperation::Assign => unimplemented!(), // Imposible - AssignOperation::Add => BinaryOperation::Add, - AssignOperation::Sub => BinaryOperation::Sub, - AssignOperation::Mul => BinaryOperation::Mul, - AssignOperation::Div => BinaryOperation::Div, - AssignOperation::Pow => BinaryOperation::Pow, - AssignOperation::Or => BinaryOperation::Or, - AssignOperation::And => BinaryOperation::And, - AssignOperation::BitOr => BinaryOperation::BitOr, - AssignOperation::BitAnd => BinaryOperation::BitAnd, - AssignOperation::BitXor => BinaryOperation::BitXor, - AssignOperation::Shr => BinaryOperation::Shr, - AssignOperation::ShrSigned => BinaryOperation::ShrSigned, - AssignOperation::Shl => BinaryOperation::Shl, - AssignOperation::Mod => BinaryOperation::Mod, - }; + let op = self.compound_operation_converstion(&assign.operation)?; let new_value = Expression::Binary(BinaryExpression { left, @@ -545,8 +600,7 @@ impl ReconstructingReducer for Canonicalizer { input: Vec, output: Option, block: Block, - _in_circuit: bool, - ) -> Result { + ) -> Result { let new_output = match output { None => Some(Type::Tuple(vec![])), _ => output, @@ -567,7 +621,7 @@ impl ReconstructingReducer for Canonicalizer { _circuit: &Circuit, circuit_name: Identifier, members: Vec, - ) -> Result { + ) -> Result { self.circuit_name = Some(circuit_name.clone()); let circ = Circuit { circuit_name, diff --git a/ast/src/reducer/mod.rs b/ast/src/reducer/mod.rs index d5d4d52982..144997d8e1 100644 --- a/ast/src/reducer/mod.rs +++ b/ast/src/reducer/mod.rs @@ -17,9 +17,6 @@ mod canonicalization; pub use canonicalization::*; -mod errors; -pub use errors::*; - mod reconstructing_reducer; pub use reconstructing_reducer::*; diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index 016d8d18db..d3a71e8e56 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -22,18 +22,14 @@ use indexmap::IndexMap; pub struct ReconstructingDirector { reducer: R, - in_circuit: bool, } impl ReconstructingDirector { pub fn new(reducer: R) -> Self { - Self { - reducer, - in_circuit: false, - } + Self { reducer } } - pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result { + pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result { let new = match type_ { Type::Array(type_, dimensions) => Type::Array(Box::new(self.reduce_type(type_, span)?), dimensions.clone()), Type::Tuple(types) => { @@ -48,11 +44,11 @@ impl ReconstructingDirector { _ => type_.clone(), }; - self.reducer.reduce_type(type_, new, self.in_circuit, span) + self.reducer.reduce_type(type_, new, span) } // Expressions - pub fn reduce_expression(&mut self, expression: &Expression) -> Result { + pub fn reduce_expression(&mut self, expression: &Expression) -> Result { let new = match expression { Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(&identifier)?), Expression::Value(value) => Expression::Value(self.reduce_value(&value)?), @@ -84,18 +80,18 @@ impl ReconstructingDirector { Expression::Call(call) => Expression::Call(self.reduce_call(&call)?), }; - self.reducer.reduce_expression(expression, new, self.in_circuit) + self.reducer.reduce_expression(expression, new) } - pub fn reduce_identifier(&mut self, identifier: &Identifier) -> Result { + pub fn reduce_identifier(&mut self, identifier: &Identifier) -> Result { self.reducer.reduce_identifier(identifier) } - pub fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result { + pub fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result { self.reducer.reduce_group_tuple(group_tuple) } - pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result { + pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result { let new = match group_value { GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(&group_tuple)?), _ => group_value.clone(), @@ -104,7 +100,7 @@ impl ReconstructingDirector { self.reducer.reduce_group_value(group_value, new) } - pub fn reduce_value(&mut self, value: &ValueExpression) -> Result { + pub fn reduce_value(&mut self, value: &ValueExpression) -> Result { let new = match value { ValueExpression::Group(group_value) => { ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?)) @@ -115,41 +111,38 @@ impl ReconstructingDirector { self.reducer.reduce_value(value, new) } - pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result { + pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result { let left = self.reduce_expression(&binary.left)?; let right = self.reduce_expression(&binary.right)?; - self.reducer - .reduce_binary(binary, left, right, binary.op.clone(), self.in_circuit) + self.reducer.reduce_binary(binary, left, right, binary.op.clone()) } - pub fn reduce_unary(&mut self, unary: &UnaryExpression) -> Result { + pub fn reduce_unary(&mut self, unary: &UnaryExpression) -> Result { let inner = self.reduce_expression(&unary.inner)?; - self.reducer - .reduce_unary(unary, inner, unary.op.clone(), self.in_circuit) + self.reducer.reduce_unary(unary, inner, unary.op.clone()) } - pub fn reduce_ternary(&mut self, ternary: &TernaryExpression) -> Result { + pub fn reduce_ternary(&mut self, ternary: &TernaryExpression) -> Result { let condition = self.reduce_expression(&ternary.condition)?; let if_true = self.reduce_expression(&ternary.if_true)?; let if_false = self.reduce_expression(&ternary.if_false)?; - self.reducer - .reduce_ternary(ternary, condition, if_true, if_false, self.in_circuit) + self.reducer.reduce_ternary(ternary, condition, if_true, if_false) } - pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result { + pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result { let inner = self.reduce_expression(&cast.inner)?; let target_type = self.reduce_type(&cast.target_type, &cast.span)?; - self.reducer.reduce_cast(cast, inner, target_type, self.in_circuit) + self.reducer.reduce_cast(cast, inner, target_type) } pub fn reduce_array_inline( &mut self, array_inline: &ArrayInlineExpression, - ) -> Result { + ) -> Result { let mut elements = vec![]; for element in array_inline.elements.iter() { let reduced_element = match element { @@ -164,34 +157,29 @@ impl ReconstructingDirector { elements.push(reduced_element); } - self.reducer - .reduce_array_inline(array_inline, elements, self.in_circuit) + self.reducer.reduce_array_inline(array_inline, elements) } - pub fn reduce_array_init( - &mut self, - array_init: &ArrayInitExpression, - ) -> Result { + pub fn reduce_array_init(&mut self, array_init: &ArrayInitExpression) -> Result { let element = self.reduce_expression(&array_init.element)?; - self.reducer.reduce_array_init(array_init, element, self.in_circuit) + self.reducer.reduce_array_init(array_init, element) } pub fn reduce_array_access( &mut self, array_access: &ArrayAccessExpression, - ) -> Result { + ) -> Result { let array = self.reduce_expression(&array_access.array)?; let index = self.reduce_expression(&array_access.index)?; - self.reducer - .reduce_array_access(array_access, array, index, self.in_circuit) + self.reducer.reduce_array_access(array_access, array, index) } pub fn reduce_array_range_access( &mut self, array_range_access: &ArrayRangeAccessExpression, - ) -> Result { + ) -> Result { let array = self.reduce_expression(&array_range_access.array)?; let left = array_range_access .left @@ -205,34 +193,31 @@ impl ReconstructingDirector { .transpose()?; self.reducer - .reduce_array_range_access(array_range_access, array, left, right, self.in_circuit) + .reduce_array_range_access(array_range_access, array, left, right) } - pub fn reduce_tuple_init( - &mut self, - tuple_init: &TupleInitExpression, - ) -> Result { + pub fn reduce_tuple_init(&mut self, tuple_init: &TupleInitExpression) -> Result { let mut elements = vec![]; for element in tuple_init.elements.iter() { elements.push(self.reduce_expression(element)?); } - self.reducer.reduce_tuple_init(tuple_init, elements, self.in_circuit) + self.reducer.reduce_tuple_init(tuple_init, elements) } pub fn reduce_tuple_access( &mut self, tuple_access: &TupleAccessExpression, - ) -> Result { + ) -> Result { let tuple = self.reduce_expression(&tuple_access.tuple)?; - self.reducer.reduce_tuple_access(tuple_access, tuple, self.in_circuit) + self.reducer.reduce_tuple_access(tuple_access, tuple) } pub fn reduce_circuit_implied_variable_definition( &mut self, variable: &CircuitImpliedVariableDefinition, - ) -> Result { + ) -> Result { let identifier = self.reduce_identifier(&variable.identifier)?; let expression = variable .expression @@ -241,13 +226,13 @@ impl ReconstructingDirector { .transpose()?; self.reducer - .reduce_circuit_implied_variable_definition(variable, identifier, expression, self.in_circuit) + .reduce_circuit_implied_variable_definition(variable, identifier, expression) } pub fn reduce_circuit_init( &mut self, circuit_init: &CircuitInitExpression, - ) -> Result { + ) -> Result { let name = self.reduce_identifier(&circuit_init.name)?; let mut members = vec![]; @@ -255,33 +240,32 @@ impl ReconstructingDirector { members.push(self.reduce_circuit_implied_variable_definition(member)?); } - self.reducer - .reduce_circuit_init(circuit_init, name, members, self.in_circuit) + self.reducer.reduce_circuit_init(circuit_init, name, members) } pub fn reduce_circuit_member_access( &mut self, circuit_member_access: &CircuitMemberAccessExpression, - ) -> Result { + ) -> Result { let circuit = self.reduce_expression(&circuit_member_access.circuit)?; let name = self.reduce_identifier(&circuit_member_access.name)?; self.reducer - .reduce_circuit_member_access(circuit_member_access, circuit, name, self.in_circuit) + .reduce_circuit_member_access(circuit_member_access, circuit, name) } pub fn reduce_circuit_static_fn_access( &mut self, circuit_static_fn_access: &CircuitStaticFunctionAccessExpression, - ) -> Result { + ) -> Result { let circuit = self.reduce_expression(&circuit_static_fn_access.circuit)?; let name = self.reduce_identifier(&circuit_static_fn_access.name)?; self.reducer - .reduce_circuit_static_fn_access(circuit_static_fn_access, circuit, name, self.in_circuit) + .reduce_circuit_static_fn_access(circuit_static_fn_access, circuit, name) } - pub fn reduce_call(&mut self, call: &CallExpression) -> Result { + pub fn reduce_call(&mut self, call: &CallExpression) -> Result { let function = self.reduce_expression(&call.function)?; let mut arguments = vec![]; @@ -289,11 +273,11 @@ impl ReconstructingDirector { arguments.push(self.reduce_expression(argument)?); } - self.reducer.reduce_call(call, function, arguments, self.in_circuit) + self.reducer.reduce_call(call, function, arguments) } // Statements - pub fn reduce_statement(&mut self, statement: &Statement) -> Result { + pub fn reduce_statement(&mut self, statement: &Statement) -> Result { let new = match statement { Statement::Return(return_statement) => Statement::Return(self.reduce_return(&return_statement)?), Statement::Definition(definition) => Statement::Definition(self.reduce_definition(&definition)?), @@ -305,26 +289,22 @@ impl ReconstructingDirector { Statement::Block(block) => Statement::Block(self.reduce_block(&block)?), }; - self.reducer.reduce_statement(statement, new, self.in_circuit) + self.reducer.reduce_statement(statement, new) } - pub fn reduce_return(&mut self, return_statement: &ReturnStatement) -> Result { + pub fn reduce_return(&mut self, return_statement: &ReturnStatement) -> Result { let expression = self.reduce_expression(&return_statement.expression)?; - self.reducer - .reduce_return(return_statement, expression, self.in_circuit) + self.reducer.reduce_return(return_statement, expression) } - pub fn reduce_variable_name(&mut self, variable_name: &VariableName) -> Result { + pub fn reduce_variable_name(&mut self, variable_name: &VariableName) -> Result { let identifier = self.reduce_identifier(&variable_name.identifier)?; self.reducer.reduce_variable_name(variable_name, identifier) } - pub fn reduce_definition( - &mut self, - definition: &DefinitionStatement, - ) -> Result { + pub fn reduce_definition(&mut self, definition: &DefinitionStatement) -> Result { let mut variable_names = vec![]; for variable_name in definition.variable_names.iter() { variable_names.push(self.reduce_variable_name(variable_name)?); @@ -338,11 +318,10 @@ impl ReconstructingDirector { let value = self.reduce_expression(&definition.value)?; - self.reducer - .reduce_definition(definition, variable_names, type_, value, self.in_circuit) + self.reducer.reduce_definition(definition, variable_names, type_, value) } - pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result { + pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result { let new = match access { AssigneeAccess::ArrayRange(left, right) => { let left = left.as_ref().map(|left| self.reduce_expression(left)).transpose()?; @@ -355,10 +334,10 @@ impl ReconstructingDirector { _ => access.clone(), }; - self.reducer.reduce_assignee_access(access, new, self.in_circuit) + self.reducer.reduce_assignee_access(access, new) } - pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result { + pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result { let identifier = self.reduce_identifier(&assignee.identifier)?; let mut accesses = vec![]; @@ -366,21 +345,20 @@ impl ReconstructingDirector { accesses.push(self.reduce_assignee_access(access)?); } - self.reducer - .reduce_assignee(assignee, identifier, accesses, self.in_circuit) + self.reducer.reduce_assignee(assignee, identifier, accesses) } - pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result { + pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result { let assignee = self.reduce_assignee(&assign.assignee)?; let value = self.reduce_expression(&assign.value)?; - self.reducer.reduce_assign(assign, assignee, value, self.in_circuit) + self.reducer.reduce_assign(assign, assignee, value) } pub fn reduce_conditional( &mut self, conditional: &ConditionalStatement, - ) -> Result { + ) -> Result { let condition = self.reduce_expression(&conditional.condition)?; let block = self.reduce_block(&conditional.block)?; let next = conditional @@ -389,27 +367,22 @@ impl ReconstructingDirector { .map(|condition| self.reduce_statement(condition)) .transpose()?; - self.reducer - .reduce_conditional(conditional, condition, block, next, self.in_circuit) + self.reducer.reduce_conditional(conditional, condition, block, next) } - pub fn reduce_iteration( - &mut self, - iteration: &IterationStatement, - ) -> Result { + pub fn reduce_iteration(&mut self, iteration: &IterationStatement) -> Result { let variable = self.reduce_identifier(&iteration.variable)?; let start = self.reduce_expression(&iteration.start)?; let stop = self.reduce_expression(&iteration.stop)?; let block = self.reduce_block(&iteration.block)?; - self.reducer - .reduce_iteration(iteration, variable, start, stop, block, self.in_circuit) + self.reducer.reduce_iteration(iteration, variable, start, stop, block) } pub fn reduce_console( &mut self, console_function_call: &ConsoleStatement, - ) -> Result { + ) -> Result { let function = match &console_function_call.function { ConsoleFunction::Assert(expression) => ConsoleFunction::Assert(self.reduce_expression(expression)?), ConsoleFunction::Debug(format) | ConsoleFunction::Error(format) | ConsoleFunction::Log(format) => { @@ -418,7 +391,7 @@ impl ReconstructingDirector { parameters.push(self.reduce_expression(parameter)?); } - let formatted = FormattedString { + let formatted = FormatString { parts: format.parts.clone(), parameters, span: format.span.clone(), @@ -428,35 +401,33 @@ impl ReconstructingDirector { ConsoleFunction::Debug(_) => ConsoleFunction::Debug(formatted), ConsoleFunction::Error(_) => ConsoleFunction::Error(formatted), ConsoleFunction::Log(_) => ConsoleFunction::Log(formatted), - _ => unimplemented!(), // impossible + _ => return Err(ReducerError::impossible_console_assert_call(&format.span)), } } }; - self.reducer - .reduce_console(console_function_call, function, self.in_circuit) + self.reducer.reduce_console(console_function_call, function) } pub fn reduce_expression_statement( &mut self, expression: &ExpressionStatement, - ) -> Result { + ) -> Result { let inner_expression = self.reduce_expression(&expression.expression)?; - self.reducer - .reduce_expression_statement(expression, inner_expression, self.in_circuit) + self.reducer.reduce_expression_statement(expression, inner_expression) } - pub fn reduce_block(&mut self, block: &Block) -> Result { + pub fn reduce_block(&mut self, block: &Block) -> Result { let mut statements = vec![]; for statement in block.statements.iter() { statements.push(self.reduce_statement(statement)?); } - self.reducer.reduce_block(block, statements, self.in_circuit) + self.reducer.reduce_block(block, statements) } // Program - pub fn reduce_program(&mut self, program: &Program) -> Result { + pub fn reduce_program(&mut self, program: &Program) -> Result { let mut inputs = vec![]; for input in program.expected_input.iter() { inputs.push(self.reduce_function_input(input)?); @@ -468,9 +439,11 @@ impl ReconstructingDirector { } let mut circuits = IndexMap::new(); + self.reducer.swap_in_circuit(); for (identifier, circuit) in program.circuits.iter() { circuits.insert(self.reduce_identifier(identifier)?, self.reduce_circuit(circuit)?); } + self.reducer.swap_in_circuit(); let mut functions = IndexMap::new(); for (identifier, function) in program.functions.iter() { @@ -484,15 +457,14 @@ impl ReconstructingDirector { pub fn reduce_function_input_variable( &mut self, variable: &FunctionInputVariable, - ) -> Result { + ) -> Result { let identifier = self.reduce_identifier(&variable.identifier)?; let type_ = self.reduce_type(&variable.type_, &variable.span)?; - self.reducer - .reduce_function_input_variable(variable, identifier, type_, self.in_circuit) + self.reducer.reduce_function_input_variable(variable, identifier, type_) } - pub fn reduce_function_input(&mut self, input: &FunctionInput) -> Result { + pub fn reduce_function_input(&mut self, input: &FunctionInput) -> Result { let new = match input { FunctionInput::Variable(function_input_variable) => { FunctionInput::Variable(self.reduce_function_input_variable(function_input_variable)?) @@ -500,13 +472,13 @@ impl ReconstructingDirector { _ => input.clone(), }; - self.reducer.reduce_function_input(input, new, self.in_circuit) + self.reducer.reduce_function_input(input, new) } pub fn reduce_package_or_packages( &mut self, package_or_packages: &PackageOrPackages, - ) -> Result { + ) -> Result { let new = match package_or_packages { PackageOrPackages::Package(package) => PackageOrPackages::Package(Package { name: self.reduce_identifier(&package.name)?, @@ -523,17 +495,13 @@ impl ReconstructingDirector { self.reducer.reduce_package_or_packages(package_or_packages, new) } - pub fn reduce_import(&mut self, import: &ImportStatement) -> Result { + pub fn reduce_import(&mut self, import: &ImportStatement) -> Result { let package_or_packages = self.reduce_package_or_packages(&import.package_or_packages)?; self.reducer.reduce_import(import, package_or_packages) } - pub fn reduce_circuit_member( - &mut self, - circuit_member: &CircuitMember, - ) -> Result { - self.in_circuit = !self.in_circuit; + pub fn reduce_circuit_member(&mut self, circuit_member: &CircuitMember) -> Result { let new = match circuit_member { CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable( self.reduce_identifier(&identifier)?, @@ -543,12 +511,11 @@ impl ReconstructingDirector { CircuitMember::CircuitFunction(self.reduce_function(&function)?) } }; - self.in_circuit = !self.in_circuit; self.reducer.reduce_circuit_member(circuit_member, new) } - pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result { + pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result { let circuit_name = self.reduce_identifier(&circuit.circuit_name)?; let mut members = vec![]; @@ -559,13 +526,13 @@ impl ReconstructingDirector { self.reducer.reduce_circuit(circuit, circuit_name, members) } - fn reduce_annotation(&mut self, annotation: &Annotation) -> Result { + fn reduce_annotation(&mut self, annotation: &Annotation) -> Result { let name = self.reduce_identifier(&annotation.name)?; self.reducer.reduce_annotation(annotation, name) } - pub fn reduce_function(&mut self, function: &Function) -> Result { + pub fn reduce_function(&mut self, function: &Function) -> Result { let identifier = self.reduce_identifier(&function.identifier)?; let mut annotations = vec![]; @@ -586,14 +553,7 @@ impl ReconstructingDirector { let block = self.reduce_block(&function.block)?; - self.reducer.reduce_function( - function, - identifier, - annotations, - inputs, - output, - block, - self.in_circuit, - ) + self.reducer + .reduce_function(function, identifier, annotations, inputs, output, block) } } diff --git a/ast/src/reducer/reconstructing_reducer.rs b/ast/src/reducer/reconstructing_reducer.rs index a06e350481..637bad2869 100644 --- a/ast/src/reducer/reconstructing_reducer.rs +++ b/ast/src/reducer/reconstructing_reducer.rs @@ -20,34 +20,26 @@ use indexmap::IndexMap; // Needed to fix clippy bug. #[allow(clippy::redundant_closure)] pub trait ReconstructingReducer { - fn reduce_type( - &mut self, - _type_: &Type, - new: Type, - _in_circuit: bool, - _span: &Span, - ) -> Result { + fn in_circuit(&self) -> bool; + fn swap_in_circuit(&mut self); + + fn reduce_type(&mut self, _type_: &Type, new: Type, _span: &Span) -> Result { Ok(new) } // Expressions - fn reduce_expression( - &mut self, - _expression: &Expression, - new: Expression, - _in_circuit: bool, - ) -> Result { + fn reduce_expression(&mut self, _expression: &Expression, new: Expression) -> Result { Ok(new) } - fn reduce_identifier(&mut self, identifier: &Identifier) -> Result { + fn reduce_identifier(&mut self, identifier: &Identifier) -> Result { Ok(Identifier { name: identifier.name.clone(), span: identifier.span.clone(), }) } - fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result { + fn reduce_group_tuple(&mut self, group_tuple: &GroupTuple) -> Result { Ok(GroupTuple { x: group_tuple.x.clone(), y: group_tuple.y.clone(), @@ -55,11 +47,7 @@ pub trait ReconstructingReducer { }) } - fn reduce_group_value( - &mut self, - _group_value: &GroupValue, - new: GroupValue, - ) -> Result { + fn reduce_group_value(&mut self, _group_value: &GroupValue, new: GroupValue) -> Result { Ok(new) } @@ -67,7 +55,7 @@ pub trait ReconstructingReducer { &mut self, _value: &ValueExpression, new: ValueExpression, - ) -> Result { + ) -> Result { Ok(new) } @@ -77,8 +65,7 @@ pub trait ReconstructingReducer { left: Expression, right: Expression, op: BinaryOperation, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(BinaryExpression { left: Box::new(left), right: Box::new(right), @@ -92,8 +79,7 @@ pub trait ReconstructingReducer { unary: &UnaryExpression, inner: Expression, op: UnaryOperation, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(UnaryExpression { inner: Box::new(inner), op, @@ -107,8 +93,7 @@ pub trait ReconstructingReducer { condition: Expression, if_true: Expression, if_false: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(TernaryExpression { condition: Box::new(condition), if_true: Box::new(if_true), @@ -122,8 +107,7 @@ pub trait ReconstructingReducer { cast: &CastExpression, inner: Expression, target_type: Type, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(CastExpression { inner: Box::new(inner), target_type, @@ -135,8 +119,7 @@ pub trait ReconstructingReducer { &mut self, array_inline: &ArrayInlineExpression, elements: Vec, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ArrayInlineExpression { elements, span: array_inline.span.clone(), @@ -147,8 +130,7 @@ pub trait ReconstructingReducer { &mut self, array_init: &ArrayInitExpression, element: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ArrayInitExpression { element: Box::new(element), dimensions: array_init.dimensions.clone(), @@ -161,8 +143,7 @@ pub trait ReconstructingReducer { array_access: &ArrayAccessExpression, array: Expression, index: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ArrayAccessExpression { array: Box::new(array), index: Box::new(index), @@ -176,8 +157,7 @@ pub trait ReconstructingReducer { array: Expression, left: Option, right: Option, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ArrayRangeAccessExpression { array: Box::new(array), left: left.map(|expr| Box::new(expr)), @@ -190,8 +170,7 @@ pub trait ReconstructingReducer { &mut self, tuple_init: &TupleInitExpression, elements: Vec, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(TupleInitExpression { elements, span: tuple_init.span.clone(), @@ -202,8 +181,7 @@ pub trait ReconstructingReducer { &mut self, tuple_access: &TupleAccessExpression, tuple: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(TupleAccessExpression { tuple: Box::new(tuple), index: tuple_access.index.clone(), @@ -216,8 +194,7 @@ pub trait ReconstructingReducer { _variable: &CircuitImpliedVariableDefinition, identifier: Identifier, expression: Option, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(CircuitImpliedVariableDefinition { identifier, expression }) } @@ -226,8 +203,7 @@ pub trait ReconstructingReducer { circuit_init: &CircuitInitExpression, name: Identifier, members: Vec, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(CircuitInitExpression { name, members, @@ -240,8 +216,7 @@ pub trait ReconstructingReducer { circuit_member_access: &CircuitMemberAccessExpression, circuit: Expression, name: Identifier, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(CircuitMemberAccessExpression { circuit: Box::new(circuit), name, @@ -254,8 +229,7 @@ pub trait ReconstructingReducer { circuit_static_fn_access: &CircuitStaticFunctionAccessExpression, circuit: Expression, name: Identifier, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(CircuitStaticFunctionAccessExpression { circuit: Box::new(circuit), name, @@ -268,8 +242,7 @@ pub trait ReconstructingReducer { call: &CallExpression, function: Expression, arguments: Vec, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(CallExpression { function: Box::new(function), arguments, @@ -278,12 +251,7 @@ pub trait ReconstructingReducer { } // Statements - fn reduce_statement( - &mut self, - _statement: &Statement, - new: Statement, - _in_circuit: bool, - ) -> Result { + fn reduce_statement(&mut self, _statement: &Statement, new: Statement) -> Result { Ok(new) } @@ -291,8 +259,7 @@ pub trait ReconstructingReducer { &mut self, return_statement: &ReturnStatement, expression: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ReturnStatement { expression, span: return_statement.span.clone(), @@ -303,7 +270,7 @@ pub trait ReconstructingReducer { &mut self, variable_name: &VariableName, identifier: Identifier, - ) -> Result { + ) -> Result { Ok(VariableName { mutable: variable_name.mutable, identifier, @@ -317,8 +284,7 @@ pub trait ReconstructingReducer { variable_names: Vec, type_: Option, value: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(DefinitionStatement { declaration_type: definition.declaration_type.clone(), variable_names, @@ -332,8 +298,7 @@ pub trait ReconstructingReducer { &mut self, _access: &AssigneeAccess, new: AssigneeAccess, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(new) } @@ -342,8 +307,7 @@ pub trait ReconstructingReducer { assignee: &Assignee, identifier: Identifier, accesses: Vec, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(Assignee { identifier, accesses, @@ -356,8 +320,7 @@ pub trait ReconstructingReducer { assign: &AssignStatement, assignee: Assignee, value: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(AssignStatement { operation: assign.operation.clone(), assignee, @@ -372,8 +335,7 @@ pub trait ReconstructingReducer { condition: Expression, block: Block, statement: Option, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ConditionalStatement { condition, block, @@ -389,8 +351,7 @@ pub trait ReconstructingReducer { start: Expression, stop: Expression, block: Block, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(IterationStatement { variable, start, @@ -404,8 +365,7 @@ pub trait ReconstructingReducer { &mut self, console: &ConsoleStatement, function: ConsoleFunction, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ConsoleStatement { function, span: console.span.clone(), @@ -416,20 +376,14 @@ pub trait ReconstructingReducer { &mut self, expression_statement: &ExpressionStatement, expression: Expression, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(ExpressionStatement { expression, span: expression_statement.span.clone(), }) } - fn reduce_block( - &mut self, - block: &Block, - statements: Vec, - _in_circuit: bool, - ) -> Result { + fn reduce_block(&mut self, block: &Block, statements: Vec) -> Result { Ok(Block { statements, span: block.span.clone(), @@ -444,7 +398,7 @@ pub trait ReconstructingReducer { imports: Vec, circuits: IndexMap, functions: IndexMap, - ) -> Result { + ) -> Result { Ok(Program { name: program.name.clone(), expected_input, @@ -459,8 +413,7 @@ pub trait ReconstructingReducer { variable: &FunctionInputVariable, identifier: Identifier, type_: Type, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(FunctionInputVariable { identifier, const_: variable.const_, @@ -474,8 +427,7 @@ pub trait ReconstructingReducer { &mut self, _input: &FunctionInput, new: FunctionInput, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(new) } @@ -483,7 +435,7 @@ pub trait ReconstructingReducer { &mut self, _package_or_packages: &PackageOrPackages, new: PackageOrPackages, - ) -> Result { + ) -> Result { Ok(new) } @@ -491,7 +443,7 @@ pub trait ReconstructingReducer { &mut self, import: &ImportStatement, package_or_packages: PackageOrPackages, - ) -> Result { + ) -> Result { Ok(ImportStatement { package_or_packages, span: import.span.clone(), @@ -502,7 +454,7 @@ pub trait ReconstructingReducer { &mut self, _circuit_member: &CircuitMember, new: CircuitMember, - ) -> Result { + ) -> Result { Ok(new) } @@ -511,15 +463,11 @@ pub trait ReconstructingReducer { _circuit: &Circuit, circuit_name: Identifier, members: Vec, - ) -> Result { + ) -> Result { Ok(Circuit { circuit_name, members }) } - fn reduce_annotation( - &mut self, - annotation: &Annotation, - name: Identifier, - ) -> Result { + fn reduce_annotation(&mut self, annotation: &Annotation, name: Identifier) -> Result { Ok(Annotation { span: annotation.span.clone(), name, @@ -536,8 +484,7 @@ pub trait ReconstructingReducer { input: Vec, output: Option, block: Block, - _in_circuit: bool, - ) -> Result { + ) -> Result { Ok(Function { identifier, annotations, diff --git a/ast/src/statements/console/console_function.rs b/ast/src/statements/console/console_function.rs index 16115878ce..17a19931cb 100644 --- a/ast/src/statements/console/console_function.rs +++ b/ast/src/statements/console/console_function.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, FormattedString, Node, Span}; +use crate::{Expression, FormatString, Node, Span}; use serde::{Deserialize, Serialize}; use std::fmt; @@ -22,9 +22,9 @@ use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] pub enum ConsoleFunction { Assert(Expression), - Debug(FormattedString), - Error(FormattedString), - Log(FormattedString), + Debug(FormatString), + Error(FormatString), + Log(FormatString), } impl fmt::Display for ConsoleFunction { diff --git a/ast/src/statements/console/formatted_string.rs b/ast/src/statements/console/formatted_string.rs index 542e61ef4a..5013b8cb93 100644 --- a/ast/src/statements/console/formatted_string.rs +++ b/ast/src/statements/console/formatted_string.rs @@ -21,19 +21,19 @@ use std::fmt; use tendril::StrTendril; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] -pub enum FormattedStringPart { +pub enum FormatStringPart { Const(#[serde(with = "crate::common::tendril_json")] StrTendril), Container, } #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] -pub struct FormattedString { - pub parts: Vec, +pub struct FormatString { + pub parts: Vec, pub parameters: Vec, pub span: Span, } -impl fmt::Display for FormattedString { +impl fmt::Display for FormatString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, @@ -41,8 +41,8 @@ impl fmt::Display for FormattedString { self.parts .iter() .map(|x| match x { - FormattedStringPart::Const(x) => x, - FormattedStringPart::Container => "{}", + FormatStringPart::Const(x) => x, + FormatStringPart::Container => "{}", }) .collect::>() .join("") @@ -50,7 +50,7 @@ impl fmt::Display for FormattedString { } } -impl Node for FormattedString { +impl Node for FormatString { fn span(&self) -> &Span { &self.span } diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 140f95c915..77d8e91e17 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-compiler" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Compiler of the Leo programming language" homepage = "https://aleo.org" @@ -19,35 +19,38 @@ edition = "2018" [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-imports] path = "../imports" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-input] path = "../input" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-package] path = "../package" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-state] path = "../state" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-asg] path = "../asg" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-parser] path = "../parser" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-asg-passes] path = "../asg-passes" -version = "1.3.0" +version = "1.4.0" + +[dependencies.tendril] +version = "0.4" [dependencies.snarkvm-curves] version = "0.2.2" diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 3db15bb556..7ba5aa463e 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -219,6 +219,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { // Use the parser to construct the abstract syntax tree (ast). let mut ast = parse_ast(self.main_file_path.to_str().unwrap_or_default(), program_string)?; + // Preform compiler optimization via canonicalizing AST if its enabled. if self.options.canonicalization_enabled { ast.canonicalize()?; diff --git a/compiler/src/console/format.rs b/compiler/src/console/format.rs index 507770543d..342cb8d7fe 100644 --- a/compiler/src/console/format.rs +++ b/compiler/src/console/format.rs @@ -17,8 +17,8 @@ //! Evaluates a formatted string in a compiled Leo program. use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType}; -use leo_asg::FormattedString; -use leo_ast::FormattedStringPart; +use leo_asg::FormatString; +use leo_ast::FormatStringPart; use snarkvm_fields::PrimeField; use snarkvm_r1cs::ConstraintSystem; @@ -26,13 +26,13 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn format>( &mut self, cs: &mut CS, - formatted: &FormattedString<'a>, + formatted: &FormatString<'a>, ) -> Result { // Check that containers and parameters match let container_count = formatted .parts .iter() - .filter(|x| matches!(x, FormattedStringPart::Container)) + .filter(|x| matches!(x, FormatStringPart::Container)) .count(); if container_count != formatted.parameters.len() { return Err(ConsoleError::length( @@ -51,8 +51,8 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { let mut parameters = executed_containers.iter(); for part in formatted.parts.iter() { match part { - FormattedStringPart::Const(c) => out.push(&**c), - FormattedStringPart::Container => out.push(&**parameters.next().unwrap()), + FormatStringPart::Const(c) => out.push(&**c), + FormatStringPart::Container => out.push(&**parameters.next().unwrap()), } } diff --git a/compiler/src/errors/compiler.rs b/compiler/src/errors/compiler.rs index f66cdd488a..f0da27c838 100644 --- a/compiler/src/errors/compiler.rs +++ b/compiler/src/errors/compiler.rs @@ -16,7 +16,7 @@ use crate::errors::FunctionError; use leo_asg::{AsgConvertError, FormattedError}; -use leo_ast::{CanonicalizeError, LeoError}; +use leo_ast::{LeoError, ReducerError}; use leo_input::InputParserError; use leo_parser::SyntaxError; use leo_state::LocalDataVerificationError; @@ -56,7 +56,7 @@ pub enum CompilerError { AsgConvertError(#[from] AsgConvertError), #[error("{}", _0)] - CanonicalizeError(#[from] CanonicalizeError), + ReducerError(#[from] ReducerError), } impl LeoError for CompilerError {} diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs index 5d4b738351..3a2eb27e13 100644 --- a/compiler/src/function/main_function.rs +++ b/compiler/src/function/main_function.rs @@ -35,13 +35,9 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { let registers = input.get_registers(); // Iterate over main function input variables and allocate new values - if function.has_input { - // let input_var = function.scope. - let asg_input = function - .scope - .resolve_input() - .expect("no input variable in scope when function is qualified"); + let asg_input = function.scope.resolve_input(); + if let Some(asg_input) = asg_input { let value = self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?; diff --git a/compiler/src/lib.rs b/compiler/src/lib.rs index ec6814c431..66d14b3def 100644 --- a/compiler/src/lib.rs +++ b/compiler/src/lib.rs @@ -56,8 +56,11 @@ pub use prelude::*; pub mod value; pub use value::*; -pub mod stage; -pub use stage::*; +pub mod phase; +pub use phase::*; + +pub mod phases; +pub use phases::*; pub mod option; pub use option::*; diff --git a/compiler/src/stage.rs b/compiler/src/phase.rs similarity index 97% rename from compiler/src/stage.rs rename to compiler/src/phase.rs index ec96dac0fd..7f8d5dcbbd 100644 --- a/compiler/src/stage.rs +++ b/compiler/src/phase.rs @@ -16,6 +16,6 @@ use leo_asg::Program; -pub trait ASGStage { +pub trait ASGPhase { fn apply(asg: &mut Program); } diff --git a/compiler/src/phases/mod.rs b/compiler/src/phases/mod.rs new file mode 100644 index 0000000000..c409e2f4d5 --- /dev/null +++ b/compiler/src/phases/mod.rs @@ -0,0 +1,23 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +//! Compiles a Leo program from a file path. + +pub mod reducing_director; +pub use reducing_director::*; + +pub mod phase; +pub use phase::*; diff --git a/compiler/src/phases/phase.rs b/compiler/src/phases/phase.rs new file mode 100644 index 0000000000..1423fa47fa --- /dev/null +++ b/compiler/src/phases/phase.rs @@ -0,0 +1,65 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +//! Compiles a Leo program from a file path. + +use crate::{CombineAstAsgDirector, CombinerOptions}; +use leo_asg::Program as AsgProgram; +use leo_ast::{Ast, Program as AstProgram, ReconstructingReducer, ReducerError}; + +macro_rules! phase { + ($phase_name:ident, $function:item) => { + pub struct $phase_name { + in_circuit: bool, + } + + pub struct Options; + + impl CombinerOptions for Options { + $function + } + + impl ReconstructingReducer for $phase_name { + fn in_circuit(&self) -> bool { + self.in_circuit + } + + fn swap_in_circuit(&mut self) { + self.in_circuit = !self.in_circuit; + } + } + + impl Default for $phase_name { + fn default() -> Self { + Self { in_circuit: false } + } + } + + impl $phase_name { + pub fn phase_ast(&self, ast: &AstProgram, asg: &AsgProgram) -> Result { + Ok(Ast::new(CombineAstAsgDirector::new(Self::default(), Options{}) + .reduce_program(ast, asg)?)) + } + } + }; +} + +phase!( + TypeInferencePhase, + fn type_inference_enabled(&self) -> bool { + true + } +); diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs new file mode 100644 index 0000000000..a654bec9a7 --- /dev/null +++ b/compiler/src/phases/reducing_director.rs @@ -0,0 +1,775 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +//! Compiles a Leo program from a file path. + +use indexmap::IndexMap; +use leo_asg::{ + ArrayAccessExpression as AsgArrayAccessExpression, + ArrayInitExpression as AsgArrayInitExpression, + ArrayInlineExpression as AsgArrayInlineExpression, + ArrayRangeAccessExpression as AsgArrayRangeAccessExpression, + AssignAccess as AsgAssignAccess, + AssignStatement as AsgAssignStatement, + BinaryExpression as AsgBinaryExpression, + BlockStatement as AsgBlockStatement, + CallExpression as AsgCallExpression, + CastExpression as AsgCastExpression, + Circuit as AsgCircuit, + CircuitAccessExpression as AsgCircuitAccessExpression, + CircuitInitExpression as AsgCircuitInitExpression, + CircuitMember as AsgCircuitMember, + ConditionalStatement as AsgConditionalStatement, + ConsoleFunction as AsgConsoleFunction, + ConsoleStatement as AsgConsoleStatement, + ConstValue, + Constant as AsgConstant, + DefinitionStatement as AsgDefinitionStatement, + Expression as AsgExpression, + ExpressionStatement as AsgExpressionStatement, + Function as AsgFunction, + GroupValue as AsgGroupValue, + IterationStatement as AsgIterationStatement, + ReturnStatement as AsgReturnStatement, + Statement as AsgStatement, + TernaryExpression as AsgTernaryExpression, + TupleAccessExpression as AsgTupleAccessExpression, + TupleInitExpression as AsgTupleInitExpression, + Type as AsgType, + UnaryExpression as AsgUnaryExpression, + VariableRef as AsgVariableRef, +}; +use leo_ast::{ + ArrayAccessExpression as AstArrayAccessExpression, + ArrayDimensions, + ArrayInitExpression as AstArrayInitExpression, + ArrayInlineExpression as AstArrayInlineExpression, + ArrayRangeAccessExpression as AstArrayRangeAccessExpression, + AssignStatement as AstAssignStatement, + Assignee, + AssigneeAccess as AstAssignAccess, + BinaryExpression as AstBinaryExpression, + Block as AstBlockStatement, + CallExpression as AstCallExpression, + CastExpression as AstCastExpression, + Circuit as AstCircuit, + CircuitImpliedVariableDefinition, + CircuitInitExpression as AstCircuitInitExpression, + CircuitMember as AstCircuitMember, + CircuitMemberAccessExpression, + CircuitStaticFunctionAccessExpression, + CombinerError, + ConditionalStatement as AstConditionalStatement, + ConsoleFunction as AstConsoleFunction, + ConsoleStatement as AstConsoleStatement, + DefinitionStatement as AstDefinitionStatement, + Expression as AstExpression, + ExpressionStatement as AstExpressionStatement, + FormatString, + Function as AstFunction, + GroupTuple, + GroupValue as AstGroupValue, + IterationStatement as AstIterationStatement, + PositiveNumber, + ReconstructingReducer, + ReducerError, + ReturnStatement as AstReturnStatement, + Span, + SpreadOrExpression, + Statement as AstStatement, + TernaryExpression as AstTernaryExpression, + TupleAccessExpression as AstTupleAccessExpression, + TupleInitExpression as AstTupleInitExpression, + Type as AstType, + UnaryExpression as AstUnaryExpression, + ValueExpression, +}; +use tendril::StrTendril; + +pub trait CombinerOptions { + fn type_inference_enabled(&self) -> bool { + false + } +} + +pub struct CombineAstAsgDirector { + ast_reducer: R, + options: O, +} + +impl CombineAstAsgDirector { + pub fn new(ast_reducer: R, options: O) -> Self { + Self { ast_reducer, options } + } + + pub fn reduce_type(&mut self, ast: &AstType, asg: &AsgType, span: &Span) -> Result { + let new = match (ast, asg) { + (AstType::Array(ast_type, ast_dimensions), AsgType::Array(asg_type, asg_dimensions)) => { + if self.options.type_inference_enabled() { + AstType::Array( + Box::new(self.reduce_type(ast_type, asg_type, span)?), + ArrayDimensions(vec![PositiveNumber { + value: StrTendril::from(format!("{}", asg_dimensions)), + }]), + ) + } else { + AstType::Array( + Box::new(self.reduce_type(ast_type, asg_type, span)?), + ast_dimensions.clone(), + ) + } + } + (AstType::Tuple(ast_types), AsgType::Tuple(asg_types)) => { + let mut reduced_types = vec![]; + for (ast_type, asg_type) in ast_types.iter().zip(asg_types) { + reduced_types.push(self.reduce_type(ast_type, asg_type, span)?); + } + + AstType::Tuple(reduced_types) + } + _ => ast.clone(), + }; + + self.ast_reducer.reduce_type(ast, new, span) + } + + pub fn reduce_expression( + &mut self, + ast: &AstExpression, + asg: &AsgExpression, + ) -> Result { + let new = match (ast, asg) { + (AstExpression::Value(value), AsgExpression::Constant(const_)) => { + AstExpression::Value(self.reduce_value(&value, &const_)?) + } + (AstExpression::Binary(ast), AsgExpression::Binary(asg)) => { + AstExpression::Binary(self.reduce_binary(&ast, &asg)?) + } + (AstExpression::Unary(ast), AsgExpression::Unary(asg)) => { + AstExpression::Unary(self.reduce_unary(&ast, &asg)?) + } + (AstExpression::Ternary(ast), AsgExpression::Ternary(asg)) => { + AstExpression::Ternary(self.reduce_ternary(&ast, &asg)?) + } + (AstExpression::Cast(ast), AsgExpression::Cast(asg)) => AstExpression::Cast(self.reduce_cast(&ast, &asg)?), + + (AstExpression::ArrayInline(ast), AsgExpression::ArrayInline(asg)) => { + AstExpression::ArrayInline(self.reduce_array_inline(&ast, &asg)?) + } + (AstExpression::ArrayInit(ast), AsgExpression::ArrayInit(asg)) => { + AstExpression::ArrayInit(self.reduce_array_init(&ast, &asg)?) + } + (AstExpression::ArrayAccess(ast), AsgExpression::ArrayAccess(asg)) => { + AstExpression::ArrayAccess(self.reduce_array_access(&ast, &asg)?) + } + (AstExpression::ArrayRangeAccess(ast), AsgExpression::ArrayRangeAccess(asg)) => { + AstExpression::ArrayRangeAccess(self.reduce_array_range_access(&ast, &asg)?) + } + + (AstExpression::TupleInit(ast), AsgExpression::TupleInit(asg)) => { + AstExpression::TupleInit(self.reduce_tuple_init(&ast, &asg)?) + } + (AstExpression::TupleAccess(ast), AsgExpression::TupleAccess(asg)) => { + AstExpression::TupleAccess(self.reduce_tuple_access(&ast, &asg)?) + } + + (AstExpression::CircuitInit(ast), AsgExpression::CircuitInit(asg)) => { + AstExpression::CircuitInit(self.reduce_circuit_init(&ast, &asg)?) + } + (AstExpression::CircuitMemberAccess(ast), AsgExpression::CircuitAccess(asg)) => { + AstExpression::CircuitMemberAccess(self.reduce_circuit_member_access(&ast, &asg)?) + } + (AstExpression::CircuitStaticFunctionAccess(ast), AsgExpression::CircuitAccess(asg)) => { + AstExpression::CircuitStaticFunctionAccess(self.reduce_circuit_static_fn_access(&ast, &asg)?) + } + + (AstExpression::Call(ast), AsgExpression::Call(asg)) => AstExpression::Call(self.reduce_call(&ast, &asg)?), + _ => ast.clone(), + }; + + self.ast_reducer.reduce_expression(ast, new) + } + + pub fn reduce_array_access( + &mut self, + ast: &AstArrayAccessExpression, + asg: &AsgArrayAccessExpression, + ) -> Result { + let array = self.reduce_expression(&ast.array, asg.array.get())?; + let index = self.reduce_expression(&ast.index, asg.index.get())?; + + self.ast_reducer.reduce_array_access(ast, array, index) + } + + pub fn reduce_array_init( + &mut self, + ast: &AstArrayInitExpression, + asg: &AsgArrayInitExpression, + ) -> Result { + let element = self.reduce_expression(&ast.element, asg.element.get())?; + + self.ast_reducer.reduce_array_init(ast, element) + } + + pub fn reduce_array_inline( + &mut self, + ast: &AstArrayInlineExpression, + asg: &AsgArrayInlineExpression, + ) -> Result { + let mut elements = vec![]; + for (ast_element, asg_element) in ast.elements.iter().zip(asg.elements.iter()) { + let reduced_element = match ast_element { + SpreadOrExpression::Expression(ast_expression) => { + SpreadOrExpression::Expression(self.reduce_expression(ast_expression, asg_element.0.get())?) + } + SpreadOrExpression::Spread(ast_expression) => { + SpreadOrExpression::Spread(self.reduce_expression(ast_expression, asg_element.0.get())?) + } + }; + + elements.push(reduced_element); + } + + self.ast_reducer.reduce_array_inline(ast, elements) + } + + pub fn reduce_array_range_access( + &mut self, + ast: &AstArrayRangeAccessExpression, + asg: &AsgArrayRangeAccessExpression, + ) -> Result { + let array = self.reduce_expression(&ast.array, asg.array.get())?; + let left = match (ast.left.as_ref(), asg.left.get()) { + (Some(ast_left), Some(asg_left)) => Some(self.reduce_expression(ast_left, asg_left)?), + _ => None, + }; + let right = match (ast.right.as_ref(), asg.right.get()) { + (Some(ast_right), Some(asg_right)) => Some(self.reduce_expression(ast_right, asg_right)?), + _ => None, + }; + + self.ast_reducer.reduce_array_range_access(ast, array, left, right) + } + + pub fn reduce_binary( + &mut self, + ast: &AstBinaryExpression, + asg: &AsgBinaryExpression, + ) -> Result { + let left = self.reduce_expression(&ast.left, asg.left.get())?; + let right = self.reduce_expression(&ast.right, asg.right.get())?; + + self.ast_reducer.reduce_binary(ast, left, right, ast.op.clone()) + } + + pub fn reduce_call( + &mut self, + ast: &AstCallExpression, + asg: &AsgCallExpression, + ) -> Result { + // TODO FIGURE IT OUT + // let function = self.reduce_expression(&ast.function, asg.function.get())?; + // let target = asg.target.get().map(|exp| self.reduce_expression()) + // Is this needed? + + let mut arguments = vec![]; + for (ast_arg, asg_arg) in ast.arguments.iter().zip(asg.arguments.iter()) { + arguments.push(self.reduce_expression(ast_arg, asg_arg.get())?); + } + + self.ast_reducer.reduce_call(ast, *ast.function.clone(), arguments) + } + + pub fn reduce_cast( + &mut self, + ast: &AstCastExpression, + asg: &AsgCastExpression, + ) -> Result { + let inner = self.reduce_expression(&ast.inner, &asg.inner.get())?; + let target_type = self.reduce_type(&ast.target_type, &asg.target_type, &ast.span)?; + + self.ast_reducer.reduce_cast(ast, inner, target_type) + } + + pub fn reduce_circuit_member_access( + &mut self, + ast: &CircuitMemberAccessExpression, + _asg: &AsgCircuitAccessExpression, + ) -> Result { + // let circuit = self.reduce_expression(&circuit_member_access.circuit)?; + // let name = self.reduce_identifier(&circuit_member_access.name)?; + // let target = input.target.get().map(|e| self.reduce_expression(e)); + + self.ast_reducer + .reduce_circuit_member_access(ast, *ast.circuit.clone(), ast.name.clone()) + } + + pub fn reduce_circuit_static_fn_access( + &mut self, + ast: &CircuitStaticFunctionAccessExpression, + _asg: &AsgCircuitAccessExpression, + ) -> Result { + // let circuit = self.reduce_expression(&circuit_member_access.circuit)?; + // let name = self.reduce_identifier(&circuit_member_access.name)?; + // let target = input.target.get().map(|e| self.reduce_expression(e)); + + self.ast_reducer + .reduce_circuit_static_fn_access(ast, *ast.circuit.clone(), ast.name.clone()) + } + + pub fn reduce_circuit_implied_variable_definition( + &mut self, + ast: &CircuitImpliedVariableDefinition, + asg: &AsgExpression, + ) -> Result { + let expression = ast + .expression + .as_ref() + .map(|ast_expr| self.reduce_expression(ast_expr, asg)) + .transpose()?; + + self.ast_reducer + .reduce_circuit_implied_variable_definition(ast, ast.identifier.clone(), expression) + } + + pub fn reduce_circuit_init( + &mut self, + ast: &AstCircuitInitExpression, + asg: &AsgCircuitInitExpression, + ) -> Result { + let mut members = vec![]; + for (ast_member, asg_member) in ast.members.iter().zip(asg.values.iter()) { + members.push(self.reduce_circuit_implied_variable_definition(ast_member, asg_member.1.get())?); + } + + self.ast_reducer.reduce_circuit_init(ast, ast.name.clone(), members) + } + + pub fn reduce_ternary( + &mut self, + ast: &AstTernaryExpression, + asg: &AsgTernaryExpression, + ) -> Result { + let condition = self.reduce_expression(&ast.condition, asg.condition.get())?; + let if_true = self.reduce_expression(&ast.if_true, asg.if_true.get())?; + let if_false = self.reduce_expression(&ast.if_false, asg.if_false.get())?; + + self.ast_reducer.reduce_ternary(ast, condition, if_true, if_false) + } + + pub fn reduce_tuple_access( + &mut self, + ast: &AstTupleAccessExpression, + asg: &AsgTupleAccessExpression, + ) -> Result { + let tuple = self.reduce_expression(&ast.tuple, asg.tuple_ref.get())?; + + self.ast_reducer.reduce_tuple_access(ast, tuple) + } + + pub fn reduce_tuple_init( + &mut self, + ast: &AstTupleInitExpression, + asg: &AsgTupleInitExpression, + ) -> Result { + let mut elements = vec![]; + for (ast_element, asg_element) in ast.elements.iter().zip(asg.elements.iter()) { + let element = self.reduce_expression(ast_element, asg_element.get())?; + elements.push(element); + } + + self.ast_reducer.reduce_tuple_init(ast, elements) + } + + pub fn reduce_unary( + &mut self, + ast: &AstUnaryExpression, + asg: &AsgUnaryExpression, + ) -> Result { + let inner = self.reduce_expression(&ast.inner, asg.inner.get())?; + + self.ast_reducer.reduce_unary(ast, inner, ast.op.clone()) + } + + pub fn reduce_value(&mut self, ast: &ValueExpression, asg: &AsgConstant) -> Result { + let mut new = ast.clone(); + + if self.options.type_inference_enabled() { + if let ValueExpression::Implicit(tendril, span) = ast { + match &asg.value { + ConstValue::Int(int) => { + new = ValueExpression::Integer(int.get_int_type(), tendril.clone(), span.clone()); + } + ConstValue::Group(group) => { + let group_value = match group { + AsgGroupValue::Single(_) => AstGroupValue::Single(tendril.clone(), span.clone()), + AsgGroupValue::Tuple(x, y) => AstGroupValue::Tuple(GroupTuple { + x: x.into(), + y: y.into(), + span: span.clone(), + }), + }; + new = ValueExpression::Group(Box::new(group_value)); + } + ConstValue::Field(_) => { + new = ValueExpression::Field(tendril.clone(), span.clone()); + } + ConstValue::Address(_) => { + new = ValueExpression::Address(tendril.clone(), span.clone()); + } + ConstValue::Boolean(_) => { + new = ValueExpression::Boolean(tendril.clone(), span.clone()); + } + _ => unimplemented!(), // impossible? + } + } + } + + self.ast_reducer.reduce_value(ast, new) + } + + pub fn reduce_variable_ref( + &mut self, + ast: &ValueExpression, + _asg: &AsgVariableRef, + ) -> Result { + // TODO FIGURE IT OUT + let new = match ast { + // ValueExpression::Group(group_value) => { + // ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?)) + // } + _ => ast.clone(), + }; + + Ok(new) + // self.ast_reducer.reduce_value(value, new) + } + + pub fn reduce_statement( + &mut self, + ast_statement: &AstStatement, + asg_statement: &AsgStatement, + ) -> Result { + let new = match (ast_statement, asg_statement) { + (AstStatement::Assign(ast), AsgStatement::Assign(asg)) => { + AstStatement::Assign(self.reduce_assign(ast, asg)?) + } + (AstStatement::Block(ast), AsgStatement::Block(asg)) => AstStatement::Block(self.reduce_block(ast, asg)?), + (AstStatement::Conditional(ast), AsgStatement::Conditional(asg)) => { + AstStatement::Conditional(self.reduce_conditional(ast, asg)?) + } + (AstStatement::Console(ast), AsgStatement::Console(asg)) => { + AstStatement::Console(self.reduce_console(ast, asg)?) + } + (AstStatement::Definition(ast), AsgStatement::Definition(asg)) => { + AstStatement::Definition(self.reduce_definition(ast, asg)?) + } + (AstStatement::Expression(ast), AsgStatement::Expression(asg)) => { + AstStatement::Expression(self.reduce_expression_statement(ast, asg)?) + } + (AstStatement::Iteration(ast), AsgStatement::Iteration(asg)) => { + AstStatement::Iteration(self.reduce_iteration(ast, asg)?) + } + (AstStatement::Return(ast), AsgStatement::Return(asg)) => { + AstStatement::Return(self.reduce_return(ast, asg)?) + } + _ => ast_statement.clone(), + }; + + self.ast_reducer.reduce_statement(ast_statement, new) + } + + pub fn reduce_assign_access( + &mut self, + ast: &AstAssignAccess, + asg: &AsgAssignAccess, + ) -> Result { + let new = match (ast, asg) { + (AstAssignAccess::ArrayRange(ast_left, ast_right), AsgAssignAccess::ArrayRange(asg_left, asg_right)) => { + let left = match (ast_left.as_ref(), asg_left.get()) { + (Some(ast_left), Some(asg_left)) => Some(self.reduce_expression(ast_left, asg_left)?), + _ => None, + }; + let right = match (ast_right.as_ref(), asg_right.get()) { + (Some(ast_right), Some(asg_right)) => Some(self.reduce_expression(ast_right, asg_right)?), + _ => None, + }; + + AstAssignAccess::ArrayRange(left, right) + } + (AstAssignAccess::ArrayIndex(ast_index), AsgAssignAccess::ArrayIndex(asg_index)) => { + let index = self.reduce_expression(&ast_index, asg_index.get())?; + AstAssignAccess::ArrayIndex(index) + } + _ => ast.clone(), + }; + + self.ast_reducer.reduce_assignee_access(ast, new) + } + + pub fn reduce_assignee(&mut self, ast: &Assignee, asg: &[AsgAssignAccess]) -> Result { + let mut accesses = vec![]; + for (ast_access, asg_access) in ast.accesses.iter().zip(asg) { + accesses.push(self.reduce_assign_access(ast_access, asg_access)?); + } + + self.ast_reducer.reduce_assignee(ast, ast.identifier.clone(), accesses) + } + + pub fn reduce_assign( + &mut self, + ast: &AstAssignStatement, + asg: &AsgAssignStatement, + ) -> Result { + let assignee = self.reduce_assignee(&ast.assignee, &asg.target_accesses)?; + let value = self.reduce_expression(&ast.value, asg.value.get())?; + + self.ast_reducer.reduce_assign(ast, assignee, value) + } + + pub fn reduce_block( + &mut self, + ast: &AstBlockStatement, + asg: &AsgBlockStatement, + ) -> Result { + let mut statements = vec![]; + for (ast_statement, asg_statement) in ast.statements.iter().zip(asg.statements.iter()) { + statements.push(self.reduce_statement(ast_statement, asg_statement.get())?); + } + + self.ast_reducer.reduce_block(ast, statements) + } + + pub fn reduce_conditional( + &mut self, + ast: &AstConditionalStatement, + asg: &AsgConditionalStatement, + ) -> Result { + let condition = self.reduce_expression(&ast.condition, asg.condition.get())?; + let block; + if let AsgStatement::Block(asg_block) = asg.result.get() { + block = self.reduce_block(&ast.block, asg_block)?; + } else { + return Err(ReducerError::from(CombinerError::asg_statement_not_block( + &asg.span.as_ref().unwrap(), + ))); + } + let next = match (ast.next.as_ref(), asg.next.get()) { + (Some(ast_next), Some(asg_next)) => Some(self.reduce_statement(ast_next, asg_next)?), + _ => None, + }; + + self.ast_reducer.reduce_conditional(ast, condition, block, next) + } + + pub fn reduce_console( + &mut self, + ast: &AstConsoleStatement, + asg: &AsgConsoleStatement, + ) -> Result { + let function = match (&ast.function, &asg.function) { + (AstConsoleFunction::Assert(ast_expression), AsgConsoleFunction::Assert(asg_expression)) => { + AstConsoleFunction::Assert(self.reduce_expression(&ast_expression, asg_expression.get())?) + } + (AstConsoleFunction::Debug(ast_format), AsgConsoleFunction::Debug(asg_format)) + | (AstConsoleFunction::Error(ast_format), AsgConsoleFunction::Error(asg_format)) + | (AstConsoleFunction::Log(ast_format), AsgConsoleFunction::Log(asg_format)) => { + let mut parameters = vec![]; + for (ast_parameter, asg_parameter) in ast_format.parameters.iter().zip(asg_format.parameters.iter()) { + parameters.push(self.reduce_expression(&ast_parameter, asg_parameter.get())?); + } + + let formatted = FormatString { + parts: ast_format.parts.clone(), + parameters, + span: ast_format.span.clone(), + }; + + match &ast.function { + AstConsoleFunction::Debug(_) => AstConsoleFunction::Debug(formatted), + AstConsoleFunction::Error(_) => AstConsoleFunction::Error(formatted), + AstConsoleFunction::Log(_) => AstConsoleFunction::Log(formatted), + _ => return Err(ReducerError::impossible_console_assert_call(&ast_format.span)), + } + } + _ => ast.function.clone(), + }; + + self.ast_reducer.reduce_console(ast, function) + } + + pub fn reduce_definition( + &mut self, + ast: &AstDefinitionStatement, + asg: &AsgDefinitionStatement, + ) -> Result { + let type_; + + if asg.variables.len() > 1 { + let mut types = vec![]; + for variable in asg.variables.iter() { + types.push(variable.borrow().type_.clone()); + } + + let asg_type = AsgType::Tuple(types); + + type_ = match &ast.type_ { + Some(ast_type) => Some(self.reduce_type(&ast_type, &asg_type, &ast.span)?), + None if self.options.type_inference_enabled() => Some((&asg_type).into()), + _ => None, + }; + } else { + type_ = match &ast.type_ { + Some(ast_type) => { + Some(self.reduce_type(&ast_type, &asg.variables.first().unwrap().borrow().type_, &ast.span)?) + } + None if self.options.type_inference_enabled() => { + Some((&asg.variables.first().unwrap().borrow().type_).into()) + } + _ => None, + }; + } + + let value = self.reduce_expression(&ast.value, asg.value.get())?; + + self.ast_reducer + .reduce_definition(ast, ast.variable_names.clone(), type_, value) + } + + pub fn reduce_expression_statement( + &mut self, + ast: &AstExpressionStatement, + asg: &AsgExpressionStatement, + ) -> Result { + let inner_expression = self.reduce_expression(&ast.expression, asg.expression.get())?; + self.ast_reducer.reduce_expression_statement(ast, inner_expression) + } + + pub fn reduce_iteration( + &mut self, + ast: &AstIterationStatement, + asg: &AsgIterationStatement, + ) -> Result { + let start = self.reduce_expression(&ast.start, asg.start.get())?; + let stop = self.reduce_expression(&ast.stop, asg.stop.get())?; + let block; + if let AsgStatement::Block(asg_block) = asg.body.get() { + block = self.reduce_block(&ast.block, asg_block)?; + } else { + return Err(ReducerError::from(CombinerError::asg_statement_not_block( + &asg.span.as_ref().unwrap(), + ))); + } + + self.ast_reducer + .reduce_iteration(ast, ast.variable.clone(), start, stop, block) + } + + pub fn reduce_return( + &mut self, + ast: &AstReturnStatement, + asg: &AsgReturnStatement, + ) -> Result { + let expression = self.reduce_expression(&ast.expression, asg.expression.get())?; + + self.ast_reducer.reduce_return(ast, expression) + } + + pub fn reduce_program( + &mut self, + ast: &leo_ast::Program, + asg: &leo_asg::Program, + ) -> Result { + self.ast_reducer.swap_in_circuit(); + let mut circuits = IndexMap::new(); + for ((ast_ident, ast_circuit), (_asg_ident, asg_circuit)) in ast.circuits.iter().zip(&asg.circuits) { + circuits.insert(ast_ident.clone(), self.reduce_circuit(ast_circuit, asg_circuit)?); + } + self.ast_reducer.swap_in_circuit(); + + let mut functions = IndexMap::new(); + for ((ast_ident, ast_function), (_asg_ident, asg_function)) in ast.functions.iter().zip(&asg.functions) { + functions.insert(ast_ident.clone(), self.reduce_function(ast_function, asg_function)?); + } + + self.ast_reducer.reduce_program( + ast, + ast.expected_input.clone(), + ast.imports.clone(), + circuits, + functions, + ) + } + + pub fn reduce_function(&mut self, ast: &AstFunction, asg: &AsgFunction) -> Result { + let output = ast + .output + .as_ref() + .map(|type_| self.reduce_type(type_, &asg.output, &ast.span)) + .transpose()?; + + let mut statements = vec![]; + if let Some(AsgStatement::Block(asg_block)) = asg.body.get() { + for (ast_statement, asg_statement) in ast.block.statements.iter().zip(asg_block.statements.iter()) { + statements.push(self.reduce_statement(ast_statement, asg_statement.get())?); + } + } + + let block = AstBlockStatement { + statements, + span: ast.block.span.clone(), + }; + + self.ast_reducer.reduce_function( + ast, + ast.identifier.clone(), + ast.annotations.clone(), + ast.input.clone(), + output, + block, + ) + } + + pub fn reduce_circuit_member( + &mut self, + ast: &AstCircuitMember, + asg: &AsgCircuitMember, + ) -> Result { + let new = match (ast, asg) { + (AstCircuitMember::CircuitVariable(identifier, ast_type), AsgCircuitMember::Variable(asg_type)) => { + AstCircuitMember::CircuitVariable( + identifier.clone(), + self.reduce_type(ast_type, asg_type, &identifier.span)?, + ) + } + (AstCircuitMember::CircuitFunction(ast_function), AsgCircuitMember::Function(asg_function)) => { + AstCircuitMember::CircuitFunction(self.reduce_function(ast_function, asg_function)?) + } + _ => ast.clone(), + }; + + self.ast_reducer.reduce_circuit_member(ast, new) + } + + pub fn reduce_circuit(&mut self, ast: &AstCircuit, asg: &AsgCircuit) -> Result { + let mut members = vec![]; + for (ast_member, asg_member) in ast.members.iter().zip(asg.members.borrow().iter()) { + members.push(self.reduce_circuit_member(ast_member, asg_member.1)?); + } + + self.ast_reducer.reduce_circuit(ast, ast.circuit_name.clone(), members) + } +} diff --git a/compiler/tests/address/console_assert_fail.leo b/compiler/tests/address/console_assert_fail.leo index 17849256ca..e8b9099843 100644 --- a/compiler/tests/address/console_assert_fail.leo +++ b/compiler/tests/address/console_assert_fail.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/compiler/tests/address/console_assert_pass.leo b/compiler/tests/address/console_assert_pass.leo index f17d7d8c05..214d01c4a8 100644 --- a/compiler/tests/address/console_assert_pass.leo +++ b/compiler/tests/address/console_assert_pass.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/compiler/tests/address/input.leo b/compiler/tests/address/input.leo index 29519f0334..506abb0fff 100644 --- a/compiler/tests/address/input.leo +++ b/compiler/tests/address/input.leo @@ -1,5 +1,5 @@ function main(owner: address) { - const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(owner == sender); } \ No newline at end of file diff --git a/compiler/tests/address/invalid_length.leo b/compiler/tests/address/invalid_length.leo index ae1defecaf..42692ded3f 100644 --- a/compiler/tests/address/invalid_length.leo +++ b/compiler/tests/address/invalid_length.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88; } \ No newline at end of file diff --git a/compiler/tests/address/ternary.leo b/compiler/tests/address/ternary.leo index dc87153d2d..f29e13ab5d 100644 --- a/compiler/tests/address/ternary.leo +++ b/compiler/tests/address/ternary.leo @@ -1,6 +1,6 @@ function main(s: bool, c: address) { - const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r); + const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r; const r = s? a: b; diff --git a/compiler/tests/address/valid.leo b/compiler/tests/address/valid.leo index 18f1682526..6d693efe78 100644 --- a/compiler/tests/address/valid.leo +++ b/compiler/tests/address/valid.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; } \ No newline at end of file diff --git a/compiler/tests/array/registers.leo b/compiler/tests/array/registers.leo index fb8980868e..98d129207f 100644 --- a/compiler/tests/array/registers.leo +++ b/compiler/tests/array/registers.leo @@ -1,3 +1,3 @@ -function main(input) -> [u8; 3] { - return input.registers.r -} \ No newline at end of file +function main() -> [u8; 3] { + return input.registers.r; +} diff --git a/compiler/tests/boolean/output_register.leo b/compiler/tests/boolean/output_register.leo index fb01d41dbe..6273b0a1df 100644 --- a/compiler/tests/boolean/output_register.leo +++ b/compiler/tests/boolean/output_register.leo @@ -1,3 +1,3 @@ -function main(input) -> bool { - return input.registers.r -} \ No newline at end of file +function main() -> bool { + return input.registers.r; +} diff --git a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo index f8b2657a70..4081e46cbf 100644 --- a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo +++ b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo @@ -6,7 +6,7 @@ circuit Foo { x: 1u32 }; - return new + return new; } } diff --git a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo index d1f30e8470..6f5100adde 100644 --- a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo +++ b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo @@ -6,7 +6,7 @@ circuit Foo { x: 1u32 }; - return new + return new; } } diff --git a/compiler/tests/canonicalization/compound_assignment.json b/compiler/tests/canonicalization/compound_assignment.json index fa2c4825a5..1a4b5285c6 100644 --- a/compiler/tests/canonicalization/compound_assignment.json +++ b/compiler/tests/canonicalization/compound_assignment.json @@ -13,14 +13,195 @@ "IntegerType": "U8" } ] + }, + { + "CircuitVariable": [ + "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y: (u8, u8),\\\"}\"}", + { + "Tuple": [ + { + "IntegerType": "U8" + }, + { + "IntegerType": "U8" + } + ] + } + ] + }, + { + "CircuitFunction": { + "annotations": [], + "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function z (mut self) -> u16 {\\\"}\"}", + "input": [ + { + "MutSelfKeyword": "{\"name\":\"mut self\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":15,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function z (mut self) -> u16 {\\\"}\"}" + } + ], + "output": { + "IntegerType": "U16" + }, + "block": { + "statements": [ + { + "Assign": { + "operation": "Assign", + "assignee": { + "identifier": "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" self.y.0 += 1u8;\\\"}\"}", + "accesses": [ + { + "Member": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" self.y.0 += 1u8;\\\"}\"}" + }, + { + "Tuple": [ + { + "value": "0" + }, + { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 13, + "path": "", + "content": " self.y.0 += 1u8;" + } + ] + } + ], + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 13, + "path": "", + "content": " self.y.0 += 1u8;" + } + }, + "value": { + "Binary": { + "left": { + "TupleAccess": { + "tuple": { + "CircuitMemberAccess": { + "circuit": { + "Identifier": "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" self.y.0 += 1u8;\\\"}\"}" + }, + "name": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" self.y.0 += 1u8;\\\"}\"}", + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 20, + "path": "", + "content": " self.y.0 += 1u8;" + } + } + }, + "index": { + "value": "0" + }, + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 20, + "path": "", + "content": " self.y.0 += 1u8;" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 6, + "line_stop": 6, + "col_start": 17, + "col_stop": 20, + "path": "", + "content": " self.y.0 += 1u8;" + } + ] + } + }, + "op": "Add", + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 20, + "path": "", + "content": " self.y.0 += 1u8;" + } + } + }, + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 20, + "path": "", + "content": " self.y.0 += 1u8;" + } + } + }, + { + "Return": { + "expression": { + "Value": { + "Integer": [ + "U16", + "1", + { + "line_start": 7, + "line_stop": 7, + "col_start": 12, + "col_stop": 16, + "path": "", + "content": " return 1u16" + } + ] + } + }, + "span": { + "line_start": 7, + "line_stop": 7, + "col_start": 5, + "col_stop": 16, + "path": "", + "content": " return 1u16" + } + } + } + ], + "span": { + "line_start": 5, + "line_stop": 8, + "col_start": 32, + "col_stop": 4, + "path": "", + "content": " function z (mut self) -> u16 {\n...\n }" + } + }, + "span": { + "line_start": 5, + "line_stop": 8, + "col_start": 3, + "col_stop": 4, + "path": "", + "content": " function z (mut self) -> u16 {\n...\n }\n" + } + } } ] } }, "functions": { - "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": { + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": { "annotations": [], - "identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}", + "identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}", "input": [], "output": { "Tuple": [] @@ -33,10 +214,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x = 10u32;\\\"}\"}", + "identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x = 10u32;\\\"}\"}", "span": { - "line_start": 5, - "line_stop": 5, + "line_start": 11, + "line_stop": 11, "col_start": 7, "col_stop": 8, "path": "", @@ -44,15 +225,17 @@ } } ], - "type_": null, + "type_": { + "IntegerType": "U32" + }, "value": { "Value": { "Integer": [ "U32", "10", { - "line_start": 5, - "line_stop": 5, + "line_start": 11, + "line_stop": 11, "col_start": 11, "col_stop": 16, "path": "", @@ -62,8 +245,8 @@ } }, "span": { - "line_start": 5, - "line_stop": 5, + "line_start": 11, + "line_stop": 11, "col_start": 3, "col_stop": 16, "path": "", @@ -75,11 +258,11 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x += 20;\\\"}\"}", + "identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x += 20;\\\"}\"}", "accesses": [], "span": { - "line_start": 6, - "line_stop": 6, + "line_start": 12, + "line_stop": 12, "col_start": 3, "col_stop": 4, "path": "", @@ -89,15 +272,16 @@ "value": { "Binary": { "left": { - "Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x += 20;\\\"}\"}" + "Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x += 20;\\\"}\"}" }, "right": { "Value": { - "Implicit": [ + "Integer": [ + "U32", "20", { - "line_start": 6, - "line_stop": 6, + "line_start": 12, + "line_stop": 12, "col_start": 8, "col_stop": 10, "path": "", @@ -108,8 +292,8 @@ }, "op": "Add", "span": { - "line_start": 6, - "line_stop": 6, + "line_start": 12, + "line_stop": 12, "col_start": 3, "col_stop": 10, "path": "", @@ -118,8 +302,8 @@ } }, "span": { - "line_start": 6, - "line_stop": 6, + "line_start": 12, + "line_stop": 12, "col_start": 3, "col_stop": 10, "path": "", @@ -133,7 +317,7 @@ "Assert": { "Binary": { "left": { - "Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(x == 30u32);\\\"}\"}" + "Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(x == 30u32);\\\"}\"}" }, "right": { "Value": { @@ -141,8 +325,8 @@ "U32", "30", { - "line_start": 7, - "line_stop": 7, + "line_start": 13, + "line_stop": 13, "col_start": 23, "col_stop": 28, "path": "", @@ -153,8 +337,8 @@ }, "op": "Eq", "span": { - "line_start": 7, - "line_stop": 7, + "line_start": 13, + "line_stop": 13, "col_start": 18, "col_stop": 28, "path": "", @@ -164,8 +348,8 @@ } }, "span": { - "line_start": 7, - "line_stop": 7, + "line_start": 13, + "line_stop": 13, "col_start": 3, "col_stop": 28, "path": "", @@ -179,10 +363,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let y = [1u8, 2u8];\\\"}\"}", + "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let y = [1u8, 2u8];\\\"}\"}", "span": { - "line_start": 9, - "line_stop": 9, + "line_start": 15, + "line_stop": 15, "col_start": 7, "col_stop": 8, "path": "", @@ -190,7 +374,18 @@ } } ], - "type_": null, + "type_": { + "Array": [ + { + "IntegerType": "U8" + }, + [ + { + "value": "2" + } + ] + ] + }, "value": { "ArrayInline": { "elements": [ @@ -201,8 +396,8 @@ "U8", "1", { - "line_start": 9, - "line_stop": 9, + "line_start": 15, + "line_stop": 15, "col_start": 12, "col_stop": 15, "path": "", @@ -219,8 +414,8 @@ "U8", "2", { - "line_start": 9, - "line_stop": 9, + "line_start": 15, + "line_stop": 15, "col_start": 17, "col_stop": 20, "path": "", @@ -232,8 +427,8 @@ } ], "span": { - "line_start": 9, - "line_stop": 9, + "line_start": 15, + "line_stop": 15, "col_start": 11, "col_stop": 21, "path": "", @@ -242,8 +437,8 @@ } }, "span": { - "line_start": 9, - "line_stop": 9, + "line_start": 15, + "line_stop": 15, "col_start": 3, "col_stop": 21, "path": "", @@ -255,16 +450,17 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y[0] += 3u8;\\\"}\"}", + "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y[0] += 3u8;\\\"}\"}", "accesses": [ { "ArrayIndex": { "Value": { - "Implicit": [ + "Integer": [ + "U32", "0", { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 5, "col_stop": 6, "path": "", @@ -276,8 +472,8 @@ } ], "span": { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 3, "col_stop": 7, "path": "", @@ -289,15 +485,16 @@ "left": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y[0] += 3u8;\\\"}\"}" + "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y[0] += 3u8;\\\"}\"}" }, "index": { "Value": { - "Implicit": [ + "Integer": [ + "U32", "0", { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 5, "col_stop": 6, "path": "", @@ -307,8 +504,8 @@ } }, "span": { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 3, "col_stop": 14, "path": "", @@ -322,8 +519,8 @@ "U8", "3", { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 11, "col_stop": 14, "path": "", @@ -334,8 +531,8 @@ }, "op": "Add", "span": { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 3, "col_stop": 14, "path": "", @@ -344,8 +541,8 @@ } }, "span": { - "line_start": 10, - "line_stop": 10, + "line_start": 16, + "line_stop": 16, "col_start": 3, "col_stop": 14, "path": "", @@ -361,15 +558,16 @@ "left": { "ArrayAccess": { "array": { - "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(y[0] == 4u8);\\\"}\"}" + "Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(y[0] == 4u8);\\\"}\"}" }, "index": { "Value": { - "Implicit": [ + "Integer": [ + "U32", "0", { - "line_start": 11, - "line_stop": 11, + "line_start": 17, + "line_stop": 17, "col_start": 20, "col_stop": 21, "path": "", @@ -379,8 +577,8 @@ } }, "span": { - "line_start": 11, - "line_stop": 11, + "line_start": 17, + "line_stop": 17, "col_start": 18, "col_stop": 22, "path": "", @@ -394,8 +592,8 @@ "U8", "4", { - "line_start": 11, - "line_stop": 11, + "line_start": 17, + "line_stop": 17, "col_start": 26, "col_stop": 29, "path": "", @@ -406,8 +604,8 @@ }, "op": "Eq", "span": { - "line_start": 11, - "line_stop": 11, + "line_start": 17, + "line_stop": 17, "col_start": 18, "col_stop": 29, "path": "", @@ -417,8 +615,8 @@ } }, "span": { - "line_start": 11, - "line_stop": 11, + "line_start": 17, + "line_stop": 17, "col_start": 3, "col_stop": 29, "path": "", @@ -432,10 +630,10 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let z = (1u8, 2u8);\\\"}\"}", + "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let z = (1u8, 2u8);\\\"}\"}", "span": { - "line_start": 13, - "line_stop": 13, + "line_start": 19, + "line_stop": 19, "col_start": 7, "col_stop": 8, "path": "", @@ -443,7 +641,16 @@ } } ], - "type_": null, + "type_": { + "Tuple": [ + { + "IntegerType": "U8" + }, + { + "IntegerType": "U8" + } + ] + }, "value": { "TupleInit": { "elements": [ @@ -453,8 +660,8 @@ "U8", "1", { - "line_start": 13, - "line_stop": 13, + "line_start": 19, + "line_stop": 19, "col_start": 12, "col_stop": 15, "path": "", @@ -469,8 +676,8 @@ "U8", "2", { - "line_start": 13, - "line_stop": 13, + "line_start": 19, + "line_stop": 19, "col_start": 17, "col_stop": 20, "path": "", @@ -481,8 +688,8 @@ } ], "span": { - "line_start": 13, - "line_stop": 13, + "line_start": 19, + "line_stop": 19, "col_start": 11, "col_stop": 21, "path": "", @@ -491,8 +698,8 @@ } }, "span": { - "line_start": 13, - "line_stop": 13, + "line_start": 19, + "line_stop": 19, "col_start": 3, "col_stop": 21, "path": "", @@ -504,7 +711,7 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}", + "identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}", "accesses": [ { "Tuple": [ @@ -512,8 +719,8 @@ "value": "1" }, { - "line_start": 14, - "line_stop": 14, + "line_start": 20, + "line_stop": 20, "col_start": 3, "col_stop": 6, "path": "", @@ -523,8 +730,8 @@ } ], "span": { - "line_start": 14, - "line_stop": 14, + "line_start": 20, + "line_stop": 20, "col_start": 3, "col_stop": 6, "path": "", @@ -536,14 +743,14 @@ "left": { "TupleAccess": { "tuple": { - "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}" + "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" z.1 += 3u8;\\\"}\"}" }, "index": { "value": "1" }, "span": { - "line_start": 14, - "line_stop": 14, + "line_start": 20, + "line_stop": 20, "col_start": 3, "col_stop": 13, "path": "", @@ -557,8 +764,8 @@ "U8", "3", { - "line_start": 14, - "line_stop": 14, + "line_start": 20, + "line_stop": 20, "col_start": 10, "col_stop": 13, "path": "", @@ -569,8 +776,8 @@ }, "op": "Add", "span": { - "line_start": 14, - "line_stop": 14, + "line_start": 20, + "line_stop": 20, "col_start": 3, "col_stop": 13, "path": "", @@ -579,8 +786,8 @@ } }, "span": { - "line_start": 14, - "line_stop": 14, + "line_start": 20, + "line_stop": 20, "col_start": 3, "col_stop": 13, "path": "", @@ -596,14 +803,14 @@ "left": { "TupleAccess": { "tuple": { - "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(z.1 == 5u8);\\\"}\"}" + "Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(z.1 == 5u8);\\\"}\"}" }, "index": { "value": "1" }, "span": { - "line_start": 15, - "line_stop": 15, + "line_start": 21, + "line_stop": 21, "col_start": 18, "col_stop": 21, "path": "", @@ -617,8 +824,8 @@ "U8", "5", { - "line_start": 15, - "line_stop": 15, + "line_start": 21, + "line_stop": 21, "col_start": 25, "col_stop": 28, "path": "", @@ -629,8 +836,8 @@ }, "op": "Eq", "span": { - "line_start": 15, - "line_stop": 15, + "line_start": 21, + "line_stop": 21, "col_start": 18, "col_stop": 28, "path": "", @@ -640,8 +847,8 @@ } }, "span": { - "line_start": 15, - "line_stop": 15, + "line_start": 21, + "line_stop": 21, "col_start": 3, "col_stop": 28, "path": "", @@ -655,59 +862,110 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":7,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8 };\\\"}\"}", + "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":7,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "span": { - "line_start": 17, - "line_stop": 17, + "line_start": 23, + "line_stop": 23, "col_start": 7, "col_stop": 10, "path": "", - "content": " let foo = Foo { f: 6u8 };" + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" } } ], - "type_": null, + "type_": { + "Circuit": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {\\\"}\"}" + }, "value": { "CircuitInit": { - "name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8 };\\\"}\"}", + "name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "members": [ { - "identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8 };\\\"}\"}", + "identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", "expression": { "Value": { "Integer": [ "U8", "6", { - "line_start": 17, - "line_stop": 17, + "line_start": 23, + "line_stop": 23, "col_start": 22, "col_stop": 25, "path": "", - "content": " let foo = Foo { f: 6u8 };" + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" } ] } } + }, + { + "identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let foo = Foo { f: 6u8, y: (1u8, 1u8) };\\\"}\"}", + "expression": { + "TupleInit": { + "elements": [ + { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 23, + "line_stop": 23, + "col_start": 31, + "col_stop": 34, + "path": "", + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" + } + ] + } + }, + { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 23, + "line_stop": 23, + "col_start": 36, + "col_stop": 39, + "path": "", + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" + } + ] + } + } + ], + "span": { + "line_start": 23, + "line_stop": 23, + "col_start": 30, + "col_stop": 40, + "path": "", + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" + } + } + } } ], "span": { - "line_start": 17, - "line_stop": 17, + "line_start": 23, + "line_stop": 23, "col_start": 13, - "col_stop": 27, + "col_stop": 42, "path": "", - "content": " let foo = Foo { f: 6u8 };" + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" } } }, "span": { - "line_start": 17, - "line_stop": 17, + "line_start": 23, + "line_stop": 23, "col_start": 3, - "col_stop": 27, + "col_stop": 42, "path": "", - "content": " let foo = Foo { f: 6u8 };" + "content": " let foo = Foo { f: 6u8, y: (1u8, 1u8) };" } } }, @@ -715,15 +973,15 @@ "Assign": { "operation": "Assign", "assignee": { - "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", + "identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", "accesses": [ { - "Member": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" + "Member": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" } ], "span": { - "line_start": 18, - "line_stop": 18, + "line_start": 24, + "line_stop": 24, "col_start": 3, "col_stop": 8, "path": "", @@ -735,12 +993,12 @@ "left": { "CircuitMemberAccess": { "circuit": { - "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" + "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":3,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}" }, - "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", + "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" foo.f += 2u8;\\\"}\"}", "span": { - "line_start": 18, - "line_stop": 18, + "line_start": 24, + "line_stop": 24, "col_start": 3, "col_stop": 15, "path": "", @@ -754,8 +1012,8 @@ "U8", "2", { - "line_start": 18, - "line_stop": 18, + "line_start": 24, + "line_stop": 24, "col_start": 12, "col_stop": 15, "path": "", @@ -766,8 +1024,8 @@ }, "op": "Add", "span": { - "line_start": 18, - "line_stop": 18, + "line_start": 24, + "line_stop": 24, "col_start": 3, "col_stop": 15, "path": "", @@ -776,8 +1034,8 @@ } }, "span": { - "line_start": 18, - "line_stop": 18, + "line_start": 24, + "line_stop": 24, "col_start": 3, "col_stop": 15, "path": "", @@ -793,12 +1051,12 @@ "left": { "CircuitMemberAccess": { "circuit": { - "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}" + "Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}" }, - "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}", + "name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(foo.f == 8u8);\\\"}\"}", "span": { - "line_start": 19, - "line_stop": 19, + "line_start": 25, + "line_stop": 25, "col_start": 18, "col_stop": 23, "path": "", @@ -812,8 +1070,8 @@ "U8", "8", { - "line_start": 19, - "line_stop": 19, + "line_start": 25, + "line_stop": 25, "col_start": 27, "col_stop": 30, "path": "", @@ -824,8 +1082,8 @@ }, "op": "Eq", "span": { - "line_start": 19, - "line_stop": 19, + "line_start": 25, + "line_stop": 25, "col_start": 18, "col_stop": 30, "path": "", @@ -835,33 +1093,940 @@ } }, "span": { - "line_start": 19, - "line_stop": 19, + "line_start": 25, + "line_stop": 25, "col_start": 3, "col_stop": 30, "path": "", "content": " console.assert(foo.f == 8u8);" } } + }, + { + "Definition": { + "declaration_type": "Let", + "variable_names": [ + { + "mutable": true, + "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":7,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let complex = 2u8;\\\"}\"}", + "span": { + "line_start": 27, + "line_stop": 27, + "col_start": 7, + "col_stop": 14, + "path": "", + "content": " let complex = 2u8;" + } + } + ], + "type_": { + "IntegerType": "U8" + }, + "value": { + "Value": { + "Integer": [ + "U8", + "2", + { + "line_start": 27, + "line_stop": 27, + "col_start": 17, + "col_stop": 20, + "path": "", + "content": " let complex = 2u8;" + } + ] + } + }, + "span": { + "line_start": 27, + "line_stop": 27, + "col_start": 3, + "col_stop": 20, + "path": "", + "content": " let complex = 2u8;" + } + } + }, + { + "Assign": { + "operation": "Assign", + "assignee": { + "identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}", + "accesses": [], + "span": { + "line_start": 28, + "line_stop": 28, + "col_start": 3, + "col_stop": 10, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + }, + "value": { + "Binary": { + "left": { + "Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":3,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" complex += 22u8 - 2u8+ 1u8;\\\"}\"}" + }, + "right": { + "Binary": { + "left": { + "Binary": { + "left": { + "Value": { + "Integer": [ + "U8", + "22", + { + "line_start": 28, + "line_stop": 28, + "col_start": 14, + "col_stop": 18, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + ] + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "2", + { + "line_start": 28, + "line_stop": 28, + "col_start": 21, + "col_stop": 24, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + ] + } + }, + "op": "Sub", + "span": { + "line_start": 28, + "line_stop": 28, + "col_start": 14, + "col_stop": 24, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 28, + "line_stop": 28, + "col_start": 26, + "col_stop": 29, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + ] + } + }, + "op": "Add", + "span": { + "line_start": 28, + "line_stop": 28, + "col_start": 14, + "col_stop": 29, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + } + }, + "op": "Add", + "span": { + "line_start": 28, + "line_stop": 28, + "col_start": 3, + "col_stop": 29, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + } + }, + "span": { + "line_start": 28, + "line_stop": 28, + "col_start": 3, + "col_stop": 29, + "path": "", + "content": " complex += 22u8 - 2u8+ 1u8;" + } + } + }, + { + "Console": { + "function": { + "Assert": { + "Binary": { + "left": { + "Identifier": "{\"name\":\"complex\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(complex == 23u8);\\\"}\"}" + }, + "right": { + "Value": { + "Integer": [ + "U8", + "23", + { + "line_start": 29, + "line_stop": 29, + "col_start": 29, + "col_stop": 33, + "path": "", + "content": " console.assert(complex == 23u8);" + } + ] + } + }, + "op": "Eq", + "span": { + "line_start": 29, + "line_stop": 29, + "col_start": 18, + "col_stop": 33, + "path": "", + "content": " console.assert(complex == 23u8);" + } + } + } + }, + "span": { + "line_start": 29, + "line_stop": 29, + "col_start": 3, + "col_stop": 33, + "path": "", + "content": " console.assert(complex == 23u8);" + } + } + }, + { + "Definition": { + "declaration_type": "Let", + "variable_names": [ + { + "mutable": true, + "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let a = [[0u8; 1]; 4];\\\"}\"}", + "span": { + "line_start": 30, + "line_stop": 30, + "col_start": 7, + "col_stop": 8, + "path": "", + "content": " let a = [[0u8; 1]; 4];" + } + } + ], + "type_": { + "Array": [ + { + "Array": [ + { + "IntegerType": "U8" + }, + [ + { + "value": "1" + } + ] + ] + }, + [ + { + "value": "4" + } + ] + ] + }, + "value": { + "ArrayInit": { + "element": { + "ArrayInit": { + "element": { + "Value": { + "Integer": [ + "U8", + "0", + { + "line_start": 30, + "line_stop": 30, + "col_start": 13, + "col_stop": 16, + "path": "", + "content": " let a = [[0u8; 1]; 4];" + } + ] + } + }, + "dimensions": [ + { + "value": "1" + } + ], + "span": { + "line_start": 30, + "line_stop": 30, + "col_start": 12, + "col_stop": 20, + "path": "", + "content": " let a = [[0u8; 1]; 4];" + } + } + }, + "dimensions": [ + { + "value": "4" + } + ], + "span": { + "line_start": 30, + "line_stop": 30, + "col_start": 11, + "col_stop": 24, + "path": "", + "content": " let a = [[0u8; 1]; 4];" + } + } + }, + "span": { + "line_start": 30, + "line_stop": 30, + "col_start": 3, + "col_stop": 24, + "path": "", + "content": " let a = [[0u8; 1]; 4];" + } + } + }, + { + "Assign": { + "operation": "Assign", + "assignee": { + "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}", + "accesses": [ + { + "ArrayIndex": { + "Value": { + "Integer": [ + "U32", + "2", + { + "line_start": 31, + "line_stop": 31, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " a[2][0] += 1u8;" + } + ] + } + } + }, + { + "ArrayIndex": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 31, + "line_stop": 31, + "col_start": 8, + "col_stop": 9, + "path": "", + "content": " a[2][0] += 1u8;" + } + ] + } + } + } + ], + "span": { + "line_start": 31, + "line_stop": 31, + "col_start": 3, + "col_stop": 10, + "path": "", + "content": " a[2][0] += 1u8;" + } + }, + "value": { + "Binary": { + "left": { + "ArrayAccess": { + "array": { + "ArrayAccess": { + "array": { + "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" a[2][0] += 1u8;\\\"}\"}" + }, + "index": { + "Value": { + "Integer": [ + "U32", + "2", + { + "line_start": 31, + "line_stop": 31, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " a[2][0] += 1u8;" + } + ] + } + }, + "span": { + "line_start": 31, + "line_stop": 31, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " a[2][0] += 1u8;" + } + } + }, + "index": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 31, + "line_stop": 31, + "col_start": 8, + "col_stop": 9, + "path": "", + "content": " a[2][0] += 1u8;" + } + ] + } + }, + "span": { + "line_start": 31, + "line_stop": 31, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " a[2][0] += 1u8;" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 31, + "line_stop": 31, + "col_start": 14, + "col_stop": 17, + "path": "", + "content": " a[2][0] += 1u8;" + } + ] + } + }, + "op": "Add", + "span": { + "line_start": 31, + "line_stop": 31, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " a[2][0] += 1u8;" + } + } + }, + "span": { + "line_start": 31, + "line_stop": 31, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " a[2][0] += 1u8;" + } + } + }, + { + "Console": { + "function": { + "Assert": { + "Binary": { + "left": { + "ArrayAccess": { + "array": { + "ArrayAccess": { + "array": { + "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" + }, + "index": { + "Value": { + "Integer": [ + "U32", + "2", + { + "line_start": 32, + "line_stop": 32, + "col_start": 20, + "col_stop": 21, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + ] + } + }, + "span": { + "line_start": 32, + "line_stop": 32, + "col_start": 18, + "col_stop": 22, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + }, + "index": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 32, + "line_stop": 32, + "col_start": 23, + "col_stop": 24, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + ] + } + }, + "span": { + "line_start": 32, + "line_stop": 32, + "col_start": 18, + "col_stop": 25, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 32, + "line_stop": 32, + "col_start": 29, + "col_stop": 32, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + ] + } + }, + "op": "Eq", + "span": { + "line_start": 32, + "line_stop": 32, + "col_start": 18, + "col_stop": 32, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + } + }, + "span": { + "line_start": 32, + "line_stop": 32, + "col_start": 3, + "col_stop": 32, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + }, + { + "Definition": { + "declaration_type": "Let", + "variable_names": [ + { + "mutable": true, + "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":34,\\\"line_stop\\\":34,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let b = [0u8; (4, 1)];\\\"}\"}", + "span": { + "line_start": 34, + "line_stop": 34, + "col_start": 7, + "col_stop": 8, + "path": "", + "content": " let b = [0u8; (4, 1)];" + } + } + ], + "type_": { + "Array": [ + { + "Array": [ + { + "IntegerType": "U8" + }, + [ + { + "value": "1" + } + ] + ] + }, + [ + { + "value": "4" + } + ] + ] + }, + "value": { + "ArrayInit": { + "element": { + "ArrayInit": { + "element": { + "Value": { + "Integer": [ + "U8", + "0", + { + "line_start": 34, + "line_stop": 34, + "col_start": 12, + "col_stop": 15, + "path": "", + "content": " let b = [0u8; (4, 1)];" + } + ] + } + }, + "dimensions": [ + { + "value": "1" + } + ], + "span": { + "line_start": 34, + "line_stop": 34, + "col_start": 11, + "col_stop": 24, + "path": "", + "content": " let b = [0u8; (4, 1)];" + } + } + }, + "dimensions": [ + { + "value": "4" + } + ], + "span": { + "line_start": 34, + "line_stop": 34, + "col_start": 11, + "col_stop": 24, + "path": "", + "content": " let b = [0u8; (4, 1)];" + } + } + }, + "span": { + "line_start": 34, + "line_stop": 34, + "col_start": 3, + "col_stop": 24, + "path": "", + "content": " let b = [0u8; (4, 1)];" + } + } + }, + { + "Assign": { + "operation": "Assign", + "assignee": { + "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}", + "accesses": [ + { + "ArrayIndex": { + "Value": { + "Integer": [ + "U32", + "2", + { + "line_start": 35, + "line_stop": 35, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " b[2][0] += 1u8;" + } + ] + } + } + }, + { + "ArrayIndex": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 35, + "line_stop": 35, + "col_start": 8, + "col_stop": 9, + "path": "", + "content": " b[2][0] += 1u8;" + } + ] + } + } + } + ], + "span": { + "line_start": 35, + "line_stop": 35, + "col_start": 3, + "col_stop": 10, + "path": "", + "content": " b[2][0] += 1u8;" + } + }, + "value": { + "Binary": { + "left": { + "ArrayAccess": { + "array": { + "ArrayAccess": { + "array": { + "Identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" b[2][0] += 1u8;\\\"}\"}" + }, + "index": { + "Value": { + "Integer": [ + "U32", + "2", + { + "line_start": 35, + "line_stop": 35, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " b[2][0] += 1u8;" + } + ] + } + }, + "span": { + "line_start": 35, + "line_stop": 35, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " b[2][0] += 1u8;" + } + } + }, + "index": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 35, + "line_stop": 35, + "col_start": 8, + "col_stop": 9, + "path": "", + "content": " b[2][0] += 1u8;" + } + ] + } + }, + "span": { + "line_start": 35, + "line_stop": 35, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " b[2][0] += 1u8;" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 35, + "line_stop": 35, + "col_start": 14, + "col_stop": 17, + "path": "", + "content": " b[2][0] += 1u8;" + } + ] + } + }, + "op": "Add", + "span": { + "line_start": 35, + "line_stop": 35, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " b[2][0] += 1u8;" + } + } + }, + "span": { + "line_start": 35, + "line_stop": 35, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " b[2][0] += 1u8;" + } + } + }, + { + "Console": { + "function": { + "Assert": { + "Binary": { + "left": { + "ArrayAccess": { + "array": { + "ArrayAccess": { + "array": { + "Identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(a[2][0] == 1u8);\\\"}\"}" + }, + "index": { + "Value": { + "Integer": [ + "U32", + "2", + { + "line_start": 36, + "line_stop": 36, + "col_start": 20, + "col_stop": 21, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + ] + } + }, + "span": { + "line_start": 36, + "line_stop": 36, + "col_start": 18, + "col_stop": 22, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + }, + "index": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 36, + "line_stop": 36, + "col_start": 23, + "col_stop": 24, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + ] + } + }, + "span": { + "line_start": 36, + "line_stop": 36, + "col_start": 18, + "col_stop": 25, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + }, + "right": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 36, + "line_stop": 36, + "col_start": 29, + "col_stop": 32, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + ] + } + }, + "op": "Eq", + "span": { + "line_start": 36, + "line_stop": 36, + "col_start": 18, + "col_stop": 32, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } + } + }, + "span": { + "line_start": 36, + "line_stop": 36, + "col_start": 3, + "col_stop": 32, + "path": "", + "content": " console.assert(a[2][0] == 1u8);" + } + } } ], "span": { - "line_start": 4, - "line_stop": 20, + "line_start": 10, + "line_stop": 37, "col_start": 17, "col_stop": 2, "path": "", - "content": "function main() {\n...\n} " + "content": "function main() {\n...\n}" } }, "span": { - "line_start": 4, - "line_stop": 20, + "line_start": 10, + "line_stop": 37, "col_start": 1, "col_stop": 2, "path": "", - "content": "function main() {\n...\n} \n\n\n\n\n\n\n\n\n\n\n\n\n\n" + "content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" } } } -} +} \ No newline at end of file diff --git a/compiler/tests/canonicalization/compound_assignment.leo b/compiler/tests/canonicalization/compound_assignment.leo index 346d4de3c7..1a6f2171fe 100644 --- a/compiler/tests/canonicalization/compound_assignment.leo +++ b/compiler/tests/canonicalization/compound_assignment.leo @@ -1,5 +1,11 @@ circuit Foo { f: u8, + y: (u8, u8), + + function z (mut self) -> u16 { + self.y.0 += 1u8; + return 1u16; + } } function main() { let x = 10u32; @@ -14,7 +20,18 @@ function main() { z.1 += 3u8; console.assert(z.1 == 5u8); - let foo = Foo { f: 6u8 }; + let foo = Foo { f: 6u8, y: (1u8, 1u8) }; foo.f += 2u8; console.assert(foo.f == 8u8); + + let complex = 2u8; + complex += 22u8 - 2u8+ 1u8; + console.assert(complex == 23u8); + let a = [[0u8; 1]; 4]; + a[2][0] += 1u8; + console.assert(a[2][0] == 1u8); + + let b = [0u8; (4, 1)]; + b[2][0] += 1u8; + console.assert(a[2][0] == 1u8); } \ No newline at end of file diff --git a/compiler/tests/canonicalization/illegal_array_range_fail.leo b/compiler/tests/canonicalization/illegal_array_range_fail.leo new file mode 100644 index 0000000000..af14957712 --- /dev/null +++ b/compiler/tests/canonicalization/illegal_array_range_fail.leo @@ -0,0 +1,4 @@ +function main () { + let x = [1u32; 5]; + x[..2] += 1; +} \ No newline at end of file diff --git a/compiler/tests/canonicalization/mod.rs b/compiler/tests/canonicalization/mod.rs index fd2db5da3f..f420b2370c 100644 --- a/compiler/tests/canonicalization/mod.rs +++ b/compiler/tests/canonicalization/mod.rs @@ -87,3 +87,11 @@ fn test_compound_assignment() { assert_eq!(expected_ast, ast); } + +#[test] +fn test_illegal_array_range_fail() { + // Check program is invalid. + let program_string = include_str!("illegal_array_range_fail.leo"); + let program = parse_program(program_string); + assert!(program.is_err()); +} diff --git a/compiler/tests/circuits/const_self_variable.leo b/compiler/tests/circuits/const_self_variable.leo index ebcc3076ae..8ba32ba0df 100644 --- a/compiler/tests/circuits/const_self_variable.leo +++ b/compiler/tests/circuits/const_self_variable.leo @@ -2,7 +2,7 @@ circuit Foo { a: u8, function use_a(const self) -> u8 { - return self.a + 1 + return self.a + 1; } } diff --git a/compiler/tests/circuits/duplicate_name_context.leo b/compiler/tests/circuits/duplicate_name_context.leo index 66640e75a2..8644d27fcb 100644 --- a/compiler/tests/circuits/duplicate_name_context.leo +++ b/compiler/tests/circuits/duplicate_name_context.leo @@ -2,7 +2,7 @@ circuit Bar { b2: u32 function add_five(z:u32) -> u32 { - return z+5u32 + return z+5u32; } } diff --git a/compiler/tests/circuits/inline_member_pass.leo b/compiler/tests/circuits/inline_member_pass.leo index 8e58e4935a..6fd7f7dff7 100644 --- a/compiler/tests/circuits/inline_member_pass.leo +++ b/compiler/tests/circuits/inline_member_pass.leo @@ -2,7 +2,7 @@ circuit Foo { x: u8 function new(x: u8) -> Self { - return Self { x } + return Self { x }; } } diff --git a/compiler/tests/circuits/member_function.leo b/compiler/tests/circuits/member_function.leo index 258b6c675e..eee44be448 100644 --- a/compiler/tests/circuits/member_function.leo +++ b/compiler/tests/circuits/member_function.leo @@ -2,7 +2,7 @@ circuit Foo { x: u32, function echo(self) -> u32 { - return self.x + return self.x; } } diff --git a/compiler/tests/circuits/member_function_fail.leo b/compiler/tests/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/compiler/tests/circuits/member_function_fail.leo +++ b/compiler/tests/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_function_invalid.leo b/compiler/tests/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/compiler/tests/circuits/member_function_invalid.leo +++ b/compiler/tests/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_function_nested.leo b/compiler/tests/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/compiler/tests/circuits/member_function_nested.leo +++ b/compiler/tests/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/compiler/tests/circuits/member_static_function.leo b/compiler/tests/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/compiler/tests/circuits/member_static_function.leo +++ b/compiler/tests/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_static_function_invalid.leo b/compiler/tests/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/compiler/tests/circuits/member_static_function_invalid.leo +++ b/compiler/tests/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_static_function_undefined.leo b/compiler/tests/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/compiler/tests/circuits/member_static_function_undefined.leo +++ b/compiler/tests/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_variable_and_function.leo b/compiler/tests/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/compiler/tests/circuits/member_variable_and_function.leo +++ b/compiler/tests/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/compiler/tests/circuits/mutable_call_immutable_context.leo b/compiler/tests/circuits/mutable_call_immutable_context.leo index d68e1866c5..d235d11cb7 100644 --- a/compiler/tests/circuits/mutable_call_immutable_context.leo +++ b/compiler/tests/circuits/mutable_call_immutable_context.leo @@ -3,10 +3,23 @@ circuit TestMe { function test_me(mut self) -> u8 { self.x += 1; - return self.x + return self.x; } + + function new() -> Self { + return Self { x: 1u8 }; + } +} + +function my_fn() -> TestMe { + return TestMe { x: 0u8 }; } function main () { const t = TestMe {x: 6u8}.test_me(); + console.assert(t == 7u8); + const u = my_fn().test_me(); + console.assert(u == 1u8); + const v = TestMe::new().test_me(); + console.assert(v == 2u8); } \ No newline at end of file diff --git a/compiler/tests/circuits/pedersen_mock.leo b/compiler/tests/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/compiler/tests/circuits/pedersen_mock.leo +++ b/compiler/tests/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/compiler/tests/circuits/self_circuit.leo b/compiler/tests/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/compiler/tests/circuits/self_circuit.leo +++ b/compiler/tests/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/compiler/tests/circuits/self_member.leo b/compiler/tests/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/compiler/tests/circuits/self_member.leo +++ b/compiler/tests/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/compiler/tests/circuits/self_member_invalid.leo b/compiler/tests/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/compiler/tests/circuits/self_member_invalid.leo +++ b/compiler/tests/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/compiler/tests/circuits/self_member_undefined.leo b/compiler/tests/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/compiler/tests/circuits/self_member_undefined.leo +++ b/compiler/tests/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo b/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo +++ b/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/compiler/tests/field/output_register.leo b/compiler/tests/field/output_register.leo index 258a6f2c74..e27a3947bd 100644 --- a/compiler/tests/field/output_register.leo +++ b/compiler/tests/field/output_register.leo @@ -1,3 +1,3 @@ function main(registers) -> field { - return registers.r + return registers.r; } \ No newline at end of file diff --git a/compiler/tests/function/conditional_return.leo b/compiler/tests/function/conditional_return.leo index 7ecd0e625c..e27dd7aea5 100644 --- a/compiler/tests/function/conditional_return.leo +++ b/compiler/tests/function/conditional_return.leo @@ -1,7 +1,7 @@ function main(x: u8) -> u8 { if x == 2u8 { - return 3u8 + return 3u8; } else { - return 4u8 + return 4u8; } } \ No newline at end of file diff --git a/compiler/tests/function/iteration.leo b/compiler/tests/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/compiler/tests/function/iteration.leo +++ b/compiler/tests/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/compiler/tests/function/iteration_repeated.leo b/compiler/tests/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/compiler/tests/function/iteration_repeated.leo +++ b/compiler/tests/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/compiler/tests/function/multiple_returns.leo b/compiler/tests/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/compiler/tests/function/multiple_returns.leo +++ b/compiler/tests/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/function/multiple_returns_fail.leo b/compiler/tests/function/multiple_returns_fail.leo index d4a8b36eac..c4539bb1a0 100644 --- a/compiler/tests/function/multiple_returns_fail.leo +++ b/compiler/tests/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns -} \ No newline at end of file + return 2i8; //ignored + return 3i8; //returns +} diff --git a/compiler/tests/function/multiple_returns_fail_conditional.leo b/compiler/tests/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/compiler/tests/function/multiple_returns_fail_conditional.leo +++ b/compiler/tests/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/compiler/tests/function/multiple_returns_main.leo b/compiler/tests/function/multiple_returns_main.leo index 0bc82e1e4b..8590cdd71e 100644 --- a/compiler/tests/function/multiple_returns_main.leo +++ b/compiler/tests/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ -function main(input) -> (bool, bool) { - return (input.registers.a, input.registers.b) -} \ No newline at end of file +function main() -> (bool, bool) { + return (input.registers.a, input.registers.b); +} diff --git a/compiler/tests/function/newlines.leo b/compiler/tests/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/compiler/tests/function/newlines.leo +++ b/compiler/tests/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/compiler/tests/function/repeated.leo b/compiler/tests/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/compiler/tests/function/repeated.leo +++ b/compiler/tests/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/compiler/tests/function/return.leo b/compiler/tests/function/return.leo index 10c7138977..e839700ee3 100644 --- a/compiler/tests/function/return.leo +++ b/compiler/tests/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/compiler/tests/function/return_array_nested_fail.leo b/compiler/tests/function/return_array_nested_fail.leo index 8eca684b8a..0db89a09e3 100644 --- a/compiler/tests/function/return_array_nested_fail.leo +++ b/compiler/tests/function/return_array_nested_fail.leo @@ -1,5 +1,5 @@ function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (2, 3)] // The correct 3x2 array tuple is `[0u8; (3, 2)]` + return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]` } function main() { diff --git a/compiler/tests/function/return_array_nested_pass.leo b/compiler/tests/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/compiler/tests/function/return_array_nested_pass.leo +++ b/compiler/tests/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/compiler/tests/function/return_array_tuple_fail.leo b/compiler/tests/function/return_array_tuple_fail.leo index c960456ac1..d2afcd2790 100644 --- a/compiler/tests/function/return_array_tuple_fail.leo +++ b/compiler/tests/function/return_array_tuple_fail.leo @@ -1,5 +1,5 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 3]; 2] // The correct 3x2 nested array is `[0u8; 2]; 3]` + return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]` } function main() { diff --git a/compiler/tests/function/return_array_tuple_pass.leo b/compiler/tests/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/compiler/tests/function/return_array_tuple_pass.leo +++ b/compiler/tests/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/compiler/tests/function/return_tuple.leo b/compiler/tests/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/compiler/tests/function/return_tuple.leo +++ b/compiler/tests/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/compiler/tests/function/return_tuple_conditional.leo b/compiler/tests/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/compiler/tests/function/return_tuple_conditional.leo +++ b/compiler/tests/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/compiler/tests/function/scope_fail.leo b/compiler/tests/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/compiler/tests/function/scope_fail.leo +++ b/compiler/tests/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/compiler/tests/import/src/test-import.leo b/compiler/tests/import/src/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/compiler/tests/import/src/test-import.leo +++ b/compiler/tests/import/src/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_input_and_program_state/access.leo b/compiler/tests/input_files/program_input_and_program_state/access.leo index ae1728c164..819f6c6c1e 100644 --- a/compiler/tests/input_files/program_input_and_program_state/access.leo +++ b/compiler/tests/input_files/program_input_and_program_state/access.leo @@ -1,4 +1,4 @@ -function main(input, data: [u8; 32]) { +function main(data: [u8; 32]) { console.assert(input.registers.value_balance == 0u64); console.assert(input.state.leaf_index == 0u32); diff --git a/compiler/tests/input_files/program_registers/registers_array.leo b/compiler/tests/input_files/program_registers/registers_array.leo index 708fa0ea61..324515c13f 100644 --- a/compiler/tests/input_files/program_registers/registers_array.leo +++ b/compiler/tests/input_files/program_registers/registers_array.leo @@ -1,3 +1,3 @@ function main () -> [[u8; 4]; 2] { - return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]] + return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]]; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_fail.leo b/compiler/tests/input_files/program_registers/registers_fail.leo index 221958dbd9..78af2bb5d8 100644 --- a/compiler/tests/input_files/program_registers/registers_fail.leo +++ b/compiler/tests/input_files/program_registers/registers_fail.leo @@ -1,3 +1,3 @@ function main() -> bool { - return false + return false; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_pass.leo b/compiler/tests/input_files/program_registers/registers_pass.leo index ce0dbcb130..ff5ef4a0cd 100644 --- a/compiler/tests/input_files/program_registers/registers_pass.leo +++ b/compiler/tests/input_files/program_registers/registers_pass.leo @@ -1,3 +1,3 @@ function main() -> u8 { - return 1u8 + return 1u8; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_state/access_all.leo b/compiler/tests/input_files/program_state/access_all.leo index 2a60f218aa..bf85a3f722 100644 --- a/compiler/tests/input_files/program_state/access_all.leo +++ b/compiler/tests/input_files/program_state/access_all.leo @@ -1,4 +1,4 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); const expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; diff --git a/compiler/tests/input_files/program_state/access_state.leo b/compiler/tests/input_files/program_state/access_state.leo index 0e014aec54..a7afe50a5f 100644 --- a/compiler/tests/input_files/program_state/access_state.leo +++ b/compiler/tests/input_files/program_state/access_state.leo @@ -1,3 +1,3 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); } \ No newline at end of file diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index fa9d2b7255..aeb93c6eab 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -37,6 +37,7 @@ pub mod mutability; pub mod statements; pub mod syntax; pub mod tuples; +pub mod type_inference; use leo_asg::{new_alloc_context, new_context, AsgContext}; use leo_ast::{InputValue, MainInput}; diff --git a/compiler/tests/mutability/swap.leo b/compiler/tests/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/compiler/tests/mutability/swap.leo +++ b/compiler/tests/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/compiler/tests/statements/conditional/cond_switch.leo b/compiler/tests/statements/conditional/cond_switch.leo index 7b7845cde3..6f2228635b 100644 --- a/compiler/tests/statements/conditional/cond_switch.leo +++ b/compiler/tests/statements/conditional/cond_switch.leo @@ -1,9 +1,9 @@ function main (x: bool) -> bool { if false { - return x + return x; } else if x { - return false + return false; } else { - return false + return false; } } \ No newline at end of file diff --git a/compiler/tests/statements/conditional/multiple_returns.leo b/compiler/tests/statements/conditional/multiple_returns.leo index b8dd869b47..f2b9e499c2 100644 --- a/compiler/tests/statements/conditional/multiple_returns.leo +++ b/compiler/tests/statements/conditional/multiple_returns.leo @@ -1,7 +1,7 @@ -function main(input) -> u32 { +function main() -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/compiler/tests/statements/iteration_type_fail.leo b/compiler/tests/statements/iteration_type_fail.leo new file mode 100644 index 0000000000..8ce5665176 --- /dev/null +++ b/compiler/tests/statements/iteration_type_fail.leo @@ -0,0 +1,9 @@ +// code sample is from fuzzing bug +// https://github.com/AleoHQ/leo/issues/758 +function main ( + x: u8, +) { + for y in 0u8..10u8 { + let z = y > x; + } +} diff --git a/compiler/tests/statements/mod.rs b/compiler/tests/statements/mod.rs index 8566d67576..d9be9023c3 100644 --- a/compiler/tests/statements/mod.rs +++ b/compiler/tests/statements/mod.rs @@ -82,6 +82,14 @@ fn test_iteration_input() { expect_asg_error(error); } +#[test] +fn test_iteration_wrong_type() { + let program_string = include_str!("iteration_type_fail.leo"); + let error = parse_program(program_string).err().unwrap(); + + expect_asg_error(error); +} + #[test] fn test_iteration_variable() { let program_string = include_str!("iteration_variable.leo"); diff --git a/compiler/tests/statements/num_returns_fail.leo b/compiler/tests/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/compiler/tests/statements/num_returns_fail.leo +++ b/compiler/tests/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/compiler/tests/syntax/undefined.leo b/compiler/tests/syntax/undefined.leo index 856b07589a..0ab97f6cb0 100644 --- a/compiler/tests/syntax/undefined.leo +++ b/compiler/tests/syntax/undefined.leo @@ -1,3 +1,3 @@ function main() -> bool { - return a + return a; } \ No newline at end of file diff --git a/compiler/tests/tuples/function.leo b/compiler/tests/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/compiler/tests/tuples/function.leo +++ b/compiler/tests/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/tuples/function_multiple.leo b/compiler/tests/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/compiler/tests/tuples/function_multiple.leo +++ b/compiler/tests/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/tuples/function_typed.leo b/compiler/tests/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/compiler/tests/tuples/function_typed.leo +++ b/compiler/tests/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/type_inference/basic.json b/compiler/tests/type_inference/basic.json new file mode 100644 index 0000000000..6f588d2f3c --- /dev/null +++ b/compiler/tests/type_inference/basic.json @@ -0,0 +1,962 @@ +{ + "name": "", + "expected_input": [], + "imports": [], + "circuits": { + "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {}\\\"}\"}": { + "circuit_name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {}\\\"}\"}", + "members": [] + } + }, + "functions": { + "{\"name\":\"two\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function two() -> u8 {\\\"}\"}": { + "annotations": [], + "identifier": "{\"name\":\"two\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function two() -> u8 {\\\"}\"}", + "input": [], + "output": { + "IntegerType": "U8" + }, + "block": { + "statements": [ + { + "Return": { + "expression": { + "Value": { + "Integer": [ + "U8", + "2", + { + "line_start": 4, + "line_stop": 4, + "col_start": 10, + "col_stop": 13, + "path": "", + "content": " return 2u8" + } + ] + } + }, + "span": { + "line_start": 4, + "line_stop": 4, + "col_start": 3, + "col_stop": 13, + "path": "", + "content": " return 2u8" + } + } + } + ], + "span": { + "line_start": 3, + "line_stop": 5, + "col_start": 22, + "col_stop": 2, + "path": "", + "content": "function two() -> u8 {\n...\n}" + } + }, + "span": { + "line_start": 3, + "line_stop": 5, + "col_start": 1, + "col_stop": 2, + "path": "", + "content": "function two() -> u8 {\n...\n}" + } + }, + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": { + "annotations": [], + "identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}", + "input": [], + "output": { + "Tuple": [] + }, + "block": { + "statements": [ + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const a = 1u8;\\\"}\"}", + "span": { + "line_start": 8, + "line_stop": 8, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const a = 1u8;" + } + } + ], + "type_": { + "IntegerType": "U8" + }, + "value": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 8, + "line_stop": 8, + "col_start": 13, + "col_stop": 16, + "path": "", + "content": " const a = 1u8;" + } + ] + } + }, + "span": { + "line_start": 8, + "line_stop": 8, + "col_start": 3, + "col_stop": 16, + "path": "", + "content": " const a = 1u8;" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const b = 1field;\\\"}\"}", + "span": { + "line_start": 9, + "line_stop": 9, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const b = 1field;" + } + } + ], + "type_": "Field", + "value": { + "Value": { + "Field": [ + "1", + { + "line_start": 9, + "line_stop": 9, + "col_start": 13, + "col_stop": 19, + "path": "", + "content": " const b = 1field;" + } + ] + } + }, + "span": { + "line_start": 9, + "line_stop": 9, + "col_start": 3, + "col_stop": 19, + "path": "", + "content": " const b = 1field;" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const c = 1group;\\\"}\"}", + "span": { + "line_start": 10, + "line_stop": 10, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const c = 1group;" + } + } + ], + "type_": "Group", + "value": { + "Value": { + "Group": { + "Single": [ + "1", + { + "line_start": 10, + "line_stop": 10, + "col_start": 13, + "col_stop": 19, + "path": "", + "content": " const c = 1group;" + } + ] + } + } + }, + "span": { + "line_start": 10, + "line_stop": 10, + "col_start": 3, + "col_stop": 19, + "path": "", + "content": " const c = 1group;" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const d = (0, 1)group;\\\"}\"}", + "span": { + "line_start": 11, + "line_stop": 11, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const d = (0, 1)group;" + } + } + ], + "type_": "Group", + "value": { + "Value": { + "Group": { + "Tuple": { + "x": { + "Number": [ + "0", + { + "line_start": 11, + "line_stop": 11, + "col_start": 14, + "col_stop": 15, + "path": "", + "content": " const d = (0, 1)group;" + } + ] + }, + "y": { + "Number": [ + "1", + { + "line_start": 11, + "line_stop": 11, + "col_start": 17, + "col_stop": 18, + "path": "", + "content": " const d = (0, 1)group;" + } + ] + }, + "span": { + "line_start": 11, + "line_stop": 11, + "col_start": 14, + "col_stop": 24, + "path": "", + "content": " const d = (0, 1)group;" + } + } + } + } + }, + "span": { + "line_start": 11, + "line_stop": 11, + "col_start": 3, + "col_stop": 24, + "path": "", + "content": " const d = (0, 1)group;" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);\\\"}\"}", + "span": { + "line_start": 12, + "line_stop": 12, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);" + } + } + ], + "type_": "Address", + "value": { + "Value": { + "Address": [ + "aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8", + { + "line_start": 12, + "line_stop": 12, + "col_start": 13, + "col_stop": 85, + "path": "", + "content": " const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);" + } + ] + } + }, + "span": { + "line_start": 12, + "line_stop": 12, + "col_start": 3, + "col_stop": 85, + "path": "", + "content": " const e = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const f = two();\\\"}\"}", + "span": { + "line_start": 13, + "line_stop": 13, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const f = two();" + } + } + ], + "type_": { + "IntegerType": "U8" + }, + "value": { + "Call": { + "function": { + "Identifier": "{\"name\":\"two\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const f = two();\\\"}\"}" + }, + "arguments": [], + "span": { + "line_start": 13, + "line_stop": 13, + "col_start": 13, + "col_stop": 18, + "path": "", + "content": " const f = two();" + } + } + }, + "span": { + "line_start": 13, + "line_stop": 13, + "col_start": 3, + "col_stop": 18, + "path": "", + "content": " const f = two();" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"g\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const g = [0u8; (3, 2)];\\\"}\"}", + "span": { + "line_start": 14, + "line_stop": 14, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const g = [0u8; (3, 2)];" + } + } + ], + "type_": { + "Array": [ + { + "Array": [ + { + "IntegerType": "U8" + }, + [ + { + "value": "2" + } + ] + ] + }, + [ + { + "value": "3" + } + ] + ] + }, + "value": { + "ArrayInit": { + "element": { + "ArrayInit": { + "element": { + "Value": { + "Integer": [ + "U8", + "0", + { + "line_start": 14, + "line_stop": 14, + "col_start": 14, + "col_stop": 17, + "path": "", + "content": " const g = [0u8; (3, 2)];" + } + ] + } + }, + "dimensions": [ + { + "value": "2" + } + ], + "span": { + "line_start": 14, + "line_stop": 14, + "col_start": 13, + "col_stop": 26, + "path": "", + "content": " const g = [0u8; (3, 2)];" + } + } + }, + "dimensions": [ + { + "value": "3" + } + ], + "span": { + "line_start": 14, + "line_stop": 14, + "col_start": 13, + "col_stop": 26, + "path": "", + "content": " const g = [0u8; (3, 2)];" + } + } + }, + "span": { + "line_start": 14, + "line_stop": 14, + "col_start": 3, + "col_stop": 26, + "path": "", + "content": " const g = [0u8; (3, 2)];" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"h\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const h = [[0u8; 3]; 2];\\\"}\"}", + "span": { + "line_start": 15, + "line_stop": 15, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const h = [[0u8; 3]; 2];" + } + } + ], + "type_": { + "Array": [ + { + "Array": [ + { + "IntegerType": "U8" + }, + [ + { + "value": "3" + } + ] + ] + }, + [ + { + "value": "2" + } + ] + ] + }, + "value": { + "ArrayInit": { + "element": { + "ArrayInit": { + "element": { + "Value": { + "Integer": [ + "U8", + "0", + { + "line_start": 15, + "line_stop": 15, + "col_start": 15, + "col_stop": 18, + "path": "", + "content": " const h = [[0u8; 3]; 2];" + } + ] + } + }, + "dimensions": [ + { + "value": "3" + } + ], + "span": { + "line_start": 15, + "line_stop": 15, + "col_start": 14, + "col_stop": 22, + "path": "", + "content": " const h = [[0u8; 3]; 2];" + } + } + }, + "dimensions": [ + { + "value": "2" + } + ], + "span": { + "line_start": 15, + "line_stop": 15, + "col_start": 13, + "col_stop": 26, + "path": "", + "content": " const h = [[0u8; 3]; 2];" + } + } + }, + "span": { + "line_start": 15, + "line_stop": 15, + "col_start": 3, + "col_stop": 26, + "path": "", + "content": " const h = [[0u8; 3]; 2];" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const i = [1u8, 1u8, 1u8];\\\"}\"}", + "span": { + "line_start": 16, + "line_stop": 16, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const i = [1u8, 1u8, 1u8];" + } + } + ], + "type_": { + "Array": [ + { + "IntegerType": "U8" + }, + [ + { + "value": "3" + } + ] + ] + }, + "value": { + "ArrayInline": { + "elements": [ + { + "Expression": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 16, + "line_stop": 16, + "col_start": 14, + "col_stop": 17, + "path": "", + "content": " const i = [1u8, 1u8, 1u8];" + } + ] + } + } + }, + { + "Expression": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 16, + "line_stop": 16, + "col_start": 19, + "col_stop": 22, + "path": "", + "content": " const i = [1u8, 1u8, 1u8];" + } + ] + } + } + }, + { + "Expression": { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 16, + "line_stop": 16, + "col_start": 24, + "col_stop": 27, + "path": "", + "content": " const i = [1u8, 1u8, 1u8];" + } + ] + } + } + } + ], + "span": { + "line_start": 16, + "line_stop": 16, + "col_start": 13, + "col_stop": 28, + "path": "", + "content": " const i = [1u8, 1u8, 1u8];" + } + } + }, + "span": { + "line_start": 16, + "line_stop": 16, + "col_start": 3, + "col_stop": 28, + "path": "", + "content": " const i = [1u8, 1u8, 1u8];" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"j\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const j = true;\\\"}\"}", + "span": { + "line_start": 17, + "line_stop": 17, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const j = true;" + } + } + ], + "type_": "Boolean", + "value": { + "Value": { + "Boolean": [ + "true", + { + "line_start": 17, + "line_stop": 17, + "col_start": 13, + "col_stop": 17, + "path": "", + "content": " const j = true;" + } + ] + } + }, + "span": { + "line_start": 17, + "line_stop": 17, + "col_start": 3, + "col_stop": 17, + "path": "", + "content": " const j = true;" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"k\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const k = (1u8, 1u8);\\\"}\"}", + "span": { + "line_start": 18, + "line_stop": 18, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const k = (1u8, 1u8);" + } + } + ], + "type_": { + "Tuple": [ + { + "IntegerType": "U8" + }, + { + "IntegerType": "U8" + } + ] + }, + "value": { + "TupleInit": { + "elements": [ + { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 18, + "line_stop": 18, + "col_start": 14, + "col_stop": 17, + "path": "", + "content": " const k = (1u8, 1u8);" + } + ] + } + }, + { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 18, + "line_stop": 18, + "col_start": 19, + "col_stop": 22, + "path": "", + "content": " const k = (1u8, 1u8);" + } + ] + } + } + ], + "span": { + "line_start": 18, + "line_stop": 18, + "col_start": 13, + "col_stop": 23, + "path": "", + "content": " const k = (1u8, 1u8);" + } + } + }, + "span": { + "line_start": 18, + "line_stop": 18, + "col_start": 3, + "col_stop": 23, + "path": "", + "content": " const k = (1u8, 1u8);" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"l\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const l = (1u8, 1u8, true);\\\"}\"}", + "span": { + "line_start": 19, + "line_stop": 19, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const l = (1u8, 1u8, true);" + } + } + ], + "type_": { + "Tuple": [ + { + "IntegerType": "U8" + }, + { + "IntegerType": "U8" + }, + "Boolean" + ] + }, + "value": { + "TupleInit": { + "elements": [ + { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 19, + "line_stop": 19, + "col_start": 14, + "col_stop": 17, + "path": "", + "content": " const l = (1u8, 1u8, true);" + } + ] + } + }, + { + "Value": { + "Integer": [ + "U8", + "1", + { + "line_start": 19, + "line_stop": 19, + "col_start": 19, + "col_stop": 22, + "path": "", + "content": " const l = (1u8, 1u8, true);" + } + ] + } + }, + { + "Value": { + "Boolean": [ + "true", + { + "line_start": 19, + "line_stop": 19, + "col_start": 24, + "col_stop": 28, + "path": "", + "content": " const l = (1u8, 1u8, true);" + } + ] + } + } + ], + "span": { + "line_start": 19, + "line_stop": 19, + "col_start": 13, + "col_stop": 29, + "path": "", + "content": " const l = (1u8, 1u8, true);" + } + } + }, + "span": { + "line_start": 19, + "line_stop": 19, + "col_start": 3, + "col_stop": 29, + "path": "", + "content": " const l = (1u8, 1u8, true);" + } + } + }, + { + "Definition": { + "declaration_type": "Const", + "variable_names": [ + { + "mutable": false, + "identifier": "{\"name\":\"m\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const m = Foo {};\\\"}\"}", + "span": { + "line_start": 20, + "line_stop": 20, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " const m = Foo {};" + } + } + ], + "type_": { + "Circuit": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Foo {}\\\"}\"}" + }, + "value": { + "CircuitInit": { + "name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const m = Foo {};\\\"}\"}", + "members": [], + "span": { + "line_start": 20, + "line_stop": 20, + "col_start": 13, + "col_stop": 19, + "path": "", + "content": " const m = Foo {};" + } + } + }, + "span": { + "line_start": 20, + "line_stop": 20, + "col_start": 3, + "col_stop": 19, + "path": "", + "content": " const m = Foo {};" + } + } + } + ], + "span": { + "line_start": 7, + "line_stop": 21, + "col_start": 17, + "col_stop": 2, + "path": "", + "content": "function main() {\n...\n}" + } + }, + "span": { + "line_start": 7, + "line_stop": 21, + "col_start": 1, + "col_stop": 2, + "path": "", + "content": "function main() {\n...\n}\n\n\n\n\n\n\n\n\n\n\n\n" + } + } + } + } \ No newline at end of file diff --git a/compiler/tests/type_inference/basic.leo b/compiler/tests/type_inference/basic.leo new file mode 100644 index 0000000000..112d5bb338 --- /dev/null +++ b/compiler/tests/type_inference/basic.leo @@ -0,0 +1,21 @@ +circuit Foo {} + +function two() -> u8 { + return 2u8; +} + +function main() { + const a = 1u8; + const b = 1field; + const c = 1group; + const d = (0, 1)group; + const e = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const f = two(); + const g = [0u8; (3, 2)]; + const h = [[0u8; 3]; 2]; + const i = [1u8, 1u8, 1u8]; + const j = true; + const k = (1u8, 1u8); + const l = (1u8, 1u8, true); + const m = Foo {}; +} \ No newline at end of file diff --git a/compiler/tests/type_inference/for_loop_and_compound.json b/compiler/tests/type_inference/for_loop_and_compound.json new file mode 100644 index 0000000000..f0079573d1 --- /dev/null +++ b/compiler/tests/type_inference/for_loop_and_compound.json @@ -0,0 +1,242 @@ +{ + "name": "", + "expected_input": [], + "imports": [], + "circuits": {}, + "functions": { + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": { + "annotations": [], + "identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() {\\\"}\"}", + "input": [], + "output": { + "Tuple": [] + }, + "block": { + "statements": [ + { + "Definition": { + "declaration_type": "Let", + "variable_names": [ + { + "mutable": true, + "identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x = 10u16;\\\"}\"}", + "span": { + "line_start": 2, + "line_stop": 2, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " let x = 10u16;" + } + } + ], + "type_": { + "IntegerType": "U16" + }, + "value": { + "Value": { + "Integer": [ + "U16", + "10", + { + "line_start": 2, + "line_stop": 2, + "col_start": 13, + "col_stop": 18, + "path": "", + "content": " let x = 10u16;" + } + ] + } + }, + "span": { + "line_start": 2, + "line_stop": 2, + "col_start": 5, + "col_stop": 18, + "path": "", + "content": " let x = 10u16;" + } + } + }, + { + "Iteration": { + "variable": "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for i in 0..3 {\\\"}\"}", + "start": { + "Value": { + "Integer": [ + "U32", + "0", + { + "line_start": 3, + "line_stop": 3, + "col_start": 14, + "col_stop": 15, + "path": "", + "content": " for i in 0..3 {" + } + ] + } + }, + "stop": { + "Value": { + "Integer": [ + "U32", + "3", + { + "line_start": 3, + "line_stop": 3, + "col_start": 17, + "col_stop": 18, + "path": "", + "content": " for i in 0..3 {" + } + ] + } + }, + "block": { + "statements": [ + { + "Assign": { + "operation": "Assign", + "assignee": { + "identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x -= 1;\\\"}\"}", + "accesses": [], + "span": { + "line_start": 4, + "line_stop": 4, + "col_start": 9, + "col_stop": 10, + "path": "", + "content": " x -= 1;" + } + }, + "value": { + "Binary": { + "left": { + "Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x -= 1;\\\"}\"}" + }, + "right": { + "Value": { + "Integer": [ + "U16", + "1", + { + "line_start": 4, + "line_stop": 4, + "col_start": 14, + "col_stop": 15, + "path": "", + "content": " x -= 1;" + } + ] + } + }, + "op": "Sub", + "span": { + "line_start": 4, + "line_stop": 4, + "col_start": 9, + "col_stop": 15, + "path": "", + "content": " x -= 1;" + } + } + }, + "span": { + "line_start": 4, + "line_stop": 4, + "col_start": 9, + "col_stop": 15, + "path": "", + "content": " x -= 1;" + } + } + } + ], + "span": { + "line_start": 3, + "line_stop": 5, + "col_start": 19, + "col_stop": 6, + "path": "", + "content": " for i in 0..3 {\n...\n }" + } + }, + "span": { + "line_start": 3, + "line_stop": 5, + "col_start": 5, + "col_stop": 6, + "path": "", + "content": " for i in 0..3 {\n...\n }" + } + } + }, + { + "Console": { + "function": { + "Assert": { + "Binary": { + "left": { + "Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(x == 7u16);\\\"}\"}" + }, + "right": { + "Value": { + "Integer": [ + "U16", + "7", + { + "line_start": 6, + "line_stop": 6, + "col_start": 25, + "col_stop": 29, + "path": "", + "content": " console.assert(x == 7u16);" + } + ] + } + }, + "op": "Eq", + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 20, + "col_stop": 29, + "path": "", + "content": " console.assert(x == 7u16);" + } + } + } + }, + "span": { + "line_start": 6, + "line_stop": 6, + "col_start": 5, + "col_stop": 29, + "path": "", + "content": " console.assert(x == 7u16);" + } + } + } + ], + "span": { + "line_start": 1, + "line_stop": 7, + "col_start": 17, + "col_stop": 2, + "path": "", + "content": "function main() {\n...\n}" + } + }, + "span": { + "line_start": 1, + "line_stop": 7, + "col_start": 1, + "col_stop": 2, + "path": "", + "content": "function main() {\n...\n}\n\n\n\n" + } + } + } + } \ No newline at end of file diff --git a/tests/pass/parse/statements/iteration_basic.leo b/compiler/tests/type_inference/for_loop_and_compound.leo similarity index 54% rename from tests/pass/parse/statements/iteration_basic.leo rename to compiler/tests/type_inference/for_loop_and_compound.leo index 5d74e69a1f..92c27ff24b 100644 --- a/tests/pass/parse/statements/iteration_basic.leo +++ b/compiler/tests/type_inference/for_loop_and_compound.leo @@ -1,8 +1,7 @@ function main() { - let x = 4u32; + let x = 10u16; for i in 0..3 { x -= 1; } - - console.assert(x == 1u32); + console.assert(x == 7u16); } \ No newline at end of file diff --git a/compiler/tests/type_inference/mod.rs b/compiler/tests/type_inference/mod.rs new file mode 100644 index 0000000000..30f859b099 --- /dev/null +++ b/compiler/tests/type_inference/mod.rs @@ -0,0 +1,85 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use crate::{assert_satisfied, parse_program}; +#[allow(unused)] +use leo_asg::{new_context, Asg, AsgContext}; +use leo_ast::Ast; +use leo_compiler::TypeInferencePhase; +use leo_imports::ImportParser; +use leo_parser::parser; + +thread_local! { + static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = { + let leaked = Box::leak(Box::new(leo_asg::new_alloc_context())); + leo_asg::new_context(leaked) + } +} + +pub fn thread_leaked_context() -> AsgContext<'static> { + THREAD_GLOBAL_CONTEXT.with(|f| *f) +} + +pub fn parse_program_ast(file_string: &str) -> Ast { + const TEST_PROGRAM_PATH: &str = ""; + let test_program_file_path = std::path::PathBuf::from(TEST_PROGRAM_PATH); + + let mut ast = Ast::new( + parser::parse(test_program_file_path.to_str().expect("unwrap fail"), &file_string) + .expect("Failed to parse file."), + ); + ast.canonicalize().expect("Failed to canonicalize program."); + + let program = ast.clone().into_repr(); + let asg = Asg::new(thread_leaked_context(), &program, &mut ImportParser::default()) + .expect("Failed to create ASG from AST"); + + let new_ast = TypeInferencePhase::default() + .phase_ast(&program, &asg.into_repr()) + .expect("Failed to produce type inference ast."); + + new_ast +} + +#[test] +fn test_basic() { + // Check program is valid. + let program_string = include_str!("basic.leo"); + let program = parse_program(program_string).unwrap(); + assert_satisfied(program); + + // Check we get expected ast. + let ast = parse_program_ast(program_string); + let expected_json = include_str!("basic.json"); + let expected_ast: Ast = Ast::from_json_string(expected_json).expect("Unable to parse json."); + + assert_eq!(expected_ast, ast); +} + +#[test] +fn test_for_loop_and_compound() { + // Check program is valid. + let program_string = include_str!("for_loop_and_compound.leo"); + let program = parse_program(program_string).unwrap(); + assert_satisfied(program); + + // Check we get expected ast. + let ast = parse_program_ast(program_string); + let expected_json = include_str!("for_loop_and_compound.json"); + let expected_ast: Ast = Ast::from_json_string(expected_json).expect("Unable to parse json."); + + assert_eq!(expected_ast, ast); +} diff --git a/examples/hello-world/src/main.leo b/examples/hello-world/src/main.leo index f78b77e855..5ce8db73a2 100644 --- a/examples/hello-world/src/main.leo +++ b/examples/hello-world/src/main.leo @@ -1,5 +1,5 @@ // The 'hello-world' main function. function main(a: u32, b: u32) -> u32 { const c: u32 = a + b; - return c + return c; } diff --git a/examples/pedersen-hash/src/main.leo b/examples/pedersen-hash/src/main.leo index 84670cd6c2..030dc0bcb8 100644 --- a/examples/pedersen-hash/src/main.leo +++ b/examples/pedersen-hash/src/main.leo @@ -3,7 +3,7 @@ circuit PedersenHash { // Instantiates a Pedersen hash circuit function new(parameters: [group; 256]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 256]) -> group { @@ -13,13 +13,13 @@ circuit PedersenHash { digest += self.parameters[i]; } } - return digest + return digest; } } // The 'pedersen-hash' main function. function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { const pedersen = PedersenHash::new(parameters); - return pedersen.hash(hash_input) + return pedersen.hash(hash_input); } diff --git a/examples/silly-sudoku/inputs/test_input.in b/examples/silly-sudoku/inputs/test_input.in new file mode 100644 index 0000000000..36f8362978 --- /dev/null +++ b/examples/silly-sudoku/inputs/test_input.in @@ -0,0 +1,14 @@ +// The program input for tmp-test/src/main.leo +[main] +puzzle: [u8; (3, 3)] = [[1, 0, 5], + [0, 2, 0], + [7, 0, 0]]; + +answer: [u8; (3, 3)] = [[1, 4, 5], + [3, 2, 6], + [7, 8, 9]]; + +expected: bool = true; + +[registers] +r: bool = false; diff --git a/examples/silly-sudoku/src/lib.leo b/examples/silly-sudoku/src/lib.leo index 0e5c93568e..c1e4922461 100644 --- a/examples/silly-sudoku/src/lib.leo +++ b/examples/silly-sudoku/src/lib.leo @@ -65,6 +65,6 @@ circuit SillySudoku { } // Returns true if all numbers 1-9 have been seen exactly once. - return result + return result; } } diff --git a/examples/silly-sudoku/src/main.leo b/examples/silly-sudoku/src/main.leo index 087acda62d..856bd8892a 100644 --- a/examples/silly-sudoku/src/main.leo +++ b/examples/silly-sudoku/src/main.leo @@ -16,7 +16,7 @@ function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool { console.log("The answer is {}.", result); - return result + return result; } // Tests that the `silly-sudoku` circuit outputs true on a correct answer. diff --git a/grammar/Cargo.toml b/grammar/Cargo.toml index 1e909e2653..21be08b853 100644 --- a/grammar/Cargo.toml +++ b/grammar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-abnf" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "ABNF to Markdown converter for the Leo programming language" homepage = "https://aleo.org" @@ -18,5 +18,5 @@ license = "GPL-3.0" edition = "2018" [dependencies] -abnf = "0.10.2" +abnf = "0.11.3" anyhow = "1.0" diff --git a/grammar/abnf-grammar.md b/grammar/README.md similarity index 76% rename from grammar/abnf-grammar.md rename to grammar/README.md index 7291db3633..7d5fe66a6c 100644 --- a/grammar/abnf-grammar.md +++ b/grammar/README.md @@ -1,30 +1,18 @@ -Leo Library +Copyright (C) 2019-2021 Aleo Systems Inc. +This file is part of the Leo library. +The Leo library is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +The Leo library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -Copyright (C) 2021 Aleo Systems Inc. - - --------- - - -Format Note ------------ - -The ABNF standard requires grammars to consist of lines terminated by CR LF -(i.e. carriage return followed by line feed, DOS/Windows-style), -as explained in the background on ABNF later in this file. -This file's lines are therefore terminated by CR LF. -To avoid losing this requirement across systems, -this file is marked as 'text eol=crlf' in .gitattributes: -this means that the file is textual, enabling visual diffs, -but its lines will always be terminated by CR LF on any system. - -Note that this CR LF requirement only applies to the grammar files themselves. -It does not apply to the lines of the languages described by the grammar. -ABNF grammars may describe any kind of languages, -with any kind of line terminators, -or even without line terminators at all (e.g. for "binary" languages). +You should have received a copy of the GNU General Public License +along with the Leo library. If not, see . -------- @@ -69,59 +57,59 @@ without going beyond context-free grammars. Instead of BNF's angle-bracket notation for nonterminals, ABNF uses case-insensitive names consisting of letters, digits, and dashes, -e.g. HTTP-message and IPv6address. +e.g. `HTTP-message` and `IPv6address`. ABNF includes an angle-bracket notation for prose descriptions, -e.g. , +e.g. ``, usable as last resort in the definiens of a nonterminal. While BNF allows arbitrary terminals, ABNF uses only natural numbers as terminals, and denotes them via: (i) binary, decimal, or hexadecimal sequences, -e.g. %b1.11.1010, %d1.3.10, and %x.1.3.A -all denote the sequence of terminals '1 3 10'; +e.g. `%b1.11.1010`, `%d1.3.10`, and `%x.1.3.A` +all denote the sequence of terminals [1, 3, 10]; (ii) binary, decimal, or hexadecimal ranges, -e.g. %x30-39 denotes any singleton sequence of terminals -'n' with 48 <= n <= 57 (an ASCII digit); +e.g. `%x30-39` denotes any singleton sequence of terminals +[_n_] with 48 <= _n_ <= 57 (an ASCII digit); (iii) case-sensitive ASCII strings, -e.g. %s"Ab" denotes the sequence of terminals '65 98'; +e.g. `%s"Ab"` denotes the sequence of terminals [65, 98]; and (iv) case-insensitive ASCII strings, -e.g. %i"ab", or just "ab", denotes +e.g. `%i"ab"`, or just `"ab"`, denotes any sequence of terminals among -'65 66', -'65 98', -'97 66', and -'97 98'. +[65, 66], +[65, 98], +[97, 66], and +[97, 98]. ABNF terminals in suitable sets represent ASCII or Unicode characters. -ABNF allows repetition prefixes n*m, -where n and m are natural numbers in decimal notation; +ABNF allows repetition prefixes `n*m`, +where `n` and `m` are natural numbers in decimal notation; if absent, -n defaults to 0, and -m defaults to infinity. +`n` defaults to 0, and +`m` defaults to infinity. For example, -1*4HEXDIG denotes one to four HEXDIGs, -*3DIGIT denotes up to three DIGITs, and -1*OCTET denotes one or more OCTETs. -A single n prefix -abbreviates n*n, -e.g. 3DIGIT denotes three DIGITs. +`1*4HEXDIG` denotes one to four `HEXDIG`s, +`*3DIGIT` denotes up to three `DIGIT`s, and +`1*OCTET` denotes one or more `OCTET`s. +A single `n` prefix +abbreviates `n*n`, +e.g. `3DIGIT` denotes three `DIGIT`s. -Instead of BNF's |, ABNF uses / to separate alternatives. +Instead of BNF's `|`, ABNF uses `/` to separate alternatives. Repetition prefixes have precedence over juxtapositions, -which have precedence over /. +which have precedence over `/`. Round brackets group things and override the aforementioned precedence rules, -e.g. *(WSP / CRLF WSP) denotes sequences of terminals +e.g. `*(WSP / CRLF WSP)` denotes sequences of terminals obtained by repeating, zero or more times, -either (i) a WSP or (ii) a CRLF followed by a WSP. +either (i) a `WSP` or (ii) a `CRLF` followed by a `WSP`. Square brackets also group things but make them optional, -e.g. [":" port] is equivalent to 0*1(":" port). +e.g. `[":" port]` is equivalent to `0*1(":" port)`. -Instead of BNF's ::=, ABNF uses = to define nonterminals, -and =/ to incrementally add alternatives +Instead of BNF's `::=`, ABNF uses `=` to define nonterminals, +and `=/` to incrementally add alternatives to previously defined nonterminals. -For example, the rule BIT = "0" / "1" -is equivalent to BIT = "0" followed by BIT =/ "1". +For example, the rule `BIT = "0" / "1"` +is equivalent to `BIT = "0"` followed by `BIT =/ "1"`. The syntax of ABNF itself is formally specified in ABNF (in Section 4 of the aforementioned RFC 5234, @@ -143,7 +131,7 @@ Structure This ABNF grammar consists of two (sub-)grammars: (i) a lexical grammar that describes how sequence of characters are parsed into tokens, and -(ii) a syntactic grammar that described how +(ii) a syntactic grammar that describes how tokens are parsed into expressions, statements, etc. The adjectives 'lexical' and 'syntactic' are the same ones used in the Java language reference, @@ -210,8 +198,8 @@ additive-expression = These rules tell us -that the additive operators '+' and '-' have lower precedence -than the multiplicative operators '*' and '/', +that the additive operators `+` and `-` have lower precedence +than the multiplicative operators `*` and `/`, and that both the additive and multiplicative operators associate to the left. This may be best understood via the examples given below. @@ -307,7 +295,7 @@ Naming Convention This ABNF grammar uses nonterminal names that consist of complete English words, separated by dashes, and that describe the construct the way it is in English. -For instance, we use the name 'conditional-statement' +For instance, we use the name `conditional-statement` to describe conditional statements. At the same time, this grammar establishes @@ -366,8 +354,8 @@ Lexical Grammar A Leo file is a finite sequence of Unicode characters, represented as Unicode code points, -which are numbers in the range form 0 to 10FFFFh. -These are captured by the ABNF rule 'character' below. +which are numbers in the range from 0 to 10FFFFh. +These are captured by the ABNF rule `character` below. The lexical grammar defines how, at least conceptually, the sequence of characters is turned into @@ -375,20 +363,20 @@ a sequence of tokens, comments, and whitespaces: these entities are all defined by the grammar rules below. As stated, the lexical grammar alone is ambiguous. -For example, the sequence of characters '**' (i.e. two stars) -could be equally parsed as two '*' symbol tokens or one '**' symbol token -(see rule for 'symbol' below). -As another example, the sequence or characters '' +For example, the sequence of characters `**` (i.e. two stars) +could be equally parsed as two `*` symbol tokens or one `**` symbol token +(see rule for `symbol` below). +As another example, the sequence or characters `` (i.e. carriage return followed by line feed) could be equally parsed as two line terminators or one -(see rule for 'newline'). +(see rule for `newline`). Thus, as often done in language syntax definitions, the lexical grammar is disambiguated by the extra-grammatical requirement that the longest possible sequence of characters is always parsed. -This way, '**' must be parsed as one '**' symbol token, -and '' must be parsed as one line terminator. +This way, `**` must be parsed as one `**` symbol token, +and `` must be parsed as one line terminator. As mentioned above, a character is any Unicode code point. This grammar does not say how those are encoded in files (e.g. UTF-8): @@ -405,27 +393,27 @@ We give names to certain ASCII characters. ```abnf -horizontal-tab = %x9 +horizontal-tab = %x9 ; ``` ```abnf -line-feed = %xA +line-feed = %xA ; ``` ```abnf -carriage-return = %xD +carriage-return = %xD ; ``` ```abnf -space = %x20 +space = %x20 ; ``` ```abnf -double-quote = %x22 +double-quote = %x22 ; " ``` We give names to complements of certain ASCII characters. @@ -444,12 +432,25 @@ not-star = %x0-29 / %x2B-10FFFF ; anything but * ```abnf not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF - ; anything but LF or CR + ; anything but or +``` + + +```abnf +not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF + ; anything but " or { +``` + + +```abnf +not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF + ; anything but " or } ``` ```abnf -not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF ; anything but * or / +not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF + ; anything but * or / ``` Lines in Leo may be terminated via @@ -465,7 +466,7 @@ described above. newline = line-feed / carriage-return / carriage-return line-feed ``` -Go to: _[carriage-return](#user-content-carriage-return), [line-feed](#user-content-line-feed)_; +Go to: _[line-feed](#user-content-line-feed), [carriage-return](#user-content-carriage-return)_; Line terminators form whitespace, along with spaces and horizontal tabs. @@ -475,16 +476,16 @@ Line terminators form whitespace, along with spaces and horizontal tabs. whitespace = space / horizontal-tab / newline ``` -Go to: _[space](#user-content-space), [horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline)_; +Go to: _[horizontal-tab](#user-content-horizontal-tab), [space](#user-content-space), [newline](#user-content-newline)_; There are two kinds of comments in Leo, as in other languages. -One is block comments of the form '/* ... */', -and the other is end-of-line comments of the form '// ...'. -The first kind start at '/*' and end at the first '*/', +One is block comments of the form `/* ... */`, +and the other is end-of-line comments of the form `// ...`. +The first kind start at `/*` and end at the first `*/`, possibly spanning multiple (partial) lines; these do no nest. -The second kind start at '//' and extend till the end of the line. +The second kind start at `//` and extend till the end of the line. The rules about comments given below are similar to the ones used in the Java language reference. @@ -510,7 +511,7 @@ rest-of-block-comment = "*" rest-of-block-comment-after-star / not-star rest-of-block-comment ``` -Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_; +Go to: _[not-star](#user-content-not-star), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_; @@ -520,7 +521,7 @@ rest-of-block-comment-after-star = "/" / not-star-or-slash rest-of-block-comment ``` -Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment), [not-star-or-slash](#user-content-not-star-or-slash)_; +Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star)_; @@ -595,7 +596,7 @@ lowercase-letter = %x61-7A ; a-z letter = uppercase-letter / lowercase-letter ``` -Go to: _[lowercase-letter](#user-content-lowercase-letter), [uppercase-letter](#user-content-uppercase-letter)_; +Go to: _[uppercase-letter](#user-content-uppercase-letter), [lowercase-letter](#user-content-lowercase-letter)_; An identifier is a non-empty sequence of letters, digits, and underscores, @@ -619,79 +620,37 @@ package-name = 1*( lowercase-letter / digit ) *( "-" 1*( lowercase-letter / digit ) ) ``` -An address starts with 'aleo1' -and continues with exactly 58 lowercase letters and digits. -Thus an address always consists of 63 characters. - - -```abnf -address = %s"aleo1" 58( lowercase-letter / digit ) -``` - -A formatted string is a sequence of characters, other than double quote, +A format string is a sequence of characters, other than double quote, surrounded by double quotes. -Within a formatted string, sub-strings '{}' are distinguished as containers +Within a format string, sub-strings `{}` are distinguished as containers (these are the ones that may be matched with values whose textual representation replaces the containers in the printed string). -There is an implicit extra-grammatical requirements that -the explicit 'formatted-string-container' instances include -all the occurrences of '{}' in the parsed character sequence: -that is, there may not be two contiguous 'not-double-quote' instances -that are '{' and '}'. - + ```abnf -formatted-string-container = "{}" +format-string-container = "{}" ``` - + ```abnf -formatted-string = double-quote - *( not-double-quote / formatted-string-container ) - double-quote +format-string-element = not-double-quote-or-open-brace + / "{" not-double-quote-or-close-brace + / format-string-container +``` + +Go to: _[not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace), [format-string-container](#user-content-format-string-container), [not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace)_; + + + +```abnf +format-string = double-quote *format-string-element double-quote ``` Go to: _[double-quote](#user-content-double-quote)_; -Here is (part of this ABNF comment), -an alternative way to specify formatted strings, -which captures the extra-grammatical requirement above in the grammar, -but is more complicated: - - - -``` -not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF -``` - - - -``` -not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF -``` - - - -``` -formatted-string-element = not-double-quote-or-open-brace - / "{" not-double-quote-or-close-brace - / formatted-string-container -``` - - - -``` -formatted-string = double-quote *formatted-string-element double-quote -``` - - - -It is not immediately clear which approach is better; there are tradeoffs. -We may choose to adopt this one in future revisions of the grammar. - -Annotations have names, which are identifiers immediately preceded by '@'. +Annotations have names, which are identifiers immediately preceded by `@`. ```abnf @@ -702,7 +661,7 @@ Go to: _[identifier](#user-content-identifier)_; A natural (number) is a sequence of one or more digits. -We allow leading zeros, e.g. '007'. +We allow leading zeros, e.g. `007`. ```abnf @@ -710,7 +669,7 @@ natural = 1*digit ``` An integer (number) is either a natural or its negation. -We allow leading zeros also in negative numbers, e.g. '-007'. +We allow leading zeros also in negative numbers, e.g. `-007`. ```abnf @@ -781,17 +740,15 @@ Boolean literals are the usual two. boolean-literal = %s"true" / %s"false" ``` -An address literal is an address wrapped into an indication of address, -to differentiate it from an identifier. +An address literal starts with `aleo1` +and continues with exactly 58 lowercase letters and digits. +Thus an address always consists of 63 characters. ```abnf -address-literal = %s"address" "(" address ")" +address-literal = %s"aleo1" 58( lowercase-letter / digit ) ``` -Go to: _[address](#user-content-address)_; - - The ones above are all the atomic literals (in the sense that they are tokens, without whitespace allowed in them), as defined by the following rule. @@ -807,16 +764,16 @@ atomic-literal = untyped-literal / address-literal ``` -Go to: _[signed-literal](#user-content-signed-literal), [field-literal](#user-content-field-literal), [boolean-literal](#user-content-boolean-literal), [untyped-literal](#user-content-untyped-literal), [unsigned-literal](#user-content-unsigned-literal), [product-group-literal](#user-content-product-group-literal), [address-literal](#user-content-address-literal)_; +Go to: _[signed-literal](#user-content-signed-literal), [field-literal](#user-content-field-literal), [product-group-literal](#user-content-product-group-literal), [unsigned-literal](#user-content-unsigned-literal), [untyped-literal](#user-content-untyped-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal)_; After defining the (mostly) alphanumeric tokens above, -it remains to define tokens for non-alphanumeric symbols such as "+" and "(". +it remains to define tokens for non-alphanumeric symbols such as `+` and `(`. Different programming languages used different terminologies for these, e.g. operators, separators, punctuators, etc. -Here we use 'symbol', for all of them. +Here we use `symbol`, for all of them. We also include a token consisting of -a closing parenthesis immediately followed by 'group': +a closing parenthesis `)` immediately followed by `group`: as defined in the syntactic grammar, this is the final part of an affine group literal; even though it includes letters, @@ -834,7 +791,7 @@ equality-operator = "==" -and defining 'symbol' in terms of those +and defining `symbol` in terms of those @@ -849,7 +806,7 @@ but it would help establish a terminology in the grammar, namely the exact names of some of these token. On the other hand, at least some of them are perhaps simple enough that they could be just described in terms of their symbols, -e.g. 'double dot', 'question mark', etc. +e.g. double dot, question mark, etc. ```abnf @@ -875,12 +832,12 @@ token = keyword / identifier / atomic-literal / package-name - / formatted-string + / format-string / annotation-name / symbol ``` -Go to: _[atomic-literal](#user-content-atomic-literal), [package-name](#user-content-package-name), [formatted-string](#user-content-formatted-string), [annotation-name](#user-content-annotation-name), [symbol](#user-content-symbol), [identifier](#user-content-identifier), [keyword](#user-content-keyword)_; +Go to: _[package-name](#user-content-package-name), [format-string](#user-content-format-string), [symbol](#user-content-symbol), [identifier](#user-content-identifier), [atomic-literal](#user-content-atomic-literal), [annotation-name](#user-content-annotation-name), [keyword](#user-content-keyword)_; @@ -937,7 +894,7 @@ group-type = %s"group" arithmetic-type = integer-type / field-type / group-type ``` -Go to: _[integer-type](#user-content-integer-type), [field-type](#user-content-field-type), [group-type](#user-content-group-type)_; +Go to: _[group-type](#user-content-group-type), [field-type](#user-content-field-type), [integer-type](#user-content-integer-type)_; The arithmetic types, along with the boolean and address types, @@ -958,10 +915,10 @@ address-type = %s"address" scalar-type = boolean-type / arithmetic-type / address-type ``` -Go to: _[boolean-type](#user-content-boolean-type), [address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type)_; +Go to: _[address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type), [boolean-type](#user-content-boolean-type)_; -Circuit types are denoted by identifiers and the keyword 'Self'. +Circuit types are denoted by identifiers and the keyword `Self`. The latter is only allowed inside a circuit definition, to denote the circuit being defined. @@ -975,7 +932,7 @@ self-type = %s"Self" circuit-type = identifier / self-type ``` -Go to: _[identifier](#user-content-identifier), [self-type](#user-content-self-type)_; +Go to: _[self-type](#user-content-self-type), [identifier](#user-content-identifier)_; A tuple type consists of zero, two, or more component types. @@ -998,7 +955,7 @@ or a tuple of one or more dimensions. array-type = "[" type ";" array-dimensions "]" ``` -Go to: _[type](#user-content-type), [array-dimensions](#user-content-array-dimensions)_; +Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content-type)_; @@ -1019,7 +976,7 @@ i.e. types whose values contain (sub-)values aggregate-type = tuple-type / array-type / circuit-type ``` -Go to: _[array-type](#user-content-array-type), [tuple-type](#user-content-tuple-type), [circuit-type](#user-content-circuit-type)_; +Go to: _[array-type](#user-content-array-type), [circuit-type](#user-content-circuit-type), [tuple-type](#user-content-tuple-type)_; Scalar and aggregate types form all the types. @@ -1029,7 +986,7 @@ Scalar and aggregate types form all the types. type = scalar-type / aggregate-type ``` -Go to: _[scalar-type](#user-content-scalar-type), [aggregate-type](#user-content-aggregate-type)_; +Go to: _[aggregate-type](#user-content-aggregate-type), [scalar-type](#user-content-scalar-type)_; The lexical grammar given earlier defines product group literals. @@ -1069,7 +1026,7 @@ Go to: _[atomic-literal](#user-content-atomic-literal), [affine-group-literal](# The following rule is not directly referenced in the rules for expressions -(which reference 'literal' instead), +(which reference `literal` instead), but it is useful to establish terminology: a group literal is either a product group literal or an affine group literal. @@ -1107,7 +1064,7 @@ primary-expression = identifier / circuit-expression ``` -Go to: _[identifier](#user-content-identifier), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression), [literal](#user-content-literal), [tuple-expression](#user-content-tuple-expression), [expression](#user-content-expression)_; +Go to: _[array-expression](#user-content-array-expression), [identifier](#user-content-identifier), [expression](#user-content-expression), [literal](#user-content-literal), [tuple-expression](#user-content-tuple-expression), [circuit-expression](#user-content-circuit-expression)_; Tuple expressions construct tuples. @@ -1132,7 +1089,7 @@ Go to: _[tuple-construction](#user-content-tuple-construction)_; Array expressions construct arrays. There are two kinds: one lists the element expressions (at least one), -including spreads (via '...') which are arrays being spliced in; +including spreads (via `...`) which are arrays being spliced in; the other repeats (the value of) a single expression across one or more dimensions. @@ -1168,7 +1125,7 @@ Go to: _[expression](#user-content-expression), [array-dimensions](#user-content array-construction = array-inline-construction / array-repeat-construction ``` -Go to: _[array-inline-construction](#user-content-array-inline-construction), [array-repeat-construction](#user-content-array-repeat-construction)_; +Go to: _[array-repeat-construction](#user-content-array-repeat-construction), [array-inline-construction](#user-content-array-inline-construction)_; @@ -1191,11 +1148,12 @@ so they are syntactically identical but semantically different. ```abnf circuit-construction = circuit-type "{" - circuit-inline-element *( "," circuit-inline-element ) + circuit-inline-element + *( "," circuit-inline-element ) [ "," ] "}" ``` -Go to: _[circuit-inline-element](#user-content-circuit-inline-element), [circuit-type](#user-content-circuit-type)_; +Go to: _[circuit-type](#user-content-circuit-type), [circuit-inline-element](#user-content-circuit-inline-element)_; @@ -1203,7 +1161,7 @@ Go to: _[circuit-inline-element](#user-content-circuit-inline-element), [circuit circuit-inline-element = identifier ":" expression / identifier ``` -Go to: _[expression](#user-content-expression), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression)_; @@ -1254,7 +1212,7 @@ postfix-expression = primary-expression / postfix-expression "[" [expression] ".." [expression] "]" ``` -Go to: _[natural](#user-content-natural), [identifier](#user-content-identifier), [circuit-type](#user-content-circuit-type), [postfix-expression](#user-content-postfix-expression), [primary-expression](#user-content-primary-expression), [function-arguments](#user-content-function-arguments), [expression](#user-content-expression)_; +Go to: _[identifier](#user-content-identifier), [function-arguments](#user-content-function-arguments), [natural](#user-content-natural), [circuit-type](#user-content-circuit-type), [primary-expression](#user-content-primary-expression), [postfix-expression](#user-content-postfix-expression), [expression](#user-content-expression)_; Unary operators have the highest operator precedence. @@ -1268,32 +1226,21 @@ unary-expression = postfix-expression / "-" unary-expression ``` -Go to: _[unary-expression](#user-content-unary-expression), [postfix-expression](#user-content-postfix-expression)_; - - -Next in the operator precedence is casting. - - -```abnf -cast-expression = unary-expression - / cast-expression %s"as" type -``` - -Go to: _[unary-expression](#user-content-unary-expression), [type](#user-content-type), [cast-expression](#user-content-cast-expression)_; +Go to: _[postfix-expression](#user-content-postfix-expression), [unary-expression](#user-content-unary-expression)_; Next in the operator precedence is exponentiation, following mathematical practice. -The current rule below makes exponentiation left-associative, -i.e. 'a ** b ** c' must be parsed as '(a ** b) ** c'. +The current rule below makes exponentiation right-associative, +i.e. `a ** b ** c` must be parsed as `a ** (b ** c)`. ```abnf -exponential-expression = cast-expression - / exponential-expression "**" cast-expression +exponential-expression = unary-expression + / unary-expression "**" exponential-expression ``` -Go to: _[cast-expression](#user-content-cast-expression), [exponential-expression](#user-content-exponential-expression)_; +Go to: _[unary-expression](#user-content-unary-expression), [exponential-expression](#user-content-exponential-expression)_; Next in precedence come multiplication and division, both left-associative. @@ -1317,7 +1264,7 @@ additive-expression = multiplicative-expression / additive-expression "-" multiplicative-expression ``` -Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [additive-expression](#user-content-additive-expression)_; +Go to: _[additive-expression](#user-content-additive-expression), [multiplicative-expression](#user-content-multiplicative-expression)_; Next in the precedence order are ordering relations. @@ -1356,7 +1303,7 @@ conjunctive-expression = equality-expression / conjunctive-expression "&&" equality-expression ``` -Go to: _[equality-expression](#user-content-equality-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; +Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [equality-expression](#user-content-equality-expression)_; Next come disjunctive expressions, left-associative. @@ -1367,7 +1314,7 @@ disjunctive-expression = conjunctive-expression / disjunctive-expression "||" conjunctive-expression ``` -Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; +Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_; Finally we have conditional expressions. @@ -1412,7 +1359,7 @@ statement = expression-statement / block ``` -Go to: _[variable-definition-statement](#user-content-variable-definition-statement), [return-statement](#user-content-return-statement), [loop-statement](#user-content-loop-statement), [block](#user-content-block), [console-statement](#user-content-console-statement), [conditional-statement](#user-content-conditional-statement), [expression-statement](#user-content-expression-statement), [assignment-statement](#user-content-assignment-statement)_; +Go to: _[return-statement](#user-content-return-statement), [loop-statement](#user-content-loop-statement), [assignment-statement](#user-content-assignment-statement), [expression-statement](#user-content-expression-statement), [console-statement](#user-content-console-statement), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [variable-definition-statement](#user-content-variable-definition-statement)_; @@ -1431,12 +1378,11 @@ expression-statement = expression ";" Go to: _[expression](#user-content-expression)_; -A return statement always takes an expression, -and does not end with a semicolon. +A return statement always takes an expression, and ends with a semicolon. ```abnf -return-statement = %s"return" expression +return-statement = %s"return" expression ";" ``` Go to: _[expression](#user-content-expression)_; @@ -1455,7 +1401,7 @@ variable-definition-statement = ( %s"let" / %s"const" ) [ ":" type ] "=" expression ";" ``` -Go to: _[type](#user-content-type), [expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers)_; +Go to: _[type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression)_; @@ -1478,7 +1424,7 @@ Note that blocks are required in all branches, not merely statements. branch = %s"if" expression block ``` -Go to: _[block](#user-content-block), [expression](#user-content-expression)_; +Go to: _[expression](#user-content-expression), [block](#user-content-block)_; @@ -1488,7 +1434,7 @@ conditional-statement = branch / branch %s"else" conditional-statement ``` -Go to: _[conditional-statement](#user-content-conditional-statement), [block](#user-content-block), [branch](#user-content-branch)_; +Go to: _[block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [branch](#user-content-branch)_; A loop statement implicitly defines a loop variable @@ -1500,11 +1446,11 @@ The body is a block. loop-statement = %s"for" identifier %s"in" expression ".." expression block ``` -Go to: _[expression](#user-content-expression), [block](#user-content-block), [identifier](#user-content-identifier)_; +Go to: _[block](#user-content-block), [expression](#user-content-expression), [identifier](#user-content-identifier)_; An assignment statement is straightforward. -Based on the operator, the assignment may be simple (i.e. '=') +Based on the operator, the assignment may be simple (i.e. `=`) or compound (i.e. combining assignment with an arithmetic operation). @@ -1520,13 +1466,13 @@ assignment-statement = expression assignment-operator expression ";" Go to: _[expression](#user-content-expression), [assignment-operator](#user-content-assignment-operator)_; -Console statements start with the 'console' keyword, +Console statements start with the `console` keyword, followed by a console function call. The call may be an assertion or a print command. The former takes an expression (which must be boolean) as argument. The latter takes either no argument, -or a formatted string followed by expressions, -whose number must match the number of containers '{}' in the formatted string. +or a format string followed by expressions, +whose number must match the number of containers `{}` in the format string. Note that the console function names are identifiers, not keywords. There are three kinds of print commands. @@ -1544,7 +1490,7 @@ console-call = assert-call / print-call ``` -Go to: _[print-call](#user-content-print-call), [assert-call](#user-content-assert-call)_; +Go to: _[assert-call](#user-content-assert-call), [print-call](#user-content-print-call)_; @@ -1562,10 +1508,10 @@ print-function = %s"debug" / %s"error" / %s"log" ```abnf -print-arguments = "(" [ formatted-string *( "," expression ) ] ")" +print-arguments = "(" [ format-string *( "," expression ) ] ")" ``` -Go to: _[formatted-string](#user-content-formatted-string)_; +Go to: _[format-string](#user-content-format-string)_; @@ -1576,7 +1522,7 @@ print-call = print-function print-arguments Go to: _[print-arguments](#user-content-print-arguments), [print-function](#user-content-print-function)_; -An annotation consists of an annotation name (which starts with '@') +An annotation consists of an annotation name (which starts with `@`) with optional annotation arguments, which are identifiers. Note that no parentheses are used if there are no arguments. @@ -1586,7 +1532,7 @@ annotation = annotation-name [ "(" identifier *( "," identifier ) ")" ] ``` -Go to: _[annotation-name](#user-content-annotation-name), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [annotation-name](#user-content-annotation-name)_; A function declaration defines a function. @@ -1594,8 +1540,7 @@ The output type is optional, defaulting to the empty tuple type. In general, a function input consists of an identifier and a type, with an optional 'const' modifier. Additionally, functions inside circuits -may start with a 'mut self' or 'const self' or 'self' parameter. -Furthermore, any function may end with an 'input' parameter. +may start with a `mut self` or `const self` or `self` parameter. ```abnf @@ -1604,18 +1549,17 @@ function-declaration = *annotation %s"function" identifier block ``` -Go to: _[type](#user-content-type), [function-parameters](#user-content-function-parameters), [block](#user-content-block), [identifier](#user-content-identifier)_; +Go to: _[type](#user-content-type), [block](#user-content-block), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters)_; ```abnf -function-parameters = self-parameter [ "," input-parameter ] - / self-parameter "," function-inputs [ "," input-parameter ] - / function-inputs [ "," input-parameter ] - / input-parameter +function-parameters = self-parameter + / self-parameter "," function-inputs + / function-inputs ``` -Go to: _[self-parameter](#user-content-self-parameter), [function-inputs](#user-content-function-inputs), [input-parameter](#user-content-input-parameter)_; +Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_; @@ -1636,14 +1580,9 @@ Go to: _[function-input](#user-content-function-input)_; function-input = [ %s"const" ] identifier ":" type ``` -Go to: _[type](#user-content-type), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; - -```abnf -input-parameter = %s"input" -``` - A circuit member variable declaration consists of an identifier and a type. A circuit member function declaration consists of a function declaration. @@ -1661,7 +1600,7 @@ Go to: _[member-variable-declaration](#user-content-member-variable-declaration) member-variable-declaration = identifier ":" type ``` -Go to: _[type](#user-content-type), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; @@ -1684,7 +1623,7 @@ circuit-declaration = *annotation %s"circuit" identifier Go to: _[identifier](#user-content-identifier), [member-declaration](#user-content-member-declaration)_; -An import declaration consists of the 'import' keyword +An import declaration consists of the `import` keyword followed by a package path, which may be one of the following: a single wildcard; an identifier, optionally followed by a local renamer; @@ -1710,7 +1649,7 @@ package-path = "*" / "(" package-path *( "," package-path ) [","] ")" ``` -Go to: _[package-path](#user-content-package-path), [identifier](#user-content-identifier), [package-name](#user-content-package-name)_; +Go to: _[package-name](#user-content-package-name), [package-path](#user-content-package-path), [identifier](#user-content-identifier)_; Finally, we define a file as a sequence of zero or more declarations. @@ -1722,10 +1661,35 @@ declaration = import-declaration / circuit-declaration ``` -Go to: _[import-declaration](#user-content-import-declaration), [circuit-declaration](#user-content-circuit-declaration), [function-declaration](#user-content-function-declaration)_; +Go to: _[function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration), [import-declaration](#user-content-import-declaration)_; ```abnf file = *declaration +``` + + +-------- + + +Format Note +----------- + +The ABNF standard requires grammars +to consist of lines terminated by `` +(i.e. carriage return followed by line feed, DOS/Windows-style), +as explained in the background on ABNF earlier in this file. +This file's lines are therefore terminated by ``. +To avoid losing this requirement across systems, +this file is marked as `text eol=crlf` in `.gitattributes`: +this means that the file is textual, enabling visual diffs, +but its lines will always be terminated by `` on any system. + +Note that this `` requirement only applies +to the grammar files themselves. +It does not apply to the lines of the languages described by the grammar. +ABNF grammars may describe any kind of languages, +with any kind of line terminators, +or even without line terminators at all (e.g. for "binary" languages). diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index cb6635d8a1..48057feb18 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -1,26 +1,18 @@ -; Leo Library -; -; Copyright (C) 2021 Aleo Systems Inc. +; Copyright (C) 2019-2021 Aleo Systems Inc. +; This file is part of the Leo library. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; The Leo library is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. -; Format Note -; ----------- +; The Leo library is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. -; The ABNF standard requires grammars to consist of lines terminated by CR LF -; (i.e. carriage return followed by line feed, DOS/Windows-style), -; as explained in the background on ABNF later in this file. -; This file's lines are therefore terminated by CR LF. -; To avoid losing this requirement across systems, -; this file is marked as 'text eol=crlf' in .gitattributes: -; this means that the file is textual, enabling visual diffs, -; but its lines will always be terminated by CR LF on any system. - -; Note that this CR LF requirement only applies to the grammar files themselves. -; It does not apply to the lines of the languages described by the grammar. -; ABNF grammars may describe any kind of languages, -; with any kind of line terminators, -; or even without line terminators at all (e.g. for "binary" languages). +; You should have received a copy of the GNU General Public License +; along with the Leo library. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -61,59 +53,59 @@ ; Instead of BNF's angle-bracket notation for nonterminals, ; ABNF uses case-insensitive names consisting of letters, digits, and dashes, -; e.g. HTTP-message and IPv6address. +; e.g. `HTTP-message` and `IPv6address`. ; ABNF includes an angle-bracket notation for prose descriptions, -; e.g. , +; e.g. ``, ; usable as last resort in the definiens of a nonterminal. ; While BNF allows arbitrary terminals, ; ABNF uses only natural numbers as terminals, ; and denotes them via: ; (i) binary, decimal, or hexadecimal sequences, -; e.g. %b1.11.1010, %d1.3.10, and %x.1.3.A -; all denote the sequence of terminals '1 3 10'; +; e.g. `%b1.11.1010`, `%d1.3.10`, and `%x.1.3.A` +; all denote the sequence of terminals [1, 3, 10]; ; (ii) binary, decimal, or hexadecimal ranges, -; e.g. %x30-39 denotes any singleton sequence of terminals -; 'n' with 48 <= n <= 57 (an ASCII digit); +; e.g. `%x30-39` denotes any singleton sequence of terminals +; [_n_] with 48 <= _n_ <= 57 (an ASCII digit); ; (iii) case-sensitive ASCII strings, -; e.g. %s"Ab" denotes the sequence of terminals '65 98'; +; e.g. `%s"Ab"` denotes the sequence of terminals [65, 98]; ; and (iv) case-insensitive ASCII strings, -; e.g. %i"ab", or just "ab", denotes +; e.g. `%i"ab"`, or just `"ab"`, denotes ; any sequence of terminals among -; '65 66', -; '65 98', -; '97 66', and -; '97 98'. +; [65, 66], +; [65, 98], +; [97, 66], and +; [97, 98]. ; ABNF terminals in suitable sets represent ASCII or Unicode characters. -; ABNF allows repetition prefixes n*m, -; where n and m are natural numbers in decimal notation; +; ABNF allows repetition prefixes `n*m`, +; where `n` and `m` are natural numbers in decimal notation; ; if absent, -; n defaults to 0, and -; m defaults to infinity. +; `n` defaults to 0, and +; `m` defaults to infinity. ; For example, -; 1*4HEXDIG denotes one to four HEXDIGs, -; *3DIGIT denotes up to three DIGITs, and -; 1*OCTET denotes one or more OCTETs. -; A single n prefix -; abbreviates n*n, -; e.g. 3DIGIT denotes three DIGITs. +; `1*4HEXDIG` denotes one to four `HEXDIG`s, +; `*3DIGIT` denotes up to three `DIGIT`s, and +; `1*OCTET` denotes one or more `OCTET`s. +; A single `n` prefix +; abbreviates `n*n`, +; e.g. `3DIGIT` denotes three `DIGIT`s. -; Instead of BNF's |, ABNF uses / to separate alternatives. +; Instead of BNF's `|`, ABNF uses `/` to separate alternatives. ; Repetition prefixes have precedence over juxtapositions, -; which have precedence over /. +; which have precedence over `/`. ; Round brackets group things and override the aforementioned precedence rules, -; e.g. *(WSP / CRLF WSP) denotes sequences of terminals +; e.g. `*(WSP / CRLF WSP)` denotes sequences of terminals ; obtained by repeating, zero or more times, -; either (i) a WSP or (ii) a CRLF followed by a WSP. +; either (i) a `WSP` or (ii) a `CRLF` followed by a `WSP`. ; Square brackets also group things but make them optional, -; e.g. [":" port] is equivalent to 0*1(":" port). +; e.g. `[":" port]` is equivalent to `0*1(":" port)`. -; Instead of BNF's ::=, ABNF uses = to define nonterminals, -; and =/ to incrementally add alternatives +; Instead of BNF's `::=`, ABNF uses `=` to define nonterminals, +; and `=/` to incrementally add alternatives ; to previously defined nonterminals. -; For example, the rule BIT = "0" / "1" -; is equivalent to BIT = "0" followed by BIT =/ "1". +; For example, the rule `BIT = "0" / "1"` +; is equivalent to `BIT = "0"` followed by `BIT =/ "1"`. ; The syntax of ABNF itself is formally specified in ABNF ; (in Section 4 of the aforementioned RFC 5234, @@ -133,7 +125,7 @@ ; This ABNF grammar consists of two (sub-)grammars: ; (i) a lexical grammar that describes how ; sequence of characters are parsed into tokens, and -; (ii) a syntactic grammar that described how +; (ii) a syntactic grammar that describes how ; tokens are parsed into expressions, statements, etc. ; The adjectives 'lexical' and 'syntactic' are ; the same ones used in the Java language reference, @@ -188,8 +180,8 @@ ; / additive-expression "-" multiplicative-expression ; ; These rules tell us -; that the additive operators '+' and '-' have lower precedence -; than the multiplicative operators '*' and '/', +; that the additive operators `+` and `-` have lower precedence +; than the multiplicative operators `*` and `/`, ; and that both the additive and multiplicative operators associate to the left. ; This may be best understood via the examples given below. @@ -247,7 +239,7 @@ ; This ABNF grammar uses nonterminal names ; that consist of complete English words, separated by dashes, ; and that describe the construct the way it is in English. -; For instance, we use the name 'conditional-statement' +; For instance, we use the name `conditional-statement` ; to describe conditional statements. ; At the same time, this grammar establishes @@ -292,8 +284,8 @@ ; A Leo file is a finite sequence of Unicode characters, ; represented as Unicode code points, -; which are numbers in the range form 0 to 10FFFFh. -; These are captured by the ABNF rule 'character' below. +; which are numbers in the range from 0 to 10FFFFh. +; These are captured by the ABNF rule `character` below. ; The lexical grammar defines how, at least conceptually, ; the sequence of characters is turned into @@ -301,20 +293,20 @@ ; these entities are all defined by the grammar rules below. ; As stated, the lexical grammar alone is ambiguous. -; For example, the sequence of characters '**' (i.e. two stars) -; could be equally parsed as two '*' symbol tokens or one '**' symbol token -; (see rule for 'symbol' below). -; As another example, the sequence or characters '' +; For example, the sequence of characters `**` (i.e. two stars) +; could be equally parsed as two `*` symbol tokens or one `**` symbol token +; (see rule for `symbol` below). +; As another example, the sequence or characters `` ; (i.e. carriage return followed by line feed) ; could be equally parsed as two line terminators or one -; (see rule for 'newline'). +; (see rule for `newline`). ; Thus, as often done in language syntax definitions, ; the lexical grammar is disambiguated by ; the extra-grammatical requirement that ; the longest possible sequence of characters is always parsed. -; This way, '**' must be parsed as one '**' symbol token, -; and '' must be parsed as one line terminator. +; This way, `**` must be parsed as one `**` symbol token, +; and `` must be parsed as one line terminator. ; As mentioned above, a character is any Unicode code point. ; This grammar does not say how those are encoded in files (e.g. UTF-8): @@ -326,15 +318,15 @@ character = %x0-10FFFF ; any Unicode code point ; We give names to certain ASCII characters. -horizontal-tab = %x9 +horizontal-tab = %x9 ; -line-feed = %xA +line-feed = %xA ; -carriage-return = %xD +carriage-return = %xD ; -space = %x20 +space = %x20 ; -double-quote = %x22 +double-quote = %x22 ; " ; We give names to complements of certain ASCII characters. ; These consist of all the Unicode characters except for one or two. @@ -344,9 +336,16 @@ not-double-quote = %x0-22 / %x24-10FFFF ; anything but " not-star = %x0-29 / %x2B-10FFFF ; anything but * not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF - ; anything but LF or CR + ; anything but or -not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF ; anything but * or / +not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF + ; anything but " or { + +not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF + ; anything but " or } + +not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF + ; anything but * or / ; Lines in Leo may be terminated via ; a single carriage return, @@ -363,12 +362,12 @@ newline = line-feed / carriage-return / carriage-return line-feed whitespace = space / horizontal-tab / newline ; There are two kinds of comments in Leo, as in other languages. -; One is block comments of the form '/* ... */', -; and the other is end-of-line comments of the form '// ...'. -; The first kind start at '/*' and end at the first '*/', +; One is block comments of the form `/* ... */`, +; and the other is end-of-line comments of the form `// ...`. +; The first kind start at `/*` and end at the first `*/`, ; possibly spanning multiple (partial) lines; ; these do no nest. -; The second kind start at '//' and extend till the end of the line. +; The second kind start at `//` and extend till the end of the line. ; The rules about comments given below are similar to ; the ones used in the Java language reference. @@ -446,59 +445,32 @@ identifier = letter *( letter / digit / "_" ) ; but not a keyword package-name = 1*( lowercase-letter / digit ) *( "-" 1*( lowercase-letter / digit ) ) -; An address starts with 'aleo1' -; and continues with exactly 58 lowercase letters and digits. -; Thus an address always consists of 63 characters. - -address = %s"aleo1" 58( lowercase-letter / digit ) - -; A formatted string is a sequence of characters, other than double quote, +; A format string is a sequence of characters, other than double quote, ; surrounded by double quotes. -; Within a formatted string, sub-strings '{}' are distinguished as containers +; Within a format string, sub-strings `{}` are distinguished as containers ; (these are the ones that may be matched with values ; whose textual representation replaces the containers ; in the printed string). -; There is an implicit extra-grammatical requirements that -; the explicit 'formatted-string-container' instances include -; all the occurrences of '{}' in the parsed character sequence: -; that is, there may not be two contiguous 'not-double-quote' instances -; that are '{' and '}'. -formatted-string-container = "{}" +format-string-container = "{}" -formatted-string = double-quote - *( not-double-quote / formatted-string-container ) - double-quote +format-string-element = not-double-quote-or-open-brace + / "{" not-double-quote-or-close-brace + / format-string-container -; Here is (part of this ABNF comment), -; an alternative way to specify formatted strings, -; which captures the extra-grammatical requirement above in the grammar, -; but is more complicated: -; -; not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF -; -; not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF -; -; formatted-string-element = not-double-quote-or-open-brace -; / "{" not-double-quote-or-close-brace -; / formatted-string-container -; -; formatted-string = double-quote *formatted-string-element double-quote -; -; It is not immediately clear which approach is better; there are tradeoffs. -; We may choose to adopt this one in future revisions of the grammar. +format-string = double-quote *format-string-element double-quote -; Annotations have names, which are identifiers immediately preceded by '@'. +; Annotations have names, which are identifiers immediately preceded by `@`. annotation-name = "@" identifier ; A natural (number) is a sequence of one or more digits. -; We allow leading zeros, e.g. '007'. +; We allow leading zeros, e.g. `007`. natural = 1*digit ; An integer (number) is either a natural or its negation. -; We allow leading zeros also in negative numbers, e.g. '-007'. +; We allow leading zeros also in negative numbers, e.g. `-007`. integer = [ "-" ] natural @@ -530,10 +502,11 @@ product-group-literal = integer %s"group" boolean-literal = %s"true" / %s"false" -; An address literal is an address wrapped into an indication of address, -; to differentiate it from an identifier. +; An address literal starts with `aleo1` +; and continues with exactly 58 lowercase letters and digits. +; Thus an address always consists of 63 characters. -address-literal = %s"address" "(" address ")" +address-literal = %s"aleo1" 58( lowercase-letter / digit ) ; The ones above are all the atomic literals ; (in the sense that they are tokens, without whitespace allowed in them), @@ -548,12 +521,12 @@ atomic-literal = untyped-literal / address-literal ; After defining the (mostly) alphanumeric tokens above, -; it remains to define tokens for non-alphanumeric symbols such as "+" and "(". +; it remains to define tokens for non-alphanumeric symbols such as `+` and `(`. ; Different programming languages used different terminologies for these, ; e.g. operators, separators, punctuators, etc. -; Here we use 'symbol', for all of them. +; Here we use `symbol`, for all of them. ; We also include a token consisting of -; a closing parenthesis immediately followed by 'group': +; a closing parenthesis `)` immediately followed by `group`: ; as defined in the syntactic grammar, ; this is the final part of an affine group literal; ; even though it includes letters, @@ -565,7 +538,7 @@ atomic-literal = untyped-literal ; ; equality-operator = "==" ; -; and defining 'symbol' in terms of those +; and defining `symbol` in terms of those ; ; symbol = ... / equality-operator / ... ; @@ -574,7 +547,7 @@ atomic-literal = untyped-literal ; namely the exact names of some of these token. ; On the other hand, at least some of them are perhaps simple enough ; that they could be just described in terms of their symbols, -; e.g. 'double dot', 'question mark', etc. +; e.g. double dot, question mark, etc. symbol = "!" / "&&" / "||" / "==" / "!=" @@ -595,7 +568,7 @@ token = keyword / identifier / atomic-literal / package-name - / formatted-string + / format-string / annotation-name / symbol @@ -639,7 +612,7 @@ address-type = %s"address" scalar-type = boolean-type / arithmetic-type / address-type -; Circuit types are denoted by identifiers and the keyword 'Self'. +; Circuit types are denoted by identifiers and the keyword `Self`. ; The latter is only allowed inside a circuit definition, ; to denote the circuit being defined. @@ -690,7 +663,7 @@ affine-group-literal = "(" group-coordinate "," group-coordinate %s")group" literal = atomic-literal / affine-group-literal ; The following rule is not directly referenced in the rules for expressions -; (which reference 'literal' instead), +; (which reference `literal` instead), ; but it is useful to establish terminology: ; a group literal is either a product group literal or an affine group literal. @@ -729,7 +702,7 @@ tuple-expression = tuple-construction ; Array expressions construct arrays. ; There are two kinds: ; one lists the element expressions (at least one), -; including spreads (via '...') which are arrays being spliced in; +; including spreads (via `...`) which are arrays being spliced in; ; the other repeats (the value of) a single expression ; across one or more dimensions. @@ -756,7 +729,8 @@ array-expression = array-construction ; so they are syntactically identical but semantically different. circuit-construction = circuit-type "{" - circuit-inline-element *( "," circuit-inline-element ) + circuit-inline-element + *( "," circuit-inline-element ) [ "," ] "}" circuit-inline-element = identifier ":" expression / identifier @@ -802,18 +776,13 @@ unary-expression = postfix-expression / "!" unary-expression / "-" unary-expression -; Next in the operator precedence is casting. - -cast-expression = unary-expression - / cast-expression %s"as" type - ; Next in the operator precedence is exponentiation, ; following mathematical practice. -; The current rule below makes exponentiation left-associative, -; i.e. 'a ** b ** c' must be parsed as '(a ** b) ** c'. +; The current rule below makes exponentiation right-associative, +; i.e. `a ** b ** c` must be parsed as `a ** (b ** c)`. -exponential-expression = cast-expression - / exponential-expression "**" cast-expression +exponential-expression = unary-expression + / unary-expression "**" exponential-expression ; Next in precedence come multiplication and division, both left-associative. @@ -887,10 +856,9 @@ block = "{" *statement "}" expression-statement = expression ";" -; A return statement always takes an expression, -; and does not end with a semicolon. +; A return statement always takes an expression, and ends with a semicolon. -return-statement = %s"return" expression +return-statement = %s"return" expression ";" ; There are two kinds of variable definition statements, ; which only differ in the starting keyword. @@ -924,20 +892,20 @@ conditional-statement = branch loop-statement = %s"for" identifier %s"in" expression ".." expression block ; An assignment statement is straightforward. -; Based on the operator, the assignment may be simple (i.e. '=') +; Based on the operator, the assignment may be simple (i.e. `=`) ; or compound (i.e. combining assignment with an arithmetic operation). assignment-operator = "=" / "+=" / "-=" / "*=" / "/=" / "**=" assignment-statement = expression assignment-operator expression ";" -; Console statements start with the 'console' keyword, +; Console statements start with the `console` keyword, ; followed by a console function call. ; The call may be an assertion or a print command. ; The former takes an expression (which must be boolean) as argument. ; The latter takes either no argument, -; or a formatted string followed by expressions, -; whose number must match the number of containers '{}' in the formatted string. +; or a format string followed by expressions, +; whose number must match the number of containers `{}` in the format string. ; Note that the console function names are identifiers, not keywords. ; There are three kinds of print commands. @@ -950,11 +918,11 @@ assert-call = %s"assert" "(" expression ")" print-function = %s"debug" / %s"error" / %s"log" -print-arguments = "(" [ formatted-string *( "," expression ) ] ")" +print-arguments = "(" [ format-string *( "," expression ) ] ")" print-call = print-function print-arguments -; An annotation consists of an annotation name (which starts with '@') +; An annotation consists of an annotation name (which starts with `@`) ; with optional annotation arguments, which are identifiers. ; Note that no parentheses are used if there are no arguments. @@ -966,17 +934,15 @@ annotation = annotation-name ; In general, a function input consists of an identifier and a type, ; with an optional 'const' modifier. ; Additionally, functions inside circuits -; may start with a 'mut self' or 'const self' or 'self' parameter. -; Furthermore, any function may end with an 'input' parameter. +; may start with a `mut self` or `const self` or `self` parameter. function-declaration = *annotation %s"function" identifier "(" [ function-parameters ] ")" [ "->" type ] block -function-parameters = self-parameter [ "," input-parameter ] - / self-parameter "," function-inputs [ "," input-parameter ] - / function-inputs [ "," input-parameter ] - / input-parameter +function-parameters = self-parameter + / self-parameter "," function-inputs + / function-inputs self-parameter = [ %s"mut" / %s"const" ] %s"self" @@ -984,8 +950,6 @@ function-inputs = function-input *( "," function-input ) function-input = [ %s"const" ] identifier ":" type -input-parameter = %s"input" - ; A circuit member variable declaration consists of an identifier and a type. ; A circuit member function declaration consists of a function declaration. @@ -1002,7 +966,7 @@ member-function-declaration = function-declaration circuit-declaration = *annotation %s"circuit" identifier "{" member-declaration *( "," member-declaration ) "}" -; An import declaration consists of the 'import' keyword +; An import declaration consists of the `import` keyword ; followed by a package path, which may be one of the following: ; a single wildcard; ; an identifier, optionally followed by a local renamer; @@ -1026,3 +990,25 @@ declaration = import-declaration / circuit-declaration file = *declaration + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Format Note +; ----------- + +; The ABNF standard requires grammars +; to consist of lines terminated by `` +; (i.e. carriage return followed by line feed, DOS/Windows-style), +; as explained in the background on ABNF earlier in this file. +; This file's lines are therefore terminated by ``. +; To avoid losing this requirement across systems, +; this file is marked as `text eol=crlf` in `.gitattributes`: +; this means that the file is textual, enabling visual diffs, +; but its lines will always be terminated by `` on any system. + +; Note that this `` requirement only applies +; to the grammar files themselves. +; It does not apply to the lines of the languages described by the grammar. +; ABNF grammars may describe any kind of languages, +; with any kind of line terminators, +; or even without line terminators at all (e.g. for "binary" languages). diff --git a/grammar/src/main.rs b/grammar/src/main.rs index f2bf4aacbb..1aa6f71ede 100644 --- a/grammar/src/main.rs +++ b/grammar/src/main.rs @@ -179,7 +179,7 @@ impl<'a> Processor<'a> { fn parse_abnf_node(node: &Node, sum: &mut Vec) { match node { // these two are just vectors of rules - Node::Alternation(vec) | Node::Concatenation(vec) => { + Node::Alternatives(vec) | Node::Concatenation(vec) => { for node in vec { parse_abnf_node(node, sum); } diff --git a/imports/Cargo.toml b/imports/Cargo.toml index c8fe120726..990ff34d32 100644 --- a/imports/Cargo.toml +++ b/imports/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-imports" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Import parser for Leo program package dependencies" homepage = "https://aleo.org" @@ -19,15 +19,15 @@ edition = "2018" [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-asg] path = "../asg" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-parser] path = "../parser" -version = "1.3.0" +version = "1.4.0" [dependencies.indexmap] version = "1.6.2" diff --git a/input/Cargo.toml b/input/Cargo.toml index 6350d5151d..f6740591d1 100644 --- a/input/Cargo.toml +++ b/input/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-input" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Input parser of the Leo programming language" homepage = "https://aleo.org" diff --git a/leo/api.rs b/leo/api.rs index 23e12b3578..4763c7a27d 100644 --- a/leo/api.rs +++ b/leo/api.rs @@ -20,27 +20,26 @@ use reqwest::{ Method, StatusCode, }; -use serde::Serialize; +use serde::{Deserialize, Serialize}; -/// Trait describes API Routes and Request bodies, struct which implements -/// Route MUST also support Serialize to be usable in Api::run_route(r: Route) +/// API Routes and Request bodies. +/// Structs that implement Route MUST also support Serialize to be usable in Api::run_route(r: Route) pub trait Route { - /// Whether to use bearer auth or not. Some routes may have additional - /// features for logged-in users, so authorization token should be sent - /// if it is created of course + /// [`true`] if a route supports bearer authentication. + /// For example, the login route. const AUTH: bool; - /// HTTP method to use when requesting + /// The HTTP method to use when requesting. const METHOD: Method; - /// URL path without first forward slash (e.g. v1/package/fetch) + /// The URL path without the first forward slash (e.g. v1/package/fetch) const PATH: &'static str; - /// Output type for this route. For login it is simple - String + /// The output type for this route. For example, the login route output is [`String`]. /// But for other routes may be more complex. type Output; - /// Process reqwest Response and turn it into Output + /// Process the reqwest Response and turn it into an Output. fn process(&self, res: Response) -> Result; /// Transform specific status codes into correct errors for this route. @@ -50,18 +49,18 @@ pub trait Route { } } -/// REST API handler with reqwest::blocking inside +/// REST API handler with reqwest::blocking inside. #[derive(Clone, Debug)] pub struct Api { host: String, client: Client, - /// Authorization token for API requests + /// Authorization token for API requests. auth_token: Option, } impl Api { - /// Create new instance of API, set host and Client is going to be - /// created and set automatically + /// Returns a new instance of API. + /// The set host and Client are created automatically. pub fn new(host: String, auth_token: Option) -> Api { Api { client: Client::new(), @@ -70,18 +69,23 @@ impl Api { } } - /// Get token for bearer auth, should be passed into Api through Context + pub fn host(&self) -> &str { + &*self.host + } + + /// Returns the token for bearer auth, otherwise None. + /// The [`auth_token`] should be passed into the Api through Context. pub fn auth_token(&self) -> Option { self.auth_token.clone() } - /// Set authorization token for future requests + /// Set the authorization token for future requests. pub fn set_auth_token(&mut self, token: String) { self.auth_token = Some(token); } /// Run specific route struct. Turn struct into request body - /// and use type constants and Route implementation to get request params + /// and use type constants and Route implementation to get request params. pub fn run_route(&self, route: T) -> Result where T: Route, @@ -100,7 +104,9 @@ impl Api { }; // only one error is possible here - let res = res.send().map_err(|_| anyhow!("Unable to connect to Aleo PM"))?; + let res = res.send().map_err(|_| { + anyhow!("Unable to connect to Aleo PM. If you specified custom API endpoint, then check the URL for errors") + })?; // where magic begins route.process(res) @@ -143,7 +149,7 @@ impl Route for Fetch { // TODO: we should return 404 on not found author/package // and return BAD_REQUEST if data format is incorrect or some of the arguments // were not passed - StatusCode::NOT_FOUND => anyhow!("Package is hidden"), + StatusCode::NOT_FOUND => anyhow!("Package not found"), _ => anyhow!("Unknown API error: {}", status), } } @@ -183,13 +189,19 @@ impl Route for Login { } /// Handler for 'my_profile' route. Meant to be used to get profile details but -/// in current application is used to check if user is logged in. Any non-200 response -/// is treated as Unauthorized +/// in the current application it is used to check if the user is logged in. Any non-200 response +/// is treated as Unauthorized. #[derive(Serialize)] pub struct Profile {} +#[derive(Deserialize)] +pub struct ProfileResponse { + username: String, +} + impl Route for Profile { - type Output = bool; + // Some with Username is success, None is failure. + type Output = Option; const AUTH: bool = true; const METHOD: Method = Method::GET; @@ -197,6 +209,12 @@ impl Route for Profile { fn process(&self, res: Response) -> Result { // this may be extended for more precise error handling - Ok(res.status() == 200) + let status = res.status(); + if status == StatusCode::OK { + let body: ProfileResponse = res.json()?; + return Ok(Some(body.username)); + } + + Ok(None) } } diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 8971f702d4..a9921906aa 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -27,7 +27,7 @@ use leo_package::{ }; use leo_synthesizer::{CircuitSynthesizer, SerializedCircuit}; -use anyhow::Result; +use anyhow::{anyhow, Result}; use snarkvm_curves::{bls12_377::Bls12_377, edwards_bls12::Fq}; use snarkvm_r1cs::ConstraintSystem; use structopt::StructOpt; @@ -83,7 +83,7 @@ pub struct Build { impl Command for Build { type Input = (); - type Output = Option<(Compiler<'static, Fq, EdwardsGroupType>, bool)>; + type Output = (Compiler<'static, Fq, EdwardsGroupType>, bool); fn log_span(&self) -> Span { tracing::span!(tracing::Level::INFO, "Build") @@ -109,96 +109,96 @@ impl Command for Build { tracing::info!("Starting..."); - // Compile the main.leo file along with constraints. - if MainFile::exists_at(&package_path) { - // Create the output directory. - OutputsDirectory::create(&package_path)?; - - // Construct the path to the main file in the source directory. - let mut main_file_path = package_path.clone(); - main_file_path.push(SOURCE_DIRECTORY_NAME); - main_file_path.push(MAIN_FILENAME); - - // Load the input file at `package_name.in` - let (input_string, input_path) = InputFile::new(&package_name).read_from(&path)?; - - // Load the state file at `package_name.in` - let (state_string, state_path) = StateFile::new(&package_name).read_from(&path)?; - - // Log compilation of files to console - tracing::info!("Compiling main program... ({:?})", main_file_path); - - // Load the program at `main_file_path` - let program = Compiler::::parse_program_with_input( - package_name.clone(), - main_file_path, - output_directory, - &input_string, - &input_path, - &state_string, - &state_path, - thread_leaked_context(), - Some(self.compiler_options.into()), - )?; - - // Compute the current program checksum. - let program_checksum = program.checksum()?; - - // Generate the program on the constraint system and verify correctness. - { - let mut cs = CircuitSynthesizer:: { - constraints: Default::default(), - public_variables: Default::default(), - private_variables: Default::default(), - namespaces: Default::default(), - }; - let temporary_program = program.clone(); - let output = temporary_program.compile_constraints(&mut cs)?; - - tracing::debug!("Compiled output - {:#?}", output); - tracing::info!("Number of constraints - {:#?}", cs.num_constraints()); - - // Serialize the circuit. - let circuit_object = SerializedCircuit::from(cs); - let json = circuit_object.to_json_string().unwrap(); - // println!("json: {}", json); - - // Write serialized circuit to circuit `.json` file. - let circuit_file = CircuitFile::new(&package_name); - circuit_file.write_to(&path, json)?; - - // Check that we can read the serialized circuit file - // let serialized = circuit_file.read_from(&package_path)?; - - // Deserialize the circuit - // let deserialized = SerializedCircuit::from_json_string(&serialized).unwrap(); - // let _circuit_synthesizer = CircuitSynthesizer::::try_from(deserialized).unwrap(); - // println!("deserialized {:?}", circuit_synthesizer.num_constraints()); - } - - // If a checksum file exists, check if it differs from the new checksum. - let checksum_file = ChecksumFile::new(&package_name); - let checksum_differs = if checksum_file.exists_at(&package_path) { - let previous_checksum = checksum_file.read_from(&package_path)?; - program_checksum != previous_checksum - } else { - // By default, the checksum differs if there is no checksum to compare against. - true - }; - - // If checksum differs, compile the program. - if checksum_differs { - // Write the new checksum to the output directory. - checksum_file.write_to(&path, program_checksum)?; - - tracing::debug!("Checksum saved ({:?})", path); - } - - tracing::info!("Complete"); - - return Ok(Some((program, checksum_differs))); + // Compile the main.leo file along with constraints + if !MainFile::exists_at(&package_path) { + return Err(anyhow!("File main.leo not found in src/ directory")); } - Ok(None) + // Create the output directory + OutputsDirectory::create(&package_path)?; + + // Construct the path to the main file in the source directory + let mut main_file_path = package_path.clone(); + main_file_path.push(SOURCE_DIRECTORY_NAME); + main_file_path.push(MAIN_FILENAME); + + // Load the input file at `package_name.in` + let (input_string, input_path) = InputFile::new(&package_name).read_from(&path)?; + + // Load the state file at `package_name.in` + let (state_string, state_path) = StateFile::new(&package_name).read_from(&path)?; + + // Log compilation of files to console + tracing::info!("Compiling main program... ({:?})", main_file_path); + + // Load the program at `main_file_path` + let program = Compiler::::parse_program_with_input( + package_name.clone(), + main_file_path, + output_directory, + &input_string, + &input_path, + &state_string, + &state_path, + thread_leaked_context(), + Some(self.compiler_options.into()), + )?; + + // Compute the current program checksum + let program_checksum = program.checksum()?; + + // Generate the program on the constraint system and verify correctness + { + let mut cs = CircuitSynthesizer:: { + constraints: Default::default(), + public_variables: Default::default(), + private_variables: Default::default(), + namespaces: Default::default(), + }; + let temporary_program = program.clone(); + let output = temporary_program.compile_constraints(&mut cs)?; + + tracing::debug!("Compiled output - {:#?}", output); + tracing::info!("Number of constraints - {:#?}", cs.num_constraints()); + + // Serialize the circuit + let circuit_object = SerializedCircuit::from(cs); + let json = circuit_object.to_json_string().unwrap(); + // println!("json: {}", json); + + // Write serialized circuit to circuit `.json` file. + let circuit_file = CircuitFile::new(&package_name); + circuit_file.write_to(&path, json)?; + + // Check that we can read the serialized circuit file + // let serialized = circuit_file.read_from(&package_path)?; + + // Deserialize the circuit + // let deserialized = SerializedCircuit::from_json_string(&serialized).unwrap(); + // let _circuit_synthesizer = CircuitSynthesizer::::try_from(deserialized).unwrap(); + // println!("deserialized {:?}", circuit_synthesizer.num_constraints()); + } + + // If a checksum file exists, check if it differs from the new checksum + let checksum_file = ChecksumFile::new(&package_name); + let checksum_differs = if checksum_file.exists_at(&package_path) { + let previous_checksum = checksum_file.read_from(&package_path)?; + program_checksum != previous_checksum + } else { + // By default, the checksum differs if there is no checksum to compare against + true + }; + + // If checksum differs, compile the program + if checksum_differs { + // Write the new checksum to the output directory + checksum_file.write_to(&path, program_checksum)?; + + tracing::debug!("Checksum saved ({:?})", path); + } + + tracing::info!("Complete"); + + Ok((program, checksum_differs)) } } diff --git a/leo/commands/init.rs b/leo/commands/init.rs index a4d07a9137..18711d6923 100644 --- a/leo/commands/init.rs +++ b/leo/commands/init.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::{commands::Command, config::*, context::Context}; use leo_package::LeoPackage; use anyhow::{anyhow, Result}; -use std::env::current_dir; use structopt::StructOpt; use tracing::span::Span; @@ -39,9 +38,14 @@ impl Command for Init { Ok(()) } - fn apply(self, _: Context, _: Self::Input) -> Result { + fn apply(self, context: Context, _: Self::Input) -> Result { // Derive the package directory path. - let path = current_dir()?; + let path = context.dir()?; + + // Check that the current package directory path exists. + if !path.exists() { + return Err(anyhow!("Directory does not exist")); + } // Check that the given package name is valid. let package_name = path @@ -50,15 +54,12 @@ impl Command for Init { .to_string_lossy() .to_string(); if !LeoPackage::is_package_name_valid(&package_name) { - return Err(anyhow!("Invalid Leo project name")); + return Err(anyhow!("Invalid Leo project name: {}", package_name)); } - // Check that the current package directory path exists. - if !path.exists() { - return Err(anyhow!("Directory does not exist")); - } + let username = read_username().ok(); - LeoPackage::initialize(&package_name, false, &path)?; + LeoPackage::initialize(&package_name, &path, username)?; Ok(()) } diff --git a/leo/commands/new.rs b/leo/commands/new.rs index c77448cfc4..9f72988bb4 100644 --- a/leo/commands/new.rs +++ b/leo/commands/new.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::{commands::Command, config::*, context::Context}; use leo_package::LeoPackage; use anyhow::{anyhow, Result}; -use std::{env::current_dir, fs}; +use std::fs; use structopt::StructOpt; use tracing::span::Span; @@ -42,15 +42,17 @@ impl Command for New { Ok(()) } - fn apply(self, _: Context, _: Self::Input) -> Result { + fn apply(self, context: Context, _: Self::Input) -> Result { // Check that the given package name is valid. let package_name = self.name; if !LeoPackage::is_package_name_valid(&package_name) { return Err(anyhow!("Invalid Leo project name")); } + let username = read_username().ok(); + // Derive the package directory path. - let mut path = current_dir()?; + let mut path = context.dir()?; path.push(&package_name); // Verify the package directory path does not exist yet. @@ -61,7 +63,7 @@ impl Command for New { // Create the package directory fs::create_dir_all(&path).map_err(|err| anyhow!("Could not create directory {}", err))?; - LeoPackage::initialize(&package_name, false, &path)?; + LeoPackage::initialize(&package_name, &path, username)?; Ok(()) } diff --git a/leo/commands/package/login.rs b/leo/commands/package/login.rs index 495f52b6e5..960b7727fc 100644 --- a/leo/commands/package/login.rs +++ b/leo/commands/package/login.rs @@ -59,34 +59,15 @@ impl Command for Login { } fn apply(self, context: Context, _: Self::Input) -> Result { - // quick hack to check if user is already logged in. ;) - if context.api.auth_token().is_some() { - tracing::info!("You are already logged in"); - return Ok(context.api.auth_token().unwrap()); - }; - - let mut api = context.api; + let mut api = context.clone().api; // ...or trying to use arguments to either get token or user-pass - let token = match (self.token, self.user, self.pass) { - // Login using existing token, use get_profile route for that - (Some(token), _, _) => { - tracing::info!("Token passed, checking..."); - - api.set_auth_token(token.clone()); - - let is_ok = api.run_route(ProfileRoute {})?; - if !is_ok { - return Err(anyhow!("Supplied token is incorrect")); - }; - - token - } - - // Login using username and password + let (token, username) = match (self.token, self.user, self.pass) { + // Login using username and password if they were passed. Even if token already + // exists login procedure will be done first (we need that for expired credentials). (None, Some(email_username), Some(password)) => { let login = LoginRoute { - email_username, + email_username: email_username.clone(), password, }; @@ -98,17 +79,48 @@ impl Command for Login { return Err(anyhow!("Unable to get token")); }; - tok_opt.unwrap() + (tok_opt.unwrap(), email_username) + } + + // Login with token, use get_profile route to verify that. + (Some(token), _, _) => { + tracing::info!("Token passed, checking..."); + + api.set_auth_token(token.clone()); + + match api.run_route(ProfileRoute {})? { + Some(username) => (token, username), + None => return Err(anyhow!("Supplied token is incorrect")), + } } // In case token or login/pass were not passed as arguments - (_, _, _) => return Err(anyhow!("No credentials provided")), + (_, _, _) => { + // Check locally stored token if there is. + let token = context.api.auth_token(); + + match token { + Some(token) => { + tracing::info!("Found locally stored credentials, verifying..."); + + if let Some(username) = api.run_route(ProfileRoute {})? { + (token, username) + } else { + remove_token_and_username()?; + return Err(anyhow!( + "Stored credentials are incorrect or expired, please login again" + )); + } + } + None => return Err(anyhow!("No credentials provided")), + } + } }; // write token either after logging or if it was passed - write_token(token.as_str())?; + write_token_and_username(token.as_str(), username.as_str())?; - tracing::info!("Success! You are now logged in!"); + tracing::info!("Success! You are logged in!"); Ok(token) } diff --git a/leo/commands/package/logout.rs b/leo/commands/package/logout.rs index c6018854ef..a18e29351b 100644 --- a/leo/commands/package/logout.rs +++ b/leo/commands/package/logout.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, config::remove_token, context::Context}; +use crate::{commands::Command, config::remove_token_and_username, context::Context}; use anyhow::Result; use std::io::ErrorKind; @@ -41,7 +41,7 @@ impl Command for Logout { fn apply(self, _context: Context, _: Self::Input) -> Result { // the only error we're interested here is NotFound // however err in this case can also be of kind PermissionDenied or other - if let Err(err) = remove_token() { + if let Err(err) = remove_token_and_username() { match err.kind() { ErrorKind::NotFound => { tracing::info!("you are not logged in"); diff --git a/leo/commands/package/publish.rs b/leo/commands/package/publish.rs index 7de94e0ac0..c1ee28c92b 100644 --- a/leo/commands/package/publish.rs +++ b/leo/commands/package/publish.rs @@ -15,11 +15,11 @@ // along with the Leo library. If not, see . use super::build::Build; -use crate::{ - commands::Command, - context::{Context, PACKAGE_MANAGER_URL}, +use crate::{commands::Command, context::Context}; +use leo_package::{ + outputs::OutputsDirectory, + root::{ZipFile, AUTHOR_PLACEHOLDER}, }; -use leo_package::{outputs::OutputsDirectory, root::ZipFile}; use anyhow::{anyhow, Result}; use reqwest::{ @@ -73,11 +73,19 @@ impl Command for Publish { }; let package_remote = manifest.get_package_remote().unwrap(); + let username = package_remote.clone().author; - // Create the output directory + // Prevent most common error before accessing API. + if username == AUTHOR_PLACEHOLDER { + return Err(anyhow!( + "Package author is not set. Specify package author in [remote] section of Leo.toml" + )); + } + + // Create the output directory. OutputsDirectory::create(&path)?; - // Create zip file + // Create zip file. let zip_file = ZipFile::new(&package_name); if zip_file.exists_at(&path) { tracing::debug!("Existing package zip file found. Clearing it to regenerate."); @@ -110,7 +118,7 @@ impl Command for Publish { // Make a request to publish a package let response = client - .post(format!("{}{}", PACKAGE_MANAGER_URL, PUBLISH_URL).as_str()) + .post(format!("{}{}", context.api.host(), PUBLISH_URL).as_str()) .headers(headers) .multipart(form_data) .send(); diff --git a/leo/commands/setup.rs b/leo/commands/setup.rs index b4b61b808b..9e2c4ceea4 100644 --- a/leo/commands/setup.rs +++ b/leo/commands/setup.rs @@ -64,8 +64,7 @@ impl Command for Setup { let package_name = context.manifest()?.get_package_name(); // Check if leo build failed - let (program, checksum_differs) = - input.ok_or_else(|| anyhow!("Unable to build, check that main file exists"))?; + let (program, checksum_differs) = input; // Check if a proving key and verification key already exists let keys_exist = ProvingKeyFile::new(&package_name).exists_at(&path) diff --git a/leo/commands/update.rs b/leo/commands/update.rs index 605633b730..07b382a1a0 100644 --- a/leo/commands/update.rs +++ b/leo/commands/update.rs @@ -21,7 +21,7 @@ use structopt::StructOpt; use tracing::span::Span; /// Setting for automatic updates of Leo -#[derive(Debug, StructOpt, PartialEq)] +#[derive(Debug, StructOpt)] pub enum Automatic { Automatic { #[structopt(name = "bool", help = "Boolean value: true or false", parse(try_from_str))] diff --git a/leo/commands/watch.rs b/leo/commands/watch.rs index b9d13ee115..0bbd546047 100644 --- a/leo/commands/watch.rs +++ b/leo/commands/watch.rs @@ -72,13 +72,8 @@ impl Command for Watch { }) .execute(context.clone()) { - Ok(_output) => { - tracing::info!("Built successfully"); - } - Err(e) => { - // Syntax error - tracing::error!("Error {:?}", e); - } + Ok(_output) => tracing::info!("Built successfully"), + Err(e) => tracing::error!("Error {:?}", e), }; } // Other events diff --git a/leo/config.rs b/leo/config.rs index 11de847b70..ae85bc3d2c 100644 --- a/leo/config.rs +++ b/leo/config.rs @@ -32,6 +32,7 @@ use serde::{Deserialize, Serialize}; pub const LEO_CREDENTIALS_FILE: &str = "credentials"; pub const LEO_CONFIG_FILE: &str = "config.toml"; +pub const LEO_USERNAME_FILE: &str = "username"; lazy_static! { pub static ref LEO_CONFIG_DIRECTORY: PathBuf = { @@ -44,6 +45,11 @@ lazy_static! { path.push(LEO_CREDENTIALS_FILE); path }; + pub static ref LEO_USERNAME_PATH: PathBuf = { + let mut path = LEO_CONFIG_DIRECTORY.to_path_buf(); + path.push(LEO_USERNAME_FILE); + path + }; pub static ref LEO_CONFIG_PATH: PathBuf = { let mut path = LEO_CONFIG_DIRECTORY.to_path_buf(); path.push(LEO_CONFIG_FILE); @@ -129,7 +135,7 @@ impl Config { } } -pub fn write_token(token: &str) -> Result<(), io::Error> { +pub fn write_token_and_username(token: &str, username: &str) -> Result<(), io::Error> { let config_dir = LEO_CONFIG_DIRECTORY.clone(); // Create Leo config directory if it not exists @@ -139,6 +145,10 @@ pub fn write_token(token: &str) -> Result<(), io::Error> { let mut credentials = File::create(&LEO_CREDENTIALS_PATH.to_path_buf())?; credentials.write_all(&token.as_bytes())?; + + let mut username_file = File::create(&LEO_USERNAME_PATH.to_path_buf())?; + username_file.write_all(&username.as_bytes())?; + Ok(()) } @@ -149,7 +159,15 @@ pub fn read_token() -> Result { Ok(buf) } -pub fn remove_token() -> Result<(), io::Error> { +pub fn read_username() -> Result { + let mut username = File::open(&LEO_USERNAME_PATH.to_path_buf())?; + let mut buf = String::new(); + username.read_to_string(&mut buf)?; + Ok(buf) +} + +pub fn remove_token_and_username() -> Result<(), io::Error> { fs::remove_file(&LEO_CREDENTIALS_PATH.to_path_buf())?; + fs::remove_file(&LEO_USERNAME_PATH.to_path_buf())?; Ok(()) } diff --git a/leo/context.rs b/leo/context.rs index bddd54e5f2..0fb96f0a11 100644 --- a/leo/context.rs +++ b/leo/context.rs @@ -48,19 +48,19 @@ impl Context { } /// Create a new context for the current directory. -pub fn create_context(path: PathBuf) -> Result { +pub fn create_context(path: PathBuf, api_url: Option) -> Result { let token = config::read_token().ok(); - let api = Api::new(PACKAGE_MANAGER_URL.to_string(), token); + let api = Api::new(api_url.unwrap_or_else(|| PACKAGE_MANAGER_URL.to_string()), token); Ok(Context { api, path: Some(path) }) } /// Returns project context. -pub fn get_context() -> Result { +pub fn get_context(api_url: Option) -> Result { let token = config::read_token().ok(); - let api = Api::new(PACKAGE_MANAGER_URL.to_string(), token); + let api = Api::new(api_url.unwrap_or_else(|| PACKAGE_MANAGER_URL.to_string()), token); Ok(Context { api, path: None }) } diff --git a/leo/logger.rs b/leo/logger.rs index a2f81bc4c1..0445f39002 100644 --- a/leo/logger.rs +++ b/leo/logger.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::fmt; +use std::{fmt, sync::Once}; use colored::Colorize; use tracing::{event::Event, subscriber::Subscriber}; @@ -24,6 +24,8 @@ use tracing_subscriber::{ FmtSubscriber, }; +static START: Once = Once::new(); + #[derive(Debug, Clone)] pub struct Format { format: F, @@ -202,6 +204,10 @@ where /// Initialize logger with custom format and verbosity. pub fn init_logger(_app_name: &'static str, verbosity: usize) { + // This line enables Windows 10 ANSI coloring API. + #[cfg(target_family = "windows")] + ansi_term::enable_ansi_support(); + let subscriber = FmtSubscriber::builder() // all spans/events with a level higher than TRACE (e.g, debug, info, warn, etc.) // will be written to stdout. @@ -216,5 +222,8 @@ pub fn init_logger(_app_name: &'static str, verbosity: usize) { .event_format(Format::default()) .finish(); - tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed"); + // call this line only once per process. needed for tests using same thread + START.call_once(|| { + tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed"); + }); } diff --git a/leo/main.rs b/leo/main.rs index a0784f70fe..7a69c7f616 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -55,6 +55,9 @@ struct Opt { #[structopt(subcommand)] command: CommandOpts, + #[structopt(help = "Custom Aleo PM backend URL", env = "APM_URL")] + api: Option, + #[structopt( long, global = true, @@ -178,9 +181,11 @@ enum CommandOpts { } fn main() { - // Read command line arguments. - let opt = Opt::from_args(); + handle_error(run_with_args(Opt::from_args())) +} +/// Run command with custom build arguments. +fn run_with_args(opt: Opt) -> Result<(), Error> { if !opt.quiet { // Init logger with optional debug flag. logger::init_logger("leo", match opt.debug { @@ -192,11 +197,11 @@ fn main() { // Get custom root folder and create context for it. // If not specified, default context will be created in cwd. let context = handle_error(match opt.path { - Some(path) => context::create_context(path), - None => context::get_context(), + Some(path) => context::create_context(path, opt.api), + None => context::get_context(opt.api), }); - handle_error(match opt.command { + match opt.command { CommandOpts::Init { command } => command.try_execute(context), CommandOpts::New { command } => command.try_execute(context), CommandOpts::Build { command } => command.try_execute(context), @@ -217,7 +222,7 @@ fn main() { CommandOpts::Lint { command } => command.try_execute(context), CommandOpts::Deploy { command } => command.try_execute(context), - }); + } } fn handle_error(res: Result) -> T { @@ -229,3 +234,140 @@ fn handle_error(res: Result) -> T { } } } + +#[cfg(test)] +mod cli_tests { + use crate::{run_with_args, Opt}; + + use anyhow::Error; + use std::path::PathBuf; + use structopt::StructOpt; + use test_dir::{DirBuilder, FileType, TestDir}; + + // Runs Command from cmd-like argument "leo run --arg1 --arg2". + fn run_cmd(args: &str, path: &Option) -> Result<(), Error> { + let args = args.split(' ').collect::>(); + let mut opts = Opt::from_iter_safe(args)?; + + if path.is_some() { + opts.path = path.clone(); + } + + if !opts.debug { + // turn off tracing for all tests + opts.quiet = true; + } + + run_with_args(opts) + } + + // Create a test directory with name. + fn testdir(name: &str) -> TestDir { + TestDir::temp().create(name, FileType::Dir) + } + + #[test] + fn global_options() { + let path = Some(PathBuf::from("examples/pedersen-hash")); + + assert!(run_cmd("leo build", &path).is_ok()); + assert!(run_cmd("leo -q build", &path).is_ok()); + + assert!(run_cmd("leo --path ../../examples/no-directory-there build", &None).is_err()); + assert!(run_cmd("leo -v build", &None).is_err()); + } + + #[test] + fn global_options_fail() { + assert!(run_cmd("leo --path ../../examples/no-directory-there build", &None).is_err()); + assert!(run_cmd("leo -v build", &None).is_err()); + } + + #[test] + fn init() { + let dir = testdir("test"); + let path = Some(dir.path("test")); + + assert!(run_cmd("leo init", &path).is_ok()); + assert!(run_cmd("leo init", &path).is_err()); // 2nd time + } + + #[test] + fn init_fail() { + let dir = testdir("incorrect_name"); + let path = Some(dir.path("incorrect_name")); + let fake = Some(PathBuf::from("no_such_directory")); + + assert!(run_cmd("leo init", &fake).is_err()); + assert!(run_cmd("leo init", &path).is_err()); + } + + #[test] + fn new() { + let dir = testdir("new"); + let path = Some(dir.path("new")); + + assert!(run_cmd("leo new test", &path).is_ok()); + assert!(run_cmd("leo new test", &path).is_err()); // 2nd time + assert!(run_cmd("leo new wrong_name", &path).is_err()); + } + + #[test] + #[should_panic] + fn unimplemented() { + assert!(run_cmd("leo lint", &None).is_err()); + assert!(run_cmd("leo deploy", &None).is_err()); + } + + #[test] + fn clean() { + let path = &Some(PathBuf::from("examples/pedersen-hash")); + + assert!(run_cmd("leo build", path).is_ok()); + assert!(run_cmd("leo clean", path).is_ok()); + } + + #[test] + fn setup_prove_run_clean() { + let dir = testdir("test"); + let path = dir.path("test"); + + assert!(run_cmd("leo new setup-test", &Some(path.clone())).is_ok()); + + let setup_path = &Some(path.join("setup-test")); + + assert!(run_cmd("leo setup", setup_path).is_ok()); + assert!(run_cmd("leo setup", setup_path).is_ok()); + assert!(run_cmd("leo setup --skip-key-check", setup_path).is_ok()); + assert!(run_cmd("leo prove --skip-key-check", setup_path).is_ok()); + assert!(run_cmd("leo run --skip-key-check", setup_path).is_ok()); + assert!(run_cmd("leo clean", setup_path).is_ok()); + } + + #[test] + fn test_missing_file() { + let dir = testdir("test"); + let path = dir.path("test"); + + assert!(run_cmd("leo new test-file-missing", &Some(path.clone())).is_ok()); + + let path = path.join("test-file-missing"); + let file = path.join("src/main.leo"); + let path = Some(path); + + assert!(run_cmd("leo test", &path).is_ok()); + std::fs::remove_file(&file).unwrap(); + assert!(run_cmd("leo test", &path).is_err()); + } + + #[test] + #[ignore] // ignore until imports path is fixed #875 + fn test_sudoku() { + let path = &Some(PathBuf::from("examples/silly-sudoku")); + + assert!(run_cmd("leo build", path).is_ok()); + assert!(run_cmd("leo test", path).is_ok()); + assert!(run_cmd("leo test -f src/lib.leo", path).is_ok()); + assert!(run_cmd("leo test -f src/main.leo", path).is_ok()); + } +} diff --git a/leo/tests/mod.rs b/leo/tests/mod.rs index 6444f630dd..0f48676e6c 100644 --- a/leo/tests/mod.rs +++ b/leo/tests/mod.rs @@ -14,9 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::path::PathBuf; - use anyhow::Result; +use std::path::PathBuf; use crate::{ commands::{ @@ -210,7 +209,7 @@ pub fn leo_update_and_update_automatic() -> Result<()> { /// Create context for Pedersen Hash example fn context() -> Result { let path = PathBuf::from(&PEDERSEN_HASH_PATH); - let context = create_context(path)?; + let context = create_context(path, None)?; Ok(context) } diff --git a/linter/Cargo.toml b/linter/Cargo.toml index f07b144c9c..bf214997cd 100644 --- a/linter/Cargo.toml +++ b/linter/Cargo.toml @@ -2,7 +2,7 @@ dependencies = { } [package] name = "leo-linter" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Linter of the Leo programming language" homepage = "https://aleo.org" diff --git a/package/Cargo.toml b/package/Cargo.toml index f608bfefb2..ff048d7808 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-package" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Package parser of the Leo programming language" homepage = "https://aleo.org" diff --git a/package/src/lib.rs b/package/src/lib.rs index eb7cf4bb00..1ae814a303 100644 --- a/package/src/lib.rs +++ b/package/src/lib.rs @@ -33,8 +33,8 @@ pub struct LeoPackage; impl LeoPackage { /// Initializes a Leo package at the given path. - pub fn initialize(package_name: &str, is_lib: bool, path: &Path) -> Result<(), PackageError> { - package::Package::initialize(package_name, is_lib, path) + pub fn initialize(package_name: &str, path: &Path, author: Option) -> Result<(), PackageError> { + package::Package::initialize(package_name, path, author) } /// Returns `true` if the given Leo package name is valid. diff --git a/package/src/package.rs b/package/src/package.rs index 4ae9e2e92d..8a7fb861e7 100644 --- a/package/src/package.rs +++ b/package/src/package.rs @@ -19,7 +19,7 @@ use crate::{ imports::ImportsDirectory, inputs::{InputFile, InputsDirectory, StateFile}, root::{Gitignore, Manifest, README}, - source::{LibraryFile, MainFile, SourceDirectory}, + source::{MainFile, SourceDirectory}, }; use serde::Deserialize; @@ -107,7 +107,7 @@ impl Package { } /// Returns `true` if a package is can be initialized at a given path. - pub fn can_initialize(package_name: &str, is_lib: bool, path: &Path) -> bool { + pub fn can_initialize(package_name: &str, path: &Path) -> bool { // Check that the package name is valid. if !Self::is_package_name_valid(package_name) { return false; @@ -122,32 +122,24 @@ impl Package { result = false; } - if is_lib { - // Check if the library file already exists. - if LibraryFile::exists_at(path) { - existing_files.push(LibraryFile::filename()); - result = false; - } - } else { - // Check if the input file already exists. - let input_file = InputFile::new(&package_name); - if input_file.exists_at(path) { - existing_files.push(input_file.filename()); - result = false; - } + // Check if the input file already exists. + let input_file = InputFile::new(&package_name); + if input_file.exists_at(path) { + existing_files.push(input_file.filename()); + result = false; + } - // Check if the state file already exists. - let state_file = StateFile::new(&package_name); - if state_file.exists_at(path) { - existing_files.push(state_file.filename()); - result = false; - } + // Check if the state file already exists. + let state_file = StateFile::new(&package_name); + if state_file.exists_at(path) { + existing_files.push(state_file.filename()); + result = false; + } - // Check if the main file already exists. - if MainFile::exists_at(path) { - existing_files.push(MainFile::filename()); - result = false; - } + // Check if the main file already exists. + if MainFile::exists_at(path) { + existing_files.push(MainFile::filename()); + result = false; } if !existing_files.is_empty() { @@ -158,7 +150,7 @@ impl Package { } /// Returns `true` if a package is initialized at the given path - pub fn is_initialized(package_name: &str, is_lib: bool, path: &Path) -> bool { + pub fn is_initialized(package_name: &str, path: &Path) -> bool { // Check that the package name is valid. if !Self::is_package_name_valid(package_name) { return false; @@ -169,38 +161,31 @@ impl Package { return false; } - if is_lib { - // Check if the library file exists. - if !LibraryFile::exists_at(&path) { - return false; - } - } else { - // Check if the input file exists. - let input_file = InputFile::new(&package_name); - if !input_file.exists_at(&path) { - return false; - } + // Check if the input file exists. + let input_file = InputFile::new(&package_name); + if !input_file.exists_at(&path) { + return false; + } - // Check if the state file exists. - let state_file = StateFile::new(&package_name); - if !state_file.exists_at(&path) { - return false; - } + // Check if the state file exists. + let state_file = StateFile::new(&package_name); + if !state_file.exists_at(&path) { + return false; + } - // Check if the main file exists. - if !MainFile::exists_at(&path) { - return false; - } + // Check if the main file exists. + if !MainFile::exists_at(&path) { + return false; } true } /// Creates a package at the given path - pub fn initialize(package_name: &str, is_lib: bool, path: &Path) -> Result<(), PackageError> { + pub fn initialize(package_name: &str, path: &Path, author: Option) -> Result<(), PackageError> { // First, verify that this directory is not already initialized as a Leo package. { - if !Self::can_initialize(package_name, is_lib, path) { + if !Self::can_initialize(package_name, path) { return Err(PackageError::FailedToInitialize( package_name.to_owned(), path.as_os_str().to_owned(), @@ -210,7 +195,7 @@ impl Package { // Next, initialize this directory as a Leo package. { // Create the manifest file. - Manifest::new(&package_name)?.write_to(&path)?; + Manifest::new(&package_name, author)?.write_to(&path)?; // Verify that the .gitignore file does not exist. if !Gitignore::exists_at(&path) { @@ -227,27 +212,21 @@ impl Package { // Create the source directory. SourceDirectory::create(&path)?; - // Create a new library or binary file. - if is_lib { - // Create the library file in the source directory. - LibraryFile::new(&package_name).write_to(&path)?; - } else { - // Create the input directory. - InputsDirectory::create(&path)?; + // Create the input directory. + InputsDirectory::create(&path)?; - // Create the input file in the inputs directory. - InputFile::new(&package_name).write_to(&path)?; + // Create the input file in the inputs directory. + InputFile::new(&package_name).write_to(&path)?; - // Create the state file in the inputs directory. - StateFile::new(&package_name).write_to(&path)?; + // Create the state file in the inputs directory. + StateFile::new(&package_name).write_to(&path)?; - // Create the main file in the source directory. - MainFile::new(&package_name).write_to(&path)?; - } + // Create the main file in the source directory. + MainFile::new(&package_name).write_to(&path)?; } // Next, verify that a valid Leo package has been initialized in this directory { - if !Self::is_initialized(package_name, is_lib, path) { + if !Self::is_initialized(package_name, path) { return Err(PackageError::FailedToInitialize( package_name.to_owned(), path.as_os_str().to_owned(), diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 540749fcdc..4ec11007fd 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -26,6 +26,7 @@ use std::{ }; pub const MANIFEST_FILENAME: &str = "Leo.toml"; +pub const AUTHOR_PLACEHOLDER: &str = "[AUTHOR]"; #[derive(Clone, Deserialize)] pub struct Remote { @@ -39,10 +40,10 @@ pub struct Manifest { } impl Manifest { - pub fn new(package_name: &str) -> Result { + pub fn new(package_name: &str, author: Option) -> Result { Ok(Self { project: Package::new(package_name)?, - remote: None, + remote: author.map(|author| Remote { author }), }) } @@ -90,6 +91,11 @@ impl Manifest { } fn template(&self) -> String { + let author = self + .remote + .clone() + .map_or(AUTHOR_PLACEHOLDER.to_string(), |remote| remote.author); + format!( r#"[project] name = "{name}" @@ -98,9 +104,10 @@ description = "The {name} package" license = "MIT" [remote] -author = "[AUTHOR]" # Add your Aleo Package Manager username, team's name, or organization's name. +author = "{author}" # Add your Aleo Package Manager username, team's name, or organization's name. "#, - name = self.project.name + name = self.project.name, + author = author ) } } diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index 46426b9d3e..6286b125d0 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -106,7 +106,8 @@ impl ZipFile { // Write file or directory if path.is_file() { tracing::info!("Adding file {:?} as {:?}", path, name); - zip.start_file(name.to_string_lossy(), options)?; + #[allow(deprecated)] + zip.start_file_from_path(name, options)?; let mut f = File::open(path)?; f.read_to_end(&mut buffer)?; @@ -116,7 +117,8 @@ impl ZipFile { // Only if not root Avoids path spec / warning // and mapname conversion failed error on unzip tracing::info!("Adding directory {:?} as {:?}", path, name); - zip.add_directory(name.to_string_lossy(), options)?; + #[allow(deprecated)] + zip.add_directory_from_path(name, options)?; } } diff --git a/package/src/source/library.rs b/package/src/source/library.rs deleted file mode 100644 index 90a5193b85..0000000000 --- a/package/src/source/library.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -//! The `lib.leo` file. - -use crate::{errors::LibraryFileError, source::directory::SOURCE_DIRECTORY_NAME}; - -use serde::Deserialize; -use std::{borrow::Cow, fs::File, io::Write, path::Path}; - -pub static LIBRARY_FILENAME: &str = "lib.leo"; - -#[derive(Deserialize)] -pub struct LibraryFile { - pub package_name: String, -} - -impl LibraryFile { - pub fn new(package_name: &str) -> Self { - Self { - package_name: package_name.to_string(), - } - } - - pub fn filename() -> String { - format!("{}{}", SOURCE_DIRECTORY_NAME, LIBRARY_FILENAME) - } - - pub fn exists_at(path: &Path) -> bool { - let mut path = Cow::from(path); - if path.is_dir() { - if !path.ends_with(SOURCE_DIRECTORY_NAME) { - path.to_mut().push(SOURCE_DIRECTORY_NAME); - } - path.to_mut().push(LIBRARY_FILENAME); - } - path.exists() - } - - pub fn write_to(self, path: &Path) -> Result<(), LibraryFileError> { - let mut path = Cow::from(path); - if path.is_dir() { - if !path.ends_with(SOURCE_DIRECTORY_NAME) { - path.to_mut().push(SOURCE_DIRECTORY_NAME); - } - path.to_mut().push(LIBRARY_FILENAME); - } - - let mut file = File::create(&path)?; - Ok(file.write_all(self.template().as_bytes())?) - } - - fn template(&self) -> String { - format!( - r#"// The '{}' library circuit. -circuit Foo {{ - a: field -}} -"#, - self.package_name - ) - } -} diff --git a/package/src/source/main.rs b/package/src/source/main.rs index 7ac8c4990d..842c85c7eb 100644 --- a/package/src/source/main.rs +++ b/package/src/source/main.rs @@ -68,7 +68,7 @@ impl MainFile { r#"// The '{}' main function. function main(a: u32, b: u32) -> u32 {{ let c: u32 = a + b; - return c + return c; }} "#, self.package_name diff --git a/package/src/source/mod.rs b/package/src/source/mod.rs index 3057d1a2b5..489cee59da 100644 --- a/package/src/source/mod.rs +++ b/package/src/source/mod.rs @@ -17,8 +17,5 @@ pub mod directory; pub use directory::*; -pub mod library; -pub use library::*; - pub mod main; pub use main::*; diff --git a/package/tests/initialize/initialize.rs b/package/tests/initialize/initialize.rs index 5e1b98bde8..882e4ae707 100644 --- a/package/tests/initialize/initialize.rs +++ b/package/tests/initialize/initialize.rs @@ -19,7 +19,7 @@ use leo_package::{ inputs::{InputFile, InputsDirectory, StateFile}, package::Package, root::Manifest, - source::{LibraryFile, MainFile, SourceDirectory}, + source::{MainFile, SourceDirectory}, }; const TEST_PACKAGE_NAME: &str = "test-package"; @@ -29,13 +29,27 @@ fn initialize_valid_package() { let test_directory = test_dir(); // Ensure a package can be initialized at the `test_directory` - assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory)); // Initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_ok()); + assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_ok()); // Ensure a package is initialized at the `test_directory` - assert!(Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(Package::is_initialized(TEST_PACKAGE_NAME, &test_directory)); +} + +#[test] +fn initialize_valid_package_with_author() { + let test_directory = test_dir(); + + // Ensure a package can be initialized at the `test_directory` + assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory)); + + // Initialize a package at the `test_directory` + assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, Some(String::from("test_user"))).is_ok()); + + // Ensure a package is initialized at the `test_directory` + assert!(Package::is_initialized(TEST_PACKAGE_NAME, &test_directory)); } #[test] @@ -49,37 +63,19 @@ fn initialize_fails_with_existing_manifest() { let test_directory = test_dir(); // Ensure a package can be initialized at the `test_directory` - assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory)); // Manually add a manifest file to the `test_directory` - Manifest::new(TEST_PACKAGE_NAME) + Manifest::new(TEST_PACKAGE_NAME, None) .unwrap() .write_to(&test_directory) .unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` - assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); -} - -#[test] -fn initialize_fails_with_existing_library_file() { - let test_directory = test_dir(); - - // Ensure a package can be initialized at the `test_directory` - assert!(Package::can_initialize(TEST_PACKAGE_NAME, true, &test_directory)); - - // Manually add a source directory and a library file to the `test_directory` - SourceDirectory::create(&test_directory).unwrap(); - LibraryFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); - - // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, true, &test_directory).is_err()); - - // Ensure package is not initialized at the `test_directory` - assert!(!Package::is_initialized(TEST_PACKAGE_NAME, true, &test_directory)); + assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory)); } #[test] @@ -87,17 +83,17 @@ fn initialize_fails_with_existing_input_file() { let test_directory = test_dir(); // Ensure a package can be initialized at the `test_directory` - assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory)); // Manually add an inputs directory and an input file to the `test_directory` InputsDirectory::create(&test_directory).unwrap(); InputFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, Some(String::from("test_user"))).is_err()); // Ensure package is not initialized at the `test_directory` - assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory)); } #[test] @@ -105,17 +101,17 @@ fn initialize_fails_with_existing_state_file() { let test_directory = test_dir(); // Ensure a package can be initialized at the `test_directory` - assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory)); // Manually add an inputs directory and a state file to the `test_directory` InputsDirectory::create(&test_directory).unwrap(); StateFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` - assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory)); } #[test] @@ -123,15 +119,15 @@ fn initialize_fails_with_existing_main_file() { let test_directory = test_dir(); // Ensure a package can be initialized at the `test_directory` - assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(Package::can_initialize(TEST_PACKAGE_NAME, &test_directory)); // Manually add a source directory and a main file to the `test_directory` SourceDirectory::create(&test_directory).unwrap(); MainFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` - assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); + assert!(!Package::is_initialized(TEST_PACKAGE_NAME, &test_directory)); } diff --git a/parser/Cargo.toml b/parser/Cargo.toml index 90fa911858..4b3248e2ef 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-parser" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "AST generated by pest from the Leo grammar rules" homepage = "https://aleo.org" @@ -24,7 +24,7 @@ harness = false [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.lazy_static] version = "1.3.0" @@ -51,6 +51,13 @@ version = "0.4" [dev-dependencies.criterion] version = "0.3" +[dev-dependencies.serde_yaml] +version = "0.8" + +[dev-dependencies.leo-test-framework] +path = "../test-framework" +version = "1.4.0" + [features] default = [ ] ci_skip = [ ] diff --git a/parser/benches/big_circuit.leo b/parser/benches/big_circuit.leo index 01d10c2daa..5d2242581c 100644 --- a/parser/benches/big_circuit.leo +++ b/parser/benches/big_circuit.leo @@ -2,7 +2,7 @@ function main() { const foo = Foo { x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, x5: 5, x6: 6, x7: 7, x8: 8, x9: 9, x10: 10, x11: 11, x12: 12, x13: 13, x14: 14, x15: 15, x16: 16, x17: 17, x18: 18, x19: 19, x20: 20, x21: 21, x22: 22, x23: 23, x24: 24, x25: 25, x26: 26, x27: 27, x28: 28, x29: 29, x30: 30, x31: 31, x32: 32, x33: 33, x34: 34, x35: 35, x36: 36, x37: 37, x38: 38, x39: 39, x40: 40, x41: 41, x42: 42, x43: 43, x44: 44, x45: 45, x46: 46, x47: 47, x48: 48, x49: 49, x50: 50, x51: 51, x52: 52, x53: 53, x54: 54, x55: 55, x56: 56, x57: 57, x58: 58, x59: 59, x60: 60, x61: 61, x62: 62, x63: 63, x64: 64, x65: 65, x66: 66, x67: 67, x68: 68, x69: 69, x70: 70, x71: 71, x72: 72, x73: 73, x74: 74, x75: 75, x76: 76, x77: 77, x78: 78, x79: 79, x80: 80, x81: 81, x82: 82, x83: 83, x84: 84, x85: 85, x86: 86, x87: 87, x88: 88, x89: 89, x90: 90, x91: 91, x92: 92, x93: 93, x94: 94, x95: 95, x96: 96, x97: 97, x98: 98, x99: 99, x100: 100, x101: 101, x102: 102, x103: 103, x104: 104, x105: 105, x106: 106, x107: 107, x108: 108, x109: 109, x110: 110, x111: 111, x112: 112, x113: 113, x114: 114, x115: 115, x116: 116, x117: 117, x118: 118, x119: 119, x120: 120, x121: 121, x122: 122, x123: 123, x124: 124, x125: 125, x126: 126, x127: 127, x128: 128, x129: 129, x130: 130, x131: 131, x132: 132, x133: 133, x134: 134, x135: 135, x136: 136, x137: 137, x138: 138, x139: 139, x140: 140, x141: 141, x142: 142, x143: 143, x144: 144, x145: 145, x146: 146, x147: 147, x148: 148, x149: 149, x150: 150, x151: 151, x152: 152, x153: 153, x154: 154, x155: 155, x156: 156, x157: 157, x158: 158, x159: 159, x160: 160, x161: 161, x162: 162, x163: 163, x164: 164, x165: 165, x166: 166, x167: 167, x168: 168, x169: 169, x170: 170, x171: 171, x172: 172, x173: 173, x174: 174, x175: 175, x176: 176, x177: 177, x178: 178, x179: 179, x180: 180, x181: 181, x182: 182, x183: 183, x184: 184, x185: 185, x186: 186, x187: 187, x188: 188, x189: 189, x190: 190, x191: 191, x192: 192, x193: 193, x194: 194, x195: 195, x196: 196, x197: 197, x198: 198, x199: 199, x200: 200, x201: 201, x202: 202, x203: 203, x204: 204, x205: 205, x206: 206, x207: 207, x208: 208, x209: 209, x210: 210, x211: 211, x212: 212, x213: 213, x214: 214, x215: 215, x216: 216, x217: 217, x218: 218, x219: 219, x220: 220, x221: 221, x222: 222, x223: 223, x224: 224, x225: 225, x226: 226, x227: 227, x228: 228, x229: 229, x230: 230, x231: 231, x232: 232, x233: 233, x234: 234, x235: 235, x236: 236, x237: 237, x238: 238, x239: 239, x240: 240, x241: 241, x242: 242, x243: 243, x244: 244, x245: 245, x246: 246, x247: 247, x248: 248, x249: 249, x250: 250, x251: 251, x252: 252, x253: 253, x254: 254, x255: 255 }; const bar = Foo { x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, x5: 5, x6: 6, x7: 7, x8: 8, x9: 9, x10: 10, x11: 11, x12: 12, x13: 13, x14: 14, x15: 15, x16: 16, x17: 17, x18: 18, x19: 19, x20: 20, x21: 21, x22: 22, x23: 23, x24: 24, x25: 25, x26: 26, x27: 27, x28: 28, x29: 29, x30: 30, x31: 31, x32: 32, x33: 33, x34: 34, x35: 35, x36: 36, x37: 37, x38: 38, x39: 39, x40: 40, x41: 41, x42: 42, x43: 43, x44: 44, x45: 45, x46: 46, x47: 47, x48: 48, x49: 49, x50: 50, x51: 51, x52: 52, x53: 53, x54: 54, x55: 55, x56: 56, x57: 57, x58: 58, x59: 59, x60: 60, x61: 61, x62: 62, x63: 63, x64: 64, x65: 65, x66: 66, x67: 67, x68: 68, x69: 69, x70: 70, x71: 71, x72: 72, x73: 73, x74: 74, x75: 75, x76: 76, x77: 77, x78: 78, x79: 79, x80: 80, x81: 81, x82: 82, x83: 83, x84: 84, x85: 85, x86: 86, x87: 87, x88: 88, x89: 89, x90: 90, x91: 91, x92: 92, x93: 93, x94: 94, x95: 95, x96: 96, x97: 97, x98: 98, x99: 99, x100: 100, x101: 101, x102: 102, x103: 103, x104: 104, x105: 105, x106: 106, x107: 107, x108: 108, x109: 109, x110: 110, x111: 111, x112: 112, x113: 113, x114: 114, x115: 115, x116: 116, x117: 117, x118: 118, x119: 119, x120: 120, x121: 121, x122: 122, x123: 123, x124: 124, x125: 125, x126: 126, x127: 127, x128: 128, x129: 129, x130: 130, x131: 131, x132: 132, x133: 133, x134: 134, x135: 135, x136: 136, x137: 137, x138: 138, x139: 139, x140: 140, x141: 141, x142: 142, x143: 143, x144: 144, x145: 145, x146: 146, x147: 147, x148: 148, x149: 149, x150: 150, x151: 151, x152: 152, x153: 153, x154: 154, x155: 155, x156: 156, x157: 157, x158: 158, x159: 159, x160: 160, x161: 161, x162: 162, x163: 163, x164: 164, x165: 165, x166: 166, x167: 167, x168: 168, x169: 169, x170: 170, x171: 171, x172: 172, x173: 173, x174: 174, x175: 175, x176: 176, x177: 177, x178: 178, x179: 179, x180: 180, x181: 181, x182: 182, x183: 183, x184: 184, x185: 185, x186: 186, x187: 187, x188: 188, x189: 189, x190: 190, x191: 191, x192: 192, x193: 193, x194: 194, x195: 195, x196: 196, x197: 197, x198: 198, x199: 199, x200: 200, x201: 201, x202: 202, x203: 203, x204: 204, x205: 205, x206: 206, x207: 207, x208: 208, x209: 209, x210: 210, x211: 211, x212: 212, x213: 213, x214: 214, x215: 215, x216: 216, x217: 217, x218: 218, x219: 219, x220: 220, x221: 221, x222: 222, x223: 223, x224: 224, x225: 225, x226: 226, x227: 227, x228: 228, x229: 229, x230: 230, x231: 231, x232: 232, x233: 233, x234: 234, x235: 235, x236: 236, x237: 237, x238: 238, x239: 239, x240: 240, x241: 241, x242: 242, x243: 243, x244: 244, x245: 245, x246: 246, x247: 247, x248: 248, x249: 249, x250: 250, x251: 251, x252: 252, x253: 253, x254: 254, x255: 255 }; - return foo.x0 + bar.x255 + return foo.x0 + bar.x255; } circuit Foo { diff --git a/parser/benches/big_if_else.leo b/parser/benches/big_if_else.leo index db0d5f45e8..b00fa9dbb7 100644 --- a/parser/benches/big_if_else.leo +++ b/parser/benches/big_if_else.leo @@ -2,388 +2,388 @@ function main() { const x: u8 = 191; if x == 0 { - return x + return x; } else if x == 1 { - return x - 1 + return x - 1; } else if x == 2 { - return x - 2 + return x - 2; } else if x == 3 { - return x - 3 + return x - 3; } else if x == 4 { - return x - 4 + return x - 4; } else if x == 5 { - return x - 5 + return x - 5; } else if x == 6 { - return x - 6 + return x - 6; } else if x == 7 { - return x - 7 + return x - 7; } else if x == 8 { - return x - 8 + return x - 8; } else if x == 9 { - return x - 9 + return x - 9; } else if x == 10 { - return x - 10 + return x - 10; } else if x == 11 { - return x - 11 + return x - 11; } else if x == 12 { - return x - 12 + return x - 12; } else if x == 13 { - return x - 13 + return x - 13; } else if x == 14 { - return x - 14 + return x - 14; } else if x == 15 { - return x - 15 + return x - 15; } else if x == 16 { - return x - 16 + return x - 16; } else if x == 17 { - return x - 17 + return x - 17; } else if x == 18 { - return x - 18 + return x - 18; } else if x == 19 { - return x - 19 + return x - 19; } else if x == 20 { - return x - 20 + return x - 20; } else if x == 21 { - return x - 21 + return x - 21; } else if x == 22 { - return x - 22 + return x - 22; } else if x == 23 { - return x - 23 + return x - 23; } else if x == 24 { - return x - 24 + return x - 24; } else if x == 25 { - return x - 25 + return x - 25; } else if x == 26 { - return x - 26 + return x - 26; } else if x == 27 { - return x - 27 + return x - 27; } else if x == 28 { - return x - 28 + return x - 28; } else if x == 29 { - return x - 29 + return x - 29; } else if x == 30 { - return x - 30 + return x - 30; } else if x == 31 { - return x - 31 + return x - 31; } else if x == 32 { - return x - 32 + return x - 32; } else if x == 33 { - return x - 33 + return x - 33; } else if x == 34 { - return x - 34 + return x - 34; } else if x == 35 { - return x - 35 + return x - 35; } else if x == 36 { - return x - 36 + return x - 36; } else if x == 37 { - return x - 37 + return x - 37; } else if x == 38 { - return x - 38 + return x - 38; } else if x == 39 { - return x - 39 + return x - 39; } else if x == 40 { - return x - 40 + return x - 40; } else if x == 41 { - return x - 41 + return x - 41; } else if x == 42 { - return x - 42 + return x - 42; } else if x == 43 { - return x - 43 + return x - 43; } else if x == 44 { - return x - 44 + return x - 44; } else if x == 45 { - return x - 45 + return x - 45; } else if x == 46 { - return x - 46 + return x - 46; } else if x == 47 { - return x - 47 + return x - 47; } else if x == 48 { - return x - 48 + return x - 48; } else if x == 49 { - return x - 49 + return x - 49; } else if x == 50 { - return x - 50 + return x - 50; } else if x == 51 { - return x - 51 + return x - 51; } else if x == 52 { - return x - 52 + return x - 52; } else if x == 53 { - return x - 53 + return x - 53; } else if x == 54 { - return x - 54 + return x - 54; } else if x == 55 { - return x - 55 + return x - 55; } else if x == 56 { - return x - 56 + return x - 56; } else if x == 57 { - return x - 57 + return x - 57; } else if x == 58 { - return x - 58 + return x - 58; } else if x == 59 { - return x - 59 + return x - 59; } else if x == 60 { - return x - 60 + return x - 60; } else if x == 61 { - return x - 61 + return x - 61; } else if x == 62 { - return x - 62 + return x - 62; } else if x == 63 { - return x - 63 + return x - 63; } else if x == 64 { - return x - 64 + return x - 64; } else if x == 65 { - return x - 65 + return x - 65; } else if x == 66 { - return x - 66 + return x - 66; } else if x == 67 { - return x - 67 + return x - 67; } else if x == 68 { - return x - 68 + return x - 68; } else if x == 69 { - return x - 69 + return x - 69; } else if x == 70 { - return x - 70 + return x - 70; } else if x == 71 { - return x - 71 + return x - 71; } else if x == 72 { - return x - 72 + return x - 72; } else if x == 73 { - return x - 73 + return x - 73; } else if x == 74 { - return x - 74 + return x - 74; } else if x == 75 { - return x - 75 + return x - 75; } else if x == 76 { - return x - 76 + return x - 76; } else if x == 77 { - return x - 77 + return x - 77; } else if x == 78 { - return x - 78 + return x - 78; } else if x == 79 { - return x - 79 + return x - 79; } else if x == 80 { - return x - 80 + return x - 80; } else if x == 81 { - return x - 81 + return x - 81; } else if x == 82 { - return x - 82 + return x - 82; } else if x == 83 { - return x - 83 + return x - 83; } else if x == 84 { - return x - 84 + return x - 84; } else if x == 85 { - return x - 85 + return x - 85; } else if x == 86 { - return x - 86 + return x - 86; } else if x == 87 { - return x - 87 + return x - 87; } else if x == 88 { - return x - 88 + return x - 88; } else if x == 89 { - return x - 89 + return x - 89; } else if x == 90 { - return x - 90 + return x - 90; } else if x == 91 { - return x - 91 + return x - 91; } else if x == 92 { - return x - 92 + return x - 92; } else if x == 93 { - return x - 93 + return x - 93; } else if x == 94 { - return x - 94 + return x - 94; } else if x == 95 { - return x - 95 + return x - 95; } else if x == 96 { - return x - 96 + return x - 96; } else if x == 97 { - return x - 97 + return x - 97; } else if x == 98 { - return x - 98 + return x - 98; } else if x == 99 { - return x - 99 + return x - 99; } else if x == 100 { - return x - 100 + return x - 100; } else if x == 101 { - return x - 101 + return x - 101; } else if x == 102 { - return x - 102 + return x - 102; } else if x == 103 { - return x - 103 + return x - 103; } else if x == 104 { - return x - 104 + return x - 104; } else if x == 105 { - return x - 105 + return x - 105; } else if x == 106 { - return x - 106 + return x - 106; } else if x == 107 { - return x - 107 + return x - 107; } else if x == 108 { - return x - 108 + return x - 108; } else if x == 109 { - return x - 109 + return x - 109; } else if x == 110 { - return x - 110 + return x - 110; } else if x == 111 { - return x - 111 + return x - 111; } else if x == 112 { - return x - 112 + return x - 112; } else if x == 113 { - return x - 113 + return x - 113; } else if x == 114 { - return x - 114 + return x - 114; } else if x == 115 { - return x - 115 + return x - 115; } else if x == 116 { - return x - 116 + return x - 116; } else if x == 117 { - return x - 117 + return x - 117; } else if x == 118 { - return x - 118 + return x - 118; } else if x == 119 { - return x - 119 + return x - 119; } else if x == 120 { - return x - 120 + return x - 120; } else if x == 121 { - return x - 121 + return x - 121; } else if x == 122 { - return x - 122 + return x - 122; } else if x == 123 { - return x - 123 + return x - 123; } else if x == 124 { - return x - 124 + return x - 124; } else if x == 125 { - return x - 125 + return x - 125; } else if x == 126 { - return x - 126 + return x - 126; } else if x == 127 { - return x - 127 + return x - 127; } else if x == 128 { - return x - 128 + return x - 128; } else if x == 129 { - return x - 129 + return x - 129; } else if x == 130 { - return x - 130 + return x - 130; } else if x == 131 { - return x - 131 + return x - 131; } else if x == 132 { - return x - 132 + return x - 132; } else if x == 133 { - return x - 133 + return x - 133; } else if x == 134 { - return x - 134 + return x - 134; } else if x == 135 { - return x - 135 + return x - 135; } else if x == 136 { - return x - 136 + return x - 136; } else if x == 137 { - return x - 137 + return x - 137; } else if x == 138 { - return x - 138 + return x - 138; } else if x == 139 { - return x - 139 + return x - 139; } else if x == 140 { - return x - 140 + return x - 140; } else if x == 141 { - return x - 141 + return x - 141; } else if x == 142 { - return x - 142 + return x - 142; } else if x == 143 { - return x - 143 + return x - 143; } else if x == 144 { - return x - 144 + return x - 144; } else if x == 145 { - return x - 145 + return x - 145; } else if x == 146 { - return x - 146 + return x - 146; } else if x == 147 { - return x - 147 + return x - 147; } else if x == 148 { - return x - 148 + return x - 148; } else if x == 149 { - return x - 149 + return x - 149; } else if x == 150 { - return x - 150 + return x - 150; } else if x == 151 { - return x - 151 + return x - 151; } else if x == 152 { - return x - 152 + return x - 152; } else if x == 153 { - return x - 153 + return x - 153; } else if x == 154 { - return x - 154 + return x - 154; } else if x == 155 { - return x - 155 + return x - 155; } else if x == 156 { - return x - 156 + return x - 156; } else if x == 157 { - return x - 157 + return x - 157; } else if x == 158 { - return x - 158 + return x - 158; } else if x == 159 { - return x - 159 + return x - 159; } else if x == 160 { - return x - 160 + return x - 160; } else if x == 161 { - return x - 161 + return x - 161; } else if x == 162 { - return x - 162 + return x - 162; } else if x == 163 { - return x - 163 + return x - 163; } else if x == 164 { - return x - 164 + return x - 164; } else if x == 165 { - return x - 165 + return x - 165; } else if x == 166 { - return x - 166 + return x - 166; } else if x == 167 { - return x - 167 + return x - 167; } else if x == 168 { - return x - 168 + return x - 168; } else if x == 169 { - return x - 169 + return x - 169; } else if x == 170 { - return x - 170 + return x - 170; } else if x == 171 { - return x - 171 + return x - 171; } else if x == 172 { - return x - 172 + return x - 172; } else if x == 173 { - return x - 173 + return x - 173; } else if x == 174 { - return x - 174 + return x - 174; } else if x == 175 { - return x - 175 + return x - 175; } else if x == 176 { - return x - 176 + return x - 176; } else if x == 177 { - return x - 177 + return x - 177; } else if x == 178 { - return x - 178 + return x - 178; } else if x == 179 { - return x - 179 + return x - 179; } else if x == 180 { - return x - 180 + return x - 180; } else if x == 181 { - return x - 181 + return x - 181; } else if x == 182 { - return x - 182 + return x - 182; } else if x == 183 { - return x - 183 + return x - 183; } else if x == 184 { - return x - 184 + return x - 184; } else if x == 185 { - return x - 185 + return x - 185; } else if x == 186 { - return x - 186 + return x - 186; } else if x == 187 { - return x - 187 + return x - 187; } else if x == 188 { - return x - 188 + return x - 188; } else if x == 189 { - return x - 189 + return x - 189; } else if x == 190 { - return x - 190 + return x - 190; } else if x == 191 { - return x - 191 + return x - 191; } } \ No newline at end of file diff --git a/parser/benches/big_ternary.leo b/parser/benches/big_ternary.leo index 46e9cd6aed..ccc0b55a51 100644 --- a/parser/benches/big_ternary.leo +++ b/parser/benches/big_ternary.leo @@ -1,5 +1,5 @@ function main() { const x: u8 = 255; - return x == 0 ? x : (x == 1 ? x : (x == 2 ? x : (x == 3 ? x : (x == 4 ? x : (x == 5 ? x : (x == 6 ? x : (x == 7 ? x : (x == 8 ? x : (x == 9 ? x : (x == 10 ? x : (x == 11 ? x : (x == 12 ? x : (x == 13 ? x : (x == 14 ? x : (x == 15 ? x : (x == 16 ? x : (x == 17 ? x : (x == 18 ? x : (x == 19 ? x : (x == 20 ? x : (x == 21 ? x : (x == 22 ? x : (x == 23 ? x : (x == 24 ? x : (x == 25 ? x : (x == 26 ? x : (x == 27 ? x : (x == 28 ? x : (x == 29 ? x : (x == 30 ? x : (x == 31 ? x : (x == 32 ? x : (x == 33 ? x : (x == 34 ? x : (x == 35 ? x : (x == 36 ? x : (x == 37 ? x : (x == 38 ? x : (x == 39 ? x : (x == 40 ? x : (x == 41 ? x : (x == 42 ? x : (x == 43 ? x : (x == 44 ? x : (x == 45 ? x : (x == 46 ? x : (x == 47 ? x : (x == 48 ? x : (x == 49 ? x : (x == 50 ? x : (x == 51 ? x : (x == 52 ? x : (x == 53 ? x : (x == 54 ? x : (x == 55 ? x : (x == 56 ? x : (x == 57 ? x : (x == 58 ? x : (x == 59 ? x : (x == 60 ? x : (x == 61 ? x : (x == 62 ? x : (x == 63 ? x : (x == 64 ? x : (x == 65 ? x : (x == 66 ? x : (x == 67 ? x : (x == 68 ? x : (x == 69 ? x : (x == 70 ? x : (x == 71 ? x : (x == 72 ? x : (x == 73 ? x : (x == 74 ? x : (x == 75 ? x : (x == 76 ? x : (x == 77 ? x : (x == 78 ? x : (x == 79 ? x : (x == 80 ? x : (x == 81 ? x : (x == 82 ? x : (x == 83 ? x : (x == 84 ? x : (x == 85 ? x : (x == 86 ? x : (x == 87 ? x : (x == 88 ? x : (x == 89 ? x : (x == 90 ? x : (x == 91 ? x : (x == 92 ? x : (x == 93 ? x : (x == 94 ? x : (x == 95 ? x : (x == 96 ? x : (x == 97 ? x : (x == 98 ? x : (x == 99 ? x : (x == 100 ? x : (x == 101 ? x : (x == 102 ? x : (x == 103 ? x : (x == 104 ? x : (x == 105 ? x : (x == 106 ? x : (x == 107 ? x : (x == 108 ? x : (x == 109 ? x : (x == 110 ? x : (x == 111 ? x : (x == 112 ? x : (x == 113 ? x : (x == 114 ? x : (x == 115 ? x : (x == 116 ? x : (x == 117 ? x : (x == 118 ? x : (x == 119 ? x : (x == 120 ? x : (x == 121 ? x : (x == 122 ? x : (x == 123 ? x : (x == 124 ? x : (x == 125 ? x : (x == 126 ? x : (x == 127 ? x : (x == 128 ? x : (x == 129 ? x : (x == 130 ? x : (x == 131 ? x : (x == 132 ? x : (x == 133 ? x : (x == 134 ? x : (x == 135 ? x : (x == 136 ? x : (x == 137 ? x : (x == 138 ? x : (x == 139 ? x : (x == 140 ? x : (x == 141 ? x : (x == 142 ? x : (x == 143 ? x : (x == 144 ? x : (x == 145 ? x : (x == 146 ? x : (x == 147 ? x : (x == 148 ? x : (x == 149 ? x : (x == 150 ? x : (x == 151 ? x : (x == 152 ? x : (x == 153 ? x : (x == 154 ? x : (x == 155 ? x : (x == 156 ? x : (x == 157 ? x : (x == 158 ? x : (x == 159 ? x : (x == 160 ? x : (x == 161 ? x : (x == 162 ? x : (x == 163 ? x : (x == 164 ? x : (x == 165 ? x : (x == 166 ? x : (x == 167 ? x : (x == 168 ? x : (x == 169 ? x : (x == 170 ? x : (x == 171 ? x : (x == 172 ? x : (x == 173 ? x : (x == 174 ? x : (x == 175 ? x : (x == 176 ? x : (x == 177 ? x : (x == 178 ? x : (x == 179 ? x : (x == 180 ? x : (x == 181 ? x : (x == 182 ? x : (x == 183 ? x : (x == 184 ? x : (x == 185 ? x : (x == 186 ? x : (x == 187 ? x : (x == 188 ? x : (x == 189 ? x : (x == 190 ? x : (x == 191 ? x : (x == 192 ? x : (x == 193 ? x : (x == 194 ? x : (x == 195 ? x : (x == 196 ? x : (x == 197 ? x : (x == 198 ? x : (x == 199 ? x : (x == 200 ? x : (x == 201 ? x : (x == 202 ? x : (x == 203 ? x : (x == 204 ? x : (x == 205 ? x : (x == 206 ? x : (x == 207 ? x : (x == 208 ? x : (x == 209 ? x : (x == 210 ? x : (x == 211 ? x : (x == 212 ? x : (x == 213 ? x : (x == 214 ? x : (x == 215 ? x : (x == 216 ? x : (x == 217 ? x : (x == 218 ? x : (x == 219 ? x : (x == 220 ? x : (x == 221 ? x : (x == 222 ? x : (x == 223 ? x : (x == 224 ? x : (x == 225 ? x : (x == 226 ? x : (x == 227 ? x : (x == 228 ? x : (x == 229 ? x : (x == 230 ? x : (x == 231 ? x : (x == 232 ? x : (x == 233 ? x : (x == 234 ? x : (x == 235 ? x : (x == 236 ? x : (x == 237 ? x : (x == 238 ? x : (x == 239 ? x : (x == 240 ? x : (x == 241 ? x : (x == 242 ? x : (x == 243 ? x : (x == 244 ? x : (x == 245 ? x : (x == 246 ? x : (x == 247 ? x : (x == 248 ? x : (x == 249 ? x : (x == 250 ? x : (x == 251 ? x : (x == 252 ? x : (x == 253 ? x : (x == 254 ? x : (x == 255 ? x : 0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + return x == 0 ? x : (x == 1 ? x : (x == 2 ? x : (x == 3 ? x : (x == 4 ? x : (x == 5 ? x : (x == 6 ? x : (x == 7 ? x : (x == 8 ? x : (x == 9 ? x : (x == 10 ? x : (x == 11 ? x : (x == 12 ? x : (x == 13 ? x : (x == 14 ? x : (x == 15 ? x : (x == 16 ? x : (x == 17 ? x : (x == 18 ? x : (x == 19 ? x : (x == 20 ? x : (x == 21 ? x : (x == 22 ? x : (x == 23 ? x : (x == 24 ? x : (x == 25 ? x : (x == 26 ? x : (x == 27 ? x : (x == 28 ? x : (x == 29 ? x : (x == 30 ? x : (x == 31 ? x : (x == 32 ? x : (x == 33 ? x : (x == 34 ? x : (x == 35 ? x : (x == 36 ? x : (x == 37 ? x : (x == 38 ? x : (x == 39 ? x : (x == 40 ? x : (x == 41 ? x : (x == 42 ? x : (x == 43 ? x : (x == 44 ? x : (x == 45 ? x : (x == 46 ? x : (x == 47 ? x : (x == 48 ? x : (x == 49 ? x : (x == 50 ? x : (x == 51 ? x : (x == 52 ? x : (x == 53 ? x : (x == 54 ? x : (x == 55 ? x : (x == 56 ? x : (x == 57 ? x : (x == 58 ? x : (x == 59 ? x : (x == 60 ? x : (x == 61 ? x : (x == 62 ? x : (x == 63 ? x : (x == 64 ? x : (x == 65 ? x : (x == 66 ? x : (x == 67 ? x : (x == 68 ? x : (x == 69 ? x : (x == 70 ? x : (x == 71 ? x : (x == 72 ? x : (x == 73 ? x : (x == 74 ? x : (x == 75 ? x : (x == 76 ? x : (x == 77 ? x : (x == 78 ? x : (x == 79 ? x : (x == 80 ? x : (x == 81 ? x : (x == 82 ? x : (x == 83 ? x : (x == 84 ? x : (x == 85 ? x : (x == 86 ? x : (x == 87 ? x : (x == 88 ? x : (x == 89 ? x : (x == 90 ? x : (x == 91 ? x : (x == 92 ? x : (x == 93 ? x : (x == 94 ? x : (x == 95 ? x : (x == 96 ? x : (x == 97 ? x : (x == 98 ? x : (x == 99 ? x : (x == 100 ? x : (x == 101 ? x : (x == 102 ? x : (x == 103 ? x : (x == 104 ? x : (x == 105 ? x : (x == 106 ? x : (x == 107 ? x : (x == 108 ? x : (x == 109 ? x : (x == 110 ? x : (x == 111 ? x : (x == 112 ? x : (x == 113 ? x : (x == 114 ? x : (x == 115 ? x : (x == 116 ? x : (x == 117 ? x : (x == 118 ? x : (x == 119 ? x : (x == 120 ? x : (x == 121 ? x : (x == 122 ? x : (x == 123 ? x : (x == 124 ? x : (x == 125 ? x : (x == 126 ? x : (x == 127 ? x : (x == 128 ? x : (x == 129 ? x : (x == 130 ? x : (x == 131 ? x : (x == 132 ? x : (x == 133 ? x : (x == 134 ? x : (x == 135 ? x : (x == 136 ? x : (x == 137 ? x : (x == 138 ? x : (x == 139 ? x : (x == 140 ? x : (x == 141 ? x : (x == 142 ? x : (x == 143 ? x : (x == 144 ? x : (x == 145 ? x : (x == 146 ? x : (x == 147 ? x : (x == 148 ? x : (x == 149 ? x : (x == 150 ? x : (x == 151 ? x : (x == 152 ? x : (x == 153 ? x : (x == 154 ? x : (x == 155 ? x : (x == 156 ? x : (x == 157 ? x : (x == 158 ? x : (x == 159 ? x : (x == 160 ? x : (x == 161 ? x : (x == 162 ? x : (x == 163 ? x : (x == 164 ? x : (x == 165 ? x : (x == 166 ? x : (x == 167 ? x : (x == 168 ? x : (x == 169 ? x : (x == 170 ? x : (x == 171 ? x : (x == 172 ? x : (x == 173 ? x : (x == 174 ? x : (x == 175 ? x : (x == 176 ? x : (x == 177 ? x : (x == 178 ? x : (x == 179 ? x : (x == 180 ? x : (x == 181 ? x : (x == 182 ? x : (x == 183 ? x : (x == 184 ? x : (x == 185 ? x : (x == 186 ? x : (x == 187 ? x : (x == 188 ? x : (x == 189 ? x : (x == 190 ? x : (x == 191 ? x : (x == 192 ? x : (x == 193 ? x : (x == 194 ? x : (x == 195 ? x : (x == 196 ? x : (x == 197 ? x : (x == 198 ? x : (x == 199 ? x : (x == 200 ? x : (x == 201 ? x : (x == 202 ? x : (x == 203 ? x : (x == 204 ? x : (x == 205 ? x : (x == 206 ? x : (x == 207 ? x : (x == 208 ? x : (x == 209 ? x : (x == 210 ? x : (x == 211 ? x : (x == 212 ? x : (x == 213 ? x : (x == 214 ? x : (x == 215 ? x : (x == 216 ? x : (x == 217 ? x : (x == 218 ? x : (x == 219 ? x : (x == 220 ? x : (x == 221 ? x : (x == 222 ? x : (x == 223 ? x : (x == 224 ? x : (x == 225 ? x : (x == 226 ? x : (x == 227 ? x : (x == 228 ? x : (x == 229 ? x : (x == 230 ? x : (x == 231 ? x : (x == 232 ? x : (x == 233 ? x : (x == 234 ? x : (x == 235 ? x : (x == 236 ? x : (x == 237 ? x : (x == 238 ? x : (x == 239 ? x : (x == 240 ? x : (x == 241 ? x : (x == 242 ? x : (x == 243 ? x : (x == 244 ? x : (x == 245 ? x : (x == 246 ? x : (x == 247 ? x : (x == 248 ? x : (x == 249 ? x : (x == 250 ? x : (x == 251 ? x : (x == 252 ? x : (x == 253 ? x : (x == 254 ? x : (x == 255 ? x : 0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); } \ No newline at end of file diff --git a/parser/benches/long_array.leo b/parser/benches/long_array.leo index 48094244b6..bd8e914940 100644 --- a/parser/benches/long_array.leo +++ b/parser/benches/long_array.leo @@ -53,5 +53,5 @@ function main() { [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31] ]; - return arr1[31][31] + arr2[15][31] + return arr1[31][31] + arr2[15][31]; } diff --git a/parser/benches/long_expr.leo b/parser/benches/long_expr.leo index 31cf1e0641..f6bc95d633 100644 --- a/parser/benches/long_expr.leo +++ b/parser/benches/long_expr.leo @@ -5,5 +5,5 @@ function main() { const d = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; const e = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - return a + b + c + d + e + return a + b + c + d + e; } diff --git a/parser/benches/many_assigns.leo b/parser/benches/many_assigns.leo index 202bbf0da4..60d7a38620 100644 --- a/parser/benches/many_assigns.leo +++ b/parser/benches/many_assigns.leo @@ -384,5 +384,5 @@ function main() { const x382: u8 = x381; const x383: u8 = x382; - return x383 + return x383; } diff --git a/parser/benches/many_foos.leo b/parser/benches/many_foos.leo index 099f04857d..1568cb0c0e 100644 --- a/parser/benches/many_foos.leo +++ b/parser/benches/many_foos.leo @@ -1,196 +1,196 @@ function main() { - return x191(0u32) + return x191(0u32); } -function x0(val: u8) -> u8 { return val } -function x1(val: u8) -> u8 { return x0(val) } -function x2(val: u8) -> u8 { return x1(val) } -function x3(val: u8) -> u8 { return x2(val) } -function x4(val: u8) -> u8 { return x3(val) } -function x5(val: u8) -> u8 { return x4(val) } -function x6(val: u8) -> u8 { return x5(val) } -function x7(val: u8) -> u8 { return x6(val) } -function x8(val: u8) -> u8 { return x7(val) } -function x9(val: u8) -> u8 { return x8(val) } -function x10(val: u8) -> u8 { return x9(val) } -function x11(val: u8) -> u8 { return x10(val) } -function x12(val: u8) -> u8 { return x11(val) } -function x13(val: u8) -> u8 { return x12(val) } -function x14(val: u8) -> u8 { return x13(val) } -function x15(val: u8) -> u8 { return x14(val) } -function x16(val: u8) -> u8 { return x15(val) } -function x17(val: u8) -> u8 { return x16(val) } -function x18(val: u8) -> u8 { return x17(val) } -function x19(val: u8) -> u8 { return x18(val) } -function x20(val: u8) -> u8 { return x19(val) } -function x21(val: u8) -> u8 { return x20(val) } -function x22(val: u8) -> u8 { return x21(val) } -function x23(val: u8) -> u8 { return x22(val) } -function x24(val: u8) -> u8 { return x23(val) } -function x25(val: u8) -> u8 { return x24(val) } -function x26(val: u8) -> u8 { return x25(val) } -function x27(val: u8) -> u8 { return x26(val) } -function x28(val: u8) -> u8 { return x27(val) } -function x29(val: u8) -> u8 { return x28(val) } -function x30(val: u8) -> u8 { return x29(val) } -function x31(val: u8) -> u8 { return x30(val) } -function x32(val: u8) -> u8 { return x31(val) } -function x33(val: u8) -> u8 { return x32(val) } -function x34(val: u8) -> u8 { return x33(val) } -function x35(val: u8) -> u8 { return x34(val) } -function x36(val: u8) -> u8 { return x35(val) } -function x37(val: u8) -> u8 { return x36(val) } -function x38(val: u8) -> u8 { return x37(val) } -function x39(val: u8) -> u8 { return x38(val) } -function x40(val: u8) -> u8 { return x39(val) } -function x41(val: u8) -> u8 { return x40(val) } -function x42(val: u8) -> u8 { return x41(val) } -function x43(val: u8) -> u8 { return x42(val) } -function x44(val: u8) -> u8 { return x43(val) } -function x45(val: u8) -> u8 { return x44(val) } -function x46(val: u8) -> u8 { return x45(val) } -function x47(val: u8) -> u8 { return x46(val) } -function x48(val: u8) -> u8 { return x47(val) } -function x49(val: u8) -> u8 { return x48(val) } -function x50(val: u8) -> u8 { return x49(val) } -function x51(val: u8) -> u8 { return x50(val) } -function x52(val: u8) -> u8 { return x51(val) } -function x53(val: u8) -> u8 { return x52(val) } -function x54(val: u8) -> u8 { return x53(val) } -function x55(val: u8) -> u8 { return x54(val) } -function x56(val: u8) -> u8 { return x55(val) } -function x57(val: u8) -> u8 { return x56(val) } -function x58(val: u8) -> u8 { return x57(val) } -function x59(val: u8) -> u8 { return x58(val) } -function x60(val: u8) -> u8 { return x59(val) } -function x61(val: u8) -> u8 { return x60(val) } -function x62(val: u8) -> u8 { return x61(val) } -function x63(val: u8) -> u8 { return x62(val) } -function x64(val: u8) -> u8 { return x63(val) } -function x65(val: u8) -> u8 { return x64(val) } -function x66(val: u8) -> u8 { return x65(val) } -function x67(val: u8) -> u8 { return x66(val) } -function x68(val: u8) -> u8 { return x67(val) } -function x69(val: u8) -> u8 { return x68(val) } -function x70(val: u8) -> u8 { return x69(val) } -function x71(val: u8) -> u8 { return x70(val) } -function x72(val: u8) -> u8 { return x71(val) } -function x73(val: u8) -> u8 { return x72(val) } -function x74(val: u8) -> u8 { return x73(val) } -function x75(val: u8) -> u8 { return x74(val) } -function x76(val: u8) -> u8 { return x75(val) } -function x77(val: u8) -> u8 { return x76(val) } -function x78(val: u8) -> u8 { return x77(val) } -function x79(val: u8) -> u8 { return x78(val) } -function x80(val: u8) -> u8 { return x79(val) } -function x81(val: u8) -> u8 { return x80(val) } -function x82(val: u8) -> u8 { return x81(val) } -function x83(val: u8) -> u8 { return x82(val) } -function x84(val: u8) -> u8 { return x83(val) } -function x85(val: u8) -> u8 { return x84(val) } -function x86(val: u8) -> u8 { return x85(val) } -function x87(val: u8) -> u8 { return x86(val) } -function x88(val: u8) -> u8 { return x87(val) } -function x89(val: u8) -> u8 { return x88(val) } -function x90(val: u8) -> u8 { return x89(val) } -function x91(val: u8) -> u8 { return x90(val) } -function x92(val: u8) -> u8 { return x91(val) } -function x93(val: u8) -> u8 { return x92(val) } -function x94(val: u8) -> u8 { return x93(val) } -function x95(val: u8) -> u8 { return x94(val) } -function x96(val: u8) -> u8 { return x95(val) } -function x97(val: u8) -> u8 { return x96(val) } -function x98(val: u8) -> u8 { return x97(val) } -function x99(val: u8) -> u8 { return x98(val) } -function x100(val: u8) -> u8 { return x99(val) } -function x101(val: u8) -> u8 { return x100(val) } -function x102(val: u8) -> u8 { return x101(val) } -function x103(val: u8) -> u8 { return x102(val) } -function x104(val: u8) -> u8 { return x103(val) } -function x105(val: u8) -> u8 { return x104(val) } -function x106(val: u8) -> u8 { return x105(val) } -function x107(val: u8) -> u8 { return x106(val) } -function x108(val: u8) -> u8 { return x107(val) } -function x109(val: u8) -> u8 { return x108(val) } -function x110(val: u8) -> u8 { return x109(val) } -function x111(val: u8) -> u8 { return x110(val) } -function x112(val: u8) -> u8 { return x111(val) } -function x113(val: u8) -> u8 { return x112(val) } -function x114(val: u8) -> u8 { return x113(val) } -function x115(val: u8) -> u8 { return x114(val) } -function x116(val: u8) -> u8 { return x115(val) } -function x117(val: u8) -> u8 { return x116(val) } -function x118(val: u8) -> u8 { return x117(val) } -function x119(val: u8) -> u8 { return x118(val) } -function x120(val: u8) -> u8 { return x119(val) } -function x121(val: u8) -> u8 { return x120(val) } -function x122(val: u8) -> u8 { return x121(val) } -function x123(val: u8) -> u8 { return x122(val) } -function x124(val: u8) -> u8 { return x123(val) } -function x125(val: u8) -> u8 { return x124(val) } -function x126(val: u8) -> u8 { return x125(val) } -function x127(val: u8) -> u8 { return x126(val) } -function x128(val: u8) -> u8 { return x127(val) } -function x129(val: u8) -> u8 { return x128(val) } -function x130(val: u8) -> u8 { return x129(val) } -function x131(val: u8) -> u8 { return x130(val) } -function x132(val: u8) -> u8 { return x131(val) } -function x133(val: u8) -> u8 { return x132(val) } -function x134(val: u8) -> u8 { return x133(val) } -function x135(val: u8) -> u8 { return x134(val) } -function x136(val: u8) -> u8 { return x135(val) } -function x137(val: u8) -> u8 { return x136(val) } -function x138(val: u8) -> u8 { return x137(val) } -function x139(val: u8) -> u8 { return x138(val) } -function x140(val: u8) -> u8 { return x139(val) } -function x141(val: u8) -> u8 { return x140(val) } -function x142(val: u8) -> u8 { return x141(val) } -function x143(val: u8) -> u8 { return x142(val) } -function x144(val: u8) -> u8 { return x143(val) } -function x145(val: u8) -> u8 { return x144(val) } -function x146(val: u8) -> u8 { return x145(val) } -function x147(val: u8) -> u8 { return x146(val) } -function x148(val: u8) -> u8 { return x147(val) } -function x149(val: u8) -> u8 { return x148(val) } -function x150(val: u8) -> u8 { return x149(val) } -function x151(val: u8) -> u8 { return x150(val) } -function x152(val: u8) -> u8 { return x151(val) } -function x153(val: u8) -> u8 { return x152(val) } -function x154(val: u8) -> u8 { return x153(val) } -function x155(val: u8) -> u8 { return x154(val) } -function x156(val: u8) -> u8 { return x155(val) } -function x157(val: u8) -> u8 { return x156(val) } -function x158(val: u8) -> u8 { return x157(val) } -function x159(val: u8) -> u8 { return x158(val) } -function x160(val: u8) -> u8 { return x159(val) } -function x161(val: u8) -> u8 { return x160(val) } -function x162(val: u8) -> u8 { return x161(val) } -function x163(val: u8) -> u8 { return x162(val) } -function x164(val: u8) -> u8 { return x163(val) } -function x165(val: u8) -> u8 { return x164(val) } -function x166(val: u8) -> u8 { return x165(val) } -function x167(val: u8) -> u8 { return x166(val) } -function x168(val: u8) -> u8 { return x167(val) } -function x169(val: u8) -> u8 { return x168(val) } -function x170(val: u8) -> u8 { return x169(val) } -function x171(val: u8) -> u8 { return x170(val) } -function x172(val: u8) -> u8 { return x171(val) } -function x173(val: u8) -> u8 { return x172(val) } -function x174(val: u8) -> u8 { return x173(val) } -function x175(val: u8) -> u8 { return x174(val) } -function x176(val: u8) -> u8 { return x175(val) } -function x177(val: u8) -> u8 { return x176(val) } -function x178(val: u8) -> u8 { return x177(val) } -function x179(val: u8) -> u8 { return x178(val) } -function x180(val: u8) -> u8 { return x179(val) } -function x181(val: u8) -> u8 { return x180(val) } -function x182(val: u8) -> u8 { return x181(val) } -function x183(val: u8) -> u8 { return x182(val) } -function x184(val: u8) -> u8 { return x183(val) } -function x185(val: u8) -> u8 { return x184(val) } -function x186(val: u8) -> u8 { return x185(val) } -function x187(val: u8) -> u8 { return x186(val) } -function x188(val: u8) -> u8 { return x187(val) } -function x189(val: u8) -> u8 { return x188(val) } -function x190(val: u8) -> u8 { return x189(val) } -function x191(val: u8) -> u8 { return x190(val) } +function x0(val: u8) -> u8 { return val; } +function x1(val: u8) -> u8 { return x0(val); } +function x2(val: u8) -> u8 { return x1(val); } +function x3(val: u8) -> u8 { return x2(val); } +function x4(val: u8) -> u8 { return x3(val); } +function x5(val: u8) -> u8 { return x4(val); } +function x6(val: u8) -> u8 { return x5(val); } +function x7(val: u8) -> u8 { return x6(val); } +function x8(val: u8) -> u8 { return x7(val); } +function x9(val: u8) -> u8 { return x8(val); } +function x10(val: u8) -> u8 { return x9(val); } +function x11(val: u8) -> u8 { return x10(val); } +function x12(val: u8) -> u8 { return x11(val); } +function x13(val: u8) -> u8 { return x12(val); } +function x14(val: u8) -> u8 { return x13(val); } +function x15(val: u8) -> u8 { return x14(val); } +function x16(val: u8) -> u8 { return x15(val); } +function x17(val: u8) -> u8 { return x16(val); } +function x18(val: u8) -> u8 { return x17(val); } +function x19(val: u8) -> u8 { return x18(val); } +function x20(val: u8) -> u8 { return x19(val); } +function x21(val: u8) -> u8 { return x20(val); } +function x22(val: u8) -> u8 { return x21(val); } +function x23(val: u8) -> u8 { return x22(val); } +function x24(val: u8) -> u8 { return x23(val); } +function x25(val: u8) -> u8 { return x24(val); } +function x26(val: u8) -> u8 { return x25(val); } +function x27(val: u8) -> u8 { return x26(val); } +function x28(val: u8) -> u8 { return x27(val); } +function x29(val: u8) -> u8 { return x28(val); } +function x30(val: u8) -> u8 { return x29(val); } +function x31(val: u8) -> u8 { return x30(val); } +function x32(val: u8) -> u8 { return x31(val); } +function x33(val: u8) -> u8 { return x32(val); } +function x34(val: u8) -> u8 { return x33(val); } +function x35(val: u8) -> u8 { return x34(val); } +function x36(val: u8) -> u8 { return x35(val); } +function x37(val: u8) -> u8 { return x36(val); } +function x38(val: u8) -> u8 { return x37(val); } +function x39(val: u8) -> u8 { return x38(val); } +function x40(val: u8) -> u8 { return x39(val); } +function x41(val: u8) -> u8 { return x40(val); } +function x42(val: u8) -> u8 { return x41(val); } +function x43(val: u8) -> u8 { return x42(val); } +function x44(val: u8) -> u8 { return x43(val); } +function x45(val: u8) -> u8 { return x44(val); } +function x46(val: u8) -> u8 { return x45(val); } +function x47(val: u8) -> u8 { return x46(val); } +function x48(val: u8) -> u8 { return x47(val); } +function x49(val: u8) -> u8 { return x48(val); } +function x50(val: u8) -> u8 { return x49(val); } +function x51(val: u8) -> u8 { return x50(val); } +function x52(val: u8) -> u8 { return x51(val); } +function x53(val: u8) -> u8 { return x52(val); } +function x54(val: u8) -> u8 { return x53(val); } +function x55(val: u8) -> u8 { return x54(val); } +function x56(val: u8) -> u8 { return x55(val); } +function x57(val: u8) -> u8 { return x56(val); } +function x58(val: u8) -> u8 { return x57(val); } +function x59(val: u8) -> u8 { return x58(val); } +function x60(val: u8) -> u8 { return x59(val); } +function x61(val: u8) -> u8 { return x60(val); } +function x62(val: u8) -> u8 { return x61(val); } +function x63(val: u8) -> u8 { return x62(val); } +function x64(val: u8) -> u8 { return x63(val); } +function x65(val: u8) -> u8 { return x64(val); } +function x66(val: u8) -> u8 { return x65(val); } +function x67(val: u8) -> u8 { return x66(val); } +function x68(val: u8) -> u8 { return x67(val); } +function x69(val: u8) -> u8 { return x68(val); } +function x70(val: u8) -> u8 { return x69(val); } +function x71(val: u8) -> u8 { return x70(val); } +function x72(val: u8) -> u8 { return x71(val); } +function x73(val: u8) -> u8 { return x72(val); } +function x74(val: u8) -> u8 { return x73(val); } +function x75(val: u8) -> u8 { return x74(val); } +function x76(val: u8) -> u8 { return x75(val); } +function x77(val: u8) -> u8 { return x76(val); } +function x78(val: u8) -> u8 { return x77(val); } +function x79(val: u8) -> u8 { return x78(val); } +function x80(val: u8) -> u8 { return x79(val); } +function x81(val: u8) -> u8 { return x80(val); } +function x82(val: u8) -> u8 { return x81(val); } +function x83(val: u8) -> u8 { return x82(val); } +function x84(val: u8) -> u8 { return x83(val); } +function x85(val: u8) -> u8 { return x84(val); } +function x86(val: u8) -> u8 { return x85(val); } +function x87(val: u8) -> u8 { return x86(val); } +function x88(val: u8) -> u8 { return x87(val); } +function x89(val: u8) -> u8 { return x88(val); } +function x90(val: u8) -> u8 { return x89(val); } +function x91(val: u8) -> u8 { return x90(val); } +function x92(val: u8) -> u8 { return x91(val); } +function x93(val: u8) -> u8 { return x92(val); } +function x94(val: u8) -> u8 { return x93(val); } +function x95(val: u8) -> u8 { return x94(val); } +function x96(val: u8) -> u8 { return x95(val); } +function x97(val: u8) -> u8 { return x96(val); } +function x98(val: u8) -> u8 { return x97(val); } +function x99(val: u8) -> u8 { return x98(val); } +function x100(val: u8) -> u8 { return x99(val); } +function x101(val: u8) -> u8 { return x100(val); } +function x102(val: u8) -> u8 { return x101(val); } +function x103(val: u8) -> u8 { return x102(val); } +function x104(val: u8) -> u8 { return x103(val); } +function x105(val: u8) -> u8 { return x104(val); } +function x106(val: u8) -> u8 { return x105(val); } +function x107(val: u8) -> u8 { return x106(val); } +function x108(val: u8) -> u8 { return x107(val); } +function x109(val: u8) -> u8 { return x108(val); } +function x110(val: u8) -> u8 { return x109(val); } +function x111(val: u8) -> u8 { return x110(val); } +function x112(val: u8) -> u8 { return x111(val); } +function x113(val: u8) -> u8 { return x112(val); } +function x114(val: u8) -> u8 { return x113(val); } +function x115(val: u8) -> u8 { return x114(val); } +function x116(val: u8) -> u8 { return x115(val); } +function x117(val: u8) -> u8 { return x116(val); } +function x118(val: u8) -> u8 { return x117(val); } +function x119(val: u8) -> u8 { return x118(val); } +function x120(val: u8) -> u8 { return x119(val); } +function x121(val: u8) -> u8 { return x120(val); } +function x122(val: u8) -> u8 { return x121(val); } +function x123(val: u8) -> u8 { return x122(val); } +function x124(val: u8) -> u8 { return x123(val); } +function x125(val: u8) -> u8 { return x124(val); } +function x126(val: u8) -> u8 { return x125(val); } +function x127(val: u8) -> u8 { return x126(val); } +function x128(val: u8) -> u8 { return x127(val); } +function x129(val: u8) -> u8 { return x128(val); } +function x130(val: u8) -> u8 { return x129(val); } +function x131(val: u8) -> u8 { return x130(val); } +function x132(val: u8) -> u8 { return x131(val); } +function x133(val: u8) -> u8 { return x132(val); } +function x134(val: u8) -> u8 { return x133(val); } +function x135(val: u8) -> u8 { return x134(val); } +function x136(val: u8) -> u8 { return x135(val); } +function x137(val: u8) -> u8 { return x136(val); } +function x138(val: u8) -> u8 { return x137(val); } +function x139(val: u8) -> u8 { return x138(val); } +function x140(val: u8) -> u8 { return x139(val); } +function x141(val: u8) -> u8 { return x140(val); } +function x142(val: u8) -> u8 { return x141(val); } +function x143(val: u8) -> u8 { return x142(val); } +function x144(val: u8) -> u8 { return x143(val); } +function x145(val: u8) -> u8 { return x144(val); } +function x146(val: u8) -> u8 { return x145(val); } +function x147(val: u8) -> u8 { return x146(val); } +function x148(val: u8) -> u8 { return x147(val); } +function x149(val: u8) -> u8 { return x148(val); } +function x150(val: u8) -> u8 { return x149(val); } +function x151(val: u8) -> u8 { return x150(val); } +function x152(val: u8) -> u8 { return x151(val); } +function x153(val: u8) -> u8 { return x152(val); } +function x154(val: u8) -> u8 { return x153(val); } +function x155(val: u8) -> u8 { return x154(val); } +function x156(val: u8) -> u8 { return x155(val); } +function x157(val: u8) -> u8 { return x156(val); } +function x158(val: u8) -> u8 { return x157(val); } +function x159(val: u8) -> u8 { return x158(val); } +function x160(val: u8) -> u8 { return x159(val); } +function x161(val: u8) -> u8 { return x160(val); } +function x162(val: u8) -> u8 { return x161(val); } +function x163(val: u8) -> u8 { return x162(val); } +function x164(val: u8) -> u8 { return x163(val); } +function x165(val: u8) -> u8 { return x164(val); } +function x166(val: u8) -> u8 { return x165(val); } +function x167(val: u8) -> u8 { return x166(val); } +function x168(val: u8) -> u8 { return x167(val); } +function x169(val: u8) -> u8 { return x168(val); } +function x170(val: u8) -> u8 { return x169(val); } +function x171(val: u8) -> u8 { return x170(val); } +function x172(val: u8) -> u8 { return x171(val); } +function x173(val: u8) -> u8 { return x172(val); } +function x174(val: u8) -> u8 { return x173(val); } +function x175(val: u8) -> u8 { return x174(val); } +function x176(val: u8) -> u8 { return x175(val); } +function x177(val: u8) -> u8 { return x176(val); } +function x178(val: u8) -> u8 { return x177(val); } +function x179(val: u8) -> u8 { return x178(val); } +function x180(val: u8) -> u8 { return x179(val); } +function x181(val: u8) -> u8 { return x180(val); } +function x182(val: u8) -> u8 { return x181(val); } +function x183(val: u8) -> u8 { return x182(val); } +function x184(val: u8) -> u8 { return x183(val); } +function x185(val: u8) -> u8 { return x184(val); } +function x186(val: u8) -> u8 { return x185(val); } +function x187(val: u8) -> u8 { return x186(val); } +function x188(val: u8) -> u8 { return x187(val); } +function x189(val: u8) -> u8 { return x188(val); } +function x190(val: u8) -> u8 { return x189(val); } +function x191(val: u8) -> u8 { return x190(val); } diff --git a/parser/src/errors/syntax.rs b/parser/src/errors/syntax.rs index c3dc26754b..a5850ee9b5 100644 --- a/parser/src/errors/syntax.rs +++ b/parser/src/errors/syntax.rs @@ -16,7 +16,7 @@ use leo_ast::{FormattedError, LeoError, Span}; -use crate::{DeprecatedError, Token, TokenError}; +use crate::{DeprecatedError, SyntaxResult, Token, TokenError}; #[derive(Debug, Error)] pub enum SyntaxError { @@ -32,6 +32,17 @@ pub enum SyntaxError { impl LeoError for SyntaxError {} +pub fn assert_no_whitespace(left_span: &Span, right_span: &Span, left: &str, right: &str) -> SyntaxResult<()> { + if left_span.col_stop != right_span.col_start { + let mut error_span = left_span + right_span; + error_span.col_start = left_span.col_stop - 1; + error_span.col_stop = right_span.col_start - 1; + return Err(SyntaxError::unexpected_whitespace(left, right, &error_span)); + } + + Ok(()) +} + impl SyntaxError { fn new_from_span(message: String, span: &Span) -> Self { SyntaxError::Error(FormattedError::new_from_span(message, span)) diff --git a/parser/src/parser/context.rs b/parser/src/parser/context.rs index 4ba080dab4..1f4a15c490 100644 --- a/parser/src/parser/context.rs +++ b/parser/src/parser/context.rs @@ -14,9 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::unimplemented; +use std::{borrow::Cow, unimplemented}; -use crate::{tokenizer::*, unexpected_whitespace, SyntaxError, SyntaxResult, Token, KEYWORD_TOKENS}; +use crate::{assert_no_whitespace, tokenizer::*, SyntaxError, SyntaxResult, Token, KEYWORD_TOKENS}; use leo_ast::*; use tendril::format_tendril; @@ -49,7 +49,11 @@ impl ParserContext { .filter(|x| !matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_))) .collect(); ParserContext { - end_span: tokens.last().map(|x| x.span.clone()).unwrap_or_default(), + end_span: tokens + .iter() + .find(|x| !x.span.content.trim().is_empty()) + .map(|x| x.span.clone()) + .unwrap_or_default(), tokens, fuzzy_struct_state: false, } @@ -69,6 +73,14 @@ impl ParserContext { self.tokens.last().ok_or_else(|| self.eof()) } + pub fn peek_token(&self) -> Cow<'_, Token> { + self.tokens + .last() + .map(|x| &x.token) + .map(Cow::Borrowed) + .unwrap_or_else(|| Cow::Owned(Token::Eof)) + } + // pub fn peek_oneof(&self, token: &[Token]) -> SyntaxResult<&SpannedToken> { // if let Some(spanned_token) = self.inner.last() { // if token.iter().any(|x| x == &spanned_token.token) { @@ -140,15 +152,21 @@ impl ParserContext { /// the next token is not a [`GroupCoordinate`]. /// fn peek_group_coordinate(&self, i: &mut usize) -> Option { - let token = self.tokens.get(*i)?; + if *i < 1 { + return None; + } + let token = self.tokens.get(*i - 1)?; *i -= 1; Some(match &token.token { Token::Add => GroupCoordinate::SignHigh, - Token::Minus => match self.tokens.get(*i) { + Token::Minus if *i > 0 => match self.tokens.get(*i - 1) { Some(SpannedToken { token: Token::Int(value), span, }) => { + if *i < 1 { + return None; + } *i -= 1; GroupCoordinate::Number(format_tendril!("-{}", value), span.clone()) } @@ -164,32 +182,32 @@ impl ParserContext { /// Removes the next two tokens if they are a pair of [`GroupCoordinate`] and returns them, /// or [None] if the next token is not a [`GroupCoordinate`]. /// - pub fn eat_group_partial(&mut self) -> SyntaxResult> { - let mut i = self.tokens.len() - 1; - let start_span = match self.tokens.get(i) { - Some(span) => span.span.clone(), - None => return Ok(None), - }; - let first = match self.peek_group_coordinate(&mut i) { - Some(coord) => coord, - None => return Ok(None), - }; - match self.tokens.get(i) { + pub fn eat_group_partial(&mut self) -> Option> { + let mut i = self.tokens.len(); + if i < 1 { + return None; + } + let start_span = self.tokens.get(i - 1)?.span.clone(); + let first = self.peek_group_coordinate(&mut i)?; + if i < 1 { + return None; + } + match self.tokens.get(i - 1) { Some(SpannedToken { token: Token::Comma, .. }) => { i -= 1; } _ => { - return Ok(None); + return None; } } - let second = match self.peek_group_coordinate(&mut i) { - Some(coord) => coord, - None => return Ok(None), - }; + let second = self.peek_group_coordinate(&mut i)?; + if i < 1 { + return None; + } let right_paren_span; - match self.tokens.get(i) { + match self.tokens.get(i - 1) { Some(SpannedToken { token: Token::RightParen, span, @@ -198,11 +216,14 @@ impl ParserContext { i -= 1; } _ => { - return Ok(None); + return None; } } + if i < 1 { + return None; + } let end_span; - match self.tokens.get(i) { + match self.tokens.get(i - 1) { Some(SpannedToken { token: Token::Group, span, @@ -211,18 +232,20 @@ impl ParserContext { i -= 1; } _ => { - return Ok(None); + return None; } } - self.tokens.drain((i + 1)..); - unexpected_whitespace( + self.tokens.drain(i..); + if let Err(e) = assert_no_whitespace( &right_paren_span, &end_span, &format!("({},{})", first, second), "group", - )?; - Ok(Some((first, second, start_span + end_span))) + ) { + return Some(Err(e)); + } + Some(Ok((first, second, start_span + end_span))) } /// diff --git a/parser/src/parser/expression.rs b/parser/src/parser/expression.rs index 042a0520b5..028f506a04 100644 --- a/parser/src/parser/expression.rs +++ b/parser/src/parser/expression.rs @@ -404,7 +404,7 @@ impl ParserContext { match token.token { Token::LeftSquare => { if self.eat(Token::DotDot).is_some() { - let right = if self.peek()?.token != Token::RightSquare { + let right = if self.peek_token().as_ref() != &Token::RightSquare { Some(Box::new(self.parse_expression()?)) } else { None @@ -422,7 +422,7 @@ impl ParserContext { let left = self.parse_expression()?; if self.eat(Token::DotDot).is_some() { - let right = if self.peek()?.token != Token::RightSquare { + let right = if self.peek_token().as_ref() != &Token::RightSquare { Some(Box::new(self.parse_expression()?)) } else { None @@ -554,7 +554,7 @@ impl ParserContext { /// tuple initialization expression. /// pub fn parse_tuple_expression(&mut self, span: &Span) -> SyntaxResult { - if let Some((left, right, span)) = self.eat_group_partial()? { + if let Some((left, right, span)) = self.eat_group_partial().transpose()? { return Ok(Expression::Value(ValueExpression::Group(Box::new(GroupValue::Tuple( GroupTuple { span, @@ -625,6 +625,10 @@ impl ParserContext { } if elements.len() == 1 { self.expect(Token::Comma)?; + if let Some(token) = self.eat(Token::RightSquare) { + end_span = token.span; + break; + } } elements.push(self.parse_spread_or_expression()?); if self.eat(Token::Comma).is_none() { @@ -658,21 +662,21 @@ impl ParserContext { token: Token::Field, span: type_span, }) => { - unexpected_whitespace(&span, &type_span, &value, "field")?; + assert_no_whitespace(&span, &type_span, &value, "field")?; Expression::Value(ValueExpression::Field(value, span + type_span)) } Some(SpannedToken { token: Token::Group, span: type_span, }) => { - unexpected_whitespace(&span, &type_span, &value, "group")?; + assert_no_whitespace(&span, &type_span, &value, "group")?; Expression::Value(ValueExpression::Group(Box::new(GroupValue::Single( value, span + type_span, )))) } Some(SpannedToken { token, span: type_span }) => { - unexpected_whitespace(&span, &type_span, &value, &token.to_string())?; + assert_no_whitespace(&span, &type_span, &value, &token.to_string())?; Expression::Value(ValueExpression::Integer( Self::token_to_int_type(token).expect("unknown int type token"), value, @@ -685,27 +689,11 @@ impl ParserContext { Token::True => Expression::Value(ValueExpression::Boolean("true".into(), span)), Token::False => Expression::Value(ValueExpression::Boolean("false".into(), span)), Token::AddressLit(value) => Expression::Value(ValueExpression::Address(value, span)), - Token::Address => { - self.expect(Token::LeftParen)?; - let value = self.expect_any()?; - let value = if let SpannedToken { - token: Token::AddressLit(value), - .. - } = value - { - value - } else { - return Err(SyntaxError::unexpected_str(&value.token, "address", &value.span)); - }; - - let end = self.expect(Token::RightParen)?; - Expression::Value(ValueExpression::Address(value, span + end)) - } Token::LeftParen => self.parse_tuple_expression(&span)?, Token::LeftSquare => self.parse_array_expression(&span)?, Token::Ident(name) => { let ident = Identifier { name, span }; - if !self.fuzzy_struct_state && self.peek()?.token == Token::LeftCurly { + if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly { self.parse_circuit_expression(ident)? } else { Expression::Identifier(ident) @@ -716,7 +704,7 @@ impl ParserContext { name: token.to_string().into(), span, }; - if !self.fuzzy_struct_state && self.peek()?.token == Token::LeftCurly { + if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly { self.parse_circuit_expression(ident)? } else { Expression::Identifier(ident) diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index 0451c6ab1d..ece7ed5825 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -91,7 +91,7 @@ impl ParserContext { ))); } - unexpected_whitespace(&start, &name.span, &name.name, "@")?; + assert_no_whitespace(&start, &name.span, &name.name, "@")?; let end_span; let arguments = if self.eat(Token::LeftParen).is_some() { @@ -153,7 +153,7 @@ impl ParserContext { Ok(PackageAccess::Star(span)) } else { let name = self.expect_ident()?; - if self.peek()?.token == Token::Dot { + if self.peek_token().as_ref() == &Token::Dot { self.backtrack(SpannedToken { token: Token::Ident(name.name), span: name.span, @@ -188,7 +188,7 @@ impl ParserContext { // Build the rest of the package name including dashes. loop { - match &self.peek()?.token { + match &self.peek_token().as_ref() { Token::Minus => { let span = self.expect(Token::Minus)?; base.span = base.span + span; @@ -312,14 +312,6 @@ impl ParserContext { /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// pub fn parse_function_parameters(&mut self) -> SyntaxResult { - if let Some(token) = self.eat(Token::Input) { - return Ok(FunctionInput::InputKeyword(InputKeyword { - identifier: Identifier { - name: token.token.to_string().into(), - span: token.span, - }, - })); - } let const_ = self.eat(Token::Const); let mutable = self.eat(Token::Mut); let mut name = if let Some(token) = self.eat(Token::LittleSelf) { @@ -369,7 +361,7 @@ impl ParserContext { /// pub fn parse_function_declaration(&mut self) -> SyntaxResult<(Identifier, Function)> { let mut annotations = Vec::new(); - while self.peek()?.token == Token::At { + while self.peek_token().as_ref() == &Token::At { annotations.push(self.parse_annotation()?); } let start = self.expect(Token::Function)?; diff --git a/parser/src/parser/mod.rs b/parser/src/parser/mod.rs index 90b914aa02..9a0cad7a4c 100644 --- a/parser/src/parser/mod.rs +++ b/parser/src/parser/mod.rs @@ -20,16 +20,16 @@ //! method to create a new program ast. mod context; -use context::*; +pub use context::*; -mod expression; -mod file; -mod statement; -mod type_; +pub mod expression; +pub mod file; +pub mod statement; +pub mod type_; use std::unimplemented; -use crate::{tokenizer::*, DeprecatedError, SyntaxError, Token}; +use crate::{errors::assert_no_whitespace, tokenizer::*, DeprecatedError, SyntaxError, Token}; use indexmap::IndexMap; use leo_ast::*; @@ -41,14 +41,3 @@ pub fn parse(path: &str, source: &str) -> SyntaxResult { tokens.parse_program() } - -pub fn unexpected_whitespace(left_span: &Span, right_span: &Span, left: &str, right: &str) -> SyntaxResult<()> { - if left_span.col_stop != right_span.col_start { - let mut error_span = left_span + right_span; - error_span.col_start = left_span.col_stop - 1; - error_span.col_stop = right_span.col_start - 1; - return Err(SyntaxError::unexpected_whitespace(left, right, &error_span)); - } - - Ok(()) -} diff --git a/parser/src/parser/statement.rs b/parser/src/parser/statement.rs index 338d9d59a6..fafc5771df 100644 --- a/parser/src/parser/statement.rs +++ b/parser/src/parser/statement.rs @@ -167,7 +167,7 @@ impl ParserContext { pub fn parse_return_statement(&mut self) -> SyntaxResult { let start = self.expect(Token::Return)?; let expr = self.parse_expression()?; - self.eat(Token::Comma); + self.expect(Token::Semicolon)?; Ok(ReturnStatement { span: &start + expr.span(), @@ -222,13 +222,13 @@ impl ParserContext { } /// - /// Returns a [`FormattedString`] AST node if the next tokens represent a formatted string. + /// Returns a [`FormatString`] AST node if the next tokens represent a formatted string. /// - pub fn parse_formatted_string(&mut self) -> SyntaxResult { + pub fn parse_formatted_string(&mut self) -> SyntaxResult { let start_span; let parts = match self.expect_any()? { SpannedToken { - token: Token::FormattedString(parts), + token: Token::FormatString(parts), span, } => { start_span = span; @@ -242,12 +242,12 @@ impl ParserContext { parameters.push(param); } - Ok(FormattedString { + Ok(FormatString { parts: parts .into_iter() .map(|x| match x { - crate::FormattedStringPart::Const(value) => FormattedStringPart::Const(value), - crate::FormattedStringPart::Container => FormattedStringPart::Container, + crate::FormatStringPart::Const(value) => FormatStringPart::Const(value), + crate::FormatStringPart::Container => FormatStringPart::Container, }) .collect(), span: &start_span + parameters.last().map(|x| x.span()).unwrap_or(&start_span), @@ -316,10 +316,17 @@ impl ParserContext { let mut variable_names = Vec::new(); if self.eat(Token::LeftParen).is_some() { variable_names.push(self.parse_variable_name(&declare)?); + let mut eaten_ending = false; while self.eat(Token::Comma).is_some() { + if self.eat(Token::RightParen).is_some() { + eaten_ending = true; + break; + } variable_names.push(self.parse_variable_name(&declare)?); } - self.expect(Token::RightParen)?; + if !eaten_ending { + self.expect(Token::RightParen)?; + } } else { variable_names.push(self.parse_variable_name(&declare)?); } diff --git a/parser/src/test.rs b/parser/src/test.rs index 8b71f584a6..b6dbf7ae49 100644 --- a/parser/src/test.rs +++ b/parser/src/test.rs @@ -14,93 +14,137 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{ - fs, - path::{Path, PathBuf}, -}; +use leo_ast::{Expression, ExpressionStatement, Span, Statement, ValueExpression}; +use leo_test_framework::runner::{Namespace, ParseType, Runner}; +use serde_yaml::Value; +use tokenizer::Token; -use crate::SyntaxError; +use crate::{tokenizer, ParserContext}; -struct TestFailure { - path: String, - error: SyntaxError, +struct TokenNamespace; + +impl Namespace for TokenNamespace { + fn parse_type(&self) -> ParseType { + ParseType::Line + } + + fn run_test(&self, test: &str) -> Result { + let output = tokenizer::tokenize("test", test.into()); + output + .map(|tokens| { + Value::String( + tokens + .into_iter() + .map(|x| x.to_string()) + .collect::>() + .join(","), + ) + }) + .map_err(|x| x.to_string()) + } } -pub fn find_tests>(path: T, out: &mut Vec<(String, String)>) { - for entry in fs::read_dir(path).expect("fail to read tests").into_iter() { - let entry = entry.expect("fail to read tests").path(); - if entry.is_dir() { - find_tests(entry.as_path(), out); - continue; - } else if entry.extension().map(|x| x.to_str()).flatten().unwrap_or_default() != "leo" { - continue; +fn not_fully_consumed(tokens: &mut ParserContext) -> Result<(), String> { + if !tokens.has_next() { + return Ok(()); + } + let mut out = "did not consume all input: ".to_string(); + while tokens.has_next() { + out.push_str(&tokens.expect_any().unwrap().to_string()); + out.push('\n'); + } + Err(out) +} + +struct ParseExpressionNamespace; + +impl Namespace for ParseExpressionNamespace { + fn parse_type(&self) -> ParseType { + ParseType::Line + } + + fn run_test(&self, test: &str) -> Result { + let tokenizer = tokenizer::tokenize("test", test.into()).map_err(|x| x.to_string())?; + if tokenizer + .iter() + .all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_))) + { + return Ok(serde_yaml::to_value(&Expression::Value(ValueExpression::Implicit( + "".into(), + Span::default(), + ))) + .expect("serialization failed")); } - let content = fs::read_to_string(entry.as_path()).expect("failed to read test"); - out.push((entry.as_path().to_str().unwrap_or_default().to_string(), content)); + let mut tokens = ParserContext::new(tokenizer); + + let parsed = tokens.parse_expression().map_err(|x| x.to_string())?; + not_fully_consumed(&mut tokens)?; + + Ok(serde_yaml::to_value(&parsed).expect("serialization failed")) + } +} + +struct ParseStatementNamespace; + +impl Namespace for ParseStatementNamespace { + fn parse_type(&self) -> ParseType { + ParseType::ContinuousLines + } + + fn run_test(&self, test: &str) -> Result { + let tokenizer = tokenizer::tokenize("test", test.into()).map_err(|x| x.to_string())?; + if tokenizer + .iter() + .all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_))) + { + return Ok(serde_yaml::to_value(&Statement::Expression(ExpressionStatement { + expression: Expression::Value(ValueExpression::Implicit("".into(), Span::default())), + span: Span::default(), + })) + .expect("serialization failed")); + } + let mut tokens = ParserContext::new(tokenizer); + + let parsed = tokens.parse_statement().map_err(|x| x.to_string())?; + not_fully_consumed(&mut tokens)?; + + Ok(serde_yaml::to_value(&parsed).expect("serialization failed")) + } +} + +struct ParseNamespace; + +impl Namespace for ParseNamespace { + fn parse_type(&self) -> ParseType { + ParseType::Whole + } + + fn run_test(&self, test: &str) -> Result { + let tokenizer = tokenizer::tokenize("test", test.into()).map_err(|x| x.to_string())?; + let mut tokens = ParserContext::new(tokenizer); + + let parsed = tokens.parse_program().map_err(|x| x.to_string())?; + not_fully_consumed(&mut tokens)?; + + Ok(serde_yaml::to_value(&parsed).expect("serialization failed")) + } +} + +struct TestRunner; + +impl Runner for TestRunner { + fn resolve_namespace(&self, name: &str) -> Option> { + Some(match name { + "Parse" => Box::new(ParseNamespace), + "ParseStatement" => Box::new(ParseStatementNamespace), + "ParseExpression" => Box::new(ParseExpressionNamespace), + "Token" => Box::new(TokenNamespace), + _ => return None, + }) } } #[test] -pub fn parser_pass_tests() { - let mut pass = 0; - let mut fail = Vec::new(); - let mut tests = Vec::new(); - let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - test_dir.push("../tests/pass/parse/"); - find_tests(&test_dir, &mut tests); - for (path, content) in tests.into_iter() { - match crate::parse(&path, &content) { - Ok(_) => { - pass += 1; - } - Err(e) => { - fail.push(TestFailure { path, error: e }); - } - } - } - if !fail.is_empty() { - for (i, fail) in fail.iter().enumerate() { - println!( - "\n\n-----------------TEST #{} FAILED (and shouldn't have)-----------------", - i + 1 - ); - println!("File: {}", fail.path); - println!("{}", fail.error); - } - panic!("failed {}/{} tests", fail.len(), fail.len() + pass); - } else { - println!("passed {}/{} tests", pass, pass); - } -} - -#[test] -pub fn parser_fail_tests() { - let mut pass = 0; - let mut fail = Vec::new(); - let mut tests = Vec::new(); - let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - test_dir.push("../tests/fail/parse/"); - find_tests(&test_dir, &mut tests); - for (path, content) in tests.into_iter() { - match crate::parse(&path, &content) { - Ok(_) => { - fail.push(path); - } - Err(_e) => { - pass += 1; - } - } - } - if !fail.is_empty() { - for (i, fail) in fail.iter().enumerate() { - println!( - "\n\n-----------------TEST #{} PASSED (and shouldn't have)-----------------", - i + 1 - ); - println!("File: {}", fail); - } - panic!("failed {}/{} tests", fail.len(), fail.len() + pass); - } else { - println!("passed {}/{} tests", pass, pass); - } +pub fn parser_tests() { + leo_test_framework::run_tests(&TestRunner, "parser"); } diff --git a/parser/src/tokenizer/lexer.rs b/parser/src/tokenizer/lexer.rs index 602e39a5c8..404e3c1b00 100644 --- a/parser/src/tokenizer/lexer.rs +++ b/parser/src/tokenizer/lexer.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::tokenizer::{FormattedStringPart, Token}; +use crate::tokenizer::{FormatStringPart, Token}; use leo_ast::Span; use serde::{Deserialize, Serialize}; use tendril::StrTendril; @@ -125,11 +125,11 @@ impl Token { continue; } if start < i { - segments.push(FormattedStringPart::Const( + segments.push(FormatStringPart::Const( input_tendril.subtendril(start as u32, (i - start) as u32), )); } - segments.push(FormattedStringPart::Container); + segments.push(FormatStringPart::Container); start = i + 2; i = start; continue; @@ -143,11 +143,11 @@ impl Token { return (0, None); } if start < i { - segments.push(FormattedStringPart::Const( + segments.push(FormatStringPart::Const( input_tendril.subtendril(start as u32, (i - start) as u32), )); } - return (i + 1, Some(Token::FormattedString(segments))); + return (i + 1, Some(Token::FormatString(segments))); } x if x.is_ascii_digit() => { return Self::eat_integer(&input_tendril); @@ -306,11 +306,7 @@ impl Token { return ( ident.len(), Some(match &*ident { - x if x.starts_with("aleo1") - && x.chars().skip(5).all(|x| x.is_ascii_lowercase() || x.is_ascii_digit()) => - { - Token::AddressLit(ident) - } + x if x.starts_with("aleo1") => Token::AddressLit(ident), "address" => Token::Address, "as" => Token::As, "bool" => Token::Bool, diff --git a/parser/src/tokenizer/token.rs b/parser/src/tokenizer/token.rs index df774c4a82..f5359e83ec 100644 --- a/parser/src/tokenizer/token.rs +++ b/parser/src/tokenizer/token.rs @@ -20,16 +20,16 @@ use tendril::StrTendril; /// Parts of a formatted string for logging to the console. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum FormattedStringPart { +pub enum FormatStringPart { Const(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), Container, } -impl fmt::Display for FormattedStringPart { +impl fmt::Display for FormatStringPart { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - FormattedStringPart::Const(c) => write!(f, "{}", c), - FormattedStringPart::Container => write!(f, "{{}}"), + FormatStringPart::Const(c) => write!(f, "{}", c), + FormatStringPart::Container => write!(f, "{{}}"), } } } @@ -41,7 +41,7 @@ pub enum Token { // Literals CommentLine(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), CommentBlock(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), - FormattedString(Vec), + FormatString(Vec), Ident(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), Int(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), True, @@ -146,6 +146,9 @@ pub enum Token { // ModEq, // OrEq, // AndEq, + + // Meta Tokens + Eof, } /// Represents all valid Leo keyword tokens. @@ -201,7 +204,7 @@ impl fmt::Display for Token { match self { CommentLine(s) => write!(f, "{}", s), CommentBlock(s) => write!(f, "{}", s), - FormattedString(parts) => { + FormatString(parts) => { // todo escapes write!(f, "\"")?; for part in parts.iter() { @@ -289,6 +292,7 @@ impl fmt::Display for Token { Return => write!(f, "return"), Static => write!(f, "static"), String => write!(f, "string"), + Eof => write!(f, ""), // BitAnd => write!(f, "&"), // BitAndEq => write!(f, "&="), // BitOr => write!(f, "|"), diff --git a/parser/tests/serialization/deprecated_error.leo b/parser/tests/serialization/deprecated_error.leo index ce128173b5..d1ce342312 100644 --- a/parser/tests/serialization/deprecated_error.leo +++ b/parser/tests/serialization/deprecated_error.leo @@ -1,5 +1,5 @@ function main() { - return 1 + 1 + return 1 + 1; } test function old { diff --git a/parser/tests/serialization/main.leo b/parser/tests/serialization/main.leo index ef22115243..b12eb1ae6b 100644 --- a/parser/tests/serialization/main.leo +++ b/parser/tests/serialization/main.leo @@ -1,3 +1,3 @@ function main() { - return 1 + 1 + return 1 + 1; } diff --git a/state/Cargo.toml b/state/Cargo.toml index ece7ec71fd..918478ee42 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-state" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "State parser of the Leo programming language" homepage = "https://aleo.org" @@ -19,11 +19,11 @@ edition = "2018" [dependencies.leo-input] path = "../input" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.snarkvm-algorithms] version = "0.2.2" diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index 43a26b8ef9..8a0f57fece 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-synthesizer" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Circuit synthesizer of the Leo programming language" homepage = "https://aleo.org" diff --git a/test-framework/Cargo.toml b/test-framework/Cargo.toml new file mode 100644 index 0000000000..0f3e2ce847 --- /dev/null +++ b/test-framework/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "leo-test-framework" +version = "1.4.0" +authors = [ "The Aleo Team " ] +description = "Leo testing framework" +homepage = "https://aleo.org" +repository = "https://github.com/AleoHQ/leo" +keywords = [ + "aleo", + "cryptography", + "leo", + "programming-language", + "zero-knowledge" +] +categories = [ "cryptography::cryptocurrencies", "web-programming" ] +include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ] +license = "GPL-3.0" +edition = "2018" + +[dependencies.serde] +version = "1.0" +features = [ "derive" ] + +[dependencies.serde_json] +version = "1.0" + +[dependencies.serde_yaml] +version = "0.8" diff --git a/test-framework/src/error.rs b/test-framework/src/error.rs new file mode 100644 index 0000000000..c49ebe75f1 --- /dev/null +++ b/test-framework/src/error.rs @@ -0,0 +1,124 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use std::fmt; + +use serde_yaml::Value; + +use crate::test::TestExpectationMode; + +pub struct TestFailure { + pub path: String, + pub errors: Vec, +} + +#[derive(Debug)] +pub enum TestError { + UnexpectedOutput { + index: usize, + expected: Value, + output: Value, + }, + PassedAndShouldntHave { + index: usize, + }, + FailedAndShouldntHave { + index: usize, + error: String, + }, + UnexpectedError { + index: usize, + expected: String, + output: String, + }, + MismatchedTestExpectationLength, +} + +impl fmt::Display for TestError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + TestError::UnexpectedOutput { + index, + expected, + output, + } => { + write!( + f, + "test #{} expected\n{}\ngot\n{}", + index + 1, + serde_yaml::to_string(&expected).expect("serialization failed"), + serde_yaml::to_string(&output).expect("serialization failed") + ) + } + TestError::PassedAndShouldntHave { index } => write!(f, "test #{} passed and shouldn't have", index + 1), + TestError::FailedAndShouldntHave { index, error } => { + write!(f, "test #{} failed and shouldn't have:\n{}", index + 1, error) + } + TestError::UnexpectedError { + expected, + output, + index, + } => { + write!(f, "test #{} expected error\n{}\ngot\n{}", index + 1, expected, output) + } + TestError::MismatchedTestExpectationLength => write!(f, "invalid number of test expectations"), + } + } +} + +pub fn emit_errors( + output: Result<&Value, &str>, + mode: &TestExpectationMode, + expected_output: Option, + test_index: usize, +) -> Option { + match (output, mode) { + (Ok(output), TestExpectationMode::Pass) => { + // passed and should have + if let Some(expected_output) = expected_output.as_ref() { + if output != expected_output { + // invalid output + return Some(TestError::UnexpectedOutput { + index: test_index, + expected: expected_output.clone(), + output: output.clone(), + }); + } + } + None + } + (Ok(_tokens), TestExpectationMode::Fail) => Some(TestError::PassedAndShouldntHave { index: test_index }), + (Err(err), TestExpectationMode::Pass) => Some(TestError::FailedAndShouldntHave { + error: err.to_string(), + index: test_index, + }), + (Err(err), TestExpectationMode::Fail) => { + let expected_output: Option = + expected_output.map(|x| serde_yaml::from_value(x).expect("test expectation deserialize failed")); + if let Some(expected_output) = expected_output.as_deref() { + if err != expected_output { + // invalid output + return Some(TestError::UnexpectedError { + expected: expected_output.to_string(), + output: err.to_string(), + index: test_index, + }); + } + } + None + } + } +} diff --git a/test-framework/src/fetch.rs b/test-framework/src/fetch.rs new file mode 100644 index 0000000000..7c9d763d84 --- /dev/null +++ b/test-framework/src/fetch.rs @@ -0,0 +1,56 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use std::{fs, path::Path}; + +pub fn find_tests>(path: T, out: &mut Vec<(String, String)>) { + for entry in fs::read_dir(path).expect("fail to read tests").into_iter() { + let entry = entry.expect("fail to read tests").path(); + if entry.is_dir() { + find_tests(entry.as_path(), out); + continue; + } else if entry.extension().map(|x| x.to_str()).flatten().unwrap_or_default() != "leo" { + continue; + } + let content = fs::read_to_string(entry.as_path()).expect("failed to read test"); + out.push((entry.as_path().to_str().unwrap_or_default().to_string(), content)); + } +} + +pub fn split_tests_oneline(source: &str) -> Vec<&str> { + source.lines().map(|x| x.trim()).filter(|x| !x.is_empty()).collect() +} + +pub fn split_tests_twoline(source: &str) -> Vec { + let mut out = vec![]; + let mut lines = vec![]; + for line in source.lines() { + let line = line.trim(); + if line.is_empty() { + if !lines.is_empty() { + out.push(lines.join("\n")); + } + lines.clear(); + continue; + } + lines.push(line); + } + let last_test = lines.join("\n"); + if !last_test.trim().is_empty() { + out.push(last_test.trim().to_string()); + } + out +} diff --git a/test-framework/src/lib.rs b/test-framework/src/lib.rs new file mode 100644 index 0000000000..48860f2f56 --- /dev/null +++ b/test-framework/src/lib.rs @@ -0,0 +1,35 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +//! The test framework to run integration tests with Leo code text. +//! +//! This module contains the [`run_tests()`] method which runs all integration tests in the +//! root [`tests/`] directory. +//! +//! To regenerate the tests after a syntax change or failing test, delete the [`tests/expectations/`] +//! directory and run the [`parser_tests()`] test in [`parser/src/test.rs`]. + +pub mod error; + +pub mod fetch; + +pub mod output; + +pub mod runner; + +pub mod test; + +pub use runner::*; diff --git a/test-framework/src/output.rs b/test-framework/src/output.rs new file mode 100644 index 0000000000..1d4361657c --- /dev/null +++ b/test-framework/src/output.rs @@ -0,0 +1,25 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use crate::test::TestExpectationMode; +use serde_yaml::Value; + +#[derive(serde::Serialize, serde::Deserialize, Clone)] +pub struct TestExpectation { + pub namespace: String, + pub expectation: TestExpectationMode, + pub outputs: Vec, +} diff --git a/test-framework/src/runner.rs b/test-framework/src/runner.rs new file mode 100644 index 0000000000..0a473e73b5 --- /dev/null +++ b/test-framework/src/runner.rs @@ -0,0 +1,196 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use serde_yaml::Value; +use std::path::{Path, PathBuf}; + +use crate::{error::*, fetch::find_tests, output::TestExpectation, test::*}; + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum ParseType { + Line, + ContinuousLines, + Whole, +} + +pub trait Namespace { + fn parse_type(&self) -> ParseType; + + fn run_test(&self, test: &str) -> Result; +} + +pub trait Runner { + fn resolve_namespace(&self, name: &str) -> Option>; +} + +pub fn run_tests(runner: &T, expectation_category: &str) { + let mut pass_categories = 0; + let mut pass_tests = 0; + let mut fail_tests = 0; + let mut fail_categories = Vec::new(); + + let mut tests = Vec::new(); + let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + test_dir.push("../tests/"); + + let mut expectation_dir = test_dir.clone(); + expectation_dir.push("expectations"); + + find_tests(&test_dir, &mut tests); + let mut outputs = vec![]; + + for (path, content) in tests.into_iter() { + let config = extract_test_config(&content); + if config.is_none() { + panic!("missing configuration for {}", path); + } + let config = config.unwrap(); + let namespace = runner.resolve_namespace(&config.namespace); + if namespace.is_none() { + continue; + } + let namespace = namespace.unwrap(); + + let path = Path::new(&path); + let relative_path = path.strip_prefix(&test_dir).expect("path error for test"); + let mut expectation_path = expectation_dir.clone(); + expectation_path.push(expectation_category); + expectation_path.push(relative_path.parent().expect("no parent dir for test")); + let mut test_name = relative_path + .file_name() + .expect("no file name for test") + .to_str() + .unwrap() + .to_string(); + test_name += ".out"; + expectation_path.push(&test_name); + + let expectations: Option = if expectation_path.exists() { + if !std::env::var("CLEAR_LEO_TEST_EXPECTATIONS") + .unwrap_or_default() + .trim() + .is_empty() + { + None + } else { + let raw = std::fs::read_to_string(&expectation_path).expect("failed to read expectations file"); + Some(serde_yaml::from_str(&raw).expect("invalid yaml in expectations file")) + } + } else { + None + }; + + let end_of_header = content.find("*/").expect("failed to find header block in test"); + let content = &content[end_of_header + 2..]; + + let tests = match namespace.parse_type() { + ParseType::Line => crate::fetch::split_tests_oneline(content) + .into_iter() + .map(|x| x.to_string()) + .collect(), + ParseType::ContinuousLines => crate::fetch::split_tests_twoline(content), + ParseType::Whole => vec![content.to_string()], + }; + + let mut errors = vec![]; + if let Some(expectations) = expectations.as_ref() { + if tests.len() != expectations.outputs.len() { + errors.push(TestError::MismatchedTestExpectationLength); + } + } + + let mut new_outputs = vec![]; + + let mut expected_output = expectations.as_ref().map(|x| x.outputs.iter()); + for (i, test) in tests.into_iter().enumerate() { + let expected_output = expected_output + .as_mut() + .map(|x| x.next()) + .flatten() + .map(|x| x.as_str()) + .flatten(); + let output = namespace.run_test(&test); + if let Some(error) = emit_errors( + output.as_ref().map_err(|x| &**x), + &config.expectation, + expected_output.map(|x| Value::String(x.to_string())), + i, + ) { + fail_tests += 1; + errors.push(error); + } else { + pass_tests += 1; + new_outputs.push( + output + .as_ref() + .map(|x| serde_yaml::to_value(x).expect("serialization failed")) + .unwrap_or_else(|e| Value::String(e.clone())), + ); + } + } + + if errors.is_empty() { + if expectations.is_none() { + outputs.push((expectation_path, TestExpectation { + namespace: config.namespace, + expectation: config.expectation, + outputs: new_outputs, + })); + } + pass_categories += 1; + } else { + fail_categories.push(TestFailure { + path: path.to_str().unwrap().to_string(), + errors, + }) + } + } + if !fail_categories.is_empty() { + for (i, fail) in fail_categories.iter().enumerate() { + println!( + "\n\n-----------------TEST #{} FAILED (and shouldn't have)-----------------", + i + 1 + ); + println!("File: {}", fail.path); + for error in &fail.errors { + println!("{}", error); + } + } + panic!( + "failed {}/{} tests in {}/{} categories", + pass_tests, + fail_tests + pass_tests, + fail_categories.len(), + fail_categories.len() + pass_categories + ); + } else { + for (path, new_expectation) in outputs { + std::fs::create_dir_all(path.parent().unwrap()).expect("failed to make test expectation parent directory"); + std::fs::write( + &path, + serde_yaml::to_string(&new_expectation).expect("failed to serialize expectation yaml"), + ) + .expect("failed to write expectation file"); + } + println!( + "passed {}/{} tests in {}/{} categories", + pass_tests, + fail_tests + pass_tests, + pass_categories, + pass_categories + ); + } +} diff --git a/test-framework/src/test.rs b/test-framework/src/test.rs new file mode 100644 index 0000000000..3e1f64694b --- /dev/null +++ b/test-framework/src/test.rs @@ -0,0 +1,34 @@ +// Copyright (C) 2019-2021 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug, Clone)] +pub enum TestExpectationMode { + Pass, + Fail, +} + +#[derive(serde::Serialize, serde::Deserialize)] +pub struct TestConfig { + pub namespace: String, + pub expectation: TestExpectationMode, +} + +pub fn extract_test_config(source: &str) -> Option { + let first_comment_start = source.find("/*")?; + let end_first_comment = source[first_comment_start + 2..].find("*/")?; + let comment_inner = &source[first_comment_start + 2..first_comment_start + 2 + end_first_comment]; + Some(serde_yaml::from_str(comment_inner).expect("invalid test configuration")) +} diff --git a/tests/expectations/parser/parser/circuits/big_self.leo.out b/tests/expectations/parser/parser/circuits/big_self.leo.out new file mode 100644 index 0000000000..ee647ea625 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/big_self.leo.out @@ -0,0 +1,52 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x() -> Self {\\\"}\"}" + input: [] + output: SelfType + block: + statements: + - Return: + expression: + CircuitInit: + name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" return Self {};\\\"}\"}" + members: [] + span: + line_start: 5 + line_stop: 5 + col_start: 16 + col_stop: 23 + path: test + content: " return Self {};" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 23 + path: test + content: " return Self {};" + span: + line_start: 4 + line_stop: 6 + col_start: 26 + col_stop: 6 + path: test + content: " function x() -> Self {\n...\n }" + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: test + content: " function x() -> Self {\n...\n }" + functions: {} diff --git a/tests/expectations/parser/parser/circuits/empty.leo.out b/tests/expectations/parser/parser/circuits/empty.leo.out new file mode 100644 index 0000000000..0fa7fe2114 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/empty.leo.out @@ -0,0 +1,12 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: [] + functions: {} diff --git a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out new file mode 100644 index 0000000000..02b64f582e --- /dev/null +++ b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out @@ -0,0 +1,96 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitVariable: + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" + - IntegerType: U32 + - CircuitVariable: + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}" + - IntegerType: U32 + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 7 + line_stop: 7 + col_start: 16 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 7 + line_stop: 7 + col_start: 9 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 6 + line_stop: 8 + col_start: 18 + col_stop: 6 + path: test + content: " function x() {\n...\n }" + span: + line_start: 6 + line_stop: 8 + col_start: 5 + col_stop: 6 + path: test + content: " function x() {\n...\n }" + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 10 + line_stop: 10 + col_start: 16 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 10 + line_stop: 10 + col_start: 9 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 9 + line_stop: 11 + col_start: 18 + col_stop: 6 + path: test + content: " function y() {\n...\n }" + span: + line_start: 9 + line_stop: 11 + col_start: 5 + col_stop: 6 + path: test + content: " function y() {\n...\n }" + functions: {} diff --git a/tests/expectations/parser/parser/circuits/fields.leo.out b/tests/expectations/parser/parser/circuits/fields.leo.out new file mode 100644 index 0000000000..354a6892bc --- /dev/null +++ b/tests/expectations/parser/parser/circuits/fields.leo.out @@ -0,0 +1,18 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitVariable: + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" + - IntegerType: U32 + - CircuitVariable: + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}" + - IntegerType: U32 + functions: {} diff --git a/tests/expectations/parser/parser/circuits/functions.leo.out b/tests/expectations/parser/parser/circuits/functions.leo.out new file mode 100644 index 0000000000..71b4a7a2bb --- /dev/null +++ b/tests/expectations/parser/parser/circuits/functions.leo.out @@ -0,0 +1,90 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 16 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 18 + col_stop: 6 + path: test + content: " function x() {\n...\n }" + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: test + content: " function x() {\n...\n }" + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 8 + line_stop: 8 + col_start: 16 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 8 + line_stop: 8 + col_start: 9 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 7 + line_stop: 9 + col_start: 18 + col_stop: 6 + path: test + content: " function y() {\n...\n }" + span: + line_start: 7 + line_stop: 9 + col_start: 5 + col_stop: 6 + path: test + content: " function y() {\n...\n }" + functions: {} diff --git a/tests/expectations/parser/parser/circuits/mut_self.leo.out b/tests/expectations/parser/parser/circuits/mut_self.leo.out new file mode 100644 index 0000000000..54800e5ed7 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/mut_self.leo.out @@ -0,0 +1,52 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}" + input: + - MutSelfKeyword: "{\"name\":\"mut self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":24,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(mut self) {\\\"}\"}" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 16 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 26 + col_stop: 6 + path: test + content: " function x(mut self) {\n...\n }" + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: test + content: " function x(mut self) {\n...\n }" + functions: {} diff --git a/tests/expectations/parser/parser/circuits/self.leo.out b/tests/expectations/parser/parser/circuits/self.leo.out new file mode 100644 index 0000000000..6f1445d071 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/self.leo.out @@ -0,0 +1,52 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitFunction: + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}" + input: + - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 16 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 18 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 22 + col_stop: 6 + path: test + content: " function x(self) {\n...\n }" + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: test + content: " function x(self) {\n...\n }" + functions: {} diff --git a/tests/expectations/parser/parser/expression/access/array_access.leo.out b/tests/expectations/parser/parser/expression/access/array_access.leo.out new file mode 100644 index 0000000000..5c820cc814 --- /dev/null +++ b/tests/expectations/parser/parser/expression/access/array_access.leo.out @@ -0,0 +1,267 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0]\\\"}\"}" + index: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[0]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x[0]" + - ArrayAccess: + array: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X[1]\\\"}\"}" + index: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "X[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "X[1]" + - ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u8]\\\"}\"}" + index: + Value: + Integer: + - U8 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[0u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[0u8]" + - ArrayAccess: + array: + ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1u8][2u8]\\\"}\"}" + index: + Value: + Integer: + - U8 + - "1" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[1u8][2u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[1u8][2u8]" + index: + Value: + Integer: + - U8 + - "2" + - line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: test + content: "x[1u8][2u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: "x[1u8][2u8]" + - ArrayAccess: + array: + ArrayAccess: + array: + ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + index: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x[x][y][z]" + index: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x[x][y][z]" + index: + Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: "x[x][y][z]" + - Call: + function: + ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0]()\\\"}\"}" + index: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[0]()" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x[0]()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[0]()" + - ArrayAccess: + array: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x()[0]\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "x()[0]" + index: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "x()[0]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x()[0]" + - Call: + function: + CircuitStaticFunctionAccess: + circuit: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x(y)::y(x)" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x(y)::y(x)" + arguments: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: "x(y)::y(x)" + - ArrayAccess: + array: + TupleAccess: + tuple: + ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + index: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x[x].0[x]" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[x].0[x]" + index: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "x[x].0[x]" diff --git a/tests/expectations/parser/parser/expression/access/array_range_access.leo.out b/tests/expectations/parser/parser/expression/access/array_range_access.leo.out new file mode 100644 index 0000000000..10b02e133d --- /dev/null +++ b/tests/expectations/parser/parser/expression/access/array_range_access.leo.out @@ -0,0 +1,401 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" + left: ~ + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "x[..]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1..]\\\"}\"}" + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[1..]" + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[1..]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..1]\\\"}\"}" + left: ~ + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "x[..1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[..1]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1..1]\\\"}\"}" + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[1..1]" + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "x[1..1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x[1..1]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0..100]\\\"}\"}" + left: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[0..100]" + right: + Value: + Implicit: + - "100" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 9 + path: test + content: "x[0..100]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "x[0..100]" + - ArrayAccess: + array: + ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[323452345.2345234523453453][323452345.2345234523453453]\\\"}\"}" + index: + TupleAccess: + tuple: + Value: + Implicit: + - "323452345" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 12 + path: test + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + index: + value: "2345234523453453" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 29 + path: test + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 30 + path: test + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + index: + TupleAccess: + tuple: + Value: + Implicit: + - "323452345" + - line_start: 1 + line_stop: 1 + col_start: 31 + col_stop: 40 + path: test + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + index: + value: "2345234523453453" + span: + line_start: 1 + line_stop: 1 + col_start: 31 + col_stop: 57 + path: test + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 58 + path: test + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u8..1u8]\\\"}\"}" + left: + Value: + Integer: + - U8 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[0u8..1u8]" + right: + Value: + Integer: + - U8 + - "1" + - line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: test + content: "x[0u8..1u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: "x[0u8..1u8]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u8..]\\\"}\"}" + left: + Value: + Integer: + - U8 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[0u8..]" + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "x[0u8..]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..0u8]\\\"}\"}" + left: ~ + right: + Value: + Integer: + - U8 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "x[..0u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "x[..0u8]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" + left: ~ + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "x[..]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" + left: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[x.y..]" + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "x[x.y..]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" + left: ~ + right: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "x[..y.x]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "x[..y.x]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + left: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[x.y..y.x]" + right: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: test + content: "x[x.y..y.x]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: "x[x.y..y.x]" + - ArrayRangeAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + left: + CircuitMemberAccess: + circuit: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "x[x.y.x..y.x.y]" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 8 + path: test + content: "x[x.y.x..y.x.y]" + right: + CircuitMemberAccess: + circuit: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 13 + path: test + content: "x[x.y.x..y.x.y]" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: "x[x.y.x..y.x.y]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: "x[x.y.x..y.x.y]" diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out new file mode 100644 index 0000000000..ed9e9058da --- /dev/null +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -0,0 +1,162 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x()\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x() + - Call: + function: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X()\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: X() + - Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: x(y) + - Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" + - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x(y, z)" + - Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" + - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: "x(x, y, z)" + - Call: + function: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x::y()" + - Call: + function: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y(x)" + arguments: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x::y(x)" + - Call: + function: + TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.0(x) + arguments: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: x.0(x) + - Call: + function: + ArrayAccess: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" + index: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[0](x)" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x[0](x)" + arguments: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x[0](x)" diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out new file mode 100644 index 0000000000..e10176179c --- /dev/null +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -0,0 +1,120 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.y + - CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" + name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: X.Y + - CircuitMemberAccess: + circuit: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.y.z + name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: x.y.z + - Call: + function: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.y() + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: x.y() + - TupleAccess: + tuple: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.y.0 + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: x.y.0 + - ArrayAccess: + array: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "x.y[1]" + index: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "x.y[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x.y[1]" diff --git a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out new file mode 100644 index 0000000000..eed96329a1 --- /dev/null +++ b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out @@ -0,0 +1,120 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y" + - CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" + name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "X::Y" + - CircuitStaticFunctionAccess: + circuit: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y::z" + name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x::y::z" + - Call: + function: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x::y()" + - TupleAccess: + tuple: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y.0" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x::y.0" + - ArrayAccess: + array: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x::y[1]" + index: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "x::y[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x::y[1]" diff --git a/tests/expectations/parser/parser/expression/access/tuple.leo.out b/tests/expectations/parser/parser/expression/access/tuple.leo.out new file mode 100644 index 0000000000..c4089a4522 --- /dev/null +++ b/tests/expectations/parser/parser/expression/access/tuple.leo.out @@ -0,0 +1,109 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0\\\"}\"}" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.0 + - TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.1\\\"}\"}" + index: + value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.1 + - TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.2\\\"}\"}" + index: + value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.2 + - TupleAccess: + tuple: + TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0.0\\\"}\"}" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.0.0 + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: x.0.0 + - TupleAccess: + tuple: + TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.1.1\\\"}\"}" + index: + value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.1.1 + index: + value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: x.1.1 + - TupleAccess: + tuple: + TupleAccess: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.2.2\\\"}\"}" + index: + value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.2.2 + index: + value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: x.2.2 diff --git a/tests/expectations/parser/parser/expression/array_init.leo.out b/tests/expectations/parser/parser/expression/array_init.leo.out new file mode 100644 index 0000000000..c8ee3bfb32 --- /dev/null +++ b/tests/expectations/parser/parser/expression/array_init.leo.out @@ -0,0 +1,150 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - ArrayInit: + element: + Value: + Integer: + - U8 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "[0u8; 1]" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "[0u8; 1]" + - ArrayInit: + element: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[0; 1]" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "[0; 1]" + - ArrayInit: + element: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[0; (1)]" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "[0; (1)]" + - ArrayInit: + element: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[0; (1, 2)]" + dimensions: + - value: "1" + - value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: "[0; (1, 2)]" + - ArrayInit: + element: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[0; (1, 2, 3)]" + dimensions: + - value: "1" + - value: "2" + - value: "3" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: "[0; (1, 2, 3)]" + - ArrayInit: + element: + ArrayInit: + element: + ArrayInit: + element: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 5 + path: test + content: "[[[0; 3]; 2]; 1]" + dimensions: + - value: "3" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 9 + path: test + content: "[[[0; 3]; 2]; 1]" + dimensions: + - value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 13 + path: test + content: "[[[0; 3]; 2]; 1]" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: "[[[0; 3]; 2]; 1]" diff --git a/tests/expectations/parser/parser/expression/array_init_fail.leo.out b/tests/expectations/parser/parser/expression/array_init_fail.leo.out new file mode 100644 index 0000000000..3e6e920477 --- /dev/null +++ b/tests/expectations/parser/parser/expression/array_init_fail.leo.out @@ -0,0 +1,6 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - " --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^\n |\n = illegal spread in array initializer" + - " --> test:1:1\n |\n 1 | [...0; 1]\n | ^^^^^\n |\n = illegal spread in array initializer" diff --git a/tests/expectations/parser/parser/expression/array_inline.leo.out b/tests/expectations/parser/parser/expression/array_inline.leo.out new file mode 100644 index 0000000000..ae4ccf624f --- /dev/null +++ b/tests/expectations/parser/parser/expression/array_inline.leo.out @@ -0,0 +1,317 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - ArrayInline: + elements: + - Expression: + Value: + Integer: + - U8 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "[0u8, 1, 2, 3]" + - Expression: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "[0u8, 1, 2, 3]" + - Expression: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: "[0u8, 1, 2, 3]" + - Expression: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: "[0u8, 1, 2, 3]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: "[0u8, 1, 2, 3]" + - ArrayInline: + elements: + - Expression: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "[1]" + - ArrayInline: + elements: + - Expression: + Value: + Integer: + - U8 + - "1" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "[1u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "[1u8]" + - ArrayInline: + elements: + - Expression: + Value: + Integer: + - U8 + - "1" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "[1u8,]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "[1u8,]" + - ArrayInline: + elements: + - Expression: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[0, 1,]" + - Expression: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "[0, 1,]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "[0, 1,]" + - ArrayInline: + elements: + - Expression: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: test + content: "[0,1,]" + - Expression: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 5 + path: test + content: "[0,1,]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "[0,1,]" + - ArrayInline: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: "[]" + - ArrayInline: + elements: + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "[[1,2,3],[1,2,3]]" + - Expression: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "[[1,2,3],[1,2,3]]" + - Expression: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "[[1,2,3],[1,2,3]]" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 9 + path: test + content: "[[1,2,3],[1,2,3]]" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "[[1,2,3],[1,2,3]]" + - Expression: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: "[[1,2,3],[1,2,3]]" + - Expression: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 16 + path: test + content: "[[1,2,3],[1,2,3]]" + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 17 + path: test + content: "[[1,2,3],[1,2,3]]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "[[1,2,3],[1,2,3]]" + - ArrayInline: + elements: + - Expression: + ArrayInline: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "[[]]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "[[]]" + - ArrayInline: + elements: + - Expression: + ArrayInline: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "[[], []]" + - Expression: + ArrayInline: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 8 + path: test + content: "[[], []]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "[[], []]" diff --git a/tests/expectations/parser/parser/expression/array_inline_fail.leo.out b/tests/expectations/parser/parser/expression/array_inline_fail.leo.out new file mode 100644 index 0000000000..3565e3e59c --- /dev/null +++ b/tests/expectations/parser/parser/expression/array_inline_fail.leo.out @@ -0,0 +1,9 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - " --> test:1:2\n |\n 1 | [,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:4\n |\n 1 | [0,,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,0]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,0,]\n | ^\n |\n = expected 'expression', got ','" diff --git a/tests/expectations/parser/parser/expression/binary/add.leo.out b/tests/expectations/parser/parser/expression/binary/add.leo.out new file mode 100644 index 0000000000..72d244dd8d --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/add.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 1 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2+3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2+3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2+3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 + 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 + 3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 + 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 + 3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 + 2 + 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 2 + 3 * 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 * 2 + 3 * 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 - 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 - 3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 - 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 - 3 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 + 2 - 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 18 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 22 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 22 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 diff --git a/tests/expectations/parser/parser/expression/binary/and.leo.out b/tests/expectations/parser/parser/expression/binary/and.leo.out new file mode 100644 index 0000000000..b6f8de5d72 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/and.leo.out @@ -0,0 +1,111 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Boolean: + - "true" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: true && false + right: + Value: + Boolean: + - "false" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: true && false + op: And + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: true && false + - Binary: + left: + Value: + Boolean: + - "false" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: false&&true + right: + Value: + Boolean: + - "true" + - line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 12 + path: test + content: false&&true + op: And + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: false&&true + - Binary: + left: + Binary: + left: + Value: + Boolean: + - "true" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: true&&false&&true + right: + Value: + Boolean: + - "false" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 12 + path: test + content: true&&false&&true + op: And + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: true&&false&&true + right: + Value: + Boolean: + - "true" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 18 + path: test + content: true&&false&&true + op: And + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: true&&false&&true diff --git a/tests/expectations/parser/parser/expression/binary/div.leo.out b/tests/expectations/parser/parser/expression/binary/div.leo.out new file mode 100644 index 0000000000..45684cd859 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/div.leo.out @@ -0,0 +1,180 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 / 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 / 1 + op: Div + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 / 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2/3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2/3 + op: Div + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2/3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 / 2 / 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 / 2 / 3 + op: Div + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 / 2 / 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 / 2 / 3 + op: Div + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 / 2 / 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 ** 2 / 3 ** 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 ** 2 / 3 ** 4 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 ** 2 / 3 ** 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 ** 2 / 3 ** 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 16 + path: test + content: 1 ** 2 / 3 ** 4 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 16 + path: test + content: 1 ** 2 / 3 ** 4 + op: Div + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: 1 ** 2 / 3 ** 4 diff --git a/tests/expectations/parser/parser/expression/binary/eq.leo.out b/tests/expectations/parser/parser/expression/binary/eq.leo.out new file mode 100644 index 0000000000..56f7df069c --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/eq.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 == 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 == 1 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 == 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2==3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 5 + path: test + content: 2==3 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: 2==3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 == 2 == 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 == 2 == 3 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 == 2 == 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 == 2 == 3 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 == 2 == 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 2 == 3 < 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 2 == 3 < 4 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 2 == 3 < 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 < 2 == 3 < 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 < 2 == 3 < 4 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 < 2 == 3 < 4 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 < 2 == 3 < 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 == 2 == 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 == 2 == 3 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 == 2 == 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 == 2 == 3 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 == 2 == 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 20 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 23 + col_stop: 24 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 24 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 + op: Eq + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: 1 < 2 == 3 < 4 == 5 < 6 diff --git a/tests/expectations/parser/parser/expression/binary/exp.leo.out b/tests/expectations/parser/parser/expression/binary/exp.leo.out new file mode 100644 index 0000000000..b0c39a877f --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/exp.leo.out @@ -0,0 +1,244 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 ** 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 ** 1 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 ** 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2**3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 5 + path: test + content: 2**3 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: 2**3 + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 ** 2 ** 3 + right: + Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 ** 2 ** 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 ** 2 ** 3 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 12 + path: test + content: 1 ** 2 ** 3 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 ** 2 ** 3 + - Binary: + left: + Cast: + inner: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 as i8 ** 3 as i8 + target_type: + IntegerType: I8 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: 1 as i8 ** 3 as i8 + right: + Cast: + inner: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 12 + col_stop: 13 + path: test + content: 1 as i8 ** 3 as i8 + target_type: + IntegerType: I8 + span: + line_start: 1 + line_stop: 1 + col_start: 12 + col_stop: 19 + path: test + content: 1 as i8 ** 3 as i8 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: 1 as i8 ** 3 as i8 + - Binary: + left: + Cast: + inner: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + target_type: + IntegerType: I8 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + right: + Binary: + left: + Cast: + inner: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 12 + col_stop: 13 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + target_type: + IntegerType: I8 + span: + line_start: 1 + line_stop: 1 + col_start: 12 + col_stop: 19 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + right: + Cast: + inner: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 23 + col_stop: 24 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + target_type: + IntegerType: I8 + span: + line_start: 1 + line_stop: 1 + col_start: 23 + col_stop: 30 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 12 + col_stop: 30 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 30 + path: test + content: 1 as i8 ** 3 as i8 ** 5 as i8 diff --git a/tests/expectations/parser/parser/expression/binary/gt.leo.out b/tests/expectations/parser/parser/expression/binary/gt.leo.out new file mode 100644 index 0000000000..b9d5cfd72d --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/gt.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 > 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 > 1 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 > 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2>3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2>3 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2>3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 > 2 > 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 > 2 > 3 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 > 2 > 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 > 2 > 3 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 > 2 > 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 > 3 + 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 > 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 > 3 + 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 > 3 + 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 + 2 > 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 + 2 > 3 + 4 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 + 2 > 3 + 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 > 2 > 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 > 2 > 3 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 > 2 > 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 > 2 > 3 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 > 2 > 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 18 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 22 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 22 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 + op: Gt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: 1 + 2 > 3 + 4 > 5 + 6 diff --git a/tests/expectations/parser/parser/expression/binary/gte.leo.out b/tests/expectations/parser/parser/expression/binary/gte.leo.out new file mode 100644 index 0000000000..9ab526f71c --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/gte.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 >= 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 >= 1 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 >= 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2 >= 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 2 >= 3 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 2 >= 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 >= 2 >= 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 >= 2 >= 3 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 >= 2 >= 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 >= 2 >= 3 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 >= 2 >= 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 >= 3 + 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 >= 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 >= 3 + 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 + 2 >= 3 + 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 + 2 >= 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 + 2 >= 3 + 4 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 + 2 >= 3 + 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 >= 2 >= 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 >= 2 >= 3 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 >= 2 >= 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 >= 2 >= 3 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 >= 2 >= 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 20 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 23 + col_stop: 24 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 24 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 + op: Ge + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: 1 + 2 >= 3 + 4 >= 5 + 6 diff --git a/tests/expectations/parser/parser/expression/binary/lt.leo.out b/tests/expectations/parser/parser/expression/binary/lt.leo.out new file mode 100644 index 0000000000..9879afc9d3 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/lt.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 1 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2<3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2<3 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2<3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 2 < 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 2 < 3 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 2 < 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 < 2 < 3 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 < 2 < 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 < 3 + 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 < 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 < 3 + 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 < 3 + 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 + 2 < 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 + 2 < 3 + 4 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 + 2 < 3 + 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 2 < 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 2 < 3 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 2 < 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 < 2 < 3 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 < 2 < 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 18 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 22 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 22 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: 1 + 2 < 3 + 4 < 5 + 6 diff --git a/tests/expectations/parser/parser/expression/binary/lte.leo.out b/tests/expectations/parser/parser/expression/binary/lte.leo.out new file mode 100644 index 0000000000..f40df4bddb --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/lte.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 <= 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 <= 1 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 <= 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2 <= 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 2 <= 3 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 2 <= 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 <= 2 <= 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 <= 2 <= 3 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 <= 2 <= 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 <= 2 <= 3 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 <= 2 <= 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 <= 3 + 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 <= 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 <= 3 + 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 + 2 <= 3 + 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 + 2 <= 3 + 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 + 2 <= 3 + 4 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 + 2 <= 3 + 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 <= 2 <= 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 <= 2 <= 3 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 <= 2 <= 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 <= 2 <= 3 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 <= 2 <= 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 20 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 23 + col_stop: 24 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 24 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 + op: Le + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: 1 + 2 <= 3 + 4 <= 5 + 6 diff --git a/tests/expectations/parser/parser/expression/binary/mul.leo.out b/tests/expectations/parser/parser/expression/binary/mul.leo.out new file mode 100644 index 0000000000..c146eeee15 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/mul.leo.out @@ -0,0 +1,289 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 1 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2*3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2*3 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2*3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 2 * 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 2 * 3 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 2 * 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 * 2 * 3 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 * 2 * 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 ** 2 * 3 ** 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 ** 2 * 3 ** 4 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 ** 2 * 3 ** 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 ** 2 * 3 ** 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 16 + path: test + content: 1 ** 2 * 3 ** 4 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 16 + path: test + content: 1 ** 2 * 3 ** 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: 1 ** 2 * 3 ** 4 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 16 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 16 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 20 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 24 + col_stop: 25 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 25 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 + op: Div + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 25 + path: test + content: 1 ** 2 * 3 ** 4 / 5 ** 6 diff --git a/tests/expectations/parser/parser/expression/binary/ne.leo.out b/tests/expectations/parser/parser/expression/binary/ne.leo.out new file mode 100644 index 0000000000..65fb6e2298 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/ne.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 != 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 != 1 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 != 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2!=3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 5 + path: test + content: 2!=3 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: 2!=3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 != 2 != 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 != 2 != 3 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 != 2 != 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 != 2 != 3 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 != 2 != 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 2 != 3 < 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 2 != 3 < 4 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 2 != 3 < 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 < 2 != 3 < 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 < 2 != 3 < 4 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 < 2 != 3 < 4 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 < 2 != 3 < 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 != 2 != 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: 1 != 2 != 3 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 1 != 2 != 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: 1 != 2 != 3 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 1 != 2 != 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 15 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 15 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 20 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 23 + col_stop: 24 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + op: Lt + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 24 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 + op: Ne + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: 1 < 2 != 3 < 4 != 5 < 6 diff --git a/tests/expectations/parser/parser/expression/binary/or.leo.out b/tests/expectations/parser/parser/expression/binary/or.leo.out new file mode 100644 index 0000000000..72d244dd8d --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/or.leo.out @@ -0,0 +1,338 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 1 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2+3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2+3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2+3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 + 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 + 3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 + 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 + 3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 + 2 + 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 2 + 3 * 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 * 2 + 3 * 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 + 2 - 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 + 2 - 3 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 + 2 - 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 + 2 - 3 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 + 2 - 3 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Binary: + left: + Value: + Implicit: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 18 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + right: + Value: + Implicit: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 22 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 17 + col_stop: 22 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: 1 * 2 + 3 * 4 - 5 * 6 diff --git a/tests/expectations/parser/parser/expression/binary/sub.leo.out b/tests/expectations/parser/parser/expression/binary/sub.leo.out new file mode 100644 index 0000000000..4e39639fe2 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/sub.leo.out @@ -0,0 +1,180 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 - 1 + right: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 - 1 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 - 1 + - Binary: + left: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 2-3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: 2-3 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: 2-3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 - 2 - 3 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 - 2 - 3 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 - 2 - 3 + right: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 - 2 - 3 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 1 - 2 - 3 + - Binary: + left: + Binary: + left: + Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: 1 * 2 - 3 * 4 + right: + Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: 1 * 2 - 3 * 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 1 * 2 - 3 * 4 + right: + Binary: + left: + Value: + Implicit: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: 1 * 2 - 3 * 4 + right: + Value: + Implicit: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: 1 * 2 - 3 * 4 + op: Mul + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: 1 * 2 - 3 * 4 + op: Sub + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 1 * 2 - 3 * 4 diff --git a/tests/expectations/parser/parser/expression/cast.leo.out b/tests/expectations/parser/parser/expression/cast.leo.out new file mode 100644 index 0000000000..25ace32c14 --- /dev/null +++ b/tests/expectations/parser/parser/expression/cast.leo.out @@ -0,0 +1,186 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Cast: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as u8\\\"}\"}" + target_type: + IntegerType: U8 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: x as u8 + - Cast: + inner: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"y as id\\\"}\"}" + target_type: + Circuit: "{\"name\":\"id\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"y as id\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: y as id + - Cast: + inner: + Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"z as u32\\\"}\"}" + target_type: + IntegerType: U32 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: z as u32 + - Cast: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as i128\\\"}\"}" + target_type: + IntegerType: I128 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: x as i128 + - Cast: + inner: + Cast: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as u8 as u128\\\"}\"}" + target_type: + IntegerType: U8 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: x as u8 as u128 + target_type: + IntegerType: U128 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: x as u8 as u128 + - Cast: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as field\\\"}\"}" + target_type: Field + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: x as field + - Cast: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x as group\\\"}\"}" + target_type: Group + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: x as group + - Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}" + right: + Binary: + left: + Cast: + inner: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}" + target_type: + IntegerType: U32 + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 14 + path: test + content: x ** y as u32 ** z + right: + Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ** y as u32 ** z\\\"}\"}" + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 19 + path: test + content: x ** y as u32 ** z + op: Pow + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: x ** y as u32 ** z + - Value: + Implicit: + - "" + - line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Cast: + inner: + Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x as u32\\\"}\"}" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: "!x as u32" + target_type: + IntegerType: U32 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "!x as u32" + - Cast: + inner: + Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x as u32\\\"}\"}" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: "-x as u32" + target_type: + IntegerType: U32 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "-x as u32" diff --git a/tests/expectations/parser/parser/expression/circuit_init.leo.out b/tests/expectations/parser/parser/expression/circuit_init.leo.out new file mode 100644 index 0000000000..4295420d95 --- /dev/null +++ b/tests/expectations/parser/parser/expression/circuit_init.leo.out @@ -0,0 +1,113 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x {}\\\"}\"}" + members: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x {}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x {y}\\\"}\"}" + members: + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x {y}\\\"}\"}" + expression: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "x {y}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y}\\\"}\"}" + members: + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y}\\\"}\"}" + expression: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x{y}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{}\\\"}\"}" + members: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "x{}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}" + members: + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}" + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: y}\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x{y: y}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}" + members: + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}" + expression: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x}\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x{y: x}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}" + members: + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}" + expression: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y: x,}\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "x{y: x,}" + - CircuitInit: + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" + members: + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" + expression: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x{y:x, x:y,}\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: "x{y:x, x:y,}" + - CircuitInit: + name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"Self {}\\\"}\"}" + members: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "Self {}" diff --git a/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out b/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out new file mode 100644 index 0000000000..3aae92971f --- /dev/null +++ b/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out @@ -0,0 +1,16 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - " --> test:1:3\n |\n 1 | x {\n | ^\n |\n = unexpected EOF" + - "did not consume all input: '}' @ 1:3-4\n" + - " --> test:1:4\n |\n 1 | x {,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:5\n |\n 1 | x { , }\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,,,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:6\n |\n 1 | x {x,,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,,x}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,x}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:8\n |\n 1 | x {x:y,,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,,x:y}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,x:y}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:6\n |\n 1 | x {x:}\n | ^\n |\n = expected 'expression', got '}'" diff --git a/tests/expectations/parser/parser/expression/ident.leo.out b/tests/expectations/parser/parser/expression/ident.leo.out new file mode 100644 index 0000000000..a92fc0c1c8 --- /dev/null +++ b/tests/expectations/parser/parser/expression/ident.leo.out @@ -0,0 +1,23 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x\\\"}\"}" + - Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X\\\"}\"}" + - Identifier: "{\"name\":\"xxx\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"xxx\\\"}\"}" + - Identifier: "{\"name\":\"XXX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"XXX\\\"}\"}" + - Identifier: "{\"name\":\"x1\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x1\\\"}\"}" + - Identifier: "{\"name\":\"xu32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"xu32\\\"}\"}" + - Identifier: "{\"name\":\"testx\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"testx\\\"}\"}" + - Identifier: "{\"name\":\"truex\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"truex\\\"}\"}" + - Identifier: "{\"name\":\"TRUE\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"TRUE\\\"}\"}" + - Identifier: "{\"name\":\"testX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"testX\\\"}\"}" + - Identifier: "{\"name\":\"letX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"letX\\\"}\"}" + - Identifier: "{\"name\":\"constX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"constX\\\"}\"}" + - Identifier: "{\"name\":\"test_test\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"test_test\\\"}\"}" + - Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"self\\\"}\"}" + - Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"Self\\\"}\"}" + - Identifier: "{\"name\":\"input\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"input\\\"}\"}" + - Identifier: "{\"name\":\"selfX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"selfX\\\"}\"}" + - Identifier: "{\"name\":\"SelfX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"SelfX\\\"}\"}" + - Identifier: "{\"name\":\"inputX\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"inputX\\\"}\"}" diff --git a/tests/expectations/parser/parser/expression/literal/address.leo.out b/tests/expectations/parser/parser/expression/literal/address.leo.out new file mode 100644 index 0000000000..04610e6ead --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/address.leo.out @@ -0,0 +1,13 @@ +--- +namespace: Token +expectation: Pass +outputs: + - "'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8' @ 1:1-64" + - "'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9' @ 1:1-64" + - "'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9' @ 1:1-64" + - "'aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st' @ 1:1-64" + - "'ALEO1' @ 1:1-6" + - "'Aleo1' @ 1:1-6" + - "'aleO1' @ 1:1-6" + - "'aleo2qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9' @ 1:1-64" + - "'bleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9' @ 1:1-64" diff --git a/tests/expectations/parser/parser/expression/literal/address_fail.leo.out b/tests/expectations/parser/parser/expression/literal/address_fail.leo.out new file mode 100644 index 0000000000..c0fc912fd4 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/address_fail.leo.out @@ -0,0 +1,13 @@ +--- +namespace: Token +expectation: Fail +outputs: + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d'" + - " --> test:1:1\n |\n 1 | aleo1\n | ^^^^^\n |\n = invalid address literal: 'aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st'" + - " --> test:1:1\n |\n 1 | aleo1\n | ^^^^^\n |\n = invalid address literal: 'aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x'" diff --git a/tests/expectations/parser/parser/expression/literal/address_parse.leo.out b/tests/expectations/parser/parser/expression/literal/address_parse.leo.out new file mode 100644 index 0000000000..ce2e019189 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/address_parse.leo.out @@ -0,0 +1,40 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Address: + - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 64 + path: test + content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 + - Value: + Address: + - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 64 + path: test + content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 + - Value: + Address: + - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 64 + path: test + content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 + - Value: + Address: + - aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 64 + path: test + content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st diff --git a/tests/expectations/parser/parser/expression/literal/bool.leo.out b/tests/expectations/parser/parser/expression/literal/bool.leo.out new file mode 100644 index 0000000000..9222f3dd49 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/bool.leo.out @@ -0,0 +1,12 @@ +--- +namespace: Token +expectation: Pass +outputs: + - "'true' @ 1:1-5" + - "'True' @ 1:1-5" + - "'TRUE' @ 1:1-5" + - "'truE' @ 1:1-5" + - "'false' @ 1:1-6" + - "'False' @ 1:1-6" + - "'FALSE' @ 1:1-6" + - "'falsE' @ 1:1-6" diff --git a/tests/expectations/parser/parser/expression/literal/bool_parse.leo.out b/tests/expectations/parser/parser/expression/literal/bool_parse.leo.out new file mode 100644 index 0000000000..85b9453e0b --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/bool_parse.leo.out @@ -0,0 +1,22 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Boolean: + - "true" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "true" + - Value: + Boolean: + - "false" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "false" diff --git a/tests/expectations/parser/parser/expression/literal/comment.leo.out b/tests/expectations/parser/parser/expression/literal/comment.leo.out new file mode 100644 index 0000000000..9f4cc8a518 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/comment.leo.out @@ -0,0 +1,22 @@ +--- +namespace: Token +expectation: Pass +outputs: + - "'// test1' @ 1:1-9" + - "'// test2' @ 1:1-9" + - "'//test3' @ 1:1-8" + - "'/' @ 1:1-2,'/' @ 1:3-4,'test4' @ 1:5-10" + - "'/* test5 */' @ 1:1-12" + - "'/*' @ 1:1-3" + - "'test' @ 1:1-5,'6' @ 1:6-7,'*' @ 1:8-9,'/' @ 1:9-10" + - "'/* test 7' @ 1:1-10" + - "'*' @ 1:1-2,'/' @ 1:2-3" + - "'/*test8 */' @ 1:1-11" + - "'/* test9*/' @ 1:1-11" + - "'/*test10*/' @ 1:1-11" + - "'/*/**/' @ 1:1-7" + - "'/**/' @ 1:1-5" + - "'/*//*/' @ 1:1-7" + - "'/** /*/' @ 1:1-8" + - "'/** **/' @ 1:1-8" + - "'/*' @ 1:1-3" diff --git a/tests/expectations/parser/parser/expression/literal/formatted_string.leo.out b/tests/expectations/parser/parser/expression/literal/formatted_string.leo.out new file mode 100644 index 0000000000..47fddf9292 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/formatted_string.leo.out @@ -0,0 +1,24 @@ +--- +namespace: Token +expectation: Pass +outputs: + - "'\"{}\"' @ 1:1-5" + - "'\" {} \"' @ 1:1-7" + - "'\"{}d\"' @ 1:1-6" + - "'\"{}D\"' @ 1:1-6" + - "'\"d{}\"' @ 1:1-6" + - "'\"D{}\"' @ 1:1-6" + - "'\"D{}D\"' @ 1:1-7" + - "'\"{}{}\"' @ 1:1-7" + - "'\"D{}{}D\"' @ 1:1-9" + - "'\"D{}{}\"' @ 1:1-8" + - "'\"{}{}D\"' @ 1:1-8" + - "'\"D{}D{}D\"' @ 1:1-10" + - "'\"{{}}\"' @ 1:1-7" + - "'\"}}\"' @ 1:1-5" + - "'\"{{\"' @ 1:1-5" + - "'\"}}{{\"' @ 1:1-7" + - "'\"{{}\"' @ 1:1-6" + - "'\"{}}\"' @ 1:1-6" + - "'\"{\"' @ 1:1-4" + - "'\"}\"' @ 1:1-4" diff --git a/tests/expectations/parser/parser/expression/literal/group.leo.out b/tests/expectations/parser/parser/expression/literal/group.leo.out new file mode 100644 index 0000000000..2a4389526e --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/group.leo.out @@ -0,0 +1,648 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Group: + Tuple: + x: SignHigh + y: Inferred + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(+, _)group" + - Value: + Group: + Tuple: + x: Inferred + y: SignLow + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(_, -)group" + - Value: + Group: + Tuple: + x: SignHigh + y: SignLow + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(+, -)group" + - Value: + Group: + Tuple: + x: SignLow + y: SignHigh + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(-, +)group" + - Value: + Group: + Tuple: + x: SignHigh + y: SignHigh + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(+, +)group" + - Value: + Group: + Tuple: + x: SignLow + y: SignLow + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(-, -)group" + - Value: + Group: + Tuple: + x: Inferred + y: Inferred + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: test + content: "(_, _)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123,-456)group" + y: + Number: + - "-456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123,-456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123,-456)group" + - Value: + Group: + Tuple: + x: + Number: + - "-123" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "(-123,456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(-123,456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(-123,456)group" + - Value: + Group: + Tuple: + x: + Number: + - "-123" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: test + content: "(-123,456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(-123,456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(-123,456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, _)group" + y: Inferred + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, _)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, -)group" + y: SignLow + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, -)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, -)group" + y: SignLow + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, -)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, +)group" + y: SignHigh + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, +)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, +)group" + y: SignHigh + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, +)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, -)group" + y: SignLow + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, -)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, _)group" + y: Inferred + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(123, _)group" + - Value: + Group: + Tuple: + x: SignHigh + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(+, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(+, 345)group" + - Value: + Group: + Tuple: + x: Inferred + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(_, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(_, 345)group" + - Value: + Group: + Tuple: + x: SignHigh + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(+, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(+, 345)group" + - Value: + Group: + Tuple: + x: SignLow + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(-, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(-, 345)group" + - Value: + Group: + Tuple: + x: SignHigh + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(+, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(+, 345)group" + - Value: + Group: + Tuple: + x: SignLow + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(-, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(-, 345)group" + - Value: + Group: + Tuple: + x: Inferred + y: + Number: + - "345" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: "(_, 345)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 14 + path: test + content: "(_, 345)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" + - Value: + Group: + Tuple: + x: + Number: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123, 456)group" + y: + Number: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 10 + path: test + content: "(123, 456)group" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 16 + path: test + content: "(123, 456)group" diff --git a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out new file mode 100644 index 0000000000..da65de24fa --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out @@ -0,0 +1,13 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - " --> test:1:1\n |\n 1 | group\n | ^^^^^\n |\n = expected 'expression', got 'group'" + - "did not consume all input: 'group' @ 1:3-8\n" + - "did not consume all input: 'group' @ 1:6-11\n" + - " --> test:1:2\n |\n 1 | (,)group\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | (+, -,)group\n | ^\n |\n = expected 'expression', got '+'" + - " --> test:1:2\n |\n 1 | (,+, -)group\n | ^\n |\n = expected 'expression', got ','" + - "did not consume all input: 'group' @ 1:6-11\n" + - "did not consume all input: 'group' @ 1:12-17\n" + - "did not consume all input: 'group' @ 1:15-20\n" diff --git a/tests/expectations/parser/parser/expression/literal/int.leo.out b/tests/expectations/parser/parser/expression/literal/int.leo.out new file mode 100644 index 0000000000..ccac03f213 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int.leo.out @@ -0,0 +1,111 @@ +--- +namespace: Token +expectation: Pass +outputs: + - "'123' @ 1:1-4,'abc123' @ 1:4-10" + - "'123' @ 1:1-4,'abc' @ 1:4-7" + - "'123' @ 1:1-4" + - "'456' @ 1:1-4" + - "'123' @ 1:1-4,'456' @ 1:5-8" + - "'87377802873778028737780287377802873778028737780287377802873778028737780287377802' @ 1:1-81" + - "'8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802' @ 1:1-401" + - "'340130024' @ 1:1-10" + - "'158951116' @ 1:1-10" + - "'155529659' @ 1:1-10" + - "'642023166' @ 1:1-10" + - "'228481736' @ 1:1-10" + - "'469712960' @ 1:1-10" + - "'929437719' @ 1:1-10" + - "'721072814' @ 1:1-10" + - "'363254789' @ 1:1-10" + - "'906732565' @ 1:1-10" + - "'288246391' @ 1:1-10" + - "'724940549' @ 1:1-10" + - "'487101620' @ 1:1-10" + - "'261373583' @ 1:1-10" + - "'891163927' @ 1:1-10" + - "'743967544' @ 1:1-10" + - "'8372586' @ 1:1-8" + - "'461793278' @ 1:1-10" + - "'806307045' @ 1:1-10" + - "'122764546' @ 1:1-10" + - "'356336181' @ 1:1-10" + - "'158370903' @ 1:1-10" + - "'774460877' @ 1:1-10" + - "'557174131' @ 1:1-10" + - "'492401267' @ 1:1-10" + - "'893445620' @ 1:1-10" + - "'957757048' @ 1:1-10" + - "'721540649' @ 1:1-10" + - "'390746493' @ 1:1-10" + - "'211251725' @ 1:1-10" + - "'938266114' @ 1:1-10" + - "'156985870' @ 1:1-10" + - "'703831126' @ 1:1-10" + - "'729964155' @ 1:1-10" + - "'988151305' @ 1:1-10" + - "'320872435' @ 1:1-10" + - "'719287167' @ 1:1-10" + - "'152289486' @ 1:1-10" + - "'740067975' @ 1:1-10" + - "'728627816' @ 1:1-10" + - "'385008978' @ 1:1-10" + - "'553967635' @ 1:1-10" + - "'71980713' @ 1:1-9" + - "'519444716' @ 1:1-10" + - "'116499965' @ 1:1-10" + - "'717422268' @ 1:1-10" + - "'18966279' @ 1:1-9" + - "'22458638' @ 1:1-9" + - "'857282620' @ 1:1-10" + - "'920675898' @ 1:1-10" + - "'762235516' @ 1:1-10" + - "'469018377' @ 1:1-10" + - "'199986521' @ 1:1-10" + - "'536679358' @ 1:1-10" + - "'591399452' @ 1:1-10" + - "'83083158' @ 1:1-9" + - "'599449051' @ 1:1-10" + - "'445442318' @ 1:1-10" + - "'585486590' @ 1:1-10" + - "'209278800' @ 1:1-10" + - "'873568117' @ 1:1-10" + - "'664470940' @ 1:1-10" + - "'465262783' @ 1:1-10" + - "'605652874' @ 1:1-10" + - "'376803940' @ 1:1-10" + - "'965247040' @ 1:1-10" + - "'598474509' @ 1:1-10" + - "'845119918' @ 1:1-10" + - "'648159133' @ 1:1-10" + - "'669051032' @ 1:1-10" + - "'800600261' @ 1:1-10" + - "'434689764' @ 1:1-10" + - "'520060080' @ 1:1-10" + - "'804659385' @ 1:1-10" + - "'537828058' @ 1:1-10" + - "'716600292' @ 1:1-10" + - "'387020273' @ 1:1-10" + - "'199375617' @ 1:1-10" + - "'680337189' @ 1:1-10" + - "'818479931' @ 1:1-10" + - "'893693281' @ 1:1-10" + - "'87377802' @ 1:1-9" + - "'84699261' @ 1:1-9" + - "'292826090' @ 1:1-10" + - "'569171405' @ 1:1-10" + - "'387436237' @ 1:1-10" + - "'150682190' @ 1:1-10" + - "'888770419' @ 1:1-10" + - "'824696431' @ 1:1-10" + - "'765659803' @ 1:1-10" + - "'270163693' @ 1:1-10" + - "'427940240' @ 1:1-10" + - "'504997332' @ 1:1-10" + - "'337808338' @ 1:1-10" + - "'907200008' @ 1:1-10" + - "'757177889' @ 1:1-10" + - "'696697188' @ 1:1-10" + - "'41376051' @ 1:1-9" + - "'496293518' @ 1:1-10" + - "'251218820' @ 1:1-10" diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/field.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/field.leo.out new file mode 100644 index 0000000000..c7f5f3576f --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/field.leo.out @@ -0,0 +1,949 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Field: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: 123field + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Field: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: 456field + - Value: + Field: + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 86 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802field + - Value: + Field: + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 406 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802field + - Value: + Field: + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 340130024field + - Value: + Field: + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 158951116field + - Value: + Field: + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 155529659field + - Value: + Field: + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 642023166field + - Value: + Field: + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 228481736field + - Value: + Field: + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 469712960field + - Value: + Field: + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 929437719field + - Value: + Field: + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 721072814field + - Value: + Field: + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 363254789field + - Value: + Field: + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 906732565field + - Value: + Field: + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 288246391field + - Value: + Field: + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 724940549field + - Value: + Field: + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 487101620field + - Value: + Field: + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 261373583field + - Value: + Field: + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 891163927field + - Value: + Field: + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 743967544field + - Value: + Field: + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 8372586field + - Value: + Field: + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 461793278field + - Value: + Field: + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 806307045field + - Value: + Field: + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 122764546field + - Value: + Field: + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 356336181field + - Value: + Field: + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 158370903field + - Value: + Field: + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 774460877field + - Value: + Field: + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 557174131field + - Value: + Field: + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 492401267field + - Value: + Field: + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 893445620field + - Value: + Field: + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 957757048field + - Value: + Field: + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 721540649field + - Value: + Field: + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 390746493field + - Value: + Field: + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 211251725field + - Value: + Field: + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 938266114field + - Value: + Field: + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 156985870field + - Value: + Field: + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 703831126field + - Value: + Field: + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 729964155field + - Value: + Field: + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 988151305field + - Value: + Field: + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 320872435field + - Value: + Field: + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 719287167field + - Value: + Field: + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 152289486field + - Value: + Field: + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 740067975field + - Value: + Field: + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 728627816field + - Value: + Field: + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 385008978field + - Value: + Field: + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 553967635field + - Value: + Field: + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 71980713field + - Value: + Field: + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 519444716field + - Value: + Field: + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 116499965field + - Value: + Field: + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 717422268field + - Value: + Field: + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 18966279field + - Value: + Field: + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 22458638field + - Value: + Field: + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 857282620field + - Value: + Field: + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 920675898field + - Value: + Field: + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 762235516field + - Value: + Field: + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 469018377field + - Value: + Field: + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 199986521field + - Value: + Field: + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 536679358field + - Value: + Field: + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 591399452field + - Value: + Field: + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 83083158field + - Value: + Field: + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 599449051field + - Value: + Field: + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 445442318field + - Value: + Field: + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 585486590field + - Value: + Field: + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 209278800field + - Value: + Field: + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 873568117field + - Value: + Field: + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 664470940field + - Value: + Field: + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 465262783field + - Value: + Field: + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 605652874field + - Value: + Field: + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 376803940field + - Value: + Field: + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 965247040field + - Value: + Field: + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 598474509field + - Value: + Field: + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 845119918field + - Value: + Field: + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 648159133field + - Value: + Field: + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 669051032field + - Value: + Field: + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 800600261field + - Value: + Field: + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 434689764field + - Value: + Field: + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 520060080field + - Value: + Field: + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 804659385field + - Value: + Field: + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 537828058field + - Value: + Field: + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 716600292field + - Value: + Field: + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 387020273field + - Value: + Field: + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 199375617field + - Value: + Field: + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 680337189field + - Value: + Field: + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 818479931field + - Value: + Field: + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 893693281field + - Value: + Field: + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 87377802field + - Value: + Field: + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 84699261field + - Value: + Field: + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 292826090field + - Value: + Field: + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 569171405field + - Value: + Field: + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 387436237field + - Value: + Field: + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 150682190field + - Value: + Field: + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 888770419field + - Value: + Field: + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 824696431field + - Value: + Field: + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 765659803field + - Value: + Field: + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 270163693field + - Value: + Field: + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 427940240field + - Value: + Field: + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 504997332field + - Value: + Field: + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 337808338field + - Value: + Field: + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 907200008field + - Value: + Field: + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 757177889field + - Value: + Field: + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 696697188field + - Value: + Field: + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 41376051field + - Value: + Field: + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 496293518field + - Value: + Field: + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 251218820field diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/i128.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/i128.leo.out new file mode 100644 index 0000000000..f0d886348f --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/i128.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - I128 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: 123i128 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - I128 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: 456i128 + - Value: + Integer: + - I128 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 85 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802i128 + - Value: + Integer: + - I128 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 405 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i128 + - Value: + Integer: + - I128 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 340130024i128 + - Value: + Integer: + - I128 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 158951116i128 + - Value: + Integer: + - I128 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 155529659i128 + - Value: + Integer: + - I128 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 642023166i128 + - Value: + Integer: + - I128 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 228481736i128 + - Value: + Integer: + - I128 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 469712960i128 + - Value: + Integer: + - I128 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 929437719i128 + - Value: + Integer: + - I128 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 721072814i128 + - Value: + Integer: + - I128 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 363254789i128 + - Value: + Integer: + - I128 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 906732565i128 + - Value: + Integer: + - I128 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 288246391i128 + - Value: + Integer: + - I128 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 724940549i128 + - Value: + Integer: + - I128 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 487101620i128 + - Value: + Integer: + - I128 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 261373583i128 + - Value: + Integer: + - I128 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 891163927i128 + - Value: + Integer: + - I128 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 743967544i128 + - Value: + Integer: + - I128 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 8372586i128 + - Value: + Integer: + - I128 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 461793278i128 + - Value: + Integer: + - I128 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 806307045i128 + - Value: + Integer: + - I128 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 122764546i128 + - Value: + Integer: + - I128 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 356336181i128 + - Value: + Integer: + - I128 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 158370903i128 + - Value: + Integer: + - I128 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 774460877i128 + - Value: + Integer: + - I128 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 557174131i128 + - Value: + Integer: + - I128 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 492401267i128 + - Value: + Integer: + - I128 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 893445620i128 + - Value: + Integer: + - I128 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 957757048i128 + - Value: + Integer: + - I128 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 721540649i128 + - Value: + Integer: + - I128 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 390746493i128 + - Value: + Integer: + - I128 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 211251725i128 + - Value: + Integer: + - I128 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 938266114i128 + - Value: + Integer: + - I128 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 156985870i128 + - Value: + Integer: + - I128 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 703831126i128 + - Value: + Integer: + - I128 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 729964155i128 + - Value: + Integer: + - I128 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 988151305i128 + - Value: + Integer: + - I128 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 320872435i128 + - Value: + Integer: + - I128 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 719287167i128 + - Value: + Integer: + - I128 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 152289486i128 + - Value: + Integer: + - I128 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 740067975i128 + - Value: + Integer: + - I128 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 728627816i128 + - Value: + Integer: + - I128 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 385008978i128 + - Value: + Integer: + - I128 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 553967635i128 + - Value: + Integer: + - I128 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 71980713i128 + - Value: + Integer: + - I128 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 519444716i128 + - Value: + Integer: + - I128 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 116499965i128 + - Value: + Integer: + - I128 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 717422268i128 + - Value: + Integer: + - I128 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 18966279i128 + - Value: + Integer: + - I128 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 22458638i128 + - Value: + Integer: + - I128 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 857282620i128 + - Value: + Integer: + - I128 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 920675898i128 + - Value: + Integer: + - I128 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 762235516i128 + - Value: + Integer: + - I128 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 469018377i128 + - Value: + Integer: + - I128 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 199986521i128 + - Value: + Integer: + - I128 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 536679358i128 + - Value: + Integer: + - I128 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 591399452i128 + - Value: + Integer: + - I128 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 83083158i128 + - Value: + Integer: + - I128 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 599449051i128 + - Value: + Integer: + - I128 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 445442318i128 + - Value: + Integer: + - I128 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 585486590i128 + - Value: + Integer: + - I128 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 209278800i128 + - Value: + Integer: + - I128 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 873568117i128 + - Value: + Integer: + - I128 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 664470940i128 + - Value: + Integer: + - I128 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 465262783i128 + - Value: + Integer: + - I128 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 605652874i128 + - Value: + Integer: + - I128 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 376803940i128 + - Value: + Integer: + - I128 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 965247040i128 + - Value: + Integer: + - I128 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 598474509i128 + - Value: + Integer: + - I128 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 845119918i128 + - Value: + Integer: + - I128 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 648159133i128 + - Value: + Integer: + - I128 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 669051032i128 + - Value: + Integer: + - I128 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 800600261i128 + - Value: + Integer: + - I128 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 434689764i128 + - Value: + Integer: + - I128 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 520060080i128 + - Value: + Integer: + - I128 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 804659385i128 + - Value: + Integer: + - I128 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 537828058i128 + - Value: + Integer: + - I128 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 716600292i128 + - Value: + Integer: + - I128 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 387020273i128 + - Value: + Integer: + - I128 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 199375617i128 + - Value: + Integer: + - I128 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 680337189i128 + - Value: + Integer: + - I128 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 818479931i128 + - Value: + Integer: + - I128 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 893693281i128 + - Value: + Integer: + - I128 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 87377802i128 + - Value: + Integer: + - I128 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 84699261i128 + - Value: + Integer: + - I128 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 292826090i128 + - Value: + Integer: + - I128 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 569171405i128 + - Value: + Integer: + - I128 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 387436237i128 + - Value: + Integer: + - I128 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 150682190i128 + - Value: + Integer: + - I128 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 888770419i128 + - Value: + Integer: + - I128 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 824696431i128 + - Value: + Integer: + - I128 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 765659803i128 + - Value: + Integer: + - I128 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 270163693i128 + - Value: + Integer: + - I128 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 427940240i128 + - Value: + Integer: + - I128 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 504997332i128 + - Value: + Integer: + - I128 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 337808338i128 + - Value: + Integer: + - I128 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 907200008i128 + - Value: + Integer: + - I128 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 757177889i128 + - Value: + Integer: + - I128 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 696697188i128 + - Value: + Integer: + - I128 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 41376051i128 + - Value: + Integer: + - I128 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 496293518i128 + - Value: + Integer: + - I128 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 251218820i128 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/i16.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/i16.leo.out new file mode 100644 index 0000000000..82a8fc8b1b --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/i16.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - I16 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 123i16 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - I16 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 456i16 + - Value: + Integer: + - I16 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 84 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802i16 + - Value: + Integer: + - I16 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 404 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i16 + - Value: + Integer: + - I16 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 340130024i16 + - Value: + Integer: + - I16 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158951116i16 + - Value: + Integer: + - I16 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 155529659i16 + - Value: + Integer: + - I16 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 642023166i16 + - Value: + Integer: + - I16 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 228481736i16 + - Value: + Integer: + - I16 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469712960i16 + - Value: + Integer: + - I16 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 929437719i16 + - Value: + Integer: + - I16 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721072814i16 + - Value: + Integer: + - I16 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 363254789i16 + - Value: + Integer: + - I16 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 906732565i16 + - Value: + Integer: + - I16 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 288246391i16 + - Value: + Integer: + - I16 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 724940549i16 + - Value: + Integer: + - I16 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 487101620i16 + - Value: + Integer: + - I16 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 261373583i16 + - Value: + Integer: + - I16 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 891163927i16 + - Value: + Integer: + - I16 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 743967544i16 + - Value: + Integer: + - I16 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 8372586i16 + - Value: + Integer: + - I16 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 461793278i16 + - Value: + Integer: + - I16 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 806307045i16 + - Value: + Integer: + - I16 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 122764546i16 + - Value: + Integer: + - I16 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 356336181i16 + - Value: + Integer: + - I16 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158370903i16 + - Value: + Integer: + - I16 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 774460877i16 + - Value: + Integer: + - I16 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 557174131i16 + - Value: + Integer: + - I16 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 492401267i16 + - Value: + Integer: + - I16 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893445620i16 + - Value: + Integer: + - I16 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 957757048i16 + - Value: + Integer: + - I16 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721540649i16 + - Value: + Integer: + - I16 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 390746493i16 + - Value: + Integer: + - I16 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 211251725i16 + - Value: + Integer: + - I16 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 938266114i16 + - Value: + Integer: + - I16 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 156985870i16 + - Value: + Integer: + - I16 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 703831126i16 + - Value: + Integer: + - I16 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 729964155i16 + - Value: + Integer: + - I16 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 988151305i16 + - Value: + Integer: + - I16 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 320872435i16 + - Value: + Integer: + - I16 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 719287167i16 + - Value: + Integer: + - I16 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 152289486i16 + - Value: + Integer: + - I16 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 740067975i16 + - Value: + Integer: + - I16 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 728627816i16 + - Value: + Integer: + - I16 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 385008978i16 + - Value: + Integer: + - I16 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 553967635i16 + - Value: + Integer: + - I16 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 71980713i16 + - Value: + Integer: + - I16 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 519444716i16 + - Value: + Integer: + - I16 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 116499965i16 + - Value: + Integer: + - I16 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 717422268i16 + - Value: + Integer: + - I16 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 18966279i16 + - Value: + Integer: + - I16 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 22458638i16 + - Value: + Integer: + - I16 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 857282620i16 + - Value: + Integer: + - I16 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 920675898i16 + - Value: + Integer: + - I16 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 762235516i16 + - Value: + Integer: + - I16 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469018377i16 + - Value: + Integer: + - I16 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199986521i16 + - Value: + Integer: + - I16 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 536679358i16 + - Value: + Integer: + - I16 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 591399452i16 + - Value: + Integer: + - I16 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 83083158i16 + - Value: + Integer: + - I16 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 599449051i16 + - Value: + Integer: + - I16 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 445442318i16 + - Value: + Integer: + - I16 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 585486590i16 + - Value: + Integer: + - I16 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 209278800i16 + - Value: + Integer: + - I16 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 873568117i16 + - Value: + Integer: + - I16 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 664470940i16 + - Value: + Integer: + - I16 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 465262783i16 + - Value: + Integer: + - I16 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 605652874i16 + - Value: + Integer: + - I16 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 376803940i16 + - Value: + Integer: + - I16 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 965247040i16 + - Value: + Integer: + - I16 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 598474509i16 + - Value: + Integer: + - I16 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 845119918i16 + - Value: + Integer: + - I16 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 648159133i16 + - Value: + Integer: + - I16 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 669051032i16 + - Value: + Integer: + - I16 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 800600261i16 + - Value: + Integer: + - I16 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 434689764i16 + - Value: + Integer: + - I16 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 520060080i16 + - Value: + Integer: + - I16 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 804659385i16 + - Value: + Integer: + - I16 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 537828058i16 + - Value: + Integer: + - I16 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 716600292i16 + - Value: + Integer: + - I16 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387020273i16 + - Value: + Integer: + - I16 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199375617i16 + - Value: + Integer: + - I16 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 680337189i16 + - Value: + Integer: + - I16 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 818479931i16 + - Value: + Integer: + - I16 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893693281i16 + - Value: + Integer: + - I16 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 87377802i16 + - Value: + Integer: + - I16 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 84699261i16 + - Value: + Integer: + - I16 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 292826090i16 + - Value: + Integer: + - I16 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 569171405i16 + - Value: + Integer: + - I16 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387436237i16 + - Value: + Integer: + - I16 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 150682190i16 + - Value: + Integer: + - I16 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 888770419i16 + - Value: + Integer: + - I16 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 824696431i16 + - Value: + Integer: + - I16 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 765659803i16 + - Value: + Integer: + - I16 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 270163693i16 + - Value: + Integer: + - I16 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 427940240i16 + - Value: + Integer: + - I16 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 504997332i16 + - Value: + Integer: + - I16 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 337808338i16 + - Value: + Integer: + - I16 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 907200008i16 + - Value: + Integer: + - I16 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 757177889i16 + - Value: + Integer: + - I16 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 696697188i16 + - Value: + Integer: + - I16 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 41376051i16 + - Value: + Integer: + - I16 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 496293518i16 + - Value: + Integer: + - I16 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 251218820i16 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/i32.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/i32.leo.out new file mode 100644 index 0000000000..82d66bdbf5 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/i32.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - I32 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 123i32 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - I32 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 456i32 + - Value: + Integer: + - I32 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 84 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802i32 + - Value: + Integer: + - I32 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 404 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i32 + - Value: + Integer: + - I32 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 340130024i32 + - Value: + Integer: + - I32 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158951116i32 + - Value: + Integer: + - I32 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 155529659i32 + - Value: + Integer: + - I32 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 642023166i32 + - Value: + Integer: + - I32 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 228481736i32 + - Value: + Integer: + - I32 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469712960i32 + - Value: + Integer: + - I32 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 929437719i32 + - Value: + Integer: + - I32 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721072814i32 + - Value: + Integer: + - I32 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 363254789i32 + - Value: + Integer: + - I32 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 906732565i32 + - Value: + Integer: + - I32 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 288246391i32 + - Value: + Integer: + - I32 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 724940549i32 + - Value: + Integer: + - I32 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 487101620i32 + - Value: + Integer: + - I32 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 261373583i32 + - Value: + Integer: + - I32 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 891163927i32 + - Value: + Integer: + - I32 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 743967544i32 + - Value: + Integer: + - I32 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 8372586i32 + - Value: + Integer: + - I32 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 461793278i32 + - Value: + Integer: + - I32 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 806307045i32 + - Value: + Integer: + - I32 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 122764546i32 + - Value: + Integer: + - I32 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 356336181i32 + - Value: + Integer: + - I32 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158370903i32 + - Value: + Integer: + - I32 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 774460877i32 + - Value: + Integer: + - I32 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 557174131i32 + - Value: + Integer: + - I32 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 492401267i32 + - Value: + Integer: + - I32 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893445620i32 + - Value: + Integer: + - I32 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 957757048i32 + - Value: + Integer: + - I32 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721540649i32 + - Value: + Integer: + - I32 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 390746493i32 + - Value: + Integer: + - I32 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 211251725i32 + - Value: + Integer: + - I32 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 938266114i32 + - Value: + Integer: + - I32 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 156985870i32 + - Value: + Integer: + - I32 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 703831126i32 + - Value: + Integer: + - I32 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 729964155i32 + - Value: + Integer: + - I32 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 988151305i32 + - Value: + Integer: + - I32 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 320872435i32 + - Value: + Integer: + - I32 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 719287167i32 + - Value: + Integer: + - I32 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 152289486i32 + - Value: + Integer: + - I32 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 740067975i32 + - Value: + Integer: + - I32 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 728627816i32 + - Value: + Integer: + - I32 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 385008978i32 + - Value: + Integer: + - I32 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 553967635i32 + - Value: + Integer: + - I32 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 71980713i32 + - Value: + Integer: + - I32 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 519444716i32 + - Value: + Integer: + - I32 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 116499965i32 + - Value: + Integer: + - I32 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 717422268i32 + - Value: + Integer: + - I32 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 18966279i32 + - Value: + Integer: + - I32 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 22458638i32 + - Value: + Integer: + - I32 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 857282620i32 + - Value: + Integer: + - I32 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 920675898i32 + - Value: + Integer: + - I32 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 762235516i32 + - Value: + Integer: + - I32 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469018377i32 + - Value: + Integer: + - I32 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199986521i32 + - Value: + Integer: + - I32 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 536679358i32 + - Value: + Integer: + - I32 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 591399452i32 + - Value: + Integer: + - I32 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 83083158i32 + - Value: + Integer: + - I32 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 599449051i32 + - Value: + Integer: + - I32 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 445442318i32 + - Value: + Integer: + - I32 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 585486590i32 + - Value: + Integer: + - I32 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 209278800i32 + - Value: + Integer: + - I32 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 873568117i32 + - Value: + Integer: + - I32 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 664470940i32 + - Value: + Integer: + - I32 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 465262783i32 + - Value: + Integer: + - I32 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 605652874i32 + - Value: + Integer: + - I32 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 376803940i32 + - Value: + Integer: + - I32 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 965247040i32 + - Value: + Integer: + - I32 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 598474509i32 + - Value: + Integer: + - I32 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 845119918i32 + - Value: + Integer: + - I32 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 648159133i32 + - Value: + Integer: + - I32 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 669051032i32 + - Value: + Integer: + - I32 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 800600261i32 + - Value: + Integer: + - I32 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 434689764i32 + - Value: + Integer: + - I32 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 520060080i32 + - Value: + Integer: + - I32 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 804659385i32 + - Value: + Integer: + - I32 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 537828058i32 + - Value: + Integer: + - I32 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 716600292i32 + - Value: + Integer: + - I32 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387020273i32 + - Value: + Integer: + - I32 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199375617i32 + - Value: + Integer: + - I32 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 680337189i32 + - Value: + Integer: + - I32 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 818479931i32 + - Value: + Integer: + - I32 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893693281i32 + - Value: + Integer: + - I32 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 87377802i32 + - Value: + Integer: + - I32 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 84699261i32 + - Value: + Integer: + - I32 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 292826090i32 + - Value: + Integer: + - I32 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 569171405i32 + - Value: + Integer: + - I32 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387436237i32 + - Value: + Integer: + - I32 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 150682190i32 + - Value: + Integer: + - I32 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 888770419i32 + - Value: + Integer: + - I32 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 824696431i32 + - Value: + Integer: + - I32 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 765659803i32 + - Value: + Integer: + - I32 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 270163693i32 + - Value: + Integer: + - I32 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 427940240i32 + - Value: + Integer: + - I32 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 504997332i32 + - Value: + Integer: + - I32 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 337808338i32 + - Value: + Integer: + - I32 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 907200008i32 + - Value: + Integer: + - I32 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 757177889i32 + - Value: + Integer: + - I32 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 696697188i32 + - Value: + Integer: + - I32 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 41376051i32 + - Value: + Integer: + - I32 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 496293518i32 + - Value: + Integer: + - I32 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 251218820i32 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/i64.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/i64.leo.out new file mode 100644 index 0000000000..24949c2f99 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/i64.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - I64 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 123i64 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - I64 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 456i64 + - Value: + Integer: + - I64 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 84 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802i64 + - Value: + Integer: + - I64 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 404 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i64 + - Value: + Integer: + - I64 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 340130024i64 + - Value: + Integer: + - I64 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158951116i64 + - Value: + Integer: + - I64 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 155529659i64 + - Value: + Integer: + - I64 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 642023166i64 + - Value: + Integer: + - I64 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 228481736i64 + - Value: + Integer: + - I64 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469712960i64 + - Value: + Integer: + - I64 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 929437719i64 + - Value: + Integer: + - I64 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721072814i64 + - Value: + Integer: + - I64 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 363254789i64 + - Value: + Integer: + - I64 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 906732565i64 + - Value: + Integer: + - I64 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 288246391i64 + - Value: + Integer: + - I64 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 724940549i64 + - Value: + Integer: + - I64 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 487101620i64 + - Value: + Integer: + - I64 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 261373583i64 + - Value: + Integer: + - I64 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 891163927i64 + - Value: + Integer: + - I64 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 743967544i64 + - Value: + Integer: + - I64 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 8372586i64 + - Value: + Integer: + - I64 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 461793278i64 + - Value: + Integer: + - I64 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 806307045i64 + - Value: + Integer: + - I64 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 122764546i64 + - Value: + Integer: + - I64 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 356336181i64 + - Value: + Integer: + - I64 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158370903i64 + - Value: + Integer: + - I64 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 774460877i64 + - Value: + Integer: + - I64 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 557174131i64 + - Value: + Integer: + - I64 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 492401267i64 + - Value: + Integer: + - I64 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893445620i64 + - Value: + Integer: + - I64 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 957757048i64 + - Value: + Integer: + - I64 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721540649i64 + - Value: + Integer: + - I64 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 390746493i64 + - Value: + Integer: + - I64 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 211251725i64 + - Value: + Integer: + - I64 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 938266114i64 + - Value: + Integer: + - I64 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 156985870i64 + - Value: + Integer: + - I64 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 703831126i64 + - Value: + Integer: + - I64 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 729964155i64 + - Value: + Integer: + - I64 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 988151305i64 + - Value: + Integer: + - I64 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 320872435i64 + - Value: + Integer: + - I64 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 719287167i64 + - Value: + Integer: + - I64 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 152289486i64 + - Value: + Integer: + - I64 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 740067975i64 + - Value: + Integer: + - I64 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 728627816i64 + - Value: + Integer: + - I64 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 385008978i64 + - Value: + Integer: + - I64 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 553967635i64 + - Value: + Integer: + - I64 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 71980713i64 + - Value: + Integer: + - I64 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 519444716i64 + - Value: + Integer: + - I64 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 116499965i64 + - Value: + Integer: + - I64 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 717422268i64 + - Value: + Integer: + - I64 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 18966279i64 + - Value: + Integer: + - I64 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 22458638i64 + - Value: + Integer: + - I64 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 857282620i64 + - Value: + Integer: + - I64 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 920675898i64 + - Value: + Integer: + - I64 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 762235516i64 + - Value: + Integer: + - I64 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469018377i64 + - Value: + Integer: + - I64 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199986521i64 + - Value: + Integer: + - I64 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 536679358i64 + - Value: + Integer: + - I64 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 591399452i64 + - Value: + Integer: + - I64 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 83083158i64 + - Value: + Integer: + - I64 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 599449051i64 + - Value: + Integer: + - I64 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 445442318i64 + - Value: + Integer: + - I64 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 585486590i64 + - Value: + Integer: + - I64 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 209278800i64 + - Value: + Integer: + - I64 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 873568117i64 + - Value: + Integer: + - I64 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 664470940i64 + - Value: + Integer: + - I64 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 465262783i64 + - Value: + Integer: + - I64 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 605652874i64 + - Value: + Integer: + - I64 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 376803940i64 + - Value: + Integer: + - I64 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 965247040i64 + - Value: + Integer: + - I64 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 598474509i64 + - Value: + Integer: + - I64 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 845119918i64 + - Value: + Integer: + - I64 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 648159133i64 + - Value: + Integer: + - I64 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 669051032i64 + - Value: + Integer: + - I64 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 800600261i64 + - Value: + Integer: + - I64 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 434689764i64 + - Value: + Integer: + - I64 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 520060080i64 + - Value: + Integer: + - I64 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 804659385i64 + - Value: + Integer: + - I64 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 537828058i64 + - Value: + Integer: + - I64 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 716600292i64 + - Value: + Integer: + - I64 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387020273i64 + - Value: + Integer: + - I64 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199375617i64 + - Value: + Integer: + - I64 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 680337189i64 + - Value: + Integer: + - I64 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 818479931i64 + - Value: + Integer: + - I64 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893693281i64 + - Value: + Integer: + - I64 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 87377802i64 + - Value: + Integer: + - I64 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 84699261i64 + - Value: + Integer: + - I64 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 292826090i64 + - Value: + Integer: + - I64 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 569171405i64 + - Value: + Integer: + - I64 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387436237i64 + - Value: + Integer: + - I64 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 150682190i64 + - Value: + Integer: + - I64 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 888770419i64 + - Value: + Integer: + - I64 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 824696431i64 + - Value: + Integer: + - I64 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 765659803i64 + - Value: + Integer: + - I64 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 270163693i64 + - Value: + Integer: + - I64 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 427940240i64 + - Value: + Integer: + - I64 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 504997332i64 + - Value: + Integer: + - I64 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 337808338i64 + - Value: + Integer: + - I64 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 907200008i64 + - Value: + Integer: + - I64 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 757177889i64 + - Value: + Integer: + - I64 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 696697188i64 + - Value: + Integer: + - I64 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 41376051i64 + - Value: + Integer: + - I64 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 496293518i64 + - Value: + Integer: + - I64 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 251218820i64 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/i8.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/i8.leo.out new file mode 100644 index 0000000000..7b06304a6a --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/i8.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - I8 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 123i8 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - I8 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 456i8 + - Value: + Integer: + - I8 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 83 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802i8 + - Value: + Integer: + - I8 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 403 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i8 + - Value: + Integer: + - I8 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 340130024i8 + - Value: + Integer: + - I8 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 158951116i8 + - Value: + Integer: + - I8 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 155529659i8 + - Value: + Integer: + - I8 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 642023166i8 + - Value: + Integer: + - I8 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 228481736i8 + - Value: + Integer: + - I8 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 469712960i8 + - Value: + Integer: + - I8 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 929437719i8 + - Value: + Integer: + - I8 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 721072814i8 + - Value: + Integer: + - I8 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 363254789i8 + - Value: + Integer: + - I8 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 906732565i8 + - Value: + Integer: + - I8 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 288246391i8 + - Value: + Integer: + - I8 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 724940549i8 + - Value: + Integer: + - I8 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 487101620i8 + - Value: + Integer: + - I8 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 261373583i8 + - Value: + Integer: + - I8 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 891163927i8 + - Value: + Integer: + - I8 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 743967544i8 + - Value: + Integer: + - I8 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 8372586i8 + - Value: + Integer: + - I8 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 461793278i8 + - Value: + Integer: + - I8 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 806307045i8 + - Value: + Integer: + - I8 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 122764546i8 + - Value: + Integer: + - I8 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 356336181i8 + - Value: + Integer: + - I8 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 158370903i8 + - Value: + Integer: + - I8 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 774460877i8 + - Value: + Integer: + - I8 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 557174131i8 + - Value: + Integer: + - I8 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 492401267i8 + - Value: + Integer: + - I8 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 893445620i8 + - Value: + Integer: + - I8 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 957757048i8 + - Value: + Integer: + - I8 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 721540649i8 + - Value: + Integer: + - I8 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 390746493i8 + - Value: + Integer: + - I8 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 211251725i8 + - Value: + Integer: + - I8 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 938266114i8 + - Value: + Integer: + - I8 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 156985870i8 + - Value: + Integer: + - I8 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 703831126i8 + - Value: + Integer: + - I8 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 729964155i8 + - Value: + Integer: + - I8 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 988151305i8 + - Value: + Integer: + - I8 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 320872435i8 + - Value: + Integer: + - I8 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 719287167i8 + - Value: + Integer: + - I8 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 152289486i8 + - Value: + Integer: + - I8 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 740067975i8 + - Value: + Integer: + - I8 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 728627816i8 + - Value: + Integer: + - I8 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 385008978i8 + - Value: + Integer: + - I8 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 553967635i8 + - Value: + Integer: + - I8 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 71980713i8 + - Value: + Integer: + - I8 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 519444716i8 + - Value: + Integer: + - I8 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 116499965i8 + - Value: + Integer: + - I8 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 717422268i8 + - Value: + Integer: + - I8 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 18966279i8 + - Value: + Integer: + - I8 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 22458638i8 + - Value: + Integer: + - I8 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 857282620i8 + - Value: + Integer: + - I8 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 920675898i8 + - Value: + Integer: + - I8 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 762235516i8 + - Value: + Integer: + - I8 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 469018377i8 + - Value: + Integer: + - I8 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 199986521i8 + - Value: + Integer: + - I8 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 536679358i8 + - Value: + Integer: + - I8 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 591399452i8 + - Value: + Integer: + - I8 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 83083158i8 + - Value: + Integer: + - I8 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 599449051i8 + - Value: + Integer: + - I8 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 445442318i8 + - Value: + Integer: + - I8 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 585486590i8 + - Value: + Integer: + - I8 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 209278800i8 + - Value: + Integer: + - I8 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 873568117i8 + - Value: + Integer: + - I8 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 664470940i8 + - Value: + Integer: + - I8 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 465262783i8 + - Value: + Integer: + - I8 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 605652874i8 + - Value: + Integer: + - I8 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 376803940i8 + - Value: + Integer: + - I8 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 965247040i8 + - Value: + Integer: + - I8 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 598474509i8 + - Value: + Integer: + - I8 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 845119918i8 + - Value: + Integer: + - I8 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 648159133i8 + - Value: + Integer: + - I8 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 669051032i8 + - Value: + Integer: + - I8 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 800600261i8 + - Value: + Integer: + - I8 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 434689764i8 + - Value: + Integer: + - I8 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 520060080i8 + - Value: + Integer: + - I8 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 804659385i8 + - Value: + Integer: + - I8 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 537828058i8 + - Value: + Integer: + - I8 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 716600292i8 + - Value: + Integer: + - I8 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 387020273i8 + - Value: + Integer: + - I8 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 199375617i8 + - Value: + Integer: + - I8 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 680337189i8 + - Value: + Integer: + - I8 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 818479931i8 + - Value: + Integer: + - I8 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 893693281i8 + - Value: + Integer: + - I8 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 87377802i8 + - Value: + Integer: + - I8 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 84699261i8 + - Value: + Integer: + - I8 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 292826090i8 + - Value: + Integer: + - I8 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 569171405i8 + - Value: + Integer: + - I8 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 387436237i8 + - Value: + Integer: + - I8 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 150682190i8 + - Value: + Integer: + - I8 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 888770419i8 + - Value: + Integer: + - I8 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 824696431i8 + - Value: + Integer: + - I8 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 765659803i8 + - Value: + Integer: + - I8 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 270163693i8 + - Value: + Integer: + - I8 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 427940240i8 + - Value: + Integer: + - I8 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 504997332i8 + - Value: + Integer: + - I8 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 337808338i8 + - Value: + Integer: + - I8 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 907200008i8 + - Value: + Integer: + - I8 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 757177889i8 + - Value: + Integer: + - I8 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 696697188i8 + - Value: + Integer: + - I8 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 41376051i8 + - Value: + Integer: + - I8 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 496293518i8 + - Value: + Integer: + - I8 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 251218820i8 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/implicit.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/implicit.leo.out new file mode 100644 index 0000000000..43e759dcc6 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/implicit.leo.out @@ -0,0 +1,949 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Implicit: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "456" + - Value: + Implicit: + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 81 + path: test + content: "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - Value: + Implicit: + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 401 + path: test + content: "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - Value: + Implicit: + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "340130024" + - Value: + Implicit: + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "158951116" + - Value: + Implicit: + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "155529659" + - Value: + Implicit: + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "642023166" + - Value: + Implicit: + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "228481736" + - Value: + Implicit: + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "469712960" + - Value: + Implicit: + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "929437719" + - Value: + Implicit: + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "721072814" + - Value: + Implicit: + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "363254789" + - Value: + Implicit: + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "906732565" + - Value: + Implicit: + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "288246391" + - Value: + Implicit: + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "724940549" + - Value: + Implicit: + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "487101620" + - Value: + Implicit: + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "261373583" + - Value: + Implicit: + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "891163927" + - Value: + Implicit: + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "743967544" + - Value: + Implicit: + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "8372586" + - Value: + Implicit: + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "461793278" + - Value: + Implicit: + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "806307045" + - Value: + Implicit: + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "122764546" + - Value: + Implicit: + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "356336181" + - Value: + Implicit: + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "158370903" + - Value: + Implicit: + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "774460877" + - Value: + Implicit: + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "557174131" + - Value: + Implicit: + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "492401267" + - Value: + Implicit: + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "893445620" + - Value: + Implicit: + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "957757048" + - Value: + Implicit: + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "721540649" + - Value: + Implicit: + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "390746493" + - Value: + Implicit: + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "211251725" + - Value: + Implicit: + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "938266114" + - Value: + Implicit: + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "156985870" + - Value: + Implicit: + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "703831126" + - Value: + Implicit: + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "729964155" + - Value: + Implicit: + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "988151305" + - Value: + Implicit: + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "320872435" + - Value: + Implicit: + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "719287167" + - Value: + Implicit: + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "152289486" + - Value: + Implicit: + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "740067975" + - Value: + Implicit: + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "728627816" + - Value: + Implicit: + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "385008978" + - Value: + Implicit: + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "553967635" + - Value: + Implicit: + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "71980713" + - Value: + Implicit: + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "519444716" + - Value: + Implicit: + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "116499965" + - Value: + Implicit: + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "717422268" + - Value: + Implicit: + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "18966279" + - Value: + Implicit: + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "22458638" + - Value: + Implicit: + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "857282620" + - Value: + Implicit: + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "920675898" + - Value: + Implicit: + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "762235516" + - Value: + Implicit: + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "469018377" + - Value: + Implicit: + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "199986521" + - Value: + Implicit: + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "536679358" + - Value: + Implicit: + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "591399452" + - Value: + Implicit: + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "83083158" + - Value: + Implicit: + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "599449051" + - Value: + Implicit: + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "445442318" + - Value: + Implicit: + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "585486590" + - Value: + Implicit: + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "209278800" + - Value: + Implicit: + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "873568117" + - Value: + Implicit: + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "664470940" + - Value: + Implicit: + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "465262783" + - Value: + Implicit: + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "605652874" + - Value: + Implicit: + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "376803940" + - Value: + Implicit: + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "965247040" + - Value: + Implicit: + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "598474509" + - Value: + Implicit: + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "845119918" + - Value: + Implicit: + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "648159133" + - Value: + Implicit: + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "669051032" + - Value: + Implicit: + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "800600261" + - Value: + Implicit: + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "434689764" + - Value: + Implicit: + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "520060080" + - Value: + Implicit: + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "804659385" + - Value: + Implicit: + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "537828058" + - Value: + Implicit: + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "716600292" + - Value: + Implicit: + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "387020273" + - Value: + Implicit: + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "199375617" + - Value: + Implicit: + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "680337189" + - Value: + Implicit: + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "818479931" + - Value: + Implicit: + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "893693281" + - Value: + Implicit: + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "87377802" + - Value: + Implicit: + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "84699261" + - Value: + Implicit: + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "292826090" + - Value: + Implicit: + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "569171405" + - Value: + Implicit: + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "387436237" + - Value: + Implicit: + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "150682190" + - Value: + Implicit: + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "888770419" + - Value: + Implicit: + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "824696431" + - Value: + Implicit: + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "765659803" + - Value: + Implicit: + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "270163693" + - Value: + Implicit: + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "427940240" + - Value: + Implicit: + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "504997332" + - Value: + Implicit: + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "337808338" + - Value: + Implicit: + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "907200008" + - Value: + Implicit: + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "757177889" + - Value: + Implicit: + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "696697188" + - Value: + Implicit: + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "41376051" + - Value: + Implicit: + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "496293518" + - Value: + Implicit: + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "251218820" diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/mono_group.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/mono_group.leo.out new file mode 100644 index 0000000000..9e959269ac --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/mono_group.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Group: + Single: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: 123group + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Group: + Single: + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: 456group + - Value: + Group: + Single: + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 86 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802group + - Value: + Group: + Single: + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 406 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802group + - Value: + Group: + Single: + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 340130024group + - Value: + Group: + Single: + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 158951116group + - Value: + Group: + Single: + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 155529659group + - Value: + Group: + Single: + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 642023166group + - Value: + Group: + Single: + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 228481736group + - Value: + Group: + Single: + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 469712960group + - Value: + Group: + Single: + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 929437719group + - Value: + Group: + Single: + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 721072814group + - Value: + Group: + Single: + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 363254789group + - Value: + Group: + Single: + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 906732565group + - Value: + Group: + Single: + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 288246391group + - Value: + Group: + Single: + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 724940549group + - Value: + Group: + Single: + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 487101620group + - Value: + Group: + Single: + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 261373583group + - Value: + Group: + Single: + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 891163927group + - Value: + Group: + Single: + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 743967544group + - Value: + Group: + Single: + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 8372586group + - Value: + Group: + Single: + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 461793278group + - Value: + Group: + Single: + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 806307045group + - Value: + Group: + Single: + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 122764546group + - Value: + Group: + Single: + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 356336181group + - Value: + Group: + Single: + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 158370903group + - Value: + Group: + Single: + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 774460877group + - Value: + Group: + Single: + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 557174131group + - Value: + Group: + Single: + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 492401267group + - Value: + Group: + Single: + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 893445620group + - Value: + Group: + Single: + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 957757048group + - Value: + Group: + Single: + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 721540649group + - Value: + Group: + Single: + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 390746493group + - Value: + Group: + Single: + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 211251725group + - Value: + Group: + Single: + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 938266114group + - Value: + Group: + Single: + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 156985870group + - Value: + Group: + Single: + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 703831126group + - Value: + Group: + Single: + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 729964155group + - Value: + Group: + Single: + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 988151305group + - Value: + Group: + Single: + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 320872435group + - Value: + Group: + Single: + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 719287167group + - Value: + Group: + Single: + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 152289486group + - Value: + Group: + Single: + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 740067975group + - Value: + Group: + Single: + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 728627816group + - Value: + Group: + Single: + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 385008978group + - Value: + Group: + Single: + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 553967635group + - Value: + Group: + Single: + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 71980713group + - Value: + Group: + Single: + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 519444716group + - Value: + Group: + Single: + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 116499965group + - Value: + Group: + Single: + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 717422268group + - Value: + Group: + Single: + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 18966279group + - Value: + Group: + Single: + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 22458638group + - Value: + Group: + Single: + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 857282620group + - Value: + Group: + Single: + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 920675898group + - Value: + Group: + Single: + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 762235516group + - Value: + Group: + Single: + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 469018377group + - Value: + Group: + Single: + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 199986521group + - Value: + Group: + Single: + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 536679358group + - Value: + Group: + Single: + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 591399452group + - Value: + Group: + Single: + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 83083158group + - Value: + Group: + Single: + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 599449051group + - Value: + Group: + Single: + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 445442318group + - Value: + Group: + Single: + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 585486590group + - Value: + Group: + Single: + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 209278800group + - Value: + Group: + Single: + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 873568117group + - Value: + Group: + Single: + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 664470940group + - Value: + Group: + Single: + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 465262783group + - Value: + Group: + Single: + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 605652874group + - Value: + Group: + Single: + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 376803940group + - Value: + Group: + Single: + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 965247040group + - Value: + Group: + Single: + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 598474509group + - Value: + Group: + Single: + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 845119918group + - Value: + Group: + Single: + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 648159133group + - Value: + Group: + Single: + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 669051032group + - Value: + Group: + Single: + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 800600261group + - Value: + Group: + Single: + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 434689764group + - Value: + Group: + Single: + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 520060080group + - Value: + Group: + Single: + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 804659385group + - Value: + Group: + Single: + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 537828058group + - Value: + Group: + Single: + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 716600292group + - Value: + Group: + Single: + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 387020273group + - Value: + Group: + Single: + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 199375617group + - Value: + Group: + Single: + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 680337189group + - Value: + Group: + Single: + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 818479931group + - Value: + Group: + Single: + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 893693281group + - Value: + Group: + Single: + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 87377802group + - Value: + Group: + Single: + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 84699261group + - Value: + Group: + Single: + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 292826090group + - Value: + Group: + Single: + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 569171405group + - Value: + Group: + Single: + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 387436237group + - Value: + Group: + Single: + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 150682190group + - Value: + Group: + Single: + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 888770419group + - Value: + Group: + Single: + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 824696431group + - Value: + Group: + Single: + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 765659803group + - Value: + Group: + Single: + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 270163693group + - Value: + Group: + Single: + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 427940240group + - Value: + Group: + Single: + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 504997332group + - Value: + Group: + Single: + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 337808338group + - Value: + Group: + Single: + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 907200008group + - Value: + Group: + Single: + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 757177889group + - Value: + Group: + Single: + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 696697188group + - Value: + Group: + Single: + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 41376051group + - Value: + Group: + Single: + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 496293518group + - Value: + Group: + Single: + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: 251218820group diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/u128.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/u128.leo.out new file mode 100644 index 0000000000..f1048e6469 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/u128.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - U128 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: 123u128 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - U128 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: 456u128 + - Value: + Integer: + - U128 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 85 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802u128 + - Value: + Integer: + - U128 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 405 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u128 + - Value: + Integer: + - U128 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 340130024u128 + - Value: + Integer: + - U128 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 158951116u128 + - Value: + Integer: + - U128 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 155529659u128 + - Value: + Integer: + - U128 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 642023166u128 + - Value: + Integer: + - U128 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 228481736u128 + - Value: + Integer: + - U128 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 469712960u128 + - Value: + Integer: + - U128 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 929437719u128 + - Value: + Integer: + - U128 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 721072814u128 + - Value: + Integer: + - U128 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 363254789u128 + - Value: + Integer: + - U128 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 906732565u128 + - Value: + Integer: + - U128 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 288246391u128 + - Value: + Integer: + - U128 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 724940549u128 + - Value: + Integer: + - U128 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 487101620u128 + - Value: + Integer: + - U128 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 261373583u128 + - Value: + Integer: + - U128 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 891163927u128 + - Value: + Integer: + - U128 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 743967544u128 + - Value: + Integer: + - U128 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 8372586u128 + - Value: + Integer: + - U128 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 461793278u128 + - Value: + Integer: + - U128 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 806307045u128 + - Value: + Integer: + - U128 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 122764546u128 + - Value: + Integer: + - U128 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 356336181u128 + - Value: + Integer: + - U128 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 158370903u128 + - Value: + Integer: + - U128 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 774460877u128 + - Value: + Integer: + - U128 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 557174131u128 + - Value: + Integer: + - U128 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 492401267u128 + - Value: + Integer: + - U128 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 893445620u128 + - Value: + Integer: + - U128 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 957757048u128 + - Value: + Integer: + - U128 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 721540649u128 + - Value: + Integer: + - U128 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 390746493u128 + - Value: + Integer: + - U128 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 211251725u128 + - Value: + Integer: + - U128 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 938266114u128 + - Value: + Integer: + - U128 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 156985870u128 + - Value: + Integer: + - U128 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 703831126u128 + - Value: + Integer: + - U128 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 729964155u128 + - Value: + Integer: + - U128 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 988151305u128 + - Value: + Integer: + - U128 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 320872435u128 + - Value: + Integer: + - U128 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 719287167u128 + - Value: + Integer: + - U128 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 152289486u128 + - Value: + Integer: + - U128 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 740067975u128 + - Value: + Integer: + - U128 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 728627816u128 + - Value: + Integer: + - U128 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 385008978u128 + - Value: + Integer: + - U128 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 553967635u128 + - Value: + Integer: + - U128 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 71980713u128 + - Value: + Integer: + - U128 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 519444716u128 + - Value: + Integer: + - U128 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 116499965u128 + - Value: + Integer: + - U128 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 717422268u128 + - Value: + Integer: + - U128 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 18966279u128 + - Value: + Integer: + - U128 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 22458638u128 + - Value: + Integer: + - U128 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 857282620u128 + - Value: + Integer: + - U128 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 920675898u128 + - Value: + Integer: + - U128 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 762235516u128 + - Value: + Integer: + - U128 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 469018377u128 + - Value: + Integer: + - U128 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 199986521u128 + - Value: + Integer: + - U128 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 536679358u128 + - Value: + Integer: + - U128 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 591399452u128 + - Value: + Integer: + - U128 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 83083158u128 + - Value: + Integer: + - U128 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 599449051u128 + - Value: + Integer: + - U128 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 445442318u128 + - Value: + Integer: + - U128 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 585486590u128 + - Value: + Integer: + - U128 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 209278800u128 + - Value: + Integer: + - U128 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 873568117u128 + - Value: + Integer: + - U128 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 664470940u128 + - Value: + Integer: + - U128 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 465262783u128 + - Value: + Integer: + - U128 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 605652874u128 + - Value: + Integer: + - U128 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 376803940u128 + - Value: + Integer: + - U128 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 965247040u128 + - Value: + Integer: + - U128 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 598474509u128 + - Value: + Integer: + - U128 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 845119918u128 + - Value: + Integer: + - U128 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 648159133u128 + - Value: + Integer: + - U128 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 669051032u128 + - Value: + Integer: + - U128 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 800600261u128 + - Value: + Integer: + - U128 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 434689764u128 + - Value: + Integer: + - U128 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 520060080u128 + - Value: + Integer: + - U128 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 804659385u128 + - Value: + Integer: + - U128 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 537828058u128 + - Value: + Integer: + - U128 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 716600292u128 + - Value: + Integer: + - U128 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 387020273u128 + - Value: + Integer: + - U128 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 199375617u128 + - Value: + Integer: + - U128 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 680337189u128 + - Value: + Integer: + - U128 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 818479931u128 + - Value: + Integer: + - U128 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 893693281u128 + - Value: + Integer: + - U128 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 87377802u128 + - Value: + Integer: + - U128 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 84699261u128 + - Value: + Integer: + - U128 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 292826090u128 + - Value: + Integer: + - U128 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 569171405u128 + - Value: + Integer: + - U128 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 387436237u128 + - Value: + Integer: + - U128 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 150682190u128 + - Value: + Integer: + - U128 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 888770419u128 + - Value: + Integer: + - U128 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 824696431u128 + - Value: + Integer: + - U128 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 765659803u128 + - Value: + Integer: + - U128 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 270163693u128 + - Value: + Integer: + - U128 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 427940240u128 + - Value: + Integer: + - U128 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 504997332u128 + - Value: + Integer: + - U128 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 337808338u128 + - Value: + Integer: + - U128 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 907200008u128 + - Value: + Integer: + - U128 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 757177889u128 + - Value: + Integer: + - U128 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 696697188u128 + - Value: + Integer: + - U128 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 41376051u128 + - Value: + Integer: + - U128 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 496293518u128 + - Value: + Integer: + - U128 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: 251218820u128 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/u16.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/u16.leo.out new file mode 100644 index 0000000000..324a0abcce --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/u16.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - U8 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 123u8 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - U8 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 456u8 + - Value: + Integer: + - U8 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 83 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + - Value: + Integer: + - U8 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 403 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + - Value: + Integer: + - U8 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 340130024u8 + - Value: + Integer: + - U8 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 158951116u8 + - Value: + Integer: + - U8 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 155529659u8 + - Value: + Integer: + - U8 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 642023166u8 + - Value: + Integer: + - U8 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 228481736u8 + - Value: + Integer: + - U8 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 469712960u8 + - Value: + Integer: + - U8 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 929437719u8 + - Value: + Integer: + - U8 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 721072814u8 + - Value: + Integer: + - U8 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 363254789u8 + - Value: + Integer: + - U8 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 906732565u8 + - Value: + Integer: + - U8 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 288246391u8 + - Value: + Integer: + - U8 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 724940549u8 + - Value: + Integer: + - U8 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 487101620u8 + - Value: + Integer: + - U8 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 261373583u8 + - Value: + Integer: + - U8 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 891163927u8 + - Value: + Integer: + - U8 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 743967544u8 + - Value: + Integer: + - U8 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 8372586u8 + - Value: + Integer: + - U8 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 461793278u8 + - Value: + Integer: + - U8 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 806307045u8 + - Value: + Integer: + - U8 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 122764546u8 + - Value: + Integer: + - U8 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 356336181u8 + - Value: + Integer: + - U8 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 158370903u8 + - Value: + Integer: + - U8 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 774460877u8 + - Value: + Integer: + - U8 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 557174131u8 + - Value: + Integer: + - U8 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 492401267u8 + - Value: + Integer: + - U8 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 893445620u8 + - Value: + Integer: + - U8 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 957757048u8 + - Value: + Integer: + - U8 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 721540649u8 + - Value: + Integer: + - U8 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 390746493u8 + - Value: + Integer: + - U8 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 211251725u8 + - Value: + Integer: + - U8 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 938266114u8 + - Value: + Integer: + - U8 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 156985870u8 + - Value: + Integer: + - U8 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 703831126u8 + - Value: + Integer: + - U8 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 729964155u8 + - Value: + Integer: + - U8 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 988151305u8 + - Value: + Integer: + - U8 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 320872435u8 + - Value: + Integer: + - U8 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 719287167u8 + - Value: + Integer: + - U8 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 152289486u8 + - Value: + Integer: + - U8 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 740067975u8 + - Value: + Integer: + - U8 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 728627816u8 + - Value: + Integer: + - U8 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 385008978u8 + - Value: + Integer: + - U8 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 553967635u8 + - Value: + Integer: + - U8 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 71980713u8 + - Value: + Integer: + - U8 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 519444716u8 + - Value: + Integer: + - U8 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 116499965u8 + - Value: + Integer: + - U8 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 717422268u8 + - Value: + Integer: + - U8 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 18966279u8 + - Value: + Integer: + - U8 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 22458638u8 + - Value: + Integer: + - U8 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 857282620u8 + - Value: + Integer: + - U8 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 920675898u8 + - Value: + Integer: + - U8 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 762235516u8 + - Value: + Integer: + - U8 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 469018377u8 + - Value: + Integer: + - U8 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 199986521u8 + - Value: + Integer: + - U8 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 536679358u8 + - Value: + Integer: + - U8 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 591399452u8 + - Value: + Integer: + - U8 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 83083158u8 + - Value: + Integer: + - U8 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 599449051u8 + - Value: + Integer: + - U8 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 445442318u8 + - Value: + Integer: + - U8 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 585486590u8 + - Value: + Integer: + - U8 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 209278800u8 + - Value: + Integer: + - U8 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 873568117u8 + - Value: + Integer: + - U8 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 664470940u8 + - Value: + Integer: + - U8 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 465262783u8 + - Value: + Integer: + - U8 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 605652874u8 + - Value: + Integer: + - U8 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 376803940u8 + - Value: + Integer: + - U8 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 965247040u8 + - Value: + Integer: + - U8 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 598474509u8 + - Value: + Integer: + - U8 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 845119918u8 + - Value: + Integer: + - U8 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 648159133u8 + - Value: + Integer: + - U8 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 669051032u8 + - Value: + Integer: + - U8 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 800600261u8 + - Value: + Integer: + - U8 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 434689764u8 + - Value: + Integer: + - U8 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 520060080u8 + - Value: + Integer: + - U8 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 804659385u8 + - Value: + Integer: + - U8 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 537828058u8 + - Value: + Integer: + - U8 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 716600292u8 + - Value: + Integer: + - U8 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 387020273u8 + - Value: + Integer: + - U8 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 199375617u8 + - Value: + Integer: + - U8 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 680337189u8 + - Value: + Integer: + - U8 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 818479931u8 + - Value: + Integer: + - U8 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 893693281u8 + - Value: + Integer: + - U8 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 87377802u8 + - Value: + Integer: + - U8 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 84699261u8 + - Value: + Integer: + - U8 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 292826090u8 + - Value: + Integer: + - U8 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 569171405u8 + - Value: + Integer: + - U8 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 387436237u8 + - Value: + Integer: + - U8 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 150682190u8 + - Value: + Integer: + - U8 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 888770419u8 + - Value: + Integer: + - U8 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 824696431u8 + - Value: + Integer: + - U8 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 765659803u8 + - Value: + Integer: + - U8 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 270163693u8 + - Value: + Integer: + - U8 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 427940240u8 + - Value: + Integer: + - U8 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 504997332u8 + - Value: + Integer: + - U8 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 337808338u8 + - Value: + Integer: + - U8 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 907200008u8 + - Value: + Integer: + - U8 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 757177889u8 + - Value: + Integer: + - U8 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 696697188u8 + - Value: + Integer: + - U8 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 41376051u8 + - Value: + Integer: + - U8 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 496293518u8 + - Value: + Integer: + - U8 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 251218820u8 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/u32.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/u32.leo.out new file mode 100644 index 0000000000..ba97127eac --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/u32.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - U32 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 123u32 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - U32 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 456u32 + - Value: + Integer: + - U32 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 84 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + - Value: + Integer: + - U32 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 404 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + - Value: + Integer: + - U32 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 340130024u32 + - Value: + Integer: + - U32 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158951116u32 + - Value: + Integer: + - U32 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 155529659u32 + - Value: + Integer: + - U32 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 642023166u32 + - Value: + Integer: + - U32 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 228481736u32 + - Value: + Integer: + - U32 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469712960u32 + - Value: + Integer: + - U32 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 929437719u32 + - Value: + Integer: + - U32 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721072814u32 + - Value: + Integer: + - U32 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 363254789u32 + - Value: + Integer: + - U32 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 906732565u32 + - Value: + Integer: + - U32 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 288246391u32 + - Value: + Integer: + - U32 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 724940549u32 + - Value: + Integer: + - U32 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 487101620u32 + - Value: + Integer: + - U32 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 261373583u32 + - Value: + Integer: + - U32 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 891163927u32 + - Value: + Integer: + - U32 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 743967544u32 + - Value: + Integer: + - U32 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 8372586u32 + - Value: + Integer: + - U32 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 461793278u32 + - Value: + Integer: + - U32 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 806307045u32 + - Value: + Integer: + - U32 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 122764546u32 + - Value: + Integer: + - U32 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 356336181u32 + - Value: + Integer: + - U32 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158370903u32 + - Value: + Integer: + - U32 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 774460877u32 + - Value: + Integer: + - U32 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 557174131u32 + - Value: + Integer: + - U32 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 492401267u32 + - Value: + Integer: + - U32 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893445620u32 + - Value: + Integer: + - U32 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 957757048u32 + - Value: + Integer: + - U32 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721540649u32 + - Value: + Integer: + - U32 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 390746493u32 + - Value: + Integer: + - U32 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 211251725u32 + - Value: + Integer: + - U32 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 938266114u32 + - Value: + Integer: + - U32 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 156985870u32 + - Value: + Integer: + - U32 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 703831126u32 + - Value: + Integer: + - U32 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 729964155u32 + - Value: + Integer: + - U32 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 988151305u32 + - Value: + Integer: + - U32 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 320872435u32 + - Value: + Integer: + - U32 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 719287167u32 + - Value: + Integer: + - U32 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 152289486u32 + - Value: + Integer: + - U32 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 740067975u32 + - Value: + Integer: + - U32 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 728627816u32 + - Value: + Integer: + - U32 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 385008978u32 + - Value: + Integer: + - U32 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 553967635u32 + - Value: + Integer: + - U32 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 71980713u32 + - Value: + Integer: + - U32 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 519444716u32 + - Value: + Integer: + - U32 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 116499965u32 + - Value: + Integer: + - U32 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 717422268u32 + - Value: + Integer: + - U32 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 18966279u32 + - Value: + Integer: + - U32 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 22458638u32 + - Value: + Integer: + - U32 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 857282620u32 + - Value: + Integer: + - U32 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 920675898u32 + - Value: + Integer: + - U32 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 762235516u32 + - Value: + Integer: + - U32 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469018377u32 + - Value: + Integer: + - U32 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199986521u32 + - Value: + Integer: + - U32 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 536679358u32 + - Value: + Integer: + - U32 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 591399452u32 + - Value: + Integer: + - U32 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 83083158u32 + - Value: + Integer: + - U32 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 599449051u32 + - Value: + Integer: + - U32 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 445442318u32 + - Value: + Integer: + - U32 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 585486590u32 + - Value: + Integer: + - U32 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 209278800u32 + - Value: + Integer: + - U32 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 873568117u32 + - Value: + Integer: + - U32 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 664470940u32 + - Value: + Integer: + - U32 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 465262783u32 + - Value: + Integer: + - U32 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 605652874u32 + - Value: + Integer: + - U32 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 376803940u32 + - Value: + Integer: + - U32 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 965247040u32 + - Value: + Integer: + - U32 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 598474509u32 + - Value: + Integer: + - U32 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 845119918u32 + - Value: + Integer: + - U32 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 648159133u32 + - Value: + Integer: + - U32 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 669051032u32 + - Value: + Integer: + - U32 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 800600261u32 + - Value: + Integer: + - U32 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 434689764u32 + - Value: + Integer: + - U32 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 520060080u32 + - Value: + Integer: + - U32 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 804659385u32 + - Value: + Integer: + - U32 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 537828058u32 + - Value: + Integer: + - U32 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 716600292u32 + - Value: + Integer: + - U32 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387020273u32 + - Value: + Integer: + - U32 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199375617u32 + - Value: + Integer: + - U32 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 680337189u32 + - Value: + Integer: + - U32 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 818479931u32 + - Value: + Integer: + - U32 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893693281u32 + - Value: + Integer: + - U32 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 87377802u32 + - Value: + Integer: + - U32 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 84699261u32 + - Value: + Integer: + - U32 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 292826090u32 + - Value: + Integer: + - U32 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 569171405u32 + - Value: + Integer: + - U32 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387436237u32 + - Value: + Integer: + - U32 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 150682190u32 + - Value: + Integer: + - U32 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 888770419u32 + - Value: + Integer: + - U32 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 824696431u32 + - Value: + Integer: + - U32 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 765659803u32 + - Value: + Integer: + - U32 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 270163693u32 + - Value: + Integer: + - U32 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 427940240u32 + - Value: + Integer: + - U32 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 504997332u32 + - Value: + Integer: + - U32 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 337808338u32 + - Value: + Integer: + - U32 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 907200008u32 + - Value: + Integer: + - U32 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 757177889u32 + - Value: + Integer: + - U32 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 696697188u32 + - Value: + Integer: + - U32 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 41376051u32 + - Value: + Integer: + - U32 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 496293518u32 + - Value: + Integer: + - U32 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 251218820u32 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/u64.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/u64.leo.out new file mode 100644 index 0000000000..ba97127eac --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/u64.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - U32 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 123u32 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - U32 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: 456u32 + - Value: + Integer: + - U32 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 84 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + - Value: + Integer: + - U32 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 404 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + - Value: + Integer: + - U32 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 340130024u32 + - Value: + Integer: + - U32 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158951116u32 + - Value: + Integer: + - U32 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 155529659u32 + - Value: + Integer: + - U32 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 642023166u32 + - Value: + Integer: + - U32 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 228481736u32 + - Value: + Integer: + - U32 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469712960u32 + - Value: + Integer: + - U32 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 929437719u32 + - Value: + Integer: + - U32 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721072814u32 + - Value: + Integer: + - U32 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 363254789u32 + - Value: + Integer: + - U32 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 906732565u32 + - Value: + Integer: + - U32 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 288246391u32 + - Value: + Integer: + - U32 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 724940549u32 + - Value: + Integer: + - U32 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 487101620u32 + - Value: + Integer: + - U32 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 261373583u32 + - Value: + Integer: + - U32 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 891163927u32 + - Value: + Integer: + - U32 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 743967544u32 + - Value: + Integer: + - U32 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 8372586u32 + - Value: + Integer: + - U32 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 461793278u32 + - Value: + Integer: + - U32 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 806307045u32 + - Value: + Integer: + - U32 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 122764546u32 + - Value: + Integer: + - U32 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 356336181u32 + - Value: + Integer: + - U32 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 158370903u32 + - Value: + Integer: + - U32 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 774460877u32 + - Value: + Integer: + - U32 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 557174131u32 + - Value: + Integer: + - U32 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 492401267u32 + - Value: + Integer: + - U32 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893445620u32 + - Value: + Integer: + - U32 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 957757048u32 + - Value: + Integer: + - U32 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 721540649u32 + - Value: + Integer: + - U32 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 390746493u32 + - Value: + Integer: + - U32 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 211251725u32 + - Value: + Integer: + - U32 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 938266114u32 + - Value: + Integer: + - U32 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 156985870u32 + - Value: + Integer: + - U32 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 703831126u32 + - Value: + Integer: + - U32 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 729964155u32 + - Value: + Integer: + - U32 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 988151305u32 + - Value: + Integer: + - U32 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 320872435u32 + - Value: + Integer: + - U32 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 719287167u32 + - Value: + Integer: + - U32 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 152289486u32 + - Value: + Integer: + - U32 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 740067975u32 + - Value: + Integer: + - U32 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 728627816u32 + - Value: + Integer: + - U32 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 385008978u32 + - Value: + Integer: + - U32 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 553967635u32 + - Value: + Integer: + - U32 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 71980713u32 + - Value: + Integer: + - U32 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 519444716u32 + - Value: + Integer: + - U32 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 116499965u32 + - Value: + Integer: + - U32 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 717422268u32 + - Value: + Integer: + - U32 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 18966279u32 + - Value: + Integer: + - U32 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 22458638u32 + - Value: + Integer: + - U32 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 857282620u32 + - Value: + Integer: + - U32 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 920675898u32 + - Value: + Integer: + - U32 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 762235516u32 + - Value: + Integer: + - U32 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 469018377u32 + - Value: + Integer: + - U32 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199986521u32 + - Value: + Integer: + - U32 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 536679358u32 + - Value: + Integer: + - U32 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 591399452u32 + - Value: + Integer: + - U32 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 83083158u32 + - Value: + Integer: + - U32 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 599449051u32 + - Value: + Integer: + - U32 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 445442318u32 + - Value: + Integer: + - U32 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 585486590u32 + - Value: + Integer: + - U32 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 209278800u32 + - Value: + Integer: + - U32 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 873568117u32 + - Value: + Integer: + - U32 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 664470940u32 + - Value: + Integer: + - U32 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 465262783u32 + - Value: + Integer: + - U32 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 605652874u32 + - Value: + Integer: + - U32 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 376803940u32 + - Value: + Integer: + - U32 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 965247040u32 + - Value: + Integer: + - U32 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 598474509u32 + - Value: + Integer: + - U32 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 845119918u32 + - Value: + Integer: + - U32 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 648159133u32 + - Value: + Integer: + - U32 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 669051032u32 + - Value: + Integer: + - U32 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 800600261u32 + - Value: + Integer: + - U32 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 434689764u32 + - Value: + Integer: + - U32 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 520060080u32 + - Value: + Integer: + - U32 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 804659385u32 + - Value: + Integer: + - U32 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 537828058u32 + - Value: + Integer: + - U32 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 716600292u32 + - Value: + Integer: + - U32 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387020273u32 + - Value: + Integer: + - U32 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 199375617u32 + - Value: + Integer: + - U32 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 680337189u32 + - Value: + Integer: + - U32 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 818479931u32 + - Value: + Integer: + - U32 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 893693281u32 + - Value: + Integer: + - U32 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 87377802u32 + - Value: + Integer: + - U32 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 84699261u32 + - Value: + Integer: + - U32 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 292826090u32 + - Value: + Integer: + - U32 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 569171405u32 + - Value: + Integer: + - U32 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 387436237u32 + - Value: + Integer: + - U32 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 150682190u32 + - Value: + Integer: + - U32 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 888770419u32 + - Value: + Integer: + - U32 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 824696431u32 + - Value: + Integer: + - U32 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 765659803u32 + - Value: + Integer: + - U32 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 270163693u32 + - Value: + Integer: + - U32 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 427940240u32 + - Value: + Integer: + - U32 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 504997332u32 + - Value: + Integer: + - U32 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 337808338u32 + - Value: + Integer: + - U32 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 907200008u32 + - Value: + Integer: + - U32 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 757177889u32 + - Value: + Integer: + - U32 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 696697188u32 + - Value: + Integer: + - U32 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 41376051u32 + - Value: + Integer: + - U32 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 496293518u32 + - Value: + Integer: + - U32 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: 251218820u32 diff --git a/tests/expectations/parser/parser/expression/literal/int_parse/u8.leo.out b/tests/expectations/parser/parser/expression/literal/int_parse/u8.leo.out new file mode 100644 index 0000000000..324a0abcce --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/int_parse/u8.leo.out @@ -0,0 +1,1053 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Integer: + - U8 + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 123u8 + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "123" + - Value: + Integer: + - U8 + - "456" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: 456u8 + - Value: + Integer: + - U8 + - "87377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 83 + path: test + content: 87377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + - Value: + Integer: + - U8 + - "8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 403 + path: test + content: 8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + - Value: + Integer: + - U8 + - "340130024" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 340130024u8 + - Value: + Integer: + - U8 + - "158951116" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 158951116u8 + - Value: + Integer: + - U8 + - "155529659" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 155529659u8 + - Value: + Integer: + - U8 + - "642023166" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 642023166u8 + - Value: + Integer: + - U8 + - "228481736" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 228481736u8 + - Value: + Integer: + - U8 + - "469712960" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 469712960u8 + - Value: + Integer: + - U8 + - "929437719" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 929437719u8 + - Value: + Integer: + - U8 + - "721072814" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 721072814u8 + - Value: + Integer: + - U8 + - "363254789" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 363254789u8 + - Value: + Integer: + - U8 + - "906732565" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 906732565u8 + - Value: + Integer: + - U8 + - "288246391" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 288246391u8 + - Value: + Integer: + - U8 + - "724940549" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 724940549u8 + - Value: + Integer: + - U8 + - "487101620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 487101620u8 + - Value: + Integer: + - U8 + - "261373583" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 261373583u8 + - Value: + Integer: + - U8 + - "891163927" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 891163927u8 + - Value: + Integer: + - U8 + - "743967544" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 743967544u8 + - Value: + Integer: + - U8 + - "8372586" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: 8372586u8 + - Value: + Integer: + - U8 + - "461793278" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 461793278u8 + - Value: + Integer: + - U8 + - "806307045" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 806307045u8 + - Value: + Integer: + - U8 + - "122764546" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 122764546u8 + - Value: + Integer: + - U8 + - "356336181" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 356336181u8 + - Value: + Integer: + - U8 + - "158370903" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 158370903u8 + - Value: + Integer: + - U8 + - "774460877" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 774460877u8 + - Value: + Integer: + - U8 + - "557174131" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 557174131u8 + - Value: + Integer: + - U8 + - "492401267" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 492401267u8 + - Value: + Integer: + - U8 + - "893445620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 893445620u8 + - Value: + Integer: + - U8 + - "957757048" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 957757048u8 + - Value: + Integer: + - U8 + - "721540649" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 721540649u8 + - Value: + Integer: + - U8 + - "390746493" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 390746493u8 + - Value: + Integer: + - U8 + - "211251725" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 211251725u8 + - Value: + Integer: + - U8 + - "938266114" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 938266114u8 + - Value: + Integer: + - U8 + - "156985870" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 156985870u8 + - Value: + Integer: + - U8 + - "703831126" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 703831126u8 + - Value: + Integer: + - U8 + - "729964155" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 729964155u8 + - Value: + Integer: + - U8 + - "988151305" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 988151305u8 + - Value: + Integer: + - U8 + - "320872435" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 320872435u8 + - Value: + Integer: + - U8 + - "719287167" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 719287167u8 + - Value: + Integer: + - U8 + - "152289486" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 152289486u8 + - Value: + Integer: + - U8 + - "740067975" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 740067975u8 + - Value: + Integer: + - U8 + - "728627816" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 728627816u8 + - Value: + Integer: + - U8 + - "385008978" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 385008978u8 + - Value: + Integer: + - U8 + - "553967635" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 553967635u8 + - Value: + Integer: + - U8 + - "71980713" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 71980713u8 + - Value: + Integer: + - U8 + - "519444716" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 519444716u8 + - Value: + Integer: + - U8 + - "116499965" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 116499965u8 + - Value: + Integer: + - U8 + - "717422268" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 717422268u8 + - Value: + Integer: + - U8 + - "18966279" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 18966279u8 + - Value: + Integer: + - U8 + - "22458638" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 22458638u8 + - Value: + Integer: + - U8 + - "857282620" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 857282620u8 + - Value: + Integer: + - U8 + - "920675898" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 920675898u8 + - Value: + Integer: + - U8 + - "762235516" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 762235516u8 + - Value: + Integer: + - U8 + - "469018377" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 469018377u8 + - Value: + Integer: + - U8 + - "199986521" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 199986521u8 + - Value: + Integer: + - U8 + - "536679358" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 536679358u8 + - Value: + Integer: + - U8 + - "591399452" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 591399452u8 + - Value: + Integer: + - U8 + - "83083158" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 83083158u8 + - Value: + Integer: + - U8 + - "599449051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 599449051u8 + - Value: + Integer: + - U8 + - "445442318" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 445442318u8 + - Value: + Integer: + - U8 + - "585486590" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 585486590u8 + - Value: + Integer: + - U8 + - "209278800" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 209278800u8 + - Value: + Integer: + - U8 + - "873568117" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 873568117u8 + - Value: + Integer: + - U8 + - "664470940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 664470940u8 + - Value: + Integer: + - U8 + - "465262783" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 465262783u8 + - Value: + Integer: + - U8 + - "605652874" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 605652874u8 + - Value: + Integer: + - U8 + - "376803940" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 376803940u8 + - Value: + Integer: + - U8 + - "965247040" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 965247040u8 + - Value: + Integer: + - U8 + - "598474509" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 598474509u8 + - Value: + Integer: + - U8 + - "845119918" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 845119918u8 + - Value: + Integer: + - U8 + - "648159133" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 648159133u8 + - Value: + Integer: + - U8 + - "669051032" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 669051032u8 + - Value: + Integer: + - U8 + - "800600261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 800600261u8 + - Value: + Integer: + - U8 + - "434689764" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 434689764u8 + - Value: + Integer: + - U8 + - "520060080" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 520060080u8 + - Value: + Integer: + - U8 + - "804659385" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 804659385u8 + - Value: + Integer: + - U8 + - "537828058" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 537828058u8 + - Value: + Integer: + - U8 + - "716600292" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 716600292u8 + - Value: + Integer: + - U8 + - "387020273" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 387020273u8 + - Value: + Integer: + - U8 + - "199375617" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 199375617u8 + - Value: + Integer: + - U8 + - "680337189" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 680337189u8 + - Value: + Integer: + - U8 + - "818479931" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 818479931u8 + - Value: + Integer: + - U8 + - "893693281" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 893693281u8 + - Value: + Integer: + - U8 + - "87377802" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 87377802u8 + - Value: + Integer: + - U8 + - "84699261" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 84699261u8 + - Value: + Integer: + - U8 + - "292826090" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 292826090u8 + - Value: + Integer: + - U8 + - "569171405" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 569171405u8 + - Value: + Integer: + - U8 + - "387436237" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 387436237u8 + - Value: + Integer: + - U8 + - "150682190" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 150682190u8 + - Value: + Integer: + - U8 + - "888770419" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 888770419u8 + - Value: + Integer: + - U8 + - "824696431" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 824696431u8 + - Value: + Integer: + - U8 + - "765659803" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 765659803u8 + - Value: + Integer: + - U8 + - "270163693" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 270163693u8 + - Value: + Integer: + - U8 + - "427940240" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 427940240u8 + - Value: + Integer: + - U8 + - "504997332" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 504997332u8 + - Value: + Integer: + - U8 + - "337808338" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 337808338u8 + - Value: + Integer: + - U8 + - "907200008" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 907200008u8 + - Value: + Integer: + - U8 + - "757177889" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 757177889u8 + - Value: + Integer: + - U8 + - "696697188" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 696697188u8 + - Value: + Integer: + - U8 + - "41376051" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: 41376051u8 + - Value: + Integer: + - U8 + - "496293518" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 496293518u8 + - Value: + Integer: + - U8 + - "251218820" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: 251218820u8 diff --git a/tests/expectations/parser/parser/expression/literal/postfix_types.leo.out b/tests/expectations/parser/parser/expression/literal/postfix_types.leo.out new file mode 100644 index 0000000000..00ff4531d4 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/postfix_types.leo.out @@ -0,0 +1,62 @@ +--- +namespace: Token +expectation: Pass +outputs: + - "'field' @ 1:1-6" + - "'Field' @ 1:1-6" + - "'fielD' @ 1:1-6" + - "'FIELD' @ 1:1-6" + - "'group' @ 1:1-6" + - "'Group' @ 1:1-6" + - "'grouP' @ 1:1-6" + - "'GROUP' @ 1:1-6" + - "'u8' @ 1:1-3" + - "'u16' @ 1:1-4" + - "'u32' @ 1:1-4" + - "'u64' @ 1:1-4" + - "'u128' @ 1:1-5" + - "'i8' @ 1:1-3" + - "'i16' @ 1:1-4" + - "'i32' @ 1:1-4" + - "'i64' @ 1:1-4" + - "'i128' @ 1:1-5" + - "'U8' @ 1:1-3" + - "'U16' @ 1:1-4" + - "'U32' @ 1:1-4" + - "'U64' @ 1:1-4" + - "'U128' @ 1:1-5" + - "'U8' @ 1:1-3" + - "'U16' @ 1:1-4" + - "'U32' @ 1:1-4" + - "'U64' @ 1:1-4" + - "'U128' @ 1:1-5" + - "'u' @ 1:1-2" + - "'8' @ 1:1-2" + - "'u' @ 1:1-2" + - "'16' @ 1:1-3" + - "'u' @ 1:1-2" + - "'32' @ 1:1-3" + - "'u' @ 1:1-2" + - "'64' @ 1:1-3" + - "'u' @ 1:1-2" + - "'128' @ 1:1-4" + - "'i' @ 1:1-2" + - "'8' @ 1:1-2" + - "'i' @ 1:1-2" + - "'16' @ 1:1-3" + - "'i' @ 1:1-2" + - "'32' @ 1:1-3" + - "'i' @ 1:1-2" + - "'64' @ 1:1-3" + - "'i' @ 1:1-2" + - "'128' @ 1:1-4" + - "'U' @ 1:1-2,'8' @ 1:3-4" + - "'U' @ 1:1-2,'16' @ 1:3-5" + - "'U' @ 1:1-2,'32' @ 1:3-5" + - "'U' @ 1:1-2,'64' @ 1:3-5" + - "'U' @ 1:1-2,'128' @ 1:3-6" + - "'U' @ 1:1-2,'8' @ 1:3-4" + - "'U' @ 1:1-2,'16' @ 1:3-5" + - "'U' @ 1:1-2,'32' @ 1:3-5" + - "'U' @ 1:1-2,'64' @ 1:3-5" + - "'U' @ 1:1-2,'128' @ 1:3-6" diff --git a/tests/expectations/parser/parser/expression/ternary.leo.out b/tests/expectations/parser/parser/expression/ternary.leo.out new file mode 100644 index 0000000000..0d672f23d9 --- /dev/null +++ b/tests/expectations/parser/parser/expression/ternary.leo.out @@ -0,0 +1,72 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Ternary: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : z\\\"}\"}" + if_true: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : z\\\"}\"}" + if_false: + Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "x ? y : z" + - Ternary: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? a ? b : c : z\\\"}\"}" + if_true: + Ternary: + condition: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? a ? b : c : z\\\"}\"}" + if_true: + Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? a ? b : c : z\\\"}\"}" + if_false: + Identifier: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? a ? b : c : z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 14 + path: test + content: "x ? a ? b : c : z" + if_false: + Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? a ? b : c : z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "x ? a ? b : c : z" + - Ternary: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : a ? b : c\\\"}\"}" + if_true: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : a ? b : c\\\"}\"}" + if_false: + Ternary: + condition: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : a ? b : c\\\"}\"}" + if_true: + Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : a ? b : c\\\"}\"}" + if_false: + Identifier: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x ? y : a ? b : c\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 18 + path: test + content: "x ? y : a ? b : c" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "x ? y : a ? b : c" diff --git a/tests/expectations/parser/parser/expression/tuple.leo.out b/tests/expectations/parser/parser/expression/tuple.leo.out new file mode 100644 index 0000000000..f5ec2aa11b --- /dev/null +++ b/tests/expectations/parser/parser/expression/tuple.leo.out @@ -0,0 +1,94 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Implicit: + - "" + - line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x)\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(y)\\\"}\"}" + - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(z)\\\"}\"}" + - Value: + Implicit: + - "" + - line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,)\\\"}\"}" + - TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y)\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "(x,y)" + - TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y,z)\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y,z)\\\"}\"}" + - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y,z)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "(x,y,z)" + - TupleInit: + elements: + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "(123,123)" + - Value: + Implicit: + - "123" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 9 + path: test + content: "(123,123)" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "(123,123)" + - TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: () + - TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: (()) diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out new file mode 100644 index 0000000000..de785f2be6 --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -0,0 +1,120 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x\\\"}\"}" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: "-x" + - Unary: + inner: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "-x.y" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "-x.y" + - Unary: + inner: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 6 + path: test + content: "-x::y" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "-x::y" + - Unary: + inner: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-x()\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "-x()" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "-x()" + - Unary: + inner: + Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"--x\\\"}\"}" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "--x" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "--x" + - Unary: + inner: + Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"-!x\\\"}\"}" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "-!x" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "-!x" diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out new file mode 100644 index 0000000000..5c93154572 --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -0,0 +1,120 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x\\\"}\"}" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: "!x" + - Unary: + inner: + CircuitMemberAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "!x.y" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "!x.y" + - Unary: + inner: + CircuitStaticFunctionAccess: + circuit: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 6 + path: test + content: "!x::y" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "!x::y" + - Unary: + inner: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!x()\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: test + content: "!x()" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "!x()" + - Unary: + inner: + Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!!x\\\"}\"}" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "!!x" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "!!x" + - Unary: + inner: + Unary: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"!-x\\\"}\"}" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "!-x" + op: Not + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "!-x" diff --git a/tests/expectations/parser/parser/functions/annotated.leo.out b/tests/expectations/parser/parser/functions/annotated.leo.out new file mode 100644 index 0000000000..c0e6dab6fb --- /dev/null +++ b/tests/expectations/parser/parser/functions/annotated.leo.out @@ -0,0 +1,57 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + annotations: + - span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 6 + path: test + content: "@test" + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"@test\\\"}\"}" + arguments: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 14 + col_stop: 2 + path: test + content: "function x() {\n...\n}" + span: + line_start: 4 + line_stop: 6 + col_start: 1 + col_stop: 2 + path: test + content: "function x() {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/annotated_param.leo.out b/tests/expectations/parser/parser/functions/annotated_param.leo.out new file mode 100644 index 0000000000..99ca4119f9 --- /dev/null +++ b/tests/expectations/parser/parser/functions/annotated_param.leo.out @@ -0,0 +1,58 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + annotations: + - span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 12 + path: test + content: "@test(test)" + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"@test(test)\\\"}\"}" + arguments: + - test + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 14 + col_stop: 2 + path: test + content: "function x() {\n...\n}" + span: + line_start: 4 + line_stop: 6 + col_start: 1 + col_stop: 2 + path: test + content: "function x() {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/annotated_twice.leo.out b/tests/expectations/parser/parser/functions/annotated_twice.leo.out new file mode 100644 index 0000000000..2a4220983e --- /dev/null +++ b/tests/expectations/parser/parser/functions/annotated_twice.leo.out @@ -0,0 +1,66 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + annotations: + - span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 6 + path: test + content: "@test @test2" + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"@test @test2\\\"}\"}" + arguments: [] + - span: + line_start: 3 + line_stop: 3 + col_start: 7 + col_stop: 13 + path: test + content: "@test @test2" + name: "{\"name\":\"test2\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"@test @test2\\\"}\"}" + arguments: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 14 + col_stop: 2 + path: test + content: "function x() {\n...\n}" + span: + line_start: 4 + line_stop: 6 + col_start: 1 + col_stop: 2 + path: test + content: "function x() {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/const_input_fail.leo.out b/tests/expectations/parser/parser/functions/const_input_fail.leo.out new file mode 100644 index 0000000000..468e683fd9 --- /dev/null +++ b/tests/expectations/parser/parser/functions/const_input_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - " --> test:3:18\n |\n 3 | function x(const input) {\n | ^^^^^\n |\n = expected 'ident', got 'input'" diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out new file mode 100644 index 0000000000..28916f76c8 --- /dev/null +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -0,0 +1,139 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: U32 + span: + line_start: 3 + line_stop: 3 + col_start: 12 + col_stop: 13 + path: test + content: "function x(x: u32, const y: i32) {" + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" + const_: true + mutable: false + type_: + IntegerType: I32 + span: + line_start: 3 + line_stop: 3 + col_start: 26 + col_stop: 27 + path: test + content: "function x(x: u32, const y: i32) {" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 34 + col_stop: 2 + path: test + content: "function x(x: u32, const y: i32) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(x: u32, const y: i32) {\n...\n}" + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" + const_: true + mutable: false + type_: + IntegerType: U32 + span: + line_start: 7 + line_stop: 7 + col_start: 18 + col_stop: 19 + path: test + content: "function x(const x: u32, y: i32) {" + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + span: + line_start: 7 + line_stop: 7 + col_start: 26 + col_stop: 27 + path: test + content: "function x(const x: u32, y: i32) {" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 8 + line_stop: 8 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 8 + line_stop: 8 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 7 + line_stop: 9 + col_start: 34 + col_stop: 2 + path: test + content: "function x(const x: u32, y: i32) {\n...\n}" + span: + line_start: 7 + line_stop: 9 + col_start: 1 + col_stop: 2 + path: test + content: "function x(const x: u32, y: i32) {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/const_self_bad.leo.out b/tests/expectations/parser/parser/functions/const_self_bad.leo.out new file mode 100644 index 0000000000..68248c8693 --- /dev/null +++ b/tests/expectations/parser/parser/functions/const_self_bad.leo.out @@ -0,0 +1,49 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}" + input: + - ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 24 + col_stop: 2 + path: test + content: "function x(const self) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(const self) {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out new file mode 100644 index 0000000000..03ff79d359 --- /dev/null +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -0,0 +1,48 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" + input: [] + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 14 + col_stop: 2 + path: test + content: "function x() {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x() {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out new file mode 100644 index 0000000000..ba7212db42 --- /dev/null +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -0,0 +1,30 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}" + input: [] + output: ~ + block: + statements: [] + span: + line_start: 3 + line_stop: 3 + col_start: 14 + col_stop: 16 + path: test + content: "function x() {}" + span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 16 + path: test + content: "function x() {}" diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out new file mode 100644 index 0000000000..6854e088a5 --- /dev/null +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -0,0 +1,63 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - IntegerType: U8 + - - value: "12" + span: + line_start: 3 + line_stop: 3 + col_start: 12 + col_stop: 13 + path: test + content: "function x(x: [u8; 12]) {" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 25 + col_stop: 2 + path: test + content: "function x(x: [u8; 12]) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(x: [u8; 12]) {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out new file mode 100644 index 0000000000..a43143a6cb --- /dev/null +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -0,0 +1,61 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" + const_: false + mutable: true + type_: + Circuit: "{\"name\":\"MyCircuit\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":15,\\\"col_stop\\\":24,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" + span: + line_start: 3 + line_stop: 3 + col_start: 12 + col_stop: 13 + path: test + content: "function x(x: MyCircuit) {" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 26 + col_stop: 2 + path: test + content: "function x(x: MyCircuit) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(x: MyCircuit) {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out new file mode 100644 index 0000000000..520d664450 --- /dev/null +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -0,0 +1,63 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" + const_: false + mutable: true + type_: + Tuple: + - IntegerType: U32 + - IntegerType: I32 + span: + line_start: 3 + line_stop: 3 + col_start: 12 + col_stop: 13 + path: test + content: "function x(x: (u32, i32)) {" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 27 + col_stop: 2 + path: test + content: "function x(x: (u32, i32)) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(x: (u32, i32)) {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out new file mode 100644 index 0000000000..6549ea1ca2 --- /dev/null +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -0,0 +1,74 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: U32 + span: + line_start: 3 + line_stop: 3 + col_start: 12 + col_stop: 13 + path: test + content: "function x(x: u32, y: i32) {" + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + span: + line_start: 3 + line_stop: 3 + col_start: 20 + col_stop: 21 + path: test + content: "function x(x: u32, y: i32) {" + output: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 28 + col_stop: 2 + path: test + content: "function x(x: u32, y: i32) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(x: u32, y: i32) {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out new file mode 100644 index 0000000000..1ec8867568 --- /dev/null +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -0,0 +1,75 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: U32 + span: + line_start: 3 + line_stop: 3 + col_start: 12 + col_stop: 13 + path: test + content: "function x(x: u32, y: i32) -> u32 {" + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + span: + line_start: 3 + line_stop: 3 + col_start: 20 + col_stop: 21 + path: test + content: "function x(x: u32, y: i32) -> u32 {" + output: + IntegerType: U32 + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 35 + col_stop: 2 + path: test + content: "function x(x: u32, y: i32) -> u32 {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x(x: u32, y: i32) -> u32 {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out new file mode 100644 index 0000000000..0f87e02968 --- /dev/null +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -0,0 +1,49 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}" + input: [] + output: + IntegerType: U32 + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 21 + col_stop: 2 + path: test + content: "function x() -> u32 {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x() -> u32 {\n...\n}" diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out new file mode 100644 index 0000000000..16b4bd1c45 --- /dev/null +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -0,0 +1,51 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: [] + circuits: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": + annotations: [] + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}" + input: [] + output: + Tuple: + - IntegerType: U32 + - IntegerType: U32 + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: test + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 28 + col_stop: 2 + path: test + content: "function x() -> (u32, u32) {\n...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "function x() -> (u32, u32) {\n...\n}" diff --git a/tests/expectations/parser/parser/import/alias.leo.out b/tests/expectations/parser/parser/import/alias.leo.out new file mode 100644 index 0000000000..654fbcefc6 --- /dev/null +++ b/tests/expectations/parser/parser/import/alias.leo.out @@ -0,0 +1,37 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Package: + name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a.b as bar;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a.b as bar;\\\"}\"}" + alias: "{\"name\":\"bar\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":15,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a.b as bar;\\\"}\"}" + span: + line_start: 3 + line_stop: 3 + col_start: 10 + col_stop: 18 + path: test + content: import a.b as bar; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 18 + path: test + content: import a.b as bar; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 18 + path: test + content: import a.b as bar; + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/import/basic.leo.out b/tests/expectations/parser/parser/import/basic.leo.out new file mode 100644 index 0000000000..6467c45999 --- /dev/null +++ b/tests/expectations/parser/parser/import/basic.leo.out @@ -0,0 +1,37 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Package: + name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a.b;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a.b;\\\"}\"}" + alias: ~ + span: + line_start: 3 + line_stop: 3 + col_start: 10 + col_stop: 11 + path: test + content: import a.b; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 11 + path: test + content: import a.b; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 11 + path: test + content: import a.b; + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/import/many_import.leo.out b/tests/expectations/parser/parser/import/many_import.leo.out new file mode 100644 index 0000000000..27e4abedd1 --- /dev/null +++ b/tests/expectations/parser/parser/import/many_import.leo.out @@ -0,0 +1,135 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Packages: + name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import test-import.( // local import\\\"}\"}" + accesses: + - Symbol: + symbol: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" Point,\\\"}\"}" + alias: ~ + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 10 + path: test + content: " Point," + - Symbol: + symbol: "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" foo,\\\"}\"}" + alias: ~ + span: + line_start: 5 + line_stop: 5 + col_start: 5 + col_stop: 8 + path: test + content: " foo," + span: + line_start: 3 + line_stop: 5 + col_start: 8 + col_stop: 8 + path: test + content: "import test-import.( // local import\n...\n foo," + span: + line_start: 3 + line_stop: 5 + col_start: 8 + col_stop: 8 + path: test + content: "import test-import.( // local import\n...\n foo," + - package_or_packages: + Packages: + name: "{\"name\":\"bar\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.( // imports directory import\\\"}\"}" + accesses: + - Symbol: + symbol: "{\"name\":\"Bar\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" Bar,\\\"}\"}" + alias: ~ + span: + line_start: 9 + line_stop: 9 + col_start: 5 + col_stop: 8 + path: test + content: " Bar," + - Multiple: + name: "{\"name\":\"baz\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" baz.(Baz, Bazzar),\\\"}\"}" + accesses: + - Symbol: + symbol: "{\"name\":\"Baz\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" baz.(Baz, Bazzar),\\\"}\"}" + alias: ~ + span: + line_start: 10 + line_stop: 10 + col_start: 10 + col_stop: 13 + path: test + content: " baz.(Baz, Bazzar)," + - Symbol: + symbol: "{\"name\":\"Bazzar\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":15,\\\"col_stop\\\":21,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" baz.(Baz, Bazzar),\\\"}\"}" + alias: ~ + span: + line_start: 10 + line_stop: 10 + col_start: 15 + col_stop: 21 + path: test + content: " baz.(Baz, Bazzar)," + span: + line_start: 10 + line_stop: 10 + col_start: 5 + col_stop: 21 + path: test + content: " baz.(Baz, Bazzar)," + - SubPackage: + name: "{\"name\":\"bat\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" bat.bat.Bat,\\\"}\"}" + access: + SubPackage: + name: "{\"name\":\"bat\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" bat.bat.Bat,\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"Bat\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" bat.bat.Bat,\\\"}\"}" + alias: ~ + span: + line_start: 11 + line_stop: 11 + col_start: 13 + col_stop: 16 + path: test + content: " bat.bat.Bat," + span: + line_start: 11 + line_stop: 11 + col_start: 9 + col_stop: 16 + path: test + content: " bat.bat.Bat," + span: + line_start: 11 + line_stop: 11 + col_start: 5 + col_stop: 16 + path: test + content: " bat.bat.Bat," + span: + line_start: 8 + line_stop: 11 + col_start: 8 + col_stop: 16 + path: test + content: "import bar.( // imports directory import\n...\n bat.bat.Bat," + span: + line_start: 8 + line_stop: 11 + col_start: 8 + col_stop: 16 + path: test + content: "import bar.( // imports directory import\n...\n bat.bat.Bat," + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/import/many_import_star.leo.out b/tests/expectations/parser/parser/import/many_import_star.leo.out new file mode 100644 index 0000000000..d72655988c --- /dev/null +++ b/tests/expectations/parser/parser/import/many_import_star.leo.out @@ -0,0 +1,164 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Package: + name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import test-import.*; // local import\\\"}\"}" + access: + Star: + line_start: 3 + line_stop: 3 + col_start: 20 + col_stop: 21 + path: test + content: import test-import.*; // local import + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 21 + path: test + content: import test-import.*; // local import + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 21 + path: test + content: import test-import.*; // local import + - package_or_packages: + Package: + name: "{\"name\":\"bar\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.*; // imports directory import\\\"}\"}" + access: + Star: + line_start: 5 + line_stop: 5 + col_start: 12 + col_stop: 13 + path: test + content: import bar.*; // imports directory import + span: + line_start: 5 + line_stop: 5 + col_start: 8 + col_stop: 13 + path: test + content: import bar.*; // imports directory import + span: + line_start: 5 + line_stop: 5 + col_start: 8 + col_stop: 13 + path: test + content: import bar.*; // imports directory import + - package_or_packages: + Package: + name: "{\"name\":\"bar\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.baz.*; // imports directory import\\\"}\"}" + access: + SubPackage: + name: "{\"name\":\"baz\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":12,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.baz.*; // imports directory import\\\"}\"}" + access: + Star: + line_start: 6 + line_stop: 6 + col_start: 16 + col_stop: 17 + path: test + content: import bar.baz.*; // imports directory import + span: + line_start: 6 + line_stop: 6 + col_start: 12 + col_stop: 17 + path: test + content: import bar.baz.*; // imports directory import + span: + line_start: 6 + line_stop: 6 + col_start: 8 + col_stop: 17 + path: test + content: import bar.baz.*; // imports directory import + span: + line_start: 6 + line_stop: 6 + col_start: 8 + col_stop: 17 + path: test + content: import bar.baz.*; // imports directory import + - package_or_packages: + Package: + name: "{\"name\":\"bar\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.bat.bat.*; // imports directory import\\\"}\"}" + access: + SubPackage: + name: "{\"name\":\"bat\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":12,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.bat.bat.*; // imports directory import\\\"}\"}" + access: + SubPackage: + name: "{\"name\":\"bat\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":16,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import bar.bat.bat.*; // imports directory import\\\"}\"}" + access: + Star: + line_start: 7 + line_stop: 7 + col_start: 20 + col_stop: 21 + path: test + content: import bar.bat.bat.*; // imports directory import + span: + line_start: 7 + line_stop: 7 + col_start: 16 + col_stop: 21 + path: test + content: import bar.bat.bat.*; // imports directory import + span: + line_start: 7 + line_stop: 7 + col_start: 12 + col_stop: 21 + path: test + content: import bar.bat.bat.*; // imports directory import + span: + line_start: 7 + line_stop: 7 + col_start: 8 + col_stop: 21 + path: test + content: import bar.bat.bat.*; // imports directory import + span: + line_start: 7 + line_stop: 7 + col_start: 8 + col_stop: 21 + path: test + content: import bar.bat.bat.*; // imports directory import + - package_or_packages: + Package: + name: "{\"name\":\"car\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import car.*; // imports directory import\\\"}\"}" + access: + Star: + line_start: 8 + line_stop: 8 + col_start: 12 + col_stop: 13 + path: test + content: import car.*; // imports directory import + span: + line_start: 8 + line_stop: 8 + col_start: 8 + col_stop: 13 + path: test + content: import car.*; // imports directory import + span: + line_start: 8 + line_stop: 8 + col_start: 8 + col_stop: 13 + path: test + content: import car.*; // imports directory import + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/import/names.leo.out b/tests/expectations/parser/parser/import/names.leo.out new file mode 100644 index 0000000000..0ea33ddad3 --- /dev/null +++ b/tests/expectations/parser/parser/import/names.leo.out @@ -0,0 +1,93 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Package: + name: "{\"name\":\"a0-f\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a0-f.foo;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a0-f.foo;\\\"}\"}" + alias: ~ + span: + line_start: 3 + line_stop: 3 + col_start: 13 + col_stop: 16 + path: test + content: import a0-f.foo; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 16 + path: test + content: import a0-f.foo; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 16 + path: test + content: import a0-f.foo; + - package_or_packages: + Package: + name: "{\"name\":\"a-9\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a-9.bar;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"bar\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":12,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import a-9.bar;\\\"}\"}" + alias: ~ + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 15 + path: test + content: import a-9.bar; + span: + line_start: 4 + line_stop: 4 + col_start: 8 + col_stop: 15 + path: test + content: import a-9.bar; + span: + line_start: 4 + line_stop: 4 + col_start: 8 + col_stop: 15 + path: test + content: import a-9.bar; + - package_or_packages: + Package: + name: "{\"name\":\"hello-world\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import hello-world.hello;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"hello\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":20,\\\"col_stop\\\":25,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import hello-world.hello;\\\"}\"}" + alias: ~ + span: + line_start: 5 + line_stop: 5 + col_start: 20 + col_stop: 25 + path: test + content: import hello-world.hello; + span: + line_start: 5 + line_stop: 5 + col_start: 8 + col_stop: 25 + path: test + content: import hello-world.hello; + span: + line_start: 5 + line_stop: 5 + col_start: 8 + col_stop: 25 + path: test + content: import hello-world.hello; + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/import/names_underscore.leo.out b/tests/expectations/parser/parser/import/names_underscore.leo.out new file mode 100644 index 0000000000..1dcd68015c --- /dev/null +++ b/tests/expectations/parser/parser/import/names_underscore.leo.out @@ -0,0 +1,37 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Package: + name: "{\"name\":\"hello_world\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import hello_world.foo;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":23,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import hello_world.foo;\\\"}\"}" + alias: ~ + span: + line_start: 3 + line_stop: 3 + col_start: 20 + col_stop: 23 + path: test + content: import hello_world.foo; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 23 + path: test + content: import hello_world.foo; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 23 + path: test + content: import hello_world.foo; + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/import/star.leo.out b/tests/expectations/parser/parser/import/star.leo.out new file mode 100644 index 0000000000..59d6e5c5b9 --- /dev/null +++ b/tests/expectations/parser/parser/import/star.leo.out @@ -0,0 +1,34 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + imports: + - package_or_packages: + Package: + name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"import test-import.*;\\\"}\"}" + access: + Star: + line_start: 3 + line_stop: 3 + col_start: 20 + col_stop: 21 + path: test + content: import test-import.*; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 21 + path: test + content: import test-import.*; + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 21 + path: test + content: import test-import.*; + circuits: {} + functions: {} diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out new file mode 100644 index 0000000000..d992c636a2 --- /dev/null +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -0,0 +1,411 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = expr;\\\"}\"}" + accesses: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: x = expr; + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: x = expr; + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = ();\\\"}\"}" + accesses: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: x = (); + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 7 + path: test + content: x = (); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: x = (); + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = x+y;\\\"}\"}" + accesses: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: x = x+y; + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: x = x+y; + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: x = x+y; + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" + accesses: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: "x = (x,y);" + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 10 + path: test + content: "x = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "x = (x,y);" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = x();\\\"}\"}" + accesses: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 2 + path: test + content: x = x(); + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: test + content: x = x(); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: x = x(); + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0] = y;\\\"}\"}" + accesses: + - ArrayIndex: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[0] = y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "x[0] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "x[0] = y;" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u32] = y;\\\"}\"}" + accesses: + - ArrayIndex: + Value: + Integer: + - U32 + - "0" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 7 + path: test + content: "x[0u32] = y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x[0u32] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[0u32] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: "x[0u32] = y;" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0 = y;\\\"}\"}" + accesses: + - Tuple: + - value: "0" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.0 = y; + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x.0 = y; + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0 = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: x.0 = y; + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1..2] = y;\\\"}\"}" + accesses: + - ArrayRange: + - Value: + Implicit: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[1..2] = y;" + - Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "x[1..2] = y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "x[1..2] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[1..2] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: "x[1..2] = y;" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..2] = y;\\\"}\"}" + accesses: + - ArrayRange: + - ~ + - Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "x[..2] = y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[..2] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..2] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: "x[..2] = y;" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[2..] = y;\\\"}\"}" + accesses: + - ArrayRange: + - Value: + Implicit: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: test + content: "x[2..] = y;" + - ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "x[2..] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[2..] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: "x[2..] = y;" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..] = y;\\\"}\"}" + accesses: + - ArrayRange: + - ~ + - ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "x[..] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[..] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "x[..] = y;" + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0[0][..] = y;\\\"}\"}" + accesses: + - Tuple: + - value: "0" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: "x.0[0][..] = y;" + - ArrayIndex: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "x.0[0][..] = y;" + - ArrayRange: + - ~ + - ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: "x.0[0][..] = y;" + value: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.0[0][..] = y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: "x.0[0][..] = y;" diff --git a/tests/expectations/parser/parser/statement/block.leo.out b/tests/expectations/parser/parser/statement/block.leo.out new file mode 100644 index 0000000000..6e40c82b0f --- /dev/null +++ b/tests/expectations/parser/parser/statement/block.leo.out @@ -0,0 +1,141 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Block: + statements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: "{}" + - Block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "{\n...\n}" + - Block: + statements: + - Block: + statements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 4 + path: test + content: "{{}}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "{{}}" + - Block: + statements: + - Block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 4 + col_start: 1 + col_stop: 2 + path: test + content: "{\n...\n}" + span: + line_start: 1 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "{\n...\n}" + - Block: + statements: + - Conditional: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if x {\\\"}\"}" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 4 + col_start: 6 + col_stop: 2 + path: test + content: "if x {\n...\n}" + next: ~ + span: + line_start: 2 + line_stop: 4 + col_start: 1 + col_stop: 2 + path: test + content: "if x {\n...\n}" + span: + line_start: 1 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: test + content: "{\n...\n}" diff --git a/tests/expectations/parser/parser/statement/conditional.leo.out b/tests/expectations/parser/parser/statement/conditional.leo.out new file mode 100644 index 0000000000..337dcace01 --- /dev/null +++ b/tests/expectations/parser/parser/statement/conditional.leo.out @@ -0,0 +1,230 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Conditional: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if x {\\\"}\"}" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 6 + col_stop: 2 + path: test + content: "if x {\n...\n}" + next: ~ + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "if x {\n...\n}" + - Conditional: + condition: + Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if Self {\\\"}\"}" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 9 + col_stop: 2 + path: test + content: "if Self {\n...\n}" + next: ~ + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "if Self {\n...\n}" + - Conditional: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if (x) {\\\"}\"}" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 8 + col_stop: 2 + path: test + content: "if (x) {\n...\n}" + next: ~ + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "if (x) {\n...\n}" + - Conditional: + condition: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if (x) {}\\\"}\"}" + block: + statements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 10 + path: test + content: "if (x) {}" + next: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "if (x) {}" + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if x+y {}\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if x+y {}\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 7 + path: test + content: "if x+y {}" + block: + statements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 10 + path: test + content: "if x+y {}" + next: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "if x+y {}" + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if x+y {\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"if x+y {\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 7 + path: test + content: "if x+y {" + block: + statements: + - Expression: + expression: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"expr;\\\"}\"}" + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 5 + path: test + content: expr; + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 4 + col_start: 8 + col_stop: 2 + path: test + content: "if x+y {\n...\n}" + next: ~ + span: + line_start: 1 + line_stop: 4 + col_start: 1 + col_stop: 2 + path: test + content: "if x+y {\n...\n}\n" diff --git a/tests/expectations/parser/parser/statement/console.leo.out b/tests/expectations/parser/parser/statement/console.leo.out new file mode 100644 index 0000000000..2ebba05261 --- /dev/null +++ b/tests/expectations/parser/parser/statement/console.leo.out @@ -0,0 +1,207 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Console: + function: + Assert: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.assert(x);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: console.assert(x); + - Console: + function: + Error: + parts: + - Container + parameters: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.error(\\\\\\\"{}\\\\\\\", x);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 22 + path: test + content: "console.error(\"{}\", x);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: "console.error(\"{}\", x);" + - Console: + function: + Error: + parts: + - Container + - Container + parameters: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.error(\\\\\\\"{}{}\\\\\\\", x, y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.error(\\\\\\\"{}{}\\\\\\\", x, y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 27 + path: test + content: "console.error(\"{}{}\", x, y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 27 + path: test + content: "console.error(\"{}{}\", x, y);" + - Console: + function: + Error: + parts: + - Const: x + parameters: [] + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 18 + path: test + content: "console.error(\"x\");" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "console.error(\"x\");" + - Console: + function: + Debug: + parts: + - Container + parameters: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.debug(\\\\\\\"{}\\\\\\\", x);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 22 + path: test + content: "console.debug(\"{}\", x);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: "console.debug(\"{}\", x);" + - Console: + function: + Debug: + parts: + - Container + - Container + parameters: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.debug(\\\\\\\"{}{}\\\\\\\", x, y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.debug(\\\\\\\"{}{}\\\\\\\", x, y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 27 + path: test + content: "console.debug(\"{}{}\", x, y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 27 + path: test + content: "console.debug(\"{}{}\", x, y);" + - Console: + function: + Debug: + parts: + - Const: x + parameters: [] + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 18 + path: test + content: "console.debug(\"x\");" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "console.debug(\"x\");" + - Console: + function: + Log: + parts: + - Container + parameters: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.log(\\\\\\\"{}\\\\\\\", x);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 20 + path: test + content: "console.log(\"{}\", x);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 20 + path: test + content: "console.log(\"{}\", x);" + - Console: + function: + Log: + parts: + - Container + - Container + parameters: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.log(\\\\\\\"{}{}\\\\\\\", x, y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":24,\\\"col_stop\\\":25,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"console.log(\\\\\\\"{}{}\\\\\\\", x, y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 25 + path: test + content: "console.log(\"{}{}\", x, y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 25 + path: test + content: "console.log(\"{}{}\", x, y);" + - Console: + function: + Log: + parts: + - Const: x + parameters: [] + span: + line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 16 + path: test + content: "console.log(\"x\");" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: "console.log(\"x\");" diff --git a/tests/expectations/parser/parser/statement/definition.leo.out b/tests/expectations/parser/parser/statement/definition.leo.out new file mode 100644 index 0000000000..fa12ad7cea --- /dev/null +++ b/tests/expectations/parser/parser/statement/definition.leo.out @@ -0,0 +1,1473 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: let x = expr; + type_: ~ + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: let x = expr; + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: let x = (); + type_: ~ + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 11 + path: test + content: let x = (); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: let x = (); + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: let x = x+y; + type_: ~ + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 12 + path: test + content: let x = x+y; + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: let x = x+y; + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "let x = (x,y);" + type_: ~ + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 14 + path: test + content: "let x = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: "let x = (x,y);" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: let x = x(); + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 12 + path: test + content: let x = x(); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: let x = x(); + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: const x = expr; + type_: ~ + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: test + content: const x = expr; + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: const x = (); + type_: ~ + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 13 + path: test + content: const x = (); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: const x = (); + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: const x = x+y; + type_: ~ + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 14 + path: test + content: const x = x+y; + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: const x = x+y; + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "const x = (x,y);" + type_: ~ + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 16 + path: test + content: "const x = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: "const x = (x,y);" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: const x = x(); + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 14 + path: test + content: const x = x(); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: const x = x(); + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "let x: u32 = expr;" + type_: + IntegerType: U32 + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "let x: u32 = expr;" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "let x: u32 = ();" + type_: + IntegerType: U32 + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 16 + path: test + content: "let x: u32 = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: "let x: u32 = ();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "let x: u32 = x+y;" + type_: + IntegerType: U32 + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 17 + path: test + content: "let x: u32 = x+y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: "let x: u32 = x+y;" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "let x: u32 = (x,y);" + type_: + IntegerType: U32 + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 19 + path: test + content: "let x: u32 = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: "let x: u32 = (x,y);" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: test + content: "let x: u32 = x();" + type_: + IntegerType: U32 + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let x: u32 = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 17 + path: test + content: "let x: u32 = x();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: "let x: u32 = x();" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "const x: u32 = expr;" + type_: + IntegerType: U32 + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 20 + path: test + content: "const x: u32 = expr;" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "const x: u32 = ();" + type_: + IntegerType: U32 + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 18 + path: test + content: "const x: u32 = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "const x: u32 = ();" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "const x: u32 = x+y;" + type_: + IntegerType: U32 + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 19 + path: test + content: "const x: u32 = x+y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: "const x: u32 = x+y;" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "const x: u32 = (x,y);" + type_: + IntegerType: U32 + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 21 + path: test + content: "const x: u32 = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 21 + path: test + content: "const x: u32 = (x,y);" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 7 + col_stop: 8 + path: test + content: "const x: u32 = x();" + type_: + IntegerType: U32 + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const x: u32 = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 19 + path: test + content: "const x: u32 = x();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: "const x: u32 = x();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y) = expr;" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y) = expr;" + type_: ~ + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "let (x, y) = expr;" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y) = ();" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y) = ();" + type_: ~ + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 16 + path: test + content: "let (x, y) = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: "let (x, y) = ();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y) = x+y;" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y) = x+y;" + type_: ~ + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 17 + path: test + content: "let (x, y) = x+y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: "let (x, y) = x+y;" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y) = (x,y);" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y) = (x,y);" + type_: ~ + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 19 + path: test + content: "let (x, y) = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: "let (x, y) = (x,y);" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y) = x();" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y) = x();" + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y) = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 17 + path: test + content: "let (x, y) = x();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: "let (x, y) = x();" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y) = expr;" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y) = expr;" + type_: ~ + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 20 + path: test + content: "const (x, y) = expr;" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y) = ();" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y) = ();" + type_: ~ + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 18 + path: test + content: "const (x, y) = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: test + content: "const (x, y) = ();" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y) = x+y;" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y) = x+y;" + type_: ~ + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 19 + path: test + content: "const (x, y) = x+y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: "const (x, y) = x+y;" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y) = (x,y);" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y) = (x,y);" + type_: ~ + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 21 + path: test + content: "const (x, y) = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 21 + path: test + content: "const (x, y) = (x,y);" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y) = x();" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y) = x();" + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y) = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 16 + col_stop: 19 + path: test + content: "const (x, y) = x();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: test + content: "const (x, y) = x();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y): u32 = expr;" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y): u32 = expr;" + type_: + IntegerType: U32 + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":23,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 23 + path: test + content: "let (x, y): u32 = expr;" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y): u32 = ();" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y): u32 = ();" + type_: + IntegerType: U32 + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 21 + path: test + content: "let (x, y): u32 = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 21 + path: test + content: "let (x, y): u32 = ();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y): u32 = x+y;" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y): u32 = x+y;" + type_: + IntegerType: U32 + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 22 + path: test + content: "let (x, y): u32 = x+y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: "let (x, y): u32 = x+y;" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y): u32 = (x,y);" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y): u32 = (x,y);" + type_: + IntegerType: U32 + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 24 + path: test + content: "let (x, y): u32 = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: "let (x, y): u32 = (x,y);" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x, y): u32 = x();" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 9 + col_stop: 10 + path: test + content: "let (x, y): u32 = x();" + type_: + IntegerType: U32 + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x, y): u32 = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 19 + col_stop: 22 + path: test + content: "let (x, y): u32 = x();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 22 + path: test + content: "let (x, y): u32 = x();" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y): u32 = expr;" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y): u32 = expr;" + type_: + IntegerType: U32 + value: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":25,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 25 + path: test + content: "const (x, y): u32 = expr;" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y): u32 = ();" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y): u32 = ();" + type_: + IntegerType: U32 + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 23 + path: test + content: "const (x, y): u32 = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 23 + path: test + content: "const (x, y): u32 = ();" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y): u32 = x+y;" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x+y;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y): u32 = x+y;" + type_: + IntegerType: U32 + value: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 24 + path: test + content: "const (x, y): u32 = x+y;" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: "const (x, y): u32 = x+y;" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y): u32 = (x,y);" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y): u32 = (x,y);" + type_: + IntegerType: U32 + value: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":24,\\\"col_stop\\\":25,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 26 + path: test + content: "const (x, y): u32 = (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 26 + path: test + content: "const (x, y): u32 = (x,y);" + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "const (x, y): u32 = x();" + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 11 + col_stop: 12 + path: test + content: "const (x, y): u32 = x();" + type_: + IntegerType: U32 + value: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"const (x, y): u32 = x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 21 + col_stop: 24 + path: test + content: "const (x, y): u32 = x();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 24 + path: test + content: "const (x, y): u32 = x();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x,y,) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x,y,) = ();" + - mutable: true + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x,y,) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 9 + path: test + content: "let (x,y,) = ();" + type_: ~ + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 14 + col_stop: 16 + path: test + content: "let (x,y,) = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: test + content: "let (x,y,) = ();" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"let (x,) = ();\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: test + content: "let (x,) = ();" + type_: ~ + value: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 12 + col_stop: 14 + path: test + content: "let (x,) = ();" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: test + content: "let (x,) = ();" diff --git a/tests/expectations/parser/parser/statement/definition_fail.leo.out b/tests/expectations/parser/parser/statement/definition_fail.leo.out new file mode 100644 index 0000000000..fcb8db8960 --- /dev/null +++ b/tests/expectations/parser/parser/statement/definition_fail.leo.out @@ -0,0 +1,27 @@ +--- +namespace: ParseStatement +expectation: Fail +outputs: + - " --> test:1:0\n |\n 1 | let mut x = expr;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = ();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = x+y;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = (x,y);\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = x();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = expr;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = ();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = x+y;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = (x,y);\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = x();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = expr;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = ();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = x+y;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = (x,y);\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = x();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = expr;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = ();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = x+y;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = (x,y);\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = x();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^\n |\n = expected 'ident', got ','" diff --git a/tests/expectations/parser/parser/statement/expression.leo.out b/tests/expectations/parser/parser/statement/expression.leo.out new file mode 100644 index 0000000000..f9542ff844 --- /dev/null +++ b/tests/expectations/parser/parser/statement/expression.leo.out @@ -0,0 +1,94 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Expression: + expression: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: expr; + - Expression: + expression: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: (); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: test + content: (); + - Expression: + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x+y; + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x+y; + - Expression: + expression: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"(x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "(x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "(x,y);" + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x();\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x(); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: test + content: x(); diff --git a/tests/expectations/parser/parser/statement/iteration.leo.out b/tests/expectations/parser/parser/statement/iteration.leo.out new file mode 100644 index 0000000000..4fa2b3b899 --- /dev/null +++ b/tests/expectations/parser/parser/statement/iteration.leo.out @@ -0,0 +1,203 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Iteration: + variable: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"for x in 0..7 {}\\\"}\"}" + start: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: "for x in 0..7 {}" + stop: + Value: + Implicit: + - "7" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: "for x in 0..7 {}" + block: + statements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 15 + col_stop: 17 + path: test + content: "for x in 0..7 {}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: test + content: "for x in 0..7 {}" + - Iteration: + variable: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"for x in 0..7 {\\\"}\"}" + start: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: "for x in 0..7 {" + stop: + Value: + Implicit: + - "7" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 14 + path: test + content: "for x in 0..7 {" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 15 + col_stop: 2 + path: test + content: "for x in 0..7 {\n...\n}" + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "for x in 0..7 {\n...\n}" + - Iteration: + variable: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"for x in 0..99u8 {\\\"}\"}" + start: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: "for x in 0..99u8 {" + stop: + Value: + Integer: + - U8 + - "99" + - line_start: 1 + line_stop: 1 + col_start: 13 + col_stop: 17 + path: test + content: "for x in 0..99u8 {" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 18 + col_stop: 2 + path: test + content: "for x in 0..99u8 {\n...\n}" + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "for x in 0..99u8 {\n...\n}" + - Iteration: + variable: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"for x in 0..Self {\\\"}\"}" + start: + Value: + Implicit: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 11 + path: test + content: "for x in 0..Self {" + stop: + Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":17,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"for x in 0..Self {\\\"}\"}" + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 3 + col_start: 18 + col_stop: 2 + path: test + content: "for x in 0..Self {\n...\n}" + span: + line_start: 1 + line_stop: 3 + col_start: 1 + col_stop: 2 + path: test + content: "for x in 0..Self {\n...\n}" diff --git a/tests/expectations/parser/parser/statement/return.leo.out b/tests/expectations/parser/parser/statement/return.leo.out new file mode 100644 index 0000000000..938e0d0efe --- /dev/null +++ b/tests/expectations/parser/parser/statement/return.leo.out @@ -0,0 +1,110 @@ +--- +namespace: ParseStatement +expectation: Pass +outputs: + - Return: + expression: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"return expr;\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: test + content: return expr; + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: return (); + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 10 + path: test + content: return (); + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: return (); + - Return: + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"return x+y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"return x+y;\\\"}\"}" + op: Add + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: test + content: return x+y; + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: test + content: return x+y; + - Return: + expression: + TupleInit: + elements: + - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"return (x,y);\\\"}\"}" + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"return (x,y);\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 13 + path: test + content: "return (x,y);" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: "return (x,y);" + - Return: + expression: + Value: + Implicit: + - "5" + - line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 2 + path: test + content: 5; + span: + line_start: 1 + line_stop: 2 + col_start: 1 + col_stop: 2 + path: test + content: "return\n5;" diff --git a/tests/expectations/parser/parser/statement/return_fail.leo.out b/tests/expectations/parser/parser/statement/return_fail.leo.out new file mode 100644 index 0000000000..9f5a9e7204 --- /dev/null +++ b/tests/expectations/parser/parser/statement/return_fail.leo.out @@ -0,0 +1,7 @@ +--- +namespace: ParseStatement +expectation: Fail +outputs: + - " --> test:1:1\n |\n 1 | return\n | ^^^^^^\n |\n = unexpected EOF" + - " --> test:1:8\n |\n 1 | return 5\n | ^\n |\n = unexpected EOF" + - " --> test:2:1\n |\n 2 | if x {}\n | ^^\n |\n = expected 'expression', got 'if'" diff --git a/tests/fail/parse/address/empty.leo b/tests/fail/parse/address/empty.leo deleted file mode 100644 index 305a77de5b..0000000000 --- a/tests/fail/parse/address/empty.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const owner = address(); -} \ No newline at end of file diff --git a/tests/fail/parse/address/invalid_length.leo b/tests/fail/parse/address/invalid_length.leo deleted file mode 100644 index ae1defecaf..0000000000 --- a/tests/fail/parse/address/invalid_length.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88); -} \ No newline at end of file diff --git a/tests/fail/parse/address/invalid_prefix.leo b/tests/fail/parse/address/invalid_prefix.leo deleted file mode 100644 index cd87e404a4..0000000000 --- a/tests/fail/parse/address/invalid_prefix.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const public_key_string = address(zleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); -} \ No newline at end of file diff --git a/tests/fail/parse/array/initializer_fail.leo b/tests/fail/parse/array/initializer_fail.leo deleted file mode 100644 index 3b2e7785cc..0000000000 --- a/tests/fail/parse/array/initializer_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; 3]) { - console.assert(a == [1u8; -3]); -} \ No newline at end of file diff --git a/tests/fail/parse/array/type_fail.leo b/tests/fail/parse/array/type_fail.leo deleted file mode 100644 index 356bba976a..0000000000 --- a/tests/fail/parse/array/type_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: [u8; -2] = [0u32; 2]; -} \ No newline at end of file diff --git a/tests/fail/parse/circuits/self_circuit.leo b/tests/fail/parse/circuits/self_circuit.leo deleted file mode 100644 index 18329433f7..0000000000 --- a/tests/fail/parse/circuits/self_circuit.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - static function new() -> Self { - return Self { } - } -} - -function main() { - const a = Foo::new(); -} \ No newline at end of file diff --git a/tests/fail/parse/console/log_fail.leo b/tests/fail/parse/console/log_fail.leo deleted file mode 100644 index dafa6bea8e..0000000000 --- a/tests/fail/parse/console/log_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log( hello ); -} \ No newline at end of file diff --git a/tests/fail/parse/import/names_a_dash.leo b/tests/fail/parse/import/names_a_dash.leo deleted file mode 100644 index ec136176b2..0000000000 --- a/tests/fail/parse/import/names_a_dash.leo +++ /dev/null @@ -1,3 +0,0 @@ -import a-.foo; - -function main() {} \ No newline at end of file diff --git a/tests/fail/parse/import/names_dash_a.leo b/tests/fail/parse/import/names_dash_a.leo deleted file mode 100644 index 95ccb7e4a5..0000000000 --- a/tests/fail/parse/import/names_dash_a.leo +++ /dev/null @@ -1,3 +0,0 @@ -import -a.foo; - -function main() {} \ No newline at end of file diff --git a/tests/fail/parse/import/names_dollar.leo b/tests/fail/parse/import/names_dollar.leo deleted file mode 100644 index e4eaec3719..0000000000 --- a/tests/fail/parse/import/names_dollar.leo +++ /dev/null @@ -1,3 +0,0 @@ -import money$.foo; - -function main() {} \ No newline at end of file diff --git a/tests/fail/parse/syntax/address_fail.leo b/tests/fail/parse/syntax/address_fail.leo deleted file mode 100644 index b39ea75df6..0000000000 --- a/tests/fail/parse/syntax/address_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const address = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/console_fail.leo b/tests/fail/parse/syntax/console_fail.leo deleted file mode 100644 index c0229dd624..0000000000 --- a/tests/fail/parse/syntax/console_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const console = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/field_fail.leo b/tests/fail/parse/syntax/field_fail.leo deleted file mode 100644 index 33bb3118d8..0000000000 --- a/tests/fail/parse/syntax/field_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const field = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/group_fail.leo b/tests/fail/parse/syntax/group_fail.leo deleted file mode 100644 index db71c8a792..0000000000 --- a/tests/fail/parse/syntax/group_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const group = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/i8_fail.leo b/tests/fail/parse/syntax/i8_fail.leo deleted file mode 100644 index a2d868f9f5..0000000000 --- a/tests/fail/parse/syntax/i8_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const i8 = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/input_fail.leo b/tests/fail/parse/syntax/input_fail.leo deleted file mode 100644 index 0053565a6f..0000000000 --- a/tests/fail/parse/syntax/input_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const input = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/self_keyword_fail.leo b/tests/fail/parse/syntax/self_keyword_fail.leo deleted file mode 100644 index 79bc4d6e96..0000000000 --- a/tests/fail/parse/syntax/self_keyword_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const Self = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/self_type_fail.leo b/tests/fail/parse/syntax/self_type_fail.leo deleted file mode 100644 index 79bc4d6e96..0000000000 --- a/tests/fail/parse/syntax/self_type_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const Self = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/semicolon.leo b/tests/fail/parse/syntax/semicolon.leo deleted file mode 100644 index f1deb29e37..0000000000 --- a/tests/fail/parse/syntax/semicolon.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a = 0 -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/true_fail.leo b/tests/fail/parse/syntax/true_fail.leo deleted file mode 100644 index b39ea75df6..0000000000 --- a/tests/fail/parse/syntax/true_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const address = 0u32; -} \ No newline at end of file diff --git a/tests/fail/parse/syntax/u8_fail.leo b/tests/fail/parse/syntax/u8_fail.leo deleted file mode 100644 index 4a48780a29..0000000000 --- a/tests/fail/parse/syntax/u8_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const u8 = 0u32; -} \ No newline at end of file diff --git a/tests/parser/circuits/big_self.leo b/tests/parser/circuits/big_self.leo new file mode 100644 index 0000000000..e6c5d08fbd --- /dev/null +++ b/tests/parser/circuits/big_self.leo @@ -0,0 +1,10 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + function x() -> Self { + return Self {}; + } +} \ No newline at end of file diff --git a/tests/parser/circuits/empty.leo b/tests/parser/circuits/empty.leo new file mode 100644 index 0000000000..c4fc98fc3e --- /dev/null +++ b/tests/parser/circuits/empty.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + +} \ No newline at end of file diff --git a/tests/parser/circuits/field_and_functions.leo b/tests/parser/circuits/field_and_functions.leo new file mode 100644 index 0000000000..01f4d3e636 --- /dev/null +++ b/tests/parser/circuits/field_and_functions.leo @@ -0,0 +1,15 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + x: u32, + y: u32, + function x() { + return (); + } + function y() { + return (); + } +} \ No newline at end of file diff --git a/tests/parser/circuits/fields.leo b/tests/parser/circuits/fields.leo new file mode 100644 index 0000000000..34c7f5cf8f --- /dev/null +++ b/tests/parser/circuits/fields.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + x: u32, + y: u32, +} \ No newline at end of file diff --git a/tests/parser/circuits/functions.leo b/tests/parser/circuits/functions.leo new file mode 100644 index 0000000000..4eff256a0a --- /dev/null +++ b/tests/parser/circuits/functions.leo @@ -0,0 +1,13 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + function x() { + return (); + } + function y() { + return (); + } +} \ No newline at end of file diff --git a/tests/parser/circuits/mut_self.leo b/tests/parser/circuits/mut_self.leo new file mode 100644 index 0000000000..952f73a236 --- /dev/null +++ b/tests/parser/circuits/mut_self.leo @@ -0,0 +1,10 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + function x(mut self) { + return (); + } +} \ No newline at end of file diff --git a/tests/parser/circuits/self.leo b/tests/parser/circuits/self.leo new file mode 100644 index 0000000000..c99c4bea1c --- /dev/null +++ b/tests/parser/circuits/self.leo @@ -0,0 +1,10 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + function x(self) { + return (); + } +} \ No newline at end of file diff --git a/tests/parser/expression/access/array_access.leo b/tests/parser/expression/access/array_access.leo new file mode 100644 index 0000000000..9773b41982 --- /dev/null +++ b/tests/parser/expression/access/array_access.leo @@ -0,0 +1,14 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x[0] +X[1] +x[0u8] +x[1u8][2u8] +x[x][y][z] +x[0]() +x()[0] +x(y)::y(x) +x[x].0[x] diff --git a/tests/parser/expression/access/array_range_access.leo b/tests/parser/expression/access/array_range_access.leo new file mode 100644 index 0000000000..4ae4f62c3f --- /dev/null +++ b/tests/parser/expression/access/array_range_access.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x[..] +x[1..] +x[..1] +x[1..1] +x[0..100] + +x[323452345.2345234523453453][323452345.2345234523453453] + +x[0u8..1u8] +x[0u8..] +x[..0u8] + +x[..] +x[x.y..] +x[..y.x] +x[x.y..y.x] +x[x.y.x..y.x.y] diff --git a/tests/parser/expression/access/call.leo b/tests/parser/expression/access/call.leo new file mode 100644 index 0000000000..3a59b7585b --- /dev/null +++ b/tests/parser/expression/access/call.leo @@ -0,0 +1,14 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x() +X() +x(y) +x(y, z) +x(x, y, z) +x::y() +x::y(x) +x.0(x) +x[0](x) diff --git a/tests/parser/expression/access/circuit.leo b/tests/parser/expression/access/circuit.leo new file mode 100644 index 0000000000..ced0211988 --- /dev/null +++ b/tests/parser/expression/access/circuit.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x.y +X.Y +x.y.z +x.y() +x.y.0 +x.y[1] \ No newline at end of file diff --git a/tests/parser/expression/access/circuit_static.leo b/tests/parser/expression/access/circuit_static.leo new file mode 100644 index 0000000000..cc9793c510 --- /dev/null +++ b/tests/parser/expression/access/circuit_static.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x::y +X::Y +x::y::z +x::y() +x::y.0 +x::y[1] \ No newline at end of file diff --git a/tests/parser/expression/access/tuple.leo b/tests/parser/expression/access/tuple.leo new file mode 100644 index 0000000000..c96e38953f --- /dev/null +++ b/tests/parser/expression/access/tuple.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x.0 +x.1 +x.2 +x.0.0 +x.1.1 +x.2.2 \ No newline at end of file diff --git a/tests/parser/expression/array_init.leo b/tests/parser/expression/array_init.leo new file mode 100644 index 0000000000..8efc49b5d6 --- /dev/null +++ b/tests/parser/expression/array_init.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +[0u8; 1] + +[0; 1] + +[0; (1)] + +[0; (1, 2)] + +[0; (1, 2, 3)] + +[[[0; 3]; 2]; 1] \ No newline at end of file diff --git a/tests/parser/expression/array_init_fail.leo b/tests/parser/expression/array_init_fail.leo new file mode 100644 index 0000000000..b9ff1835f8 --- /dev/null +++ b/tests/parser/expression/array_init_fail.leo @@ -0,0 +1,9 @@ + +/* +namespace: ParseExpression +expectation: Fail +*/ + +[...0u8; 1] + +[...0; 1] diff --git a/tests/parser/expression/array_inline.leo b/tests/parser/expression/array_inline.leo new file mode 100644 index 0000000000..5dc6746f17 --- /dev/null +++ b/tests/parser/expression/array_inline.leo @@ -0,0 +1,24 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +[0u8, 1, 2, 3] + +[1] + +[1u8] + +[1u8,] + +[0, 1,] + +[0,1,] + +[] + +[[1,2,3],[1,2,3]] + +[[]] + +[[], []] \ No newline at end of file diff --git a/tests/parser/expression/array_inline_fail.leo b/tests/parser/expression/array_inline_fail.leo new file mode 100644 index 0000000000..9b1b1eea46 --- /dev/null +++ b/tests/parser/expression/array_inline_fail.leo @@ -0,0 +1,14 @@ +/* +namespace: ParseExpression +expectation: Fail +*/ + +[,] + +[,,] + +[0,,] + +[,0] + +[,0,] \ No newline at end of file diff --git a/tests/parser/expression/binary/add.leo b/tests/parser/expression/binary/add.leo new file mode 100644 index 0000000000..1e0cf5f032 --- /dev/null +++ b/tests/parser/expression/binary/add.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 + 1 + +2+3 + +1 + 2 + 3 + +1 * 2 + 3 * 4 + +1 + 2 - 3 + +1 * 2 + 3 * 4 - 5 * 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/and.leo b/tests/parser/expression/binary/and.leo new file mode 100644 index 0000000000..bc2fa9aaf3 --- /dev/null +++ b/tests/parser/expression/binary/and.leo @@ -0,0 +1,10 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +true && false + +false&&true + +true&&false&&true \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_and.leo.off b/tests/parser/expression/binary/bit_and.leo.off new file mode 100644 index 0000000000..5f122c5c8c --- /dev/null +++ b/tests/parser/expression/binary/bit_and.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 & 1 + +2&3 + +1 & 2 & 3 + +1 == 2 & 3 == 4 + +1 & 2 & 3 + +1 == 2 & 3 == 4 & 5 == 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_or.leo.off b/tests/parser/expression/binary/bit_or.leo.off new file mode 100644 index 0000000000..afe99bc0f1 --- /dev/null +++ b/tests/parser/expression/binary/bit_or.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 | 1 + +2|3 + +1 | 2 | 3 + +1 ^ 2 | 3 ^ 4 + +1 | 2 | 3 + +1 ^ 2 | 3 ^ 4 | 5 ^ 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_xor.leo.off b/tests/parser/expression/binary/bit_xor.leo.off new file mode 100644 index 0000000000..1bfb8df786 --- /dev/null +++ b/tests/parser/expression/binary/bit_xor.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 ^ 1 + +2^3 + +1 ^ 2 ^ 3 + +1 & 2 ^ 3 & 4 + +1 ^ 2 ^ 3 + +1 & 2 ^ 3 & 4 ^ 5 & 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/div.leo b/tests/parser/expression/binary/div.leo new file mode 100644 index 0000000000..d6fc7bcf94 --- /dev/null +++ b/tests/parser/expression/binary/div.leo @@ -0,0 +1,12 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 / 1 + +2/3 + +1 / 2 / 3 + +1 ** 2 / 3 ** 4 \ No newline at end of file diff --git a/tests/parser/expression/binary/eq.leo b/tests/parser/expression/binary/eq.leo new file mode 100644 index 0000000000..d84b5f0738 --- /dev/null +++ b/tests/parser/expression/binary/eq.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 == 1 + +2==3 + +1 == 2 == 3 + +1 < 2 == 3 < 4 + +1 == 2 == 3 + +1 < 2 == 3 < 4 == 5 < 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/exp.leo b/tests/parser/expression/binary/exp.leo new file mode 100644 index 0000000000..0bd2795265 --- /dev/null +++ b/tests/parser/expression/binary/exp.leo @@ -0,0 +1,14 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 ** 1 + +2**3 + +1 ** 2 ** 3 + +1 as i8 ** 3 as i8 + +1 as i8 ** 3 as i8 ** 5 as i8 \ No newline at end of file diff --git a/tests/parser/expression/binary/gt.leo b/tests/parser/expression/binary/gt.leo new file mode 100644 index 0000000000..649b8ca92e --- /dev/null +++ b/tests/parser/expression/binary/gt.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 > 1 + +2>3 + +1 > 2 > 3 + +1 + 2 > 3 + 4 + +1 > 2 > 3 + +1 + 2 > 3 + 4 > 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/gt.leo.off b/tests/parser/expression/binary/gt.leo.off new file mode 100644 index 0000000000..d66b9bb7f0 --- /dev/null +++ b/tests/parser/expression/binary/gt.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 > 1 + +2>3 + +1 > 2 > 3 + +1 >> 2 > 3 >> 4 + +1 > 2 > 3 + +1 >> 2 > 3 >> 4 > 5 >> 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/gte.leo b/tests/parser/expression/binary/gte.leo new file mode 100644 index 0000000000..48637fd536 --- /dev/null +++ b/tests/parser/expression/binary/gte.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 >= 1 + +2 >= 3 + +1 >= 2 >= 3 + +1 + 2 >= 3 + 4 + +1 >= 2 >= 3 + +1 + 2 >= 3 + 4 >= 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/gte.leo.off b/tests/parser/expression/binary/gte.leo.off new file mode 100644 index 0000000000..929b13fa40 --- /dev/null +++ b/tests/parser/expression/binary/gte.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 >= 1 + +2 >= 3 + +1 >= 2 >= 3 + +1 >> 2 >= 3 >> 4 + +1 >= 2 >= 3 + +1 >> 2 >= 3 >> 4 >= 5 >> 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/lt.leo b/tests/parser/expression/binary/lt.leo new file mode 100644 index 0000000000..e8d7a1ff61 --- /dev/null +++ b/tests/parser/expression/binary/lt.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 < 1 + +2<3 + +1 < 2 < 3 + +1 + 2 < 3 + 4 + +1 < 2 < 3 + +1 + 2 < 3 + 4 < 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/lt.leo.off b/tests/parser/expression/binary/lt.leo.off new file mode 100644 index 0000000000..7f74c3f2fc --- /dev/null +++ b/tests/parser/expression/binary/lt.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 < 1 + +2<3 + +1 < 2 < 3 + +1 << 2 < 3 << 4 + +1 < 2 < 3 + +1 << 2 < 3 << 4 < 5 << 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/lte.leo b/tests/parser/expression/binary/lte.leo new file mode 100644 index 0000000000..95275d96aa --- /dev/null +++ b/tests/parser/expression/binary/lte.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 <= 1 + +2 <= 3 + +1 <= 2 <= 3 + +1 + 2 <= 3 + 4 + +1 <= 2 <= 3 + +1 + 2 <= 3 + 4 <= 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/lte.leo.off b/tests/parser/expression/binary/lte.leo.off new file mode 100644 index 0000000000..611fb11cf4 --- /dev/null +++ b/tests/parser/expression/binary/lte.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 <= 1 + +2 <= 3 + +1 <= 2 <= 3 + +1 << 2 <= 3 << 4 + +1 <= 2 <= 3 + +1 << 2 <= 3 << 4 <= 5 << 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/mod.leo.off b/tests/parser/expression/binary/mod.leo.off new file mode 100644 index 0000000000..f20d9fd262 --- /dev/null +++ b/tests/parser/expression/binary/mod.leo.off @@ -0,0 +1,14 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 % 1 + +2%3 + +1 % 2 % 3 + +1 ** 2 % 3 ** 4 + +1 ** 2 % 3 ** 4 % 5 ** 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/mul.leo b/tests/parser/expression/binary/mul.leo new file mode 100644 index 0000000000..e25f5690e0 --- /dev/null +++ b/tests/parser/expression/binary/mul.leo @@ -0,0 +1,14 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 * 1 + +2*3 + +1 * 2 * 3 + +1 ** 2 * 3 ** 4 + +1 ** 2 * 3 ** 4 / 5 ** 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/ne.leo b/tests/parser/expression/binary/ne.leo new file mode 100644 index 0000000000..46b4e8cdf6 --- /dev/null +++ b/tests/parser/expression/binary/ne.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 != 1 + +2!=3 + +1 != 2 != 3 + +1 < 2 != 3 < 4 + +1 != 2 != 3 + +1 < 2 != 3 < 4 != 5 < 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/or.leo b/tests/parser/expression/binary/or.leo new file mode 100644 index 0000000000..1e0cf5f032 --- /dev/null +++ b/tests/parser/expression/binary/or.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 + 1 + +2+3 + +1 + 2 + 3 + +1 * 2 + 3 * 4 + +1 + 2 - 3 + +1 * 2 + 3 * 4 - 5 * 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/shl.leo.off b/tests/parser/expression/binary/shl.leo.off new file mode 100644 index 0000000000..0064ba91d8 --- /dev/null +++ b/tests/parser/expression/binary/shl.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 << 1 + +2<<3 + +1 << 2 << 3 + +1 + 2 << 3 + 4 + +1 << 2 << 3 + +1 + 2 << 3 + 4 << 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/shr.leo.off b/tests/parser/expression/binary/shr.leo.off new file mode 100644 index 0000000000..a02e84811b --- /dev/null +++ b/tests/parser/expression/binary/shr.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 >> 1 + +2>>3 + +1 >> 2 >> 3 + +1 + 2 >> 3 + 4 + +1 >> 2 >> 3 + +1 + 2 >> 3 + 4 >> 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/shr_signed.leo.off b/tests/parser/expression/binary/shr_signed.leo.off new file mode 100644 index 0000000000..248e4d3bd4 --- /dev/null +++ b/tests/parser/expression/binary/shr_signed.leo.off @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 >>> 1 + +2>>>3 + +1 >>> 2 >>> 3 + +1 + 2 >>> 3 + 4 + +1 >>> 2 >>> 3 + +1 + 2 >>> 3 + 4 >>> 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/sub.leo b/tests/parser/expression/binary/sub.leo new file mode 100644 index 0000000000..ad36645465 --- /dev/null +++ b/tests/parser/expression/binary/sub.leo @@ -0,0 +1,12 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1 - 1 + +2-3 + +1 - 2 - 3 + +1 * 2 - 3 * 4 \ No newline at end of file diff --git a/tests/parser/expression/cast.leo b/tests/parser/expression/cast.leo new file mode 100644 index 0000000000..76809aa8b9 --- /dev/null +++ b/tests/parser/expression/cast.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x as u8 +y as id +z as u32 +x as i128 +x as u8 as u128 +x as field +x as group +x ** y as u32 ** z +// ~x as u32 +!x as u32 +-x as u32 \ No newline at end of file diff --git a/tests/parser/expression/circuit_init.leo b/tests/parser/expression/circuit_init.leo new file mode 100644 index 0000000000..a6817977c2 --- /dev/null +++ b/tests/parser/expression/circuit_init.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x {} + +x {y} + +x{y} + +x{} + +x{y: y} + +x{y: x} + +x{y: x,} + +x{y:x, x:y,} + +Self {} diff --git a/tests/parser/expression/circuit_init_fail.leo b/tests/parser/expression/circuit_init_fail.leo new file mode 100644 index 0000000000..9311b49d4f --- /dev/null +++ b/tests/parser/expression/circuit_init_fail.leo @@ -0,0 +1,28 @@ +/* +namespace: ParseExpression +expectation: Fail +*/ + +x { + +x } + +x {,} + +x { , } + +x {,,,} + +x {x,,} + +x {,,x} + +x {,x} + +x {x:y,,} + +x {,,x:y} + +x {,x:y} + +x {x:} diff --git a/tests/parser/expression/ident.leo b/tests/parser/expression/ident.leo new file mode 100644 index 0000000000..72fefe5c8f --- /dev/null +++ b/tests/parser/expression/ident.leo @@ -0,0 +1,42 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x + +X + +xxx + +XXX + +x1 + +xu32 + +testx + +truex + +TRUE + +testX + +letX + +constX + +test_test + +self + +Self + +input + +selfX + +SelfX + +inputX \ No newline at end of file diff --git a/tests/parser/expression/literal/address.leo b/tests/parser/expression/literal/address.leo new file mode 100644 index 0000000000..137f8477a7 --- /dev/null +++ b/tests/parser/expression/literal/address.leo @@ -0,0 +1,15 @@ +/* +namespace: Token +expectation: Pass +*/ +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 +aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st + +ALEO1 +Aleo1 +aleO1 + +aleo2qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 +bleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 diff --git a/tests/parser/expression/literal/address_fail.leo b/tests/parser/expression/literal/address_fail.leo new file mode 100644 index 0000000000..16e74f545e --- /dev/null +++ b/tests/parser/expression/literal/address_fail.leo @@ -0,0 +1,17 @@ +/* +namespace: Token +expectation: Fail +*/ +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1 + +aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9 + +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d + +aleo1 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st +aleo1 + +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x diff --git a/tests/parser/expression/literal/address_parse.leo b/tests/parser/expression/literal/address_parse.leo new file mode 100644 index 0000000000..4ffe7ccc60 --- /dev/null +++ b/tests/parser/expression/literal/address_parse.leo @@ -0,0 +1,9 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 +aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st diff --git a/tests/parser/expression/literal/bool.leo b/tests/parser/expression/literal/bool.leo new file mode 100644 index 0000000000..726aa4124e --- /dev/null +++ b/tests/parser/expression/literal/bool.leo @@ -0,0 +1,14 @@ +/* +namespace: Token +expectation: Pass +*/ + +true +True +TRUE +truE + +false +False +FALSE +falsE \ No newline at end of file diff --git a/tests/parser/expression/literal/bool_parse.leo b/tests/parser/expression/literal/bool_parse.leo new file mode 100644 index 0000000000..a988a54fd6 --- /dev/null +++ b/tests/parser/expression/literal/bool_parse.leo @@ -0,0 +1,8 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +true + +false \ No newline at end of file diff --git a/tests/parser/expression/literal/comment.leo b/tests/parser/expression/literal/comment.leo new file mode 100644 index 0000000000..3dc0ab4360 --- /dev/null +++ b/tests/parser/expression/literal/comment.leo @@ -0,0 +1,36 @@ +/* +namespace: Token +expectation: Pass +*/ + +// test1 + +// test2 + +//test3 + +/ / test4 + +/* test5 */ +/* +test 6 */ +/* test 7 +*/ + +/*test8 */ + +/* test9*/ + +/*test10*/ + +/*/**/ + +/**/ + +/*//*/ + +/** /*/ + +/** **/ + +/* \ No newline at end of file diff --git a/tests/parser/expression/literal/formatted_string.leo b/tests/parser/expression/literal/formatted_string.leo new file mode 100644 index 0000000000..c359c7f530 --- /dev/null +++ b/tests/parser/expression/literal/formatted_string.leo @@ -0,0 +1,25 @@ +/* +namespace: Token +expectation: Pass +*/ + +"{}" +" {} " +"{}d" +"{}D" +"d{}" +"D{}" +"D{}D" +"{}{}" +"D{}{}D" +"D{}{}" +"{}{}D" +"D{}D{}D" +"{{}}" +"}}" +"{{" +"}}{{" +"{{}" +"{}}" +"{" +"}" \ No newline at end of file diff --git a/tests/parser/expression/literal/group.leo b/tests/parser/expression/literal/group.leo new file mode 100644 index 0000000000..c69a52b93c --- /dev/null +++ b/tests/parser/expression/literal/group.leo @@ -0,0 +1,68 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +(+, _)group + +(_, -)group + +(+, -)group + +(-, +)group + +(+, +)group + +(-, -)group + +(_, _)group + + +(123,-456)group + +(-123,456)group + +(-123,456)group + +(123, _)group + +(123, -)group + +(123, -)group + +(123, +)group + +(123, +)group + +(123, -)group + +(123, _)group + +(+, 345)group + +(_, 345)group + +(+, 345)group + +(-, 345)group + +(+, 345)group + +(-, 345)group + +(_, 345)group + + +(123, 456)group + +(123, 456)group + +(123, 456)group + +(123, 456)group + +(123, 456)group + +(123, 456)group + +(123, 456)group diff --git a/tests/parser/expression/literal/group_fail.leo b/tests/parser/expression/literal/group_fail.leo new file mode 100644 index 0000000000..6a5651d9c0 --- /dev/null +++ b/tests/parser/expression/literal/group_fail.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Fail +*/ + +group + +()group + +(123)group + +(,)group + +(+, -,)group + +(,+, -)group + +(x,y)group + +(123,456u8)group + +(123,456field)group diff --git a/tests/parser/expression/literal/int.leo b/tests/parser/expression/literal/int.leo new file mode 100644 index 0000000000..a2421a23a2 --- /dev/null +++ b/tests/parser/expression/literal/int.leo @@ -0,0 +1,118 @@ +/* +namespace: Token +expectation: Pass +*/ + +123abc123 + +123abc + +123 +456 + +123 456 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802 + +340130024 +158951116 +155529659 +642023166 +228481736 +469712960 +929437719 +721072814 +363254789 +906732565 +288246391 +724940549 +487101620 +261373583 +891163927 +743967544 +8372586 +461793278 +806307045 +122764546 +356336181 +158370903 +774460877 +557174131 +492401267 +893445620 +957757048 +721540649 +390746493 +211251725 +938266114 +156985870 +703831126 +729964155 +988151305 +320872435 +719287167 +152289486 +740067975 +728627816 +385008978 +553967635 +71980713 +519444716 +116499965 +717422268 +18966279 +22458638 +857282620 +920675898 +762235516 +469018377 +199986521 +536679358 +591399452 +83083158 +599449051 +445442318 +585486590 +209278800 +873568117 +664470940 +465262783 +605652874 +376803940 +965247040 +598474509 +845119918 +648159133 +669051032 +800600261 +434689764 +520060080 +804659385 +537828058 +716600292 +387020273 +199375617 +680337189 +818479931 +893693281 +87377802 +84699261 +292826090 +569171405 +387436237 +150682190 +888770419 +824696431 +765659803 +270163693 +427940240 +504997332 +337808338 +907200008 +757177889 +696697188 +41376051 +496293518 +251218820 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/field.leo b/tests/parser/expression/literal/int_parse/field.leo new file mode 100644 index 0000000000..e8537beb68 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/field.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123field + +123 +456field + +87377802873778028737780287377802873778028737780287377802873778028737780287377802field + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802field + +340130024field +158951116field +155529659field +642023166field +228481736field +469712960field +929437719field +721072814field +363254789field +906732565field +288246391field +724940549field +487101620field +261373583field +891163927field +743967544field +8372586field +461793278field +806307045field +122764546field +356336181field +158370903field +774460877field +557174131field +492401267field +893445620field +957757048field +721540649field +390746493field +211251725field +938266114field +156985870field +703831126field +729964155field +988151305field +320872435field +719287167field +152289486field +740067975field +728627816field +385008978field +553967635field +71980713field +519444716field +116499965field +717422268field +18966279field +22458638field +857282620field +920675898field +762235516field +469018377field +199986521field +536679358field +591399452field +83083158field +599449051field +445442318field +585486590field +209278800field +873568117field +664470940field +465262783field +605652874field +376803940field +965247040field +598474509field +845119918field +648159133field +669051032field +800600261field +434689764field +520060080field +804659385field +537828058field +716600292field +387020273field +199375617field +680337189field +818479931field +893693281field +87377802field +84699261field +292826090field +569171405field +387436237field +150682190field +888770419field +824696431field +765659803field +270163693field +427940240field +504997332field +337808338field +907200008field +757177889field +696697188field +41376051field +496293518field +251218820field \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/i128.leo b/tests/parser/expression/literal/int_parse/i128.leo new file mode 100644 index 0000000000..93e554eee9 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/i128.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123i128 + +123 +456i128 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802i128 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i128 + +340130024i128 +158951116i128 +155529659i128 +642023166i128 +228481736i128 +469712960i128 +929437719i128 +721072814i128 +363254789i128 +906732565i128 +288246391i128 +724940549i128 +487101620i128 +261373583i128 +891163927i128 +743967544i128 +8372586i128 +461793278i128 +806307045i128 +122764546i128 +356336181i128 +158370903i128 +774460877i128 +557174131i128 +492401267i128 +893445620i128 +957757048i128 +721540649i128 +390746493i128 +211251725i128 +938266114i128 +156985870i128 +703831126i128 +729964155i128 +988151305i128 +320872435i128 +719287167i128 +152289486i128 +740067975i128 +728627816i128 +385008978i128 +553967635i128 +71980713i128 +519444716i128 +116499965i128 +717422268i128 +18966279i128 +22458638i128 +857282620i128 +920675898i128 +762235516i128 +469018377i128 +199986521i128 +536679358i128 +591399452i128 +83083158i128 +599449051i128 +445442318i128 +585486590i128 +209278800i128 +873568117i128 +664470940i128 +465262783i128 +605652874i128 +376803940i128 +965247040i128 +598474509i128 +845119918i128 +648159133i128 +669051032i128 +800600261i128 +434689764i128 +520060080i128 +804659385i128 +537828058i128 +716600292i128 +387020273i128 +199375617i128 +680337189i128 +818479931i128 +893693281i128 +87377802i128 +84699261i128 +292826090i128 +569171405i128 +387436237i128 +150682190i128 +888770419i128 +824696431i128 +765659803i128 +270163693i128 +427940240i128 +504997332i128 +337808338i128 +907200008i128 +757177889i128 +696697188i128 +41376051i128 +496293518i128 +251218820i128 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/i16.leo b/tests/parser/expression/literal/int_parse/i16.leo new file mode 100644 index 0000000000..20b4af030c --- /dev/null +++ b/tests/parser/expression/literal/int_parse/i16.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123i16 + +123 +456i16 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802i16 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i16 + +340130024i16 +158951116i16 +155529659i16 +642023166i16 +228481736i16 +469712960i16 +929437719i16 +721072814i16 +363254789i16 +906732565i16 +288246391i16 +724940549i16 +487101620i16 +261373583i16 +891163927i16 +743967544i16 +8372586i16 +461793278i16 +806307045i16 +122764546i16 +356336181i16 +158370903i16 +774460877i16 +557174131i16 +492401267i16 +893445620i16 +957757048i16 +721540649i16 +390746493i16 +211251725i16 +938266114i16 +156985870i16 +703831126i16 +729964155i16 +988151305i16 +320872435i16 +719287167i16 +152289486i16 +740067975i16 +728627816i16 +385008978i16 +553967635i16 +71980713i16 +519444716i16 +116499965i16 +717422268i16 +18966279i16 +22458638i16 +857282620i16 +920675898i16 +762235516i16 +469018377i16 +199986521i16 +536679358i16 +591399452i16 +83083158i16 +599449051i16 +445442318i16 +585486590i16 +209278800i16 +873568117i16 +664470940i16 +465262783i16 +605652874i16 +376803940i16 +965247040i16 +598474509i16 +845119918i16 +648159133i16 +669051032i16 +800600261i16 +434689764i16 +520060080i16 +804659385i16 +537828058i16 +716600292i16 +387020273i16 +199375617i16 +680337189i16 +818479931i16 +893693281i16 +87377802i16 +84699261i16 +292826090i16 +569171405i16 +387436237i16 +150682190i16 +888770419i16 +824696431i16 +765659803i16 +270163693i16 +427940240i16 +504997332i16 +337808338i16 +907200008i16 +757177889i16 +696697188i16 +41376051i16 +496293518i16 +251218820i16 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/i32.leo b/tests/parser/expression/literal/int_parse/i32.leo new file mode 100644 index 0000000000..518f8cd778 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/i32.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123i32 + +123 +456i32 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802i32 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i32 + +340130024i32 +158951116i32 +155529659i32 +642023166i32 +228481736i32 +469712960i32 +929437719i32 +721072814i32 +363254789i32 +906732565i32 +288246391i32 +724940549i32 +487101620i32 +261373583i32 +891163927i32 +743967544i32 +8372586i32 +461793278i32 +806307045i32 +122764546i32 +356336181i32 +158370903i32 +774460877i32 +557174131i32 +492401267i32 +893445620i32 +957757048i32 +721540649i32 +390746493i32 +211251725i32 +938266114i32 +156985870i32 +703831126i32 +729964155i32 +988151305i32 +320872435i32 +719287167i32 +152289486i32 +740067975i32 +728627816i32 +385008978i32 +553967635i32 +71980713i32 +519444716i32 +116499965i32 +717422268i32 +18966279i32 +22458638i32 +857282620i32 +920675898i32 +762235516i32 +469018377i32 +199986521i32 +536679358i32 +591399452i32 +83083158i32 +599449051i32 +445442318i32 +585486590i32 +209278800i32 +873568117i32 +664470940i32 +465262783i32 +605652874i32 +376803940i32 +965247040i32 +598474509i32 +845119918i32 +648159133i32 +669051032i32 +800600261i32 +434689764i32 +520060080i32 +804659385i32 +537828058i32 +716600292i32 +387020273i32 +199375617i32 +680337189i32 +818479931i32 +893693281i32 +87377802i32 +84699261i32 +292826090i32 +569171405i32 +387436237i32 +150682190i32 +888770419i32 +824696431i32 +765659803i32 +270163693i32 +427940240i32 +504997332i32 +337808338i32 +907200008i32 +757177889i32 +696697188i32 +41376051i32 +496293518i32 +251218820i32 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/i64.leo b/tests/parser/expression/literal/int_parse/i64.leo new file mode 100644 index 0000000000..fd1a259200 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/i64.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123i64 + +123 +456i64 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802i64 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i64 + +340130024i64 +158951116i64 +155529659i64 +642023166i64 +228481736i64 +469712960i64 +929437719i64 +721072814i64 +363254789i64 +906732565i64 +288246391i64 +724940549i64 +487101620i64 +261373583i64 +891163927i64 +743967544i64 +8372586i64 +461793278i64 +806307045i64 +122764546i64 +356336181i64 +158370903i64 +774460877i64 +557174131i64 +492401267i64 +893445620i64 +957757048i64 +721540649i64 +390746493i64 +211251725i64 +938266114i64 +156985870i64 +703831126i64 +729964155i64 +988151305i64 +320872435i64 +719287167i64 +152289486i64 +740067975i64 +728627816i64 +385008978i64 +553967635i64 +71980713i64 +519444716i64 +116499965i64 +717422268i64 +18966279i64 +22458638i64 +857282620i64 +920675898i64 +762235516i64 +469018377i64 +199986521i64 +536679358i64 +591399452i64 +83083158i64 +599449051i64 +445442318i64 +585486590i64 +209278800i64 +873568117i64 +664470940i64 +465262783i64 +605652874i64 +376803940i64 +965247040i64 +598474509i64 +845119918i64 +648159133i64 +669051032i64 +800600261i64 +434689764i64 +520060080i64 +804659385i64 +537828058i64 +716600292i64 +387020273i64 +199375617i64 +680337189i64 +818479931i64 +893693281i64 +87377802i64 +84699261i64 +292826090i64 +569171405i64 +387436237i64 +150682190i64 +888770419i64 +824696431i64 +765659803i64 +270163693i64 +427940240i64 +504997332i64 +337808338i64 +907200008i64 +757177889i64 +696697188i64 +41376051i64 +496293518i64 +251218820i64 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/i8.leo b/tests/parser/expression/literal/int_parse/i8.leo new file mode 100644 index 0000000000..899b42fecc --- /dev/null +++ b/tests/parser/expression/literal/int_parse/i8.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123i8 + +123 +456i8 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802i8 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802i8 + +340130024i8 +158951116i8 +155529659i8 +642023166i8 +228481736i8 +469712960i8 +929437719i8 +721072814i8 +363254789i8 +906732565i8 +288246391i8 +724940549i8 +487101620i8 +261373583i8 +891163927i8 +743967544i8 +8372586i8 +461793278i8 +806307045i8 +122764546i8 +356336181i8 +158370903i8 +774460877i8 +557174131i8 +492401267i8 +893445620i8 +957757048i8 +721540649i8 +390746493i8 +211251725i8 +938266114i8 +156985870i8 +703831126i8 +729964155i8 +988151305i8 +320872435i8 +719287167i8 +152289486i8 +740067975i8 +728627816i8 +385008978i8 +553967635i8 +71980713i8 +519444716i8 +116499965i8 +717422268i8 +18966279i8 +22458638i8 +857282620i8 +920675898i8 +762235516i8 +469018377i8 +199986521i8 +536679358i8 +591399452i8 +83083158i8 +599449051i8 +445442318i8 +585486590i8 +209278800i8 +873568117i8 +664470940i8 +465262783i8 +605652874i8 +376803940i8 +965247040i8 +598474509i8 +845119918i8 +648159133i8 +669051032i8 +800600261i8 +434689764i8 +520060080i8 +804659385i8 +537828058i8 +716600292i8 +387020273i8 +199375617i8 +680337189i8 +818479931i8 +893693281i8 +87377802i8 +84699261i8 +292826090i8 +569171405i8 +387436237i8 +150682190i8 +888770419i8 +824696431i8 +765659803i8 +270163693i8 +427940240i8 +504997332i8 +337808338i8 +907200008i8 +757177889i8 +696697188i8 +41376051i8 +496293518i8 +251218820i8 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/implicit.leo b/tests/parser/expression/literal/int_parse/implicit.leo new file mode 100644 index 0000000000..34c1eed0bd --- /dev/null +++ b/tests/parser/expression/literal/int_parse/implicit.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123 + +123 +456 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802 + +340130024 +158951116 +155529659 +642023166 +228481736 +469712960 +929437719 +721072814 +363254789 +906732565 +288246391 +724940549 +487101620 +261373583 +891163927 +743967544 +8372586 +461793278 +806307045 +122764546 +356336181 +158370903 +774460877 +557174131 +492401267 +893445620 +957757048 +721540649 +390746493 +211251725 +938266114 +156985870 +703831126 +729964155 +988151305 +320872435 +719287167 +152289486 +740067975 +728627816 +385008978 +553967635 +71980713 +519444716 +116499965 +717422268 +18966279 +22458638 +857282620 +920675898 +762235516 +469018377 +199986521 +536679358 +591399452 +83083158 +599449051 +445442318 +585486590 +209278800 +873568117 +664470940 +465262783 +605652874 +376803940 +965247040 +598474509 +845119918 +648159133 +669051032 +800600261 +434689764 +520060080 +804659385 +537828058 +716600292 +387020273 +199375617 +680337189 +818479931 +893693281 +87377802 +84699261 +292826090 +569171405 +387436237 +150682190 +888770419 +824696431 +765659803 +270163693 +427940240 +504997332 +337808338 +907200008 +757177889 +696697188 +41376051 +496293518 +251218820 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/mono_group.leo b/tests/parser/expression/literal/int_parse/mono_group.leo new file mode 100644 index 0000000000..8871214875 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/mono_group.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123group + +123 +456group + +87377802873778028737780287377802873778028737780287377802873778028737780287377802group + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802group + +340130024group +158951116group +155529659group +642023166group +228481736group +469712960group +929437719group +721072814group +363254789group +906732565group +288246391group +724940549group +487101620group +261373583group +891163927group +743967544group +8372586group +461793278group +806307045group +122764546group +356336181group +158370903group +774460877group +557174131group +492401267group +893445620group +957757048group +721540649group +390746493group +211251725group +938266114group +156985870group +703831126group +729964155group +988151305group +320872435group +719287167group +152289486group +740067975group +728627816group +385008978group +553967635group +71980713group +519444716group +116499965group +717422268group +18966279group +22458638group +857282620group +920675898group +762235516group +469018377group +199986521group +536679358group +591399452group +83083158group +599449051group +445442318group +585486590group +209278800group +873568117group +664470940group +465262783group +605652874group +376803940group +965247040group +598474509group +845119918group +648159133group +669051032group +800600261group +434689764group +520060080group +804659385group +537828058group +716600292group +387020273group +199375617group +680337189group +818479931group +893693281group +87377802group +84699261group +292826090group +569171405group +387436237group +150682190group +888770419group +824696431group +765659803group +270163693group +427940240group +504997332group +337808338group +907200008group +757177889group +696697188group +41376051group +496293518group +251218820group \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/u128.leo b/tests/parser/expression/literal/int_parse/u128.leo new file mode 100644 index 0000000000..d010081723 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/u128.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123u128 + +123 +456u128 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802u128 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u128 + +340130024u128 +158951116u128 +155529659u128 +642023166u128 +228481736u128 +469712960u128 +929437719u128 +721072814u128 +363254789u128 +906732565u128 +288246391u128 +724940549u128 +487101620u128 +261373583u128 +891163927u128 +743967544u128 +8372586u128 +461793278u128 +806307045u128 +122764546u128 +356336181u128 +158370903u128 +774460877u128 +557174131u128 +492401267u128 +893445620u128 +957757048u128 +721540649u128 +390746493u128 +211251725u128 +938266114u128 +156985870u128 +703831126u128 +729964155u128 +988151305u128 +320872435u128 +719287167u128 +152289486u128 +740067975u128 +728627816u128 +385008978u128 +553967635u128 +71980713u128 +519444716u128 +116499965u128 +717422268u128 +18966279u128 +22458638u128 +857282620u128 +920675898u128 +762235516u128 +469018377u128 +199986521u128 +536679358u128 +591399452u128 +83083158u128 +599449051u128 +445442318u128 +585486590u128 +209278800u128 +873568117u128 +664470940u128 +465262783u128 +605652874u128 +376803940u128 +965247040u128 +598474509u128 +845119918u128 +648159133u128 +669051032u128 +800600261u128 +434689764u128 +520060080u128 +804659385u128 +537828058u128 +716600292u128 +387020273u128 +199375617u128 +680337189u128 +818479931u128 +893693281u128 +87377802u128 +84699261u128 +292826090u128 +569171405u128 +387436237u128 +150682190u128 +888770419u128 +824696431u128 +765659803u128 +270163693u128 +427940240u128 +504997332u128 +337808338u128 +907200008u128 +757177889u128 +696697188u128 +41376051u128 +496293518u128 +251218820u128 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/u16.leo b/tests/parser/expression/literal/int_parse/u16.leo new file mode 100644 index 0000000000..1518748456 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/u16.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123u8 + +123 +456u8 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + +340130024u8 +158951116u8 +155529659u8 +642023166u8 +228481736u8 +469712960u8 +929437719u8 +721072814u8 +363254789u8 +906732565u8 +288246391u8 +724940549u8 +487101620u8 +261373583u8 +891163927u8 +743967544u8 +8372586u8 +461793278u8 +806307045u8 +122764546u8 +356336181u8 +158370903u8 +774460877u8 +557174131u8 +492401267u8 +893445620u8 +957757048u8 +721540649u8 +390746493u8 +211251725u8 +938266114u8 +156985870u8 +703831126u8 +729964155u8 +988151305u8 +320872435u8 +719287167u8 +152289486u8 +740067975u8 +728627816u8 +385008978u8 +553967635u8 +71980713u8 +519444716u8 +116499965u8 +717422268u8 +18966279u8 +22458638u8 +857282620u8 +920675898u8 +762235516u8 +469018377u8 +199986521u8 +536679358u8 +591399452u8 +83083158u8 +599449051u8 +445442318u8 +585486590u8 +209278800u8 +873568117u8 +664470940u8 +465262783u8 +605652874u8 +376803940u8 +965247040u8 +598474509u8 +845119918u8 +648159133u8 +669051032u8 +800600261u8 +434689764u8 +520060080u8 +804659385u8 +537828058u8 +716600292u8 +387020273u8 +199375617u8 +680337189u8 +818479931u8 +893693281u8 +87377802u8 +84699261u8 +292826090u8 +569171405u8 +387436237u8 +150682190u8 +888770419u8 +824696431u8 +765659803u8 +270163693u8 +427940240u8 +504997332u8 +337808338u8 +907200008u8 +757177889u8 +696697188u8 +41376051u8 +496293518u8 +251218820u8 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/u32.leo b/tests/parser/expression/literal/int_parse/u32.leo new file mode 100644 index 0000000000..05efd55c47 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/u32.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123u32 + +123 +456u32 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + +340130024u32 +158951116u32 +155529659u32 +642023166u32 +228481736u32 +469712960u32 +929437719u32 +721072814u32 +363254789u32 +906732565u32 +288246391u32 +724940549u32 +487101620u32 +261373583u32 +891163927u32 +743967544u32 +8372586u32 +461793278u32 +806307045u32 +122764546u32 +356336181u32 +158370903u32 +774460877u32 +557174131u32 +492401267u32 +893445620u32 +957757048u32 +721540649u32 +390746493u32 +211251725u32 +938266114u32 +156985870u32 +703831126u32 +729964155u32 +988151305u32 +320872435u32 +719287167u32 +152289486u32 +740067975u32 +728627816u32 +385008978u32 +553967635u32 +71980713u32 +519444716u32 +116499965u32 +717422268u32 +18966279u32 +22458638u32 +857282620u32 +920675898u32 +762235516u32 +469018377u32 +199986521u32 +536679358u32 +591399452u32 +83083158u32 +599449051u32 +445442318u32 +585486590u32 +209278800u32 +873568117u32 +664470940u32 +465262783u32 +605652874u32 +376803940u32 +965247040u32 +598474509u32 +845119918u32 +648159133u32 +669051032u32 +800600261u32 +434689764u32 +520060080u32 +804659385u32 +537828058u32 +716600292u32 +387020273u32 +199375617u32 +680337189u32 +818479931u32 +893693281u32 +87377802u32 +84699261u32 +292826090u32 +569171405u32 +387436237u32 +150682190u32 +888770419u32 +824696431u32 +765659803u32 +270163693u32 +427940240u32 +504997332u32 +337808338u32 +907200008u32 +757177889u32 +696697188u32 +41376051u32 +496293518u32 +251218820u32 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/u64.leo b/tests/parser/expression/literal/int_parse/u64.leo new file mode 100644 index 0000000000..05efd55c47 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/u64.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123u32 + +123 +456u32 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u32 + +340130024u32 +158951116u32 +155529659u32 +642023166u32 +228481736u32 +469712960u32 +929437719u32 +721072814u32 +363254789u32 +906732565u32 +288246391u32 +724940549u32 +487101620u32 +261373583u32 +891163927u32 +743967544u32 +8372586u32 +461793278u32 +806307045u32 +122764546u32 +356336181u32 +158370903u32 +774460877u32 +557174131u32 +492401267u32 +893445620u32 +957757048u32 +721540649u32 +390746493u32 +211251725u32 +938266114u32 +156985870u32 +703831126u32 +729964155u32 +988151305u32 +320872435u32 +719287167u32 +152289486u32 +740067975u32 +728627816u32 +385008978u32 +553967635u32 +71980713u32 +519444716u32 +116499965u32 +717422268u32 +18966279u32 +22458638u32 +857282620u32 +920675898u32 +762235516u32 +469018377u32 +199986521u32 +536679358u32 +591399452u32 +83083158u32 +599449051u32 +445442318u32 +585486590u32 +209278800u32 +873568117u32 +664470940u32 +465262783u32 +605652874u32 +376803940u32 +965247040u32 +598474509u32 +845119918u32 +648159133u32 +669051032u32 +800600261u32 +434689764u32 +520060080u32 +804659385u32 +537828058u32 +716600292u32 +387020273u32 +199375617u32 +680337189u32 +818479931u32 +893693281u32 +87377802u32 +84699261u32 +292826090u32 +569171405u32 +387436237u32 +150682190u32 +888770419u32 +824696431u32 +765659803u32 +270163693u32 +427940240u32 +504997332u32 +337808338u32 +907200008u32 +757177889u32 +696697188u32 +41376051u32 +496293518u32 +251218820u32 \ No newline at end of file diff --git a/tests/parser/expression/literal/int_parse/u8.leo b/tests/parser/expression/literal/int_parse/u8.leo new file mode 100644 index 0000000000..1518748456 --- /dev/null +++ b/tests/parser/expression/literal/int_parse/u8.leo @@ -0,0 +1,114 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +123u8 + +123 +456u8 + +87377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + +8737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802873778028737780287377802u8 + +340130024u8 +158951116u8 +155529659u8 +642023166u8 +228481736u8 +469712960u8 +929437719u8 +721072814u8 +363254789u8 +906732565u8 +288246391u8 +724940549u8 +487101620u8 +261373583u8 +891163927u8 +743967544u8 +8372586u8 +461793278u8 +806307045u8 +122764546u8 +356336181u8 +158370903u8 +774460877u8 +557174131u8 +492401267u8 +893445620u8 +957757048u8 +721540649u8 +390746493u8 +211251725u8 +938266114u8 +156985870u8 +703831126u8 +729964155u8 +988151305u8 +320872435u8 +719287167u8 +152289486u8 +740067975u8 +728627816u8 +385008978u8 +553967635u8 +71980713u8 +519444716u8 +116499965u8 +717422268u8 +18966279u8 +22458638u8 +857282620u8 +920675898u8 +762235516u8 +469018377u8 +199986521u8 +536679358u8 +591399452u8 +83083158u8 +599449051u8 +445442318u8 +585486590u8 +209278800u8 +873568117u8 +664470940u8 +465262783u8 +605652874u8 +376803940u8 +965247040u8 +598474509u8 +845119918u8 +648159133u8 +669051032u8 +800600261u8 +434689764u8 +520060080u8 +804659385u8 +537828058u8 +716600292u8 +387020273u8 +199375617u8 +680337189u8 +818479931u8 +893693281u8 +87377802u8 +84699261u8 +292826090u8 +569171405u8 +387436237u8 +150682190u8 +888770419u8 +824696431u8 +765659803u8 +270163693u8 +427940240u8 +504997332u8 +337808338u8 +907200008u8 +757177889u8 +696697188u8 +41376051u8 +496293518u8 +251218820u8 \ No newline at end of file diff --git a/tests/parser/expression/literal/postfix_types.leo b/tests/parser/expression/literal/postfix_types.leo new file mode 100644 index 0000000000..a0afa641e2 --- /dev/null +++ b/tests/parser/expression/literal/postfix_types.leo @@ -0,0 +1,73 @@ +/* +namespace: Token +expectation: Pass +*/ + +field +Field +fielD +FIELD + +group +Group +grouP +GROUP + +u8 +u16 +u32 +u64 +u128 + +i8 +i16 +i32 +i64 +i128 + +U8 +U16 +U32 +U64 +U128 + +U8 +U16 +U32 +U64 +U128 + + +u +8 +u +16 +u +32 +u +64 +u +128 + +i +8 +i +16 +i +32 +i +64 +i +128 + +U 8 +U 16 +U 32 +U 64 +U 128 + +U 8 +U 16 +U 32 +U 64 +U 128 diff --git a/tests/parser/expression/ternary.leo b/tests/parser/expression/ternary.leo new file mode 100644 index 0000000000..73d7fe8713 --- /dev/null +++ b/tests/parser/expression/ternary.leo @@ -0,0 +1,10 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x ? y : z + +x ? a ? b : c : z + +x ? y : a ? b : c \ No newline at end of file diff --git a/tests/parser/expression/tuple.leo b/tests/parser/expression/tuple.leo new file mode 100644 index 0000000000..abfcab0999 --- /dev/null +++ b/tests/parser/expression/tuple.leo @@ -0,0 +1,19 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +//not tuples +(x) +(y) +(z) + +//tuples +(x,) +(x,y) +(x,y,z) +(123,123) + +() + +(()) \ No newline at end of file diff --git a/tests/parser/expression/unary/bit_not.leo.off b/tests/parser/expression/unary/bit_not.leo.off new file mode 100644 index 0000000000..db3ba31b70 --- /dev/null +++ b/tests/parser/expression/unary/bit_not.leo.off @@ -0,0 +1,13 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +~x +~x.y +~x::y +~x() +~~x +~-!x +-!~x +-~!x \ No newline at end of file diff --git a/tests/parser/expression/unary/negate.leo b/tests/parser/expression/unary/negate.leo new file mode 100644 index 0000000000..b23e99c5d2 --- /dev/null +++ b/tests/parser/expression/unary/negate.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +-x +-x.y +-x::y +-x() +--x +-!x diff --git a/tests/parser/expression/unary/not.leo b/tests/parser/expression/unary/not.leo new file mode 100644 index 0000000000..5ad9c3b5d3 --- /dev/null +++ b/tests/parser/expression/unary/not.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!x +!x.y +!x::y +!x() +!!x +!-x \ No newline at end of file diff --git a/tests/parser/functions/annotated.leo b/tests/parser/functions/annotated.leo new file mode 100644 index 0000000000..39a1686dd7 --- /dev/null +++ b/tests/parser/functions/annotated.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Pass +*/ + +@test +function x() { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/annotated_param.leo b/tests/parser/functions/annotated_param.leo new file mode 100644 index 0000000000..65a16b3894 --- /dev/null +++ b/tests/parser/functions/annotated_param.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Pass +*/ + +@test(test) +function x() { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/annotated_twice.leo b/tests/parser/functions/annotated_twice.leo new file mode 100644 index 0000000000..b969c4df35 --- /dev/null +++ b/tests/parser/functions/annotated_twice.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Pass +*/ + +@test @test2 +function x() { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/const_input_fail.leo b/tests/parser/functions/const_input_fail.leo new file mode 100644 index 0000000000..2b4c0b69a6 --- /dev/null +++ b/tests/parser/functions/const_input_fail.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Fail +*/ + +function x(const input) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/const_param.leo b/tests/parser/functions/const_param.leo new file mode 100644 index 0000000000..3fbe5dfdba --- /dev/null +++ b/tests/parser/functions/const_param.leo @@ -0,0 +1,12 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(x: u32, const y: i32) { + return (); +} + +function x(const x: u32, y: i32) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/const_self_bad.leo b/tests/parser/functions/const_self_bad.leo new file mode 100644 index 0000000000..281dbab043 --- /dev/null +++ b/tests/parser/functions/const_self_bad.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(const self) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/empty.leo b/tests/parser/functions/empty.leo new file mode 100644 index 0000000000..0c463ae036 --- /dev/null +++ b/tests/parser/functions/empty.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x() { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/empty2.leo b/tests/parser/functions/empty2.leo new file mode 100644 index 0000000000..2a39bb43df --- /dev/null +++ b/tests/parser/functions/empty2.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x() {} \ No newline at end of file diff --git a/tests/parser/functions/param_array.leo b/tests/parser/functions/param_array.leo new file mode 100644 index 0000000000..36e5bbb930 --- /dev/null +++ b/tests/parser/functions/param_array.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(x: [u8; 12]) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/param_circuit.leo b/tests/parser/functions/param_circuit.leo new file mode 100644 index 0000000000..dbffe0608c --- /dev/null +++ b/tests/parser/functions/param_circuit.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(x: MyCircuit) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/param_tuple.leo b/tests/parser/functions/param_tuple.leo new file mode 100644 index 0000000000..80d9c202f9 --- /dev/null +++ b/tests/parser/functions/param_tuple.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(x: (u32, i32)) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/params.leo b/tests/parser/functions/params.leo new file mode 100644 index 0000000000..e42363568c --- /dev/null +++ b/tests/parser/functions/params.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(x: u32, y: i32) { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/params_return.leo b/tests/parser/functions/params_return.leo new file mode 100644 index 0000000000..d1f2b434fd --- /dev/null +++ b/tests/parser/functions/params_return.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(x: u32, y: i32) -> u32 { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/return.leo b/tests/parser/functions/return.leo new file mode 100644 index 0000000000..ccf8dee32b --- /dev/null +++ b/tests/parser/functions/return.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x() -> u32 { + return (); +} \ No newline at end of file diff --git a/tests/parser/functions/return_tuple.leo b/tests/parser/functions/return_tuple.leo new file mode 100644 index 0000000000..618ddec00d --- /dev/null +++ b/tests/parser/functions/return_tuple.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x() -> (u32, u32) { + return (); +} \ No newline at end of file diff --git a/tests/parser/import/alias.leo b/tests/parser/import/alias.leo new file mode 100644 index 0000000000..5913a203b0 --- /dev/null +++ b/tests/parser/import/alias.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Pass +*/ + +import a.b as bar; diff --git a/tests/parser/import/basic.leo b/tests/parser/import/basic.leo new file mode 100644 index 0000000000..f0fabaab79 --- /dev/null +++ b/tests/parser/import/basic.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Pass +*/ + +import a.b; \ No newline at end of file diff --git a/tests/parser/import/many_import.leo b/tests/parser/import/many_import.leo new file mode 100644 index 0000000000..47b104aa34 --- /dev/null +++ b/tests/parser/import/many_import.leo @@ -0,0 +1,15 @@ +/* +namespace: Parse +expectation: Pass +*/ + +import test-import.( // local import + Point, + foo, +); + +import bar.( // imports directory import + Bar, + baz.(Baz, Bazzar), + bat.bat.Bat, +); diff --git a/tests/parser/import/many_import_star.leo b/tests/parser/import/many_import_star.leo new file mode 100644 index 0000000000..276deb7fcb --- /dev/null +++ b/tests/parser/import/many_import_star.leo @@ -0,0 +1,11 @@ +/* +namespace: Parse +expectation: Pass +*/ + +import test-import.*; // local import + +import bar.*; // imports directory import +import bar.baz.*; // imports directory import +import bar.bat.bat.*; // imports directory import +import car.*; // imports directory import diff --git a/tests/pass/parse/import/names.leo b/tests/parser/import/names.leo similarity index 59% rename from tests/pass/parse/import/names.leo rename to tests/parser/import/names.leo index d3ce50829a..a37f401735 100644 --- a/tests/pass/parse/import/names.leo +++ b/tests/parser/import/names.leo @@ -1,5 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + import a0-f.foo; import a-9.bar; import hello-world.hello; - -function main() {} \ No newline at end of file diff --git a/tests/parser/import/names_underscore.leo b/tests/parser/import/names_underscore.leo new file mode 100644 index 0000000000..8bc3ebefaf --- /dev/null +++ b/tests/parser/import/names_underscore.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Pass +*/ + +import hello_world.foo; diff --git a/tests/parser/import/star.leo b/tests/parser/import/star.leo new file mode 100644 index 0000000000..c5363d15a0 --- /dev/null +++ b/tests/parser/import/star.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Pass +*/ + +import test-import.*; diff --git a/tests/parser/statement/assign.leo b/tests/parser/statement/assign.leo new file mode 100644 index 0000000000..4d3db94c85 --- /dev/null +++ b/tests/parser/statement/assign.leo @@ -0,0 +1,31 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +x = expr; + +x = (); + +x = x+y; + +x = (x,y); + +x = x(); + + +x[0] = y; + +x[0u32] = y; + +x.0 = y; + +x[1..2] = y; + +x[..2] = y; + +x[2..] = y; + +x[..] = y; + +x.0[0][..] = y; diff --git a/tests/parser/statement/block.leo b/tests/parser/statement/block.leo new file mode 100644 index 0000000000..307cc6928d --- /dev/null +++ b/tests/parser/statement/block.leo @@ -0,0 +1,25 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +{} + +{ + return (); +} + +{{}} + +{ + { + return (); + } +} + +{ + if x { + return (); + } +} + diff --git a/tests/parser/statement/conditional.leo b/tests/parser/statement/conditional.leo new file mode 100644 index 0000000000..2605521ae1 --- /dev/null +++ b/tests/parser/statement/conditional.leo @@ -0,0 +1,25 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +if x { + return (); +} + +if Self { + return (); +} + +if (x) { + return (); +} + +if (x) {} + +if x+y {} + +if x+y { + expr; + return (); +} \ No newline at end of file diff --git a/tests/parser/statement/console.leo b/tests/parser/statement/console.leo new file mode 100644 index 0000000000..ba1b5e2cf4 --- /dev/null +++ b/tests/parser/statement/console.leo @@ -0,0 +1,27 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +console.assert(x); + + +console.error("{}", x); + +console.error("{}{}", x, y); + +console.error("x"); + + +console.debug("{}", x); + +console.debug("{}{}", x, y); + +console.debug("x"); + + +console.log("{}", x); + +console.log("{}{}", x, y); + +console.log("x"); \ No newline at end of file diff --git a/tests/parser/statement/definition.leo b/tests/parser/statement/definition.leo new file mode 100644 index 0000000000..0f1a7617bc --- /dev/null +++ b/tests/parser/statement/definition.leo @@ -0,0 +1,100 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +let x = expr; + +let x = (); + +let x = x+y; + +let x = (x,y); + +let x = x(); + + +const x = expr; + +const x = (); + +const x = x+y; + +const x = (x,y); + +const x = x(); + + +let x: u32 = expr; + +let x: u32 = (); + +let x: u32 = x+y; + +let x: u32 = (x,y); + +let x: u32 = x(); + + +const x: u32 = expr; + +const x: u32 = (); + +const x: u32 = x+y; + +const x: u32 = (x,y); + +const x: u32 = x(); + + + + + + +let (x, y) = expr; + +let (x, y) = (); + +let (x, y) = x+y; + +let (x, y) = (x,y); + +let (x, y) = x(); + + +const (x, y) = expr; + +const (x, y) = (); + +const (x, y) = x+y; + +const (x, y) = (x,y); + +const (x, y) = x(); + + +let (x, y): u32 = expr; + +let (x, y): u32 = (); + +let (x, y): u32 = x+y; + +let (x, y): u32 = (x,y); + +let (x, y): u32 = x(); + + +const (x, y): u32 = expr; + +const (x, y): u32 = (); + +const (x, y): u32 = x+y; + +const (x, y): u32 = (x,y); + +const (x, y): u32 = x(); + + +let (x,y,) = (); + +let (x,) = (); diff --git a/tests/parser/statement/definition_fail.leo b/tests/parser/statement/definition_fail.leo new file mode 100644 index 0000000000..7e3fd0d28b --- /dev/null +++ b/tests/parser/statement/definition_fail.leo @@ -0,0 +1,54 @@ +/* +namespace: ParseStatement +expectation: Fail +*/ + +let mut x = expr; + +let mut x = (); + +let mut x = x+y; + +let mut x = (x,y); + +let mut x = x(); + + +const mut x = expr; + +const mut x = (); + +const mut x = x+y; + +const mut x = (x,y); + +const mut x = x(); + + +let mut x: u32 = expr; + +let mut x: u32 = (); + +let mut x: u32 = x+y; + +let mut x: u32 = (x,y); + +let mut x: u32 = x(); + + +const mut x: u32 = expr; + +const mut x: u32 = (); + +const mut x: u32 = x+y; + +const mut x: u32 = (x,y); + +const mut x: u32 = x(); + + +let (x,y,,) = (); + +let (,x,y) = (); + +let (x,,y) = (); \ No newline at end of file diff --git a/tests/parser/statement/expression.leo b/tests/parser/statement/expression.leo new file mode 100644 index 0000000000..cc63041b00 --- /dev/null +++ b/tests/parser/statement/expression.leo @@ -0,0 +1,14 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +expr; + +(); + +x+y; + +(x,y); + +x(); \ No newline at end of file diff --git a/tests/parser/statement/iteration.leo b/tests/parser/statement/iteration.leo new file mode 100644 index 0000000000..79850fa6b9 --- /dev/null +++ b/tests/parser/statement/iteration.leo @@ -0,0 +1,18 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +for x in 0..7 {} + +for x in 0..7 { + return (); +} + +for x in 0..99u8 { + return (); +} + +for x in 0..Self { + return (); +} \ No newline at end of file diff --git a/tests/parser/statement/return.leo b/tests/parser/statement/return.leo new file mode 100644 index 0000000000..e3e835c5df --- /dev/null +++ b/tests/parser/statement/return.leo @@ -0,0 +1,17 @@ +/* +namespace: ParseStatement +expectation: Pass +*/ + +return expr; + +return (); + +return (); + +return x+y; + +return (x,y); + +return +5; \ No newline at end of file diff --git a/tests/parser/statement/return_fail.leo b/tests/parser/statement/return_fail.leo new file mode 100644 index 0000000000..21617c0cc5 --- /dev/null +++ b/tests/parser/statement/return_fail.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseStatement +expectation: Fail +*/ + +return + +return 5 + +return +if x {} diff --git a/tests/pass/parse/address/console_assert_fail.leo b/tests/pass/parse/address/console_assert_fail.leo deleted file mode 100644 index 17849256ca..0000000000 --- a/tests/pass/parse/address/console_assert_fail.leo +++ /dev/null @@ -1,6 +0,0 @@ -function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9); - - console.assert(address_1 == address_2); -} \ No newline at end of file diff --git a/tests/pass/parse/address/console_assert_pass.leo b/tests/pass/parse/address/console_assert_pass.leo deleted file mode 100644 index f17d7d8c05..0000000000 --- a/tests/pass/parse/address/console_assert_pass.leo +++ /dev/null @@ -1,6 +0,0 @@ -function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - - console.assert(address_1 == address_2); -} \ No newline at end of file diff --git a/tests/pass/parse/address/equal.leo b/tests/pass/parse/address/equal.leo deleted file mode 100644 index 9012a8c49d..0000000000 --- a/tests/pass/parse/address/equal.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: address, b: address, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/address/implicit_invalid.leo b/tests/pass/parse/address/implicit_invalid.leo deleted file mode 100644 index aadc38a6d8..0000000000 --- a/tests/pass/parse/address/implicit_invalid.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const public_key_string: address = zleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -} \ No newline at end of file diff --git a/tests/pass/parse/address/implicit_valid.leo b/tests/pass/parse/address/implicit_valid.leo deleted file mode 100644 index 75bcbaa8a1..0000000000 --- a/tests/pass/parse/address/implicit_valid.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const public_key_string: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -} \ No newline at end of file diff --git a/tests/pass/parse/address/input.leo b/tests/pass/parse/address/input.leo deleted file mode 100644 index 29519f0334..0000000000 --- a/tests/pass/parse/address/input.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(owner: address) { - const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - - console.assert(owner == sender); -} \ No newline at end of file diff --git a/tests/pass/parse/address/ternary.leo b/tests/pass/parse/address/ternary.leo deleted file mode 100644 index dc87153d2d..0000000000 --- a/tests/pass/parse/address/ternary.leo +++ /dev/null @@ -1,8 +0,0 @@ -function main(s: bool, c: address) { - const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r); - - const r = s? a: b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/address/valid.leo b/tests/pass/parse/address/valid.leo deleted file mode 100644 index 18f1682526..0000000000 --- a/tests/pass/parse/address/valid.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); -} \ No newline at end of file diff --git a/tests/pass/parse/array/initializer.leo b/tests/pass/parse/array/initializer.leo deleted file mode 100644 index 51ac19f68f..0000000000 --- a/tests/pass/parse/array/initializer.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; 3]) { - console.assert(a == [1u8; 3]); -} \ No newline at end of file diff --git a/tests/pass/parse/array/initializer_input.leo b/tests/pass/parse/array/initializer_input.leo deleted file mode 100644 index 4b886159dc..0000000000 --- a/tests/pass/parse/array/initializer_input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [0u8; (3, 2)]); -} \ No newline at end of file diff --git a/tests/pass/parse/array/inline.leo b/tests/pass/parse/array/inline.leo deleted file mode 100644 index 8c5c98ae50..0000000000 --- a/tests/pass/parse/array/inline.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; 3]) { - console.assert(a == [1u8, 1u8, 1u8]); -} \ No newline at end of file diff --git a/tests/pass/parse/array/input_nested_3x2.leo b/tests/pass/parse/array/input_nested_3x2.leo deleted file mode 100644 index b7e59a5dc0..0000000000 --- a/tests/pass/parse/array/input_nested_3x2.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [[0u8; 2]; 3]); -} diff --git a/tests/pass/parse/array/input_tuple_3x2.leo b/tests/pass/parse/array/input_tuple_3x2.leo deleted file mode 100644 index 4c3c001f41..0000000000 --- a/tests/pass/parse/array/input_tuple_3x2.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [0u8; (3, 2)]); -} diff --git a/tests/pass/parse/array/input_tuple_3x2_fail.leo b/tests/pass/parse/array/input_tuple_3x2_fail.leo deleted file mode 100644 index 4c3c001f41..0000000000 --- a/tests/pass/parse/array/input_tuple_3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: [u8; (3, 2)]) { - console.assert(a == [0u8; (3, 2)]); -} diff --git a/tests/pass/parse/array/multi_fail_initializer.leo b/tests/pass/parse/array/multi_fail_initializer.leo deleted file mode 100644 index be1ab315bd..0000000000 --- a/tests/pass/parse/array/multi_fail_initializer.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const arr: [u8; (2, 2)] = [[1u8; 2]; 1]; // incorrect dimensions -} \ No newline at end of file diff --git a/tests/pass/parse/array/multi_fail_inline.leo b/tests/pass/parse/array/multi_fail_inline.leo deleted file mode 100644 index 49c9296798..0000000000 --- a/tests/pass/parse/array/multi_fail_inline.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const arr: [u8; (2, 2)] = [[1u8, 1u8], - [1u8]]; // incorrect dimensions -} \ No newline at end of file diff --git a/tests/pass/parse/array/multi_initializer.leo b/tests/pass/parse/array/multi_initializer.leo deleted file mode 100644 index 6133542ef0..0000000000 --- a/tests/pass/parse/array/multi_initializer.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main() { - const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)]; - - const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2]; - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/multi_initializer_fail.leo b/tests/pass/parse/array/multi_initializer_fail.leo deleted file mode 100644 index e38a8fdaee..0000000000 --- a/tests/pass/parse/array/multi_initializer_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions -} \ No newline at end of file diff --git a/tests/pass/parse/array/nested.leo b/tests/pass/parse/array/nested.leo deleted file mode 100644 index 80fc5511bf..0000000000 --- a/tests/pass/parse/array/nested.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main () { - const x = [false; (2, 2)]; - const y: bool = x[0][0]; -} diff --git a/tests/pass/parse/array/nested_3x2_value.leo b/tests/pass/parse/array/nested_3x2_value.leo deleted file mode 100644 index c5f64c997e..0000000000 --- a/tests/pass/parse/array/nested_3x2_value.leo +++ /dev/null @@ -1,8 +0,0 @@ -// Multidimensional array syntax in leo -function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline - - const b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/nested_3x2_value_fail.leo b/tests/pass/parse/array/nested_3x2_value_fail.leo deleted file mode 100644 index a187a51991..0000000000 --- a/tests/pass/parse/array/nested_3x2_value_fail.leo +++ /dev/null @@ -1,4 +0,0 @@ -// Multidimensional array syntax in leo -function main() { - const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) -} diff --git a/tests/pass/parse/array/registers.leo b/tests/pass/parse/array/registers.leo deleted file mode 100644 index fb8980868e..0000000000 --- a/tests/pass/parse/array/registers.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(input) -> [u8; 3] { - return input.registers.r -} \ No newline at end of file diff --git a/tests/pass/parse/array/slice.leo b/tests/pass/parse/array/slice.leo deleted file mode 100644 index 9ff83dbbb8..0000000000 --- a/tests/pass/parse/array/slice.leo +++ /dev/null @@ -1,6 +0,0 @@ -// `{from}..{to}` copies the elements of one array into another exclusively -function main(a: [u8; 3]) { - const b = [1u8; 4]; - - console.assert(a == b[0..3]); -} diff --git a/tests/pass/parse/array/slice_lower.leo b/tests/pass/parse/array/slice_lower.leo deleted file mode 100644 index 0af6fbd937..0000000000 --- a/tests/pass/parse/array/slice_lower.leo +++ /dev/null @@ -1,8 +0,0 @@ -function main() { - const arr: [u32; 9] = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - const expected: [u32; 2] = [0, 1]; - - const actual = arr[..2]; // Should produce [0, 1] - - console.assert(expected == actual); -} \ No newline at end of file diff --git a/tests/pass/parse/array/spread.leo b/tests/pass/parse/array/spread.leo deleted file mode 100644 index 8bd2861aae..0000000000 --- a/tests/pass/parse/array/spread.leo +++ /dev/null @@ -1,7 +0,0 @@ -// A spread operator `...` copies the elements of one array into another -function main(a: [u8; 3]) { - const b = [1u8, 1u8]; - const c = [1u8, ...b]; - - console.assert(a == c); -} \ No newline at end of file diff --git a/tests/pass/parse/array/tuple_3x2_value.leo b/tests/pass/parse/array/tuple_3x2_value.leo deleted file mode 100644 index b6659539d5..0000000000 --- a/tests/pass/parse/array/tuple_3x2_value.leo +++ /dev/null @@ -1,8 +0,0 @@ -// Multidimensional array syntax in leo -function main() { - const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline - - const b: [u32; (3, 2)] = [0; (3, 2)]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/tuple_3x2_value_fail.leo b/tests/pass/parse/array/tuple_3x2_value_fail.leo deleted file mode 100644 index 78593ab696..0000000000 --- a/tests/pass/parse/array/tuple_3x2_value_fail.leo +++ /dev/null @@ -1,4 +0,0 @@ -// Multidimensional array syntax in leo -function main() { - const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) -} diff --git a/tests/pass/parse/array/type_input_3x2.leo b/tests/pass/parse/array/type_input_3x2.leo deleted file mode 100644 index ea60a0cc24..0000000000 --- a/tests/pass/parse/array/type_input_3x2.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(a: [[u8; 2]; 3]) { - const b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_input_4x3x2.leo b/tests/pass/parse/array/type_input_4x3x2.leo deleted file mode 100644 index 2d9c4cff22..0000000000 --- a/tests/pass/parse/array/type_input_4x3x2.leo +++ /dev/null @@ -1,8 +0,0 @@ -function main(a: [[[u8; 2]; 3]; 4]) { - const b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_nested_3x2.leo b/tests/pass/parse/array/type_nested_value_nested_3x2.leo deleted file mode 100644 index bcf5bae674..0000000000 --- a/tests/pass/parse/array/type_nested_value_nested_3x2.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - - const b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_nested_3x2_fail.leo b/tests/pass/parse/array/type_nested_value_nested_3x2_fail.leo deleted file mode 100644 index 56c8916fb0..0000000000 --- a/tests/pass/parse/array/type_nested_value_nested_3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_nested_4x3x2.leo b/tests/pass/parse/array/type_nested_value_nested_4x3x2.leo deleted file mode 100644 index 1691fa26c7..0000000000 --- a/tests/pass/parse/array/type_nested_value_nested_4x3x2.leo +++ /dev/null @@ -1,10 +0,0 @@ -function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - - const b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_nested_4x3x2_fail.leo b/tests/pass/parse/array/type_nested_value_nested_4x3x2_fail.leo deleted file mode 100644 index 480327a91d..0000000000 --- a/tests/pass/parse/array/type_nested_value_nested_4x3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_tuple_3x2.leo b/tests/pass/parse/array/type_nested_value_tuple_3x2.leo deleted file mode 100644 index 5f14084d55..0000000000 --- a/tests/pass/parse/array/type_nested_value_tuple_3x2.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - - const b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_tuple_3x2_fail.leo b/tests/pass/parse/array/type_nested_value_tuple_3x2_fail.leo deleted file mode 100644 index 3bfb559615..0000000000 --- a/tests/pass/parse/array/type_nested_value_tuple_3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_tuple_4x3x2.leo b/tests/pass/parse/array/type_nested_value_tuple_4x3x2.leo deleted file mode 100644 index 88a5143bd2..0000000000 --- a/tests/pass/parse/array/type_nested_value_tuple_4x3x2.leo +++ /dev/null @@ -1,10 +0,0 @@ -function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - - const b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_nested_value_tuple_4x3x2_fail.leo b/tests/pass/parse/array/type_nested_value_tuple_4x3x2_fail.leo deleted file mode 100644 index ce1219a37b..0000000000 --- a/tests/pass/parse/array/type_nested_value_tuple_4x3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_nested_3x2.leo b/tests/pass/parse/array/type_tuple_value_nested_3x2.leo deleted file mode 100644 index 81195e03a1..0000000000 --- a/tests/pass/parse/array/type_tuple_value_nested_3x2.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - - const b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_nested_3x2_fail.leo b/tests/pass/parse/array/type_tuple_value_nested_3x2_fail.leo deleted file mode 100644 index e84f025a9f..0000000000 --- a/tests/pass/parse/array/type_tuple_value_nested_3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_nested_4x3x2.leo b/tests/pass/parse/array/type_tuple_value_nested_4x3x2.leo deleted file mode 100644 index 322a6f7601..0000000000 --- a/tests/pass/parse/array/type_tuple_value_nested_4x3x2.leo +++ /dev/null @@ -1,10 +0,0 @@ -function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - - const b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_nested_4x3x2_fail.leo b/tests/pass/parse/array/type_tuple_value_nested_4x3x2_fail.leo deleted file mode 100644 index cbb7ccbf76..0000000000 --- a/tests/pass/parse/array/type_tuple_value_nested_4x3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_tuple_3x2.leo b/tests/pass/parse/array/type_tuple_value_tuple_3x2.leo deleted file mode 100644 index d451a9c1a8..0000000000 --- a/tests/pass/parse/array/type_tuple_value_tuple_3x2.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main() { - const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline - - const b: [u8; (3, 2)] = [0; (3, 2)]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_tuple_3x2_fail.leo b/tests/pass/parse/array/type_tuple_value_tuple_3x2_fail.leo deleted file mode 100644 index 884a75db9d..0000000000 --- a/tests/pass/parse/array/type_tuple_value_tuple_3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering) -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_tuple_4x3x2.leo b/tests/pass/parse/array/type_tuple_value_tuple_4x3x2.leo deleted file mode 100644 index 1205b1dc9c..0000000000 --- a/tests/pass/parse/array/type_tuple_value_tuple_4x3x2.leo +++ /dev/null @@ -1,10 +0,0 @@ -function main() { - const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]], - [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline - - const b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer - - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/array/type_tuple_value_tuple_4x3x2_fail.leo b/tests/pass/parse/array/type_tuple_value_tuple_4x3x2_fail.leo deleted file mode 100644 index 31e2a5e552..0000000000 --- a/tests/pass/parse/array/type_tuple_value_tuple_4x3x2_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order) -} \ No newline at end of file diff --git a/tests/pass/parse/array/variable_slice_fail.leo b/tests/pass/parse/array/variable_slice_fail.leo deleted file mode 100644 index e79d64112f..0000000000 --- a/tests/pass/parse/array/variable_slice_fail.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main() { - const a = [1u8; 10]; - for i in 0..10 { - const x = a[i..10]; - console.debug("{}", x); - } -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/all.leo b/tests/pass/parse/boolean/all.leo deleted file mode 100644 index 64fe8a795a..0000000000 --- a/tests/pass/parse/boolean/all.leo +++ /dev/null @@ -1,8 +0,0 @@ -// !(true && (false || true)) -function main() { - const a = true; - const b = false || a; - const c = !(true && b); - - console.assert(c == false); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/assert_eq_input.leo b/tests/pass/parse/boolean/assert_eq_input.leo deleted file mode 100644 index 8a796e5bbd..0000000000 --- a/tests/pass/parse/boolean/assert_eq_input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: bool, b: bool) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/conditional_mut.leo b/tests/pass/parse/boolean/conditional_mut.leo deleted file mode 100644 index cebf82ab00..0000000000 --- a/tests/pass/parse/boolean/conditional_mut.leo +++ /dev/null @@ -1,6 +0,0 @@ -function main () { - let x = true; - if x { - const y = 0u8; - } -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/false_and_false.leo b/tests/pass/parse/boolean/false_and_false.leo deleted file mode 100644 index 03dfabab4d..0000000000 --- a/tests/pass/parse/boolean/false_and_false.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = false && false; - - console.assert(a == false); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/false_or_false.leo b/tests/pass/parse/boolean/false_or_false.leo deleted file mode 100644 index 7ea710802c..0000000000 --- a/tests/pass/parse/boolean/false_or_false.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = false || false; - - console.assert(a == false); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/not_false.leo b/tests/pass/parse/boolean/not_false.leo deleted file mode 100644 index 796b616871..0000000000 --- a/tests/pass/parse/boolean/not_false.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.assert(!false == true); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/not_mutable.leo b/tests/pass/parse/boolean/not_mutable.leo deleted file mode 100644 index c621647ff9..0000000000 --- a/tests/pass/parse/boolean/not_mutable.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main () { - let b = false; - const a = !b; -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/not_true.leo b/tests/pass/parse/boolean/not_true.leo deleted file mode 100644 index 8c87dffabb..0000000000 --- a/tests/pass/parse/boolean/not_true.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.assert(!true == false); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/not_u32.leo b/tests/pass/parse/boolean/not_u32.leo deleted file mode 100644 index 44491d785b..0000000000 --- a/tests/pass/parse/boolean/not_u32.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() -> bool { - console.assert(!1u32 == 0u32); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/output_register.leo b/tests/pass/parse/boolean/output_register.leo deleted file mode 100644 index fb01d41dbe..0000000000 --- a/tests/pass/parse/boolean/output_register.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(input) -> bool { - return input.registers.r -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/true_and_false.leo b/tests/pass/parse/boolean/true_and_false.leo deleted file mode 100644 index 336dde7558..0000000000 --- a/tests/pass/parse/boolean/true_and_false.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = true && false; - - console.assert(a == false); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/true_and_true.leo b/tests/pass/parse/boolean/true_and_true.leo deleted file mode 100644 index dae445dcf8..0000000000 --- a/tests/pass/parse/boolean/true_and_true.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = true && true; - - console.assert(a == true); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/true_and_u32.leo b/tests/pass/parse/boolean/true_and_u32.leo deleted file mode 100644 index ad3ead9040..0000000000 --- a/tests/pass/parse/boolean/true_and_u32.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a = true && 1u32; -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/true_or_false.leo b/tests/pass/parse/boolean/true_or_false.leo deleted file mode 100644 index 216e473cdb..0000000000 --- a/tests/pass/parse/boolean/true_or_false.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = true || false; - - console.assert(a == true); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/true_or_true.leo b/tests/pass/parse/boolean/true_or_true.leo deleted file mode 100644 index fea8628b9f..0000000000 --- a/tests/pass/parse/boolean/true_or_true.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = true || true; - - console.assert(a == true); -} \ No newline at end of file diff --git a/tests/pass/parse/boolean/true_or_u32.leo b/tests/pass/parse/boolean/true_or_u32.leo deleted file mode 100644 index 38dab727b9..0000000000 --- a/tests/pass/parse/boolean/true_or_u32.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a = true || 1u32; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/define_circuit_inside_circuit_function.leo b/tests/pass/parse/circuits/define_circuit_inside_circuit_function.leo deleted file mode 100644 index cedabf2185..0000000000 --- a/tests/pass/parse/circuits/define_circuit_inside_circuit_function.leo +++ /dev/null @@ -1,13 +0,0 @@ -circuit Foo { - a: u32, -} - -circuit Bar { - function bar() { - const f = Foo { a: 0u32 }; - } -} - -function main() { - const b = Bar::bar(); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/duplicate_name_context.leo b/tests/pass/parse/circuits/duplicate_name_context.leo deleted file mode 100644 index 66640e75a2..0000000000 --- a/tests/pass/parse/circuits/duplicate_name_context.leo +++ /dev/null @@ -1,13 +0,0 @@ -circuit Bar { - b2: u32 - - function add_five(z:u32) -> u32 { - return z+5u32 - } -} - -function main () { - const Bar = 66u32; - const k1 = Bar{ b2: 30u32 }; - const k2 = Bar::add_five(55u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/inline.leo b/tests/pass/parse/circuits/inline.leo deleted file mode 100644 index 9ba06f4191..0000000000 --- a/tests/pass/parse/circuits/inline.leo +++ /dev/null @@ -1,7 +0,0 @@ -circuit Foo { - x: u32 -} - -function main() { - const a = Foo { x: 1u32 }; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/inline_fail.leo b/tests/pass/parse/circuits/inline_fail.leo deleted file mode 100644 index 01597005fb..0000000000 --- a/tests/pass/parse/circuits/inline_fail.leo +++ /dev/null @@ -1,7 +0,0 @@ -circuit Foo { - x: u32 -} - -function main() { - const a = Foo { y: 0u32 }; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/inline_member_fail.leo b/tests/pass/parse/circuits/inline_member_fail.leo deleted file mode 100644 index 59f6d7992b..0000000000 --- a/tests/pass/parse/circuits/inline_member_fail.leo +++ /dev/null @@ -1,8 +0,0 @@ -circuit Foo { - x: u8 -} - -function main() { - const y: u8 = 1; - const a = Foo { y }; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/inline_member_pass.leo b/tests/pass/parse/circuits/inline_member_pass.leo deleted file mode 100644 index 8e58e4935a..0000000000 --- a/tests/pass/parse/circuits/inline_member_pass.leo +++ /dev/null @@ -1,13 +0,0 @@ -circuit Foo { - x: u8 - - function new(x: u8) -> Self { - return Self { x } - } -} - -function main() { - const x: u8 = 1; - const a = Foo { x }; - const b = Foo::new(x); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/inline_undefined.leo b/tests/pass/parse/circuits/inline_undefined.leo deleted file mode 100644 index 40c4cf722c..0000000000 --- a/tests/pass/parse/circuits/inline_undefined.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a = Foo { }; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_function.leo b/tests/pass/parse/circuits/member_function.leo deleted file mode 100644 index 258b6c675e..0000000000 --- a/tests/pass/parse/circuits/member_function.leo +++ /dev/null @@ -1,13 +0,0 @@ -circuit Foo { - x: u32, - - function echo(self) -> u32 { - return self.x - } -} - -function main() { - const a = Foo { x: 1u32 }; - - console.assert(a.echo() == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_function_fail.leo b/tests/pass/parse/circuits/member_function_fail.leo deleted file mode 100644 index 5a1c4100c5..0000000000 --- a/tests/pass/parse/circuits/member_function_fail.leo +++ /dev/null @@ -1,10 +0,0 @@ -circuit Foo { - function echo(x: u32) -> u32 { - return x - } -} - -function main() { - const a = Foo { }; - const err = a.echoed(1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_function_invalid.leo b/tests/pass/parse/circuits/member_function_invalid.leo deleted file mode 100644 index aa689eb976..0000000000 --- a/tests/pass/parse/circuits/member_function_invalid.leo +++ /dev/null @@ -1,10 +0,0 @@ -circuit Foo { - function echo(x: u32) -> u32 { - return x - } -} - -function main() { - const a = Foo { }; - const err = a.echo(1u32); // echo is a static function and must be accessed using `::` -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_function_nested.leo b/tests/pass/parse/circuits/member_function_nested.leo deleted file mode 100644 index e512c9df52..0000000000 --- a/tests/pass/parse/circuits/member_function_nested.leo +++ /dev/null @@ -1,18 +0,0 @@ -circuit Foo { - x: u32, - - function add_x(self, y: u32) -> u32 { - return self.x + y - } - - function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) - } -} - -function main() { - const a = Foo { x: 1u32 }; - const b = a.add_x(1u32); - - console.assert(b == 2u32); -} diff --git a/tests/pass/parse/circuits/member_static_function.leo b/tests/pass/parse/circuits/member_static_function.leo deleted file mode 100644 index 9d53314f27..0000000000 --- a/tests/pass/parse/circuits/member_static_function.leo +++ /dev/null @@ -1,11 +0,0 @@ -circuit Foo { - function echo(x: u32) -> u32 { - return x - } -} - -function main() { - const a = Foo::echo(1u32); - - console.assert(a == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_static_function_invalid.leo b/tests/pass/parse/circuits/member_static_function_invalid.leo deleted file mode 100644 index 7829b4b430..0000000000 --- a/tests/pass/parse/circuits/member_static_function_invalid.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - function echo(x: u32) -> u32 { - return x - } -} - -function main() { - const err = Foo.echo(1u32); // Invalid, echo is a static function and must be accessed using `::` -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_static_function_nested.leo b/tests/pass/parse/circuits/member_static_function_nested.leo deleted file mode 100644 index ef536e3f6e..0000000000 --- a/tests/pass/parse/circuits/member_static_function_nested.leo +++ /dev/null @@ -1,15 +0,0 @@ -circuit Foo { - function qux() {} - - function bar() { - Self::qux(); - } - - function baz() { - Self::bar(); - } -} - -function main() { - Foo::baz(); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_static_function_undefined.leo b/tests/pass/parse/circuits/member_static_function_undefined.leo deleted file mode 100644 index ece1d00963..0000000000 --- a/tests/pass/parse/circuits/member_static_function_undefined.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - function echo(x: u32) -> u32 { - return x - } -} - -function main() { - const err = Foo::echoed(1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_variable.leo b/tests/pass/parse/circuits/member_variable.leo deleted file mode 100644 index a3f3fbe7e6..0000000000 --- a/tests/pass/parse/circuits/member_variable.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - x: u32, -} - -function main() { - const a = Foo { x: 1u32 }; - - console.assert(a.x == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/member_variable_and_function.leo b/tests/pass/parse/circuits/member_variable_and_function.leo deleted file mode 100644 index 3b90db7eaa..0000000000 --- a/tests/pass/parse/circuits/member_variable_and_function.leo +++ /dev/null @@ -1,15 +0,0 @@ -circuit Foo { - foo: u32, - - function bar() -> u32 { - return 1u32 - } -} - -function main() { - const a = Foo { foo: 1 }; - - const b = a.foo + Foo::bar(); - - console.assert(b == 2u32); -} diff --git a/tests/pass/parse/circuits/member_variable_fail.leo b/tests/pass/parse/circuits/member_variable_fail.leo deleted file mode 100644 index fdf42068d5..0000000000 --- a/tests/pass/parse/circuits/member_variable_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - x: u32 -} - -function main() { - const a = Foo { x: 1u32 }; - - const err = a.y; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_function_fail.leo b/tests/pass/parse/circuits/mut_function_fail.leo deleted file mode 100644 index 1b87e2bfb1..0000000000 --- a/tests/pass/parse/circuits/mut_function_fail.leo +++ /dev/null @@ -1,11 +0,0 @@ -circuit Foo { - a: u8, - - function bar() {} -} - -function main() { - let f = Foo { a: 0u8 }; - - f.bar = 1u8; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_self_function_fail.leo b/tests/pass/parse/circuits/mut_self_function_fail.leo deleted file mode 100644 index 58c8088ba1..0000000000 --- a/tests/pass/parse/circuits/mut_self_function_fail.leo +++ /dev/null @@ -1,15 +0,0 @@ -circuit Foo { - a: u8, - - function bar() {} - - function set_a(mut self, new: u8) { - self.bar = new; - } -} - -function main() { - let f = Foo { a: 0u8 }; - - f.set_a(1u8); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_self_static_function_fail.leo b/tests/pass/parse/circuits/mut_self_static_function_fail.leo deleted file mode 100644 index 58c8088ba1..0000000000 --- a/tests/pass/parse/circuits/mut_self_static_function_fail.leo +++ /dev/null @@ -1,15 +0,0 @@ -circuit Foo { - a: u8, - - function bar() {} - - function set_a(mut self, new: u8) { - self.bar = new; - } -} - -function main() { - let f = Foo { a: 0u8 }; - - f.set_a(1u8); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_self_variable.leo b/tests/pass/parse/circuits/mut_self_variable.leo deleted file mode 100644 index 92bcca0050..0000000000 --- a/tests/pass/parse/circuits/mut_self_variable.leo +++ /dev/null @@ -1,22 +0,0 @@ -circuit Foo { - a: u8, - - function set_a(mut self, new: u8) { - self.a = new; - console.assert(self.a == new); - } -} - -function main() { - let f = Foo { a: 0u8 }; - - console.assert(f.a == 0u8); - - f.set_a(1u8); - - console.assert(f.a == 1u8); - - f.set_a(2u8); - - console.assert(f.a == 2u8); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_self_variable_branch.leo b/tests/pass/parse/circuits/mut_self_variable_branch.leo deleted file mode 100644 index 0c5b8f40a4..0000000000 --- a/tests/pass/parse/circuits/mut_self_variable_branch.leo +++ /dev/null @@ -1,32 +0,0 @@ -circuit Foo { - a: u8, - - function set_a(mut self, condition: bool, new: u8) { - if condition { - self.a = new; - console.assert(self.a == new); - } - } -} - -function main() { - let f = Foo { a: 0u8 }; - - console.assert(f.a == 0u8); - - f.set_a(false, 1u8); - - console.assert(f.a == 0u8); - - f.set_a(true, 1u8); - - console.assert(f.a == 1u8); - - f.set_a(false, 2u8); - - console.assert(f.a == 1u8); - - f.set_a(true, 2u8); - - console.assert(f.a == 2u8); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_self_variable_conditional.leo b/tests/pass/parse/circuits/mut_self_variable_conditional.leo deleted file mode 100644 index 61a5e354dc..0000000000 --- a/tests/pass/parse/circuits/mut_self_variable_conditional.leo +++ /dev/null @@ -1,15 +0,0 @@ -function main() { - let f = Foo { a: 0u32 }; - - f.bar(); -} - -circuit Foo { - a: u32 - - function bar(mut self) { - if true { - self.a = 5u32; // Mutating a variable inside a conditional statement should work. - } - } -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_self_variable_fail.leo b/tests/pass/parse/circuits/mut_self_variable_fail.leo deleted file mode 100644 index 4db62a4d3e..0000000000 --- a/tests/pass/parse/circuits/mut_self_variable_fail.leo +++ /dev/null @@ -1,13 +0,0 @@ -circuit Foo { - a: u8, - - function set_a(self, new: u8) { - self.a = new; - } -} - -function main() { - let f = Foo { a: 0u8 }; - - f.set_a(1u8); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_static_function_fail.leo b/tests/pass/parse/circuits/mut_static_function_fail.leo deleted file mode 100644 index fd873bd17b..0000000000 --- a/tests/pass/parse/circuits/mut_static_function_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - function bar() {} -} - -function main() { - let f = Foo { a: 0u8 }; - - f.bar = 1u8; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_variable.leo b/tests/pass/parse/circuits/mut_variable.leo deleted file mode 100644 index 151babb1cd..0000000000 --- a/tests/pass/parse/circuits/mut_variable.leo +++ /dev/null @@ -1,17 +0,0 @@ -circuit Foo { - a: u8, -} - -function main() { - let f = Foo { a: 0u8 }; - - console.assert(f.a == 0u8); - - f.a = 1u8; - - console.assert(f.a == 1u8); - - f.a = 2u8; - - console.assert(f.a == 2u8); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/mut_variable_fail.leo b/tests/pass/parse/circuits/mut_variable_fail.leo deleted file mode 100644 index 7ba4193074..0000000000 --- a/tests/pass/parse/circuits/mut_variable_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -circuit Foo { - a: u8, -} - -function main() { - const f = Foo { a: 0u8 }; - - f.a = 1u8; -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/pedersen_mock.leo b/tests/pass/parse/circuits/pedersen_mock.leo deleted file mode 100644 index 4abef65caa..0000000000 --- a/tests/pass/parse/circuits/pedersen_mock.leo +++ /dev/null @@ -1,27 +0,0 @@ -circuit PedersenHash { - parameters: [u32; 512] - - function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } - } - - function hash(self, bits: [bool; 512]) -> u32 { - let digest: u32 = 0; - for i in 0..512 { - const base = bits[i] ? self.parameters[i] : 0u32; - digest += base; - } - return digest - } -} - -// The 'pedersen_hash' main function. -function main() { - const parameters = [0u32; 512]; - const pedersen = PedersenHash::new(parameters); - const hash_input: [bool; 512] = [true; 512]; - - const res = pedersen.hash(hash_input); - - console.assert(res == 0u32); -} diff --git a/tests/pass/parse/circuits/self_fail.leo b/tests/pass/parse/circuits/self_fail.leo deleted file mode 100644 index e4e878dc89..0000000000 --- a/tests/pass/parse/circuits/self_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - Self::main(); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/self_member.leo b/tests/pass/parse/circuits/self_member.leo deleted file mode 100644 index 2b3401a228..0000000000 --- a/tests/pass/parse/circuits/self_member.leo +++ /dev/null @@ -1,14 +0,0 @@ -circuit Foo { - f: u32, - - function bar(self) -> u32 { - return self.f - } -} - -function main() { - const a = Foo { f: 1u32 }; - const b = a.bar(); - - console.assert(b == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/self_member_invalid.leo b/tests/pass/parse/circuits/self_member_invalid.leo deleted file mode 100644 index 163499d619..0000000000 --- a/tests/pass/parse/circuits/self_member_invalid.leo +++ /dev/null @@ -1,12 +0,0 @@ -circuit Foo { - f: u32, - - function bar() -> u32 { - return f - } -} - -function main() -> u32 { - const foo = Foo { f: 1u32 }; - const err = foo.bar(); -} \ No newline at end of file diff --git a/tests/pass/parse/circuits/self_member_undefined.leo b/tests/pass/parse/circuits/self_member_undefined.leo deleted file mode 100644 index 05a40905d7..0000000000 --- a/tests/pass/parse/circuits/self_member_undefined.leo +++ /dev/null @@ -1,10 +0,0 @@ -circuit Foo { - function bar() -> u32 { - return self.f - } -} - -function main() { - const foo = Foo { }; - const err = foo.bar(); -} \ No newline at end of file diff --git a/tests/pass/parse/compiler/main.leo b/tests/pass/parse/compiler/main.leo deleted file mode 100644 index ed25576751..0000000000 --- a/tests/pass/parse/compiler/main.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u32 = 1 + 2; -} \ No newline at end of file diff --git a/tests/pass/parse/console/assert.leo b/tests/pass/parse/console/assert.leo deleted file mode 100644 index ba6be77256..0000000000 --- a/tests/pass/parse/console/assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: bool) { - console.assert(a == true); -} \ No newline at end of file diff --git a/tests/pass/parse/console/conditional_assert.leo b/tests/pass/parse/console/conditional_assert.leo deleted file mode 100644 index f2c1591e9c..0000000000 --- a/tests/pass/parse/console/conditional_assert.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main(a: bool) { - if a { - console.assert(a == true); - } else { - console.assert(a == false); - } -} \ No newline at end of file diff --git a/tests/pass/parse/console/debug.leo b/tests/pass/parse/console/debug.leo deleted file mode 100644 index 54e6eb539f..0000000000 --- a/tests/pass/parse/console/debug.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.debug("hello debug"); -} \ No newline at end of file diff --git a/tests/pass/parse/console/error.leo b/tests/pass/parse/console/error.leo deleted file mode 100644 index 86d13f8cee..0000000000 --- a/tests/pass/parse/console/error.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.error("hello error"); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log.leo b/tests/pass/parse/console/log.leo deleted file mode 100644 index a190ca4ba9..0000000000 --- a/tests/pass/parse/console/log.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log("hello world"); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_conditional.leo b/tests/pass/parse/console/log_conditional.leo deleted file mode 100644 index a9fdb6e698..0000000000 --- a/tests/pass/parse/console/log_conditional.leo +++ /dev/null @@ -1,6 +0,0 @@ -// Conditionally add two u32 integers and log the result to the console. -function main(a: u32, b: u32) { - if a == b { - console.log("{}=={}",a,b); // This line should not fail. - } -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_input.leo b/tests/pass/parse/console/log_input.leo deleted file mode 100644 index c4fd0a8b12..0000000000 --- a/tests/pass/parse/console/log_input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: bool) { - console.log("a = {}", a); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_parameter.leo b/tests/pass/parse/console/log_parameter.leo deleted file mode 100644 index ebcb931a2b..0000000000 --- a/tests/pass/parse/console/log_parameter.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log("{}", 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_parameter_fail_empty.leo b/tests/pass/parse/console/log_parameter_fail_empty.leo deleted file mode 100644 index 81b42c0919..0000000000 --- a/tests/pass/parse/console/log_parameter_fail_empty.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log("{}"); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_parameter_fail_none.leo b/tests/pass/parse/console/log_parameter_fail_none.leo deleted file mode 100644 index c92fdfbb2d..0000000000 --- a/tests/pass/parse/console/log_parameter_fail_none.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log("", 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_parameter_fail_unknown.leo b/tests/pass/parse/console/log_parameter_fail_unknown.leo deleted file mode 100644 index 757f4c27c3..0000000000 --- a/tests/pass/parse/console/log_parameter_fail_unknown.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log("{}", a); -} \ No newline at end of file diff --git a/tests/pass/parse/console/log_parameter_many.leo b/tests/pass/parse/console/log_parameter_many.leo deleted file mode 100644 index 60455ebbb0..0000000000 --- a/tests/pass/parse/console/log_parameter_many.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - console.log("{} {}", 1u32, true); -} \ No newline at end of file diff --git a/tests/pass/parse/core/arguments_length_fail.leo b/tests/pass/parse/core/arguments_length_fail.leo deleted file mode 100644 index 614490432d..0000000000 --- a/tests/pass/parse/core/arguments_length_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -import core.unstable.blake2s.Blake2s; - -function main() { - const seed: [u8; 32] = [0; 32]; - - const result = Blake2s::hash(seed); // function `hash` takes 2 arguments - - console.log("Result: {}", result); -} diff --git a/tests/pass/parse/core/arguments_type_fail.leo b/tests/pass/parse/core/arguments_type_fail.leo deleted file mode 100644 index f80e7b0205..0000000000 --- a/tests/pass/parse/core/arguments_type_fail.leo +++ /dev/null @@ -1,10 +0,0 @@ -import core.unstable.blake2s.Blake2s; - -function main() { - const seed: [u8; 32] = [0; 32]; - const message: [u16; 32] = [0; 32]; // message should be type [u8; 32] - - const result = Blake2s::hash(seed, message); - - console.log("Result: {}", result); -} diff --git a/tests/pass/parse/core/blake2s_input.leo b/tests/pass/parse/core/blake2s_input.leo deleted file mode 100644 index 6044795c3d..0000000000 --- a/tests/pass/parse/core/blake2s_input.leo +++ /dev/null @@ -1,5 +0,0 @@ -import core.unstable.blake2s.Blake2s; - -function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) -} diff --git a/tests/pass/parse/core/blake2s_random.leo b/tests/pass/parse/core/blake2s_random.leo deleted file mode 100644 index c9592fcbf8..0000000000 --- a/tests/pass/parse/core/blake2s_random.leo +++ /dev/null @@ -1,7 +0,0 @@ -import core.unstable.blake2s.Blake2s; - -function main(seed: [u8; 32], message: [u8; 32], expected: [u8; 32]) { - const actual = Blake2s::hash(seed, message); - - console.assert(expected == actual); -} diff --git a/tests/pass/parse/core/core_circuit_invalid.leo b/tests/pass/parse/core/core_circuit_invalid.leo deleted file mode 100644 index 4a42bda032..0000000000 --- a/tests/pass/parse/core/core_circuit_invalid.leo +++ /dev/null @@ -1,3 +0,0 @@ -import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package - -function main() {} diff --git a/tests/pass/parse/core/core_circuit_star_fail.leo b/tests/pass/parse/core/core_circuit_star_fail.leo deleted file mode 100644 index 14b54b0d69..0000000000 --- a/tests/pass/parse/core/core_circuit_star_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -import core.*; // You cannot import all dependencies from core at once - -function main() {} diff --git a/tests/pass/parse/core/core_package_invalid.leo b/tests/pass/parse/core/core_package_invalid.leo deleted file mode 100644 index 7cbcf93ecc..0000000000 --- a/tests/pass/parse/core/core_package_invalid.leo +++ /dev/null @@ -1,3 +0,0 @@ -import core.bad_circuit; // `bad_circuit` is not a core package - -function main() {} diff --git a/tests/pass/parse/core/core_unstable_package_invalid.leo b/tests/pass/parse/core/core_unstable_package_invalid.leo deleted file mode 100644 index 35e6c0d1ba..0000000000 --- a/tests/pass/parse/core/core_unstable_package_invalid.leo +++ /dev/null @@ -1,3 +0,0 @@ -import core.unstable.bad_circuit; // `bad_circuit` is not a core unstable package - -function main() {} diff --git a/tests/pass/parse/core/unstable_blake2s.leo b/tests/pass/parse/core/unstable_blake2s.leo deleted file mode 100644 index c430d9a837..0000000000 --- a/tests/pass/parse/core/unstable_blake2s.leo +++ /dev/null @@ -1,10 +0,0 @@ -import core.unstable.blake2s.Blake2s; - -function main() { - const seed: [u8; 32] = [0; 32]; - const message: [u8; 32] = [0; 32]; - - const result = Blake2s::hash(seed, message); - - console.log("Result: {}", result); -} diff --git a/tests/pass/parse/definition/out_of_order.leo b/tests/pass/parse/definition/out_of_order.leo deleted file mode 100644 index 69d46d0e74..0000000000 --- a/tests/pass/parse/definition/out_of_order.leo +++ /dev/null @@ -1,6 +0,0 @@ -@test -function fake_test() {} - -function main() {} - -circuit Foo {} \ No newline at end of file diff --git a/tests/pass/parse/definition/out_of_order_with_import.leo b/tests/pass/parse/definition/out_of_order_with_import.leo deleted file mode 100644 index daf92fdecb..0000000000 --- a/tests/pass/parse/definition/out_of_order_with_import.leo +++ /dev/null @@ -1,7 +0,0 @@ -@test function fake_test() {} - -function main() {} - -import test_import.foo; - -circuit Foo {} \ No newline at end of file diff --git a/tests/pass/parse/field/add.leo b/tests/pass/parse/field/add.leo deleted file mode 100644 index 8dc2c7df4e..0000000000 --- a/tests/pass/parse/field/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field, c: field) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/field/console_assert.leo b/tests/pass/parse/field/console_assert.leo deleted file mode 100644 index c7224bcea5..0000000000 --- a/tests/pass/parse/field/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/field/div.leo b/tests/pass/parse/field/div.leo deleted file mode 100644 index 028b06fad2..0000000000 --- a/tests/pass/parse/field/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field, c: field) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/field/eq.leo b/tests/pass/parse/field/eq.leo deleted file mode 100644 index e64307d8de..0000000000 --- a/tests/pass/parse/field/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/field/field.leo b/tests/pass/parse/field/field.leo deleted file mode 100644 index 5d5732e906..0000000000 --- a/tests/pass/parse/field/field.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const negOneField: field = -1field; - const oneField = 1field; -} \ No newline at end of file diff --git a/tests/pass/parse/field/mul.leo b/tests/pass/parse/field/mul.leo deleted file mode 100644 index 7df7c83830..0000000000 --- a/tests/pass/parse/field/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field, c: field) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/field/negate.leo b/tests/pass/parse/field/negate.leo deleted file mode 100644 index 94c730207a..0000000000 --- a/tests/pass/parse/field/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/field/sub.leo b/tests/pass/parse/field/sub.leo deleted file mode 100644 index 2c84b24647..0000000000 --- a/tests/pass/parse/field/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: field, b: field, c: field) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/field/ternary.leo b/tests/pass/parse/field/ternary.leo deleted file mode 100644 index 05cb161b46..0000000000 --- a/tests/pass/parse/field/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: field, b: field, c: field) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/function/array_input.leo b/tests/pass/parse/function/array_input.leo deleted file mode 100644 index 899c0e4af6..0000000000 --- a/tests/pass/parse/function/array_input.leo +++ /dev/null @@ -1,6 +0,0 @@ -function foo(a: [u8; 1]) {} - -function main() { - const a: [u16; 1] = [1; 1]; - foo(a); -} \ No newline at end of file diff --git a/tests/pass/parse/function/array_params_direct_call.leo b/tests/pass/parse/function/array_params_direct_call.leo deleted file mode 100644 index 8ded724bc4..0000000000 --- a/tests/pass/parse/function/array_params_direct_call.leo +++ /dev/null @@ -1,9 +0,0 @@ -function do_nothing(arr: [u32; 2]) {} - -function main() { - const arr: [u32; 2] = [0; 2]; - - do_nothing(arr); - do_nothing([...arr]); - do_nothing(arr[1u32..]); -} \ No newline at end of file diff --git a/tests/pass/parse/function/conditional_return.leo b/tests/pass/parse/function/conditional_return.leo deleted file mode 100644 index 7ecd0e625c..0000000000 --- a/tests/pass/parse/function/conditional_return.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main(x: u8) -> u8 { - if x == 2u8 { - return 3u8 - } else { - return 4u8 - } -} \ No newline at end of file diff --git a/tests/pass/parse/function/empty.leo b/tests/pass/parse/function/empty.leo deleted file mode 100644 index f06c976158..0000000000 --- a/tests/pass/parse/function/empty.leo +++ /dev/null @@ -1,5 +0,0 @@ -function empty() { } - -function main() { - empty(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/iteration.leo b/tests/pass/parse/function/iteration.leo deleted file mode 100644 index b1fcee6964..0000000000 --- a/tests/pass/parse/function/iteration.leo +++ /dev/null @@ -1,13 +0,0 @@ -function one() -> u32 { - return 1u32 -} - -function main() { - let a = 0u32; - - for i in 0..10 { - a += one(); - } - - console.assert(a == 10u32); -} \ No newline at end of file diff --git a/tests/pass/parse/function/iteration_repeated.leo b/tests/pass/parse/function/iteration_repeated.leo deleted file mode 100644 index d76380a6b5..0000000000 --- a/tests/pass/parse/function/iteration_repeated.leo +++ /dev/null @@ -1,15 +0,0 @@ -function iteration() -> u32 { - let a = 0u32; - - for i in 0..10 { - a += 1; - } - - return a -} - -function main() { - const total = iteration() + iteration(); - - console.assert(total == 20); -} \ No newline at end of file diff --git a/tests/pass/parse/function/multiple_returns.leo b/tests/pass/parse/function/multiple_returns.leo deleted file mode 100644 index d927c51976..0000000000 --- a/tests/pass/parse/function/multiple_returns.leo +++ /dev/null @@ -1,10 +0,0 @@ -function tuple() -> (bool, bool) { - return (true, false) -} - -function main() { - const (a, b) = tuple(); - - console.assert(a == true); - console.assert(b == false); -} \ No newline at end of file diff --git a/tests/pass/parse/function/multiple_returns_fail.leo b/tests/pass/parse/function/multiple_returns_fail.leo deleted file mode 100644 index d4a8b36eac..0000000000 --- a/tests/pass/parse/function/multiple_returns_fail.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main () -> i8 { - if true { - return 1i8 //ignored - } - return 2i8 //ignored - return 3i8 //returns -} \ No newline at end of file diff --git a/tests/pass/parse/function/multiple_returns_fail_conditional.leo b/tests/pass/parse/function/multiple_returns_fail_conditional.leo deleted file mode 100644 index 227fe5ce12..0000000000 --- a/tests/pass/parse/function/multiple_returns_fail_conditional.leo +++ /dev/null @@ -1,9 +0,0 @@ -function main () -> u16 { - if false { - const a = 1u16; - const b = a + 1u16; - return b - } else if false { - return 0u16 - } -} \ No newline at end of file diff --git a/tests/pass/parse/function/multiple_returns_main.leo b/tests/pass/parse/function/multiple_returns_main.leo deleted file mode 100644 index 0bc82e1e4b..0000000000 --- a/tests/pass/parse/function/multiple_returns_main.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(input) -> (bool, bool) { - return (input.registers.a, input.registers.b) -} \ No newline at end of file diff --git a/tests/pass/parse/function/newlines.leo b/tests/pass/parse/function/newlines.leo deleted file mode 100644 index 8c703f81d3..0000000000 --- a/tests/pass/parse/function/newlines.leo +++ /dev/null @@ -1,9 +0,0 @@ -function main( - a: u32, - b: u32, -) -> ( - u32, - u32, -) { - return (a, b) -} \ No newline at end of file diff --git a/tests/pass/parse/function/repeated.leo b/tests/pass/parse/function/repeated.leo deleted file mode 100644 index f83fa6098b..0000000000 --- a/tests/pass/parse/function/repeated.leo +++ /dev/null @@ -1,9 +0,0 @@ -function one() -> bool { - return true -} - -function main() { - const a = one() && one(); - - console.assert(a == true); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return.leo b/tests/pass/parse/function/return.leo deleted file mode 100644 index 10c7138977..0000000000 --- a/tests/pass/parse/function/return.leo +++ /dev/null @@ -1,7 +0,0 @@ -function one() -> u32 { - return 1u32 -} - -function main() { - console.assert(one() == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return_array_nested_fail.leo b/tests/pass/parse/function/return_array_nested_fail.leo deleted file mode 100644 index 8eca684b8a..0000000000 --- a/tests/pass/parse/function/return_array_nested_fail.leo +++ /dev/null @@ -1,7 +0,0 @@ -function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (2, 3)] // The correct 3x2 array tuple is `[0u8; (3, 2)]` -} - -function main() { - const b = array_3x2_tuple(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return_array_nested_pass.leo b/tests/pass/parse/function/return_array_nested_pass.leo deleted file mode 100644 index bfbfc8fd29..0000000000 --- a/tests/pass/parse/function/return_array_nested_pass.leo +++ /dev/null @@ -1,12 +0,0 @@ -function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] -} - -function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] -} - -function main() { - const a = array_3x2_nested(); - const b = array_3x2_tuple(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return_array_tuple_fail.leo b/tests/pass/parse/function/return_array_tuple_fail.leo deleted file mode 100644 index c960456ac1..0000000000 --- a/tests/pass/parse/function/return_array_tuple_fail.leo +++ /dev/null @@ -1,7 +0,0 @@ -function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 3]; 2] // The correct 3x2 nested array is `[0u8; 2]; 3]` -} - -function main() { - const a = array_3x2_nested(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return_array_tuple_pass.leo b/tests/pass/parse/function/return_array_tuple_pass.leo deleted file mode 100644 index 4199e31990..0000000000 --- a/tests/pass/parse/function/return_array_tuple_pass.leo +++ /dev/null @@ -1,12 +0,0 @@ -function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] -} - -function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] -} - -function main() { - const a = array_3x2_nested(); - const b = array_3x2_tuple(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return_tuple.leo b/tests/pass/parse/function/return_tuple.leo deleted file mode 100644 index a3b1bbc36a..0000000000 --- a/tests/pass/parse/function/return_tuple.leo +++ /dev/null @@ -1,11 +0,0 @@ -// Returns a tuple of tuples. -function tuples() -> ((u8, u8), u32) { - const a: (u8, u8) = (1, 2); - const b: u32 = 3; - - return (a, b) -} - -function main() { - const t = tuples(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/return_tuple_conditional.leo b/tests/pass/parse/function/return_tuple_conditional.leo deleted file mode 100644 index 839081b2a4..0000000000 --- a/tests/pass/parse/function/return_tuple_conditional.leo +++ /dev/null @@ -1,15 +0,0 @@ -// Returns a tuple using a conditional "if" statement. -function tuple_conditional () -> ( - i64, - i64 -) { - if true { - return (1, 1) - } else { - return (2, 2) - } -} - -function main() { - const t = tuple_conditional(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/scope_fail.leo b/tests/pass/parse/function/scope_fail.leo deleted file mode 100644 index 6f1d390541..0000000000 --- a/tests/pass/parse/function/scope_fail.leo +++ /dev/null @@ -1,8 +0,0 @@ -function foo() -> field { - return myGlobal -} - -function main() { - const myGlobal = 42field; - const err = foo(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/undefined.leo b/tests/pass/parse/function/undefined.leo deleted file mode 100644 index e1db3b9f09..0000000000 --- a/tests/pass/parse/function/undefined.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - my_function(); -} \ No newline at end of file diff --git a/tests/pass/parse/function/value_unchanged.leo b/tests/pass/parse/function/value_unchanged.leo deleted file mode 100644 index e116736316..0000000000 --- a/tests/pass/parse/function/value_unchanged.leo +++ /dev/null @@ -1,19 +0,0 @@ -// Functions input in leo are pass-by-value. -// -// Program execution: -// line 15: variable `a` is defined with value `1`. -// line 16: value `1` is copied and passed into function `bad_mutate()`. -// line 10: variable `x` is defined with value `1`. -// line 11: variable `x` is set to value `0`. -// line 18: program returns the value of `a`. - -function bad_mutate(x: u32) { - x = 0; // <- does not change `a` -} - -function main() { - const a = 1u32; - bad_mutate(a); - - console.assert(a == 1u32); // <- value `a` is still `1u32` -} \ No newline at end of file diff --git a/tests/pass/parse/group/add.leo b/tests/pass/parse/group/add.leo deleted file mode 100644 index bb84df2d6c..0000000000 --- a/tests/pass/parse/group/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group, b: group, c: group) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/group/assert_eq.leo b/tests/pass/parse/group/assert_eq.leo deleted file mode 100644 index 3886a07bbf..0000000000 --- a/tests/pass/parse/group/assert_eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group, b: group) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/group/both_sign_high.leo b/tests/pass/parse/group/both_sign_high.leo deleted file mode 100644 index 4c93573e1e..0000000000 --- a/tests/pass/parse/group/both_sign_high.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (+, +)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/both_sign_inferred.leo b/tests/pass/parse/group/both_sign_inferred.leo deleted file mode 100644 index 0bbd360ba0..0000000000 --- a/tests/pass/parse/group/both_sign_inferred.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (_, _)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/both_sign_low.leo b/tests/pass/parse/group/both_sign_low.leo deleted file mode 100644 index 1cb4f46c55..0000000000 --- a/tests/pass/parse/group/both_sign_low.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (-, -)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/eq.leo b/tests/pass/parse/group/eq.leo deleted file mode 100644 index 89701d9c99..0000000000 --- a/tests/pass/parse/group/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group, b: group, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/group/input.leo b/tests/pass/parse/group/input.leo deleted file mode 100644 index 3886a07bbf..0000000000 --- a/tests/pass/parse/group/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group, b: group) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/group/negate.leo b/tests/pass/parse/group/negate.leo deleted file mode 100644 index 506d8d73ce..0000000000 --- a/tests/pass/parse/group/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group, b: group) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/group/one.leo b/tests/pass/parse/group/one.leo deleted file mode 100644 index 510110150b..0000000000 --- a/tests/pass/parse/group/one.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = 1group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/point.leo b/tests/pass/parse/group/point.leo deleted file mode 100644 index 5e68415a0d..0000000000 --- a/tests/pass/parse/group/point.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/point_input.leo b/tests/pass/parse/group/point_input.leo deleted file mode 100644 index a3a8e63bd3..0000000000 --- a/tests/pass/parse/group/point_input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group) { - const b = a; -} \ No newline at end of file diff --git a/tests/pass/parse/group/positive_and_negative.leo b/tests/pass/parse/group/positive_and_negative.leo deleted file mode 100644 index 5d29e36ef2..0000000000 --- a/tests/pass/parse/group/positive_and_negative.leo +++ /dev/null @@ -1,10 +0,0 @@ -function main() { - const pos_element = 1group; - const neg_element = -1group; - - const pair_x_pos = (1, _)group; - const pair_x_neg = (-1, _)group; - - const pair_y_pos = (_, 1)group; - const pair_y_neg = (_, -1)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/sub.leo b/tests/pass/parse/group/sub.leo deleted file mode 100644 index dfe82d8e31..0000000000 --- a/tests/pass/parse/group/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: group, b: group, c: group) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/group/ternary.leo b/tests/pass/parse/group/ternary.leo deleted file mode 100644 index 97fba1f5b6..0000000000 --- a/tests/pass/parse/group/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: group, b: group, c: group) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/group/x_and_y.leo b/tests/pass/parse/group/x_and_y.leo deleted file mode 100644 index a350a7ad6b..0000000000 --- a/tests/pass/parse/group/x_and_y.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(element: group) { - const b = element; -} \ No newline at end of file diff --git a/tests/pass/parse/group/x_sign_high.leo b/tests/pass/parse/group/x_sign_high.leo deleted file mode 100644 index f38b54ad9a..0000000000 --- a/tests/pass/parse/group/x_sign_high.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (0, +)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/x_sign_inferred.leo b/tests/pass/parse/group/x_sign_inferred.leo deleted file mode 100644 index 02c5ac988b..0000000000 --- a/tests/pass/parse/group/x_sign_inferred.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (0, _)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/x_sign_low.leo b/tests/pass/parse/group/x_sign_low.leo deleted file mode 100644 index ad74d18b64..0000000000 --- a/tests/pass/parse/group/x_sign_low.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (0, -)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/y_sign_high.leo b/tests/pass/parse/group/y_sign_high.leo deleted file mode 100644 index af2a20149d..0000000000 --- a/tests/pass/parse/group/y_sign_high.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (+, 1)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/y_sign_inferred.leo b/tests/pass/parse/group/y_sign_inferred.leo deleted file mode 100644 index a4efa6a982..0000000000 --- a/tests/pass/parse/group/y_sign_inferred.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (_, 1)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/y_sign_low.leo b/tests/pass/parse/group/y_sign_low.leo deleted file mode 100644 index f557ed0d35..0000000000 --- a/tests/pass/parse/group/y_sign_low.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = (-, 1)group; -} \ No newline at end of file diff --git a/tests/pass/parse/group/zero.leo b/tests/pass/parse/group/zero.leo deleted file mode 100644 index 6cdd4c960e..0000000000 --- a/tests/pass/parse/group/zero.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const element = 0group; -} \ No newline at end of file diff --git a/tests/pass/parse/import/a-9.leo b/tests/pass/parse/import/a-9.leo deleted file mode 100644 index 8cd9f87f14..0000000000 --- a/tests/pass/parse/import/a-9.leo +++ /dev/null @@ -1 +0,0 @@ -function bar() {} \ No newline at end of file diff --git a/tests/pass/parse/import/a0-f.leo b/tests/pass/parse/import/a0-f.leo deleted file mode 100644 index c99ad3b713..0000000000 --- a/tests/pass/parse/import/a0-f.leo +++ /dev/null @@ -1 +0,0 @@ -function foo() {} \ No newline at end of file diff --git a/tests/pass/parse/import/alias.leo b/tests/pass/parse/import/alias.leo deleted file mode 100644 index f153b5a128..0000000000 --- a/tests/pass/parse/import/alias.leo +++ /dev/null @@ -1,5 +0,0 @@ -import test-import.foo as bar; - -function main() { - console.assert(bar() == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/import/basic.leo b/tests/pass/parse/import/basic.leo deleted file mode 100644 index 53d243efaa..0000000000 --- a/tests/pass/parse/import/basic.leo +++ /dev/null @@ -1,5 +0,0 @@ -import test-import.foo; - -function main() { - console.assert(foo() == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/import/bat.leo b/tests/pass/parse/import/bat.leo deleted file mode 100755 index a7d2fc83d4..0000000000 --- a/tests/pass/parse/import/bat.leo +++ /dev/null @@ -1,3 +0,0 @@ -circuit Bat { - t: u32 -} \ No newline at end of file diff --git a/tests/pass/parse/import/baz.leo b/tests/pass/parse/import/baz.leo deleted file mode 100755 index 1bb268a84c..0000000000 --- a/tests/pass/parse/import/baz.leo +++ /dev/null @@ -1,7 +0,0 @@ -circuit Baz { - z: u32 -} - -circuit Bazzar { - a: u32 -} \ No newline at end of file diff --git a/tests/pass/parse/import/hello-world.leo b/tests/pass/parse/import/hello-world.leo deleted file mode 100644 index 2d96e74c4c..0000000000 --- a/tests/pass/parse/import/hello-world.leo +++ /dev/null @@ -1 +0,0 @@ -function hello() {} \ No newline at end of file diff --git a/tests/pass/parse/import/lib.leo b/tests/pass/parse/import/lib.leo deleted file mode 100755 index c169f5935e..0000000000 --- a/tests/pass/parse/import/lib.leo +++ /dev/null @@ -1,3 +0,0 @@ -circuit Bar { - r: u32 -} \ No newline at end of file diff --git a/tests/pass/parse/import/many_import.leo b/tests/pass/parse/import/many_import.leo deleted file mode 100644 index 08ae494c4f..0000000000 --- a/tests/pass/parse/import/many_import.leo +++ /dev/null @@ -1,26 +0,0 @@ -import test-import.( // local import - Point, - foo, -); - -import bar.( // imports directory import - Bar, - baz.(Baz, Bazzar), - bat.bat.Bat, -); - -import car.Car; // imports directory import - -function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); - - const bar = Bar { r: 1u32 }; - const baz = Baz { z: 1u32 }; - const bazzar = Bazzar { a: 1u32 }; - const bat = Bat { t: 1u32 }; - - const car = Car { c: 1u32 }; - - console.assert(car.c == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/import/many_import_star.leo b/tests/pass/parse/import/many_import_star.leo deleted file mode 100644 index 575487a929..0000000000 --- a/tests/pass/parse/import/many_import_star.leo +++ /dev/null @@ -1,19 +0,0 @@ -import test-import.*; // local import - -import bar.*; // imports directory import -import bar.baz.*; // imports directory import -import bar.bat.bat.*; // imports directory import -import car.*; // imports directory import - -function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); - - const bar = Bar { r: 1u32 }; - const bat = Bat { t: 1u32 }; - const baz = Baz { z: 1u32 }; - - const car = Car { c: 1u32 }; - - console.assert(car.c == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/import/multiple.leo b/tests/pass/parse/import/multiple.leo deleted file mode 100644 index 4bd181c02d..0000000000 --- a/tests/pass/parse/import/multiple.leo +++ /dev/null @@ -1,10 +0,0 @@ -import test-import.( - Point, - foo -); - -function main() { - const a = Point { x: 1u32, y: 0u32 }; - - console.assert(a.x == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/import/names_underscore.leo b/tests/pass/parse/import/names_underscore.leo deleted file mode 100644 index c5822ebadd..0000000000 --- a/tests/pass/parse/import/names_underscore.leo +++ /dev/null @@ -1,3 +0,0 @@ -import hello_world.foo; - -function main() {} \ No newline at end of file diff --git a/tests/pass/parse/import/star.leo b/tests/pass/parse/import/star.leo deleted file mode 100644 index 69d0791627..0000000000 --- a/tests/pass/parse/import/star.leo +++ /dev/null @@ -1,7 +0,0 @@ -import test-import.*; - -function main() { - const a = Point { x: 1u32, y: 0u32 }; - - console.assert(foo() == 1u32); -} \ No newline at end of file diff --git a/tests/pass/parse/import/star_fail.leo b/tests/pass/parse/import/star_fail.leo deleted file mode 100644 index 47f2efeda7..0000000000 --- a/tests/pass/parse/import/star_fail.leo +++ /dev/null @@ -1,4 +0,0 @@ -// importing `*` from a directory is illegal -import bar.bat.*; - -function main() {} \ No newline at end of file diff --git a/tests/pass/parse/import/test-import.leo b/tests/pass/parse/import/test-import.leo deleted file mode 100644 index 6dd3e2c88a..0000000000 --- a/tests/pass/parse/import/test-import.leo +++ /dev/null @@ -1,8 +0,0 @@ -circuit Point { - x: u32 - y: u32 -} - -function foo() -> u32 { - return 1u32 -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/add.leo b/tests/pass/parse/integers/i128/add.leo deleted file mode 100644 index e35648f545..0000000000 --- a/tests/pass/parse/integers/i128/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: i128) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/console_assert.leo b/tests/pass/parse/integers/i128/console_assert.leo deleted file mode 100644 index c89021f609..0000000000 --- a/tests/pass/parse/integers/i128/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/div.leo b/tests/pass/parse/integers/i128/div.leo deleted file mode 100644 index ffaeae19a8..0000000000 --- a/tests/pass/parse/integers/i128/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: i128) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/eq.leo b/tests/pass/parse/integers/i128/eq.leo deleted file mode 100644 index f4beddc8fc..0000000000 --- a/tests/pass/parse/integers/i128/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/ge.leo b/tests/pass/parse/integers/i128/ge.leo deleted file mode 100644 index 1fbbd68073..0000000000 --- a/tests/pass/parse/integers/i128/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/gt.leo b/tests/pass/parse/integers/i128/gt.leo deleted file mode 100644 index 27849afbe8..0000000000 --- a/tests/pass/parse/integers/i128/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/input.leo b/tests/pass/parse/integers/i128/input.leo deleted file mode 100644 index c89021f609..0000000000 --- a/tests/pass/parse/integers/i128/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/le.leo b/tests/pass/parse/integers/i128/le.leo deleted file mode 100644 index ea0c3c9e1d..0000000000 --- a/tests/pass/parse/integers/i128/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/lt.leo b/tests/pass/parse/integers/i128/lt.leo deleted file mode 100644 index bde4def85c..0000000000 --- a/tests/pass/parse/integers/i128/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/max.leo b/tests/pass/parse/integers/i128/max.leo deleted file mode 100644 index 5ba44213e1..0000000000 --- a/tests/pass/parse/integers/i128/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i128 = 170141183460469231731687303715884105727; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/max_fail.leo b/tests/pass/parse/integers/i128/max_fail.leo deleted file mode 100644 index a9a46afd7f..0000000000 --- a/tests/pass/parse/integers/i128/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i128 = 170141183460469231731687303715884105728; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/min.leo b/tests/pass/parse/integers/i128/min.leo deleted file mode 100644 index 19509a3fb0..0000000000 --- a/tests/pass/parse/integers/i128/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i128 = -170141183460469231731687303715884105728; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/min_fail.leo b/tests/pass/parse/integers/i128/min_fail.leo deleted file mode 100644 index 918f0e439d..0000000000 --- a/tests/pass/parse/integers/i128/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i128 = -170141183460469231731687303715884105729; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/mod.rs b/tests/pass/parse/integers/i128/mod.rs deleted file mode 100644 index e62e07260e..0000000000 --- a/tests/pass/parse/integers/i128/mod.rs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{I128Type, IntegerType, SignedIntegerType}; - -test_int!( - TestI128, - i128, - IntegerType::Signed(SignedIntegerType::I128Type(I128Type {})), - Int128 -); - -#[test] -fn test_i128_min() { - TestI128::test_min(); -} - -#[test] -fn test_i128_min_fail() { - TestI128::test_min_fail(); -} - -#[test] -fn test_i128_max() { - TestI128::test_max(); -} - -#[test] -fn test_i128_max_fail() { - TestI128::test_max_fail(); -} - -#[test] -fn test_i128_neg() { - TestI128::test_negate(); -} - -#[test] -fn test_i128_neg_max_fail() { - TestI128::test_negate_min_fail(); -} - -#[test] -fn test_i128_neg_zero() { - TestI128::test_negate_zero(); -} - -#[test] -fn test_i128_add() { - TestI128::test_add(); -} - -#[test] -fn test_i128_sub() { - TestI128::test_sub(); -} - -#[test] -fn test_i128_mul() { - TestI128::test_mul(); -} - -#[test] -#[ignore] // takes several minutes -fn test_i128_div() { - TestI128::test_div(); -} - -#[test] -fn test_i128_pow() { - TestI128::test_pow(); -} - -#[test] -fn test_i128_eq() { - TestI128::test_eq(); -} - -#[test] -fn test_i128_ne() { - TestI128::test_ne(); -} - -#[test] -fn test_i128_ge() { - TestI128::test_ge(); -} - -#[test] -fn test_i128_gt() { - TestI128::test_gt(); -} - -#[test] -fn test_i128_le() { - TestI128::test_le(); -} - -#[test] -fn test_i128_lt() { - TestI128::test_lt(); -} - -#[test] -fn test_i128_assert_eq() { - TestI128::test_console_assert(); -} - -#[test] -fn test_i128_ternary() { - TestI128::test_ternary(); -} diff --git a/tests/pass/parse/integers/i128/mul.leo b/tests/pass/parse/integers/i128/mul.leo deleted file mode 100644 index 25b902d53c..0000000000 --- a/tests/pass/parse/integers/i128/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: i128) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/ne.leo b/tests/pass/parse/integers/i128/ne.leo deleted file mode 100644 index dae148b49c..0000000000 --- a/tests/pass/parse/integers/i128/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/negate.leo b/tests/pass/parse/integers/i128/negate.leo deleted file mode 100644 index 437ee06390..0000000000 --- a/tests/pass/parse/integers/i128/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/negate_min.leo b/tests/pass/parse/integers/i128/negate_min.leo deleted file mode 100644 index c9de272960..0000000000 --- a/tests/pass/parse/integers/i128/negate_min.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a: i128 = -170141183460469231731687303715884105728; - const b = -a; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/negate_zero.leo b/tests/pass/parse/integers/i128/negate_zero.leo deleted file mode 100644 index e079baf393..0000000000 --- a/tests/pass/parse/integers/i128/negate_zero.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = 0i128; - - console.assert(-a == 0i128); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/pow.leo b/tests/pass/parse/integers/i128/pow.leo deleted file mode 100644 index 05536aad51..0000000000 --- a/tests/pass/parse/integers/i128/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: i128) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/sub.leo b/tests/pass/parse/integers/i128/sub.leo deleted file mode 100644 index 3a723eec49..0000000000 --- a/tests/pass/parse/integers/i128/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i128, b: i128, c: i128) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i128/ternary.leo b/tests/pass/parse/integers/i128/ternary.leo deleted file mode 100644 index 3783463b22..0000000000 --- a/tests/pass/parse/integers/i128/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: i128, b: i128, c: i128) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/add.leo b/tests/pass/parse/integers/i16/add.leo deleted file mode 100644 index 556ae65c3a..0000000000 --- a/tests/pass/parse/integers/i16/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: i16) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/console_assert.leo b/tests/pass/parse/integers/i16/console_assert.leo deleted file mode 100644 index 3afb25b207..0000000000 --- a/tests/pass/parse/integers/i16/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/div.leo b/tests/pass/parse/integers/i16/div.leo deleted file mode 100644 index 6d0c8f4614..0000000000 --- a/tests/pass/parse/integers/i16/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: i16) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/eq.leo b/tests/pass/parse/integers/i16/eq.leo deleted file mode 100644 index 338e3e50f6..0000000000 --- a/tests/pass/parse/integers/i16/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/ge.leo b/tests/pass/parse/integers/i16/ge.leo deleted file mode 100644 index 68a4d40bf8..0000000000 --- a/tests/pass/parse/integers/i16/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/gt.leo b/tests/pass/parse/integers/i16/gt.leo deleted file mode 100644 index 75d9bfb612..0000000000 --- a/tests/pass/parse/integers/i16/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/input.leo b/tests/pass/parse/integers/i16/input.leo deleted file mode 100644 index 3afb25b207..0000000000 --- a/tests/pass/parse/integers/i16/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/le.leo b/tests/pass/parse/integers/i16/le.leo deleted file mode 100644 index ff112c7fbc..0000000000 --- a/tests/pass/parse/integers/i16/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/lt.leo b/tests/pass/parse/integers/i16/lt.leo deleted file mode 100644 index 46c57aabe6..0000000000 --- a/tests/pass/parse/integers/i16/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/max.leo b/tests/pass/parse/integers/i16/max.leo deleted file mode 100644 index 2b70b3cc56..0000000000 --- a/tests/pass/parse/integers/i16/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i16 = 32767; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/max_fail.leo b/tests/pass/parse/integers/i16/max_fail.leo deleted file mode 100644 index 209bcc6518..0000000000 --- a/tests/pass/parse/integers/i16/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i16 = 32768; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/min.leo b/tests/pass/parse/integers/i16/min.leo deleted file mode 100644 index 3d05bef95a..0000000000 --- a/tests/pass/parse/integers/i16/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i16 = -32768; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/min_fail.leo b/tests/pass/parse/integers/i16/min_fail.leo deleted file mode 100644 index 13d7c8b7f2..0000000000 --- a/tests/pass/parse/integers/i16/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i16 = -32769; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/mod.rs b/tests/pass/parse/integers/i16/mod.rs deleted file mode 100644 index 49b45f5b3e..0000000000 --- a/tests/pass/parse/integers/i16/mod.rs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{I16Type, IntegerType, SignedIntegerType}; - -test_int!( - TestI16, - i16, - IntegerType::Signed(SignedIntegerType::I16Type(I16Type {})), - Int16 -); - -#[test] -fn test_i16_min() { - TestI16::test_min(); -} - -#[test] -fn test_i16_min_fail() { - TestI16::test_min_fail(); -} - -#[test] -fn test_i16_max() { - TestI16::test_max(); -} - -#[test] -fn test_i16_max_fail() { - TestI16::test_max_fail(); -} - -#[test] -fn test_i16_neg() { - TestI16::test_negate(); -} - -#[test] -fn test_i16_neg_max_fail() { - TestI16::test_negate_min_fail(); -} - -#[test] -fn test_i16_neg_zero() { - TestI16::test_negate_zero(); -} - -#[test] -fn test_i16_add() { - TestI16::test_add(); -} - -#[test] -fn test_i16_sub() { - TestI16::test_sub(); -} - -#[test] -fn test_i16_mul() { - TestI16::test_mul(); -} - -#[test] -fn test_i16_div() { - TestI16::test_div(); -} - -#[test] -fn test_i16_pow() { - TestI16::test_pow(); -} - -#[test] -fn test_i16_eq() { - TestI16::test_eq(); -} - -#[test] -fn test_i16_ne() { - TestI16::test_ne(); -} - -#[test] -fn test_i16_ge() { - TestI16::test_ge(); -} - -#[test] -fn test_i16_gt() { - TestI16::test_gt(); -} - -#[test] -fn test_i16_le() { - TestI16::test_le(); -} - -#[test] -fn test_i16_lt() { - TestI16::test_lt(); -} - -#[test] -fn test_i16_console_assert() { - TestI16::test_console_assert(); -} - -#[test] -fn test_i16_ternary() { - TestI16::test_ternary(); -} diff --git a/tests/pass/parse/integers/i16/mul.leo b/tests/pass/parse/integers/i16/mul.leo deleted file mode 100644 index 6fd19b703a..0000000000 --- a/tests/pass/parse/integers/i16/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: i16) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/ne.leo b/tests/pass/parse/integers/i16/ne.leo deleted file mode 100644 index f0a9472678..0000000000 --- a/tests/pass/parse/integers/i16/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/negate.leo b/tests/pass/parse/integers/i16/negate.leo deleted file mode 100644 index 1d2644dce7..0000000000 --- a/tests/pass/parse/integers/i16/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/negate_min.leo b/tests/pass/parse/integers/i16/negate_min.leo deleted file mode 100644 index d52a356396..0000000000 --- a/tests/pass/parse/integers/i16/negate_min.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a = -32768i16; - const b = -a; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/negate_zero.leo b/tests/pass/parse/integers/i16/negate_zero.leo deleted file mode 100644 index 20f8a4fba7..0000000000 --- a/tests/pass/parse/integers/i16/negate_zero.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = 0i16; - - console.assert(-a == 0i16); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/pow.leo b/tests/pass/parse/integers/i16/pow.leo deleted file mode 100644 index 769d2d2fbb..0000000000 --- a/tests/pass/parse/integers/i16/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: i16) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/sub.leo b/tests/pass/parse/integers/i16/sub.leo deleted file mode 100644 index e935935187..0000000000 --- a/tests/pass/parse/integers/i16/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i16, b: i16, c: i16) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i16/ternary.leo b/tests/pass/parse/integers/i16/ternary.leo deleted file mode 100644 index d66c73cb93..0000000000 --- a/tests/pass/parse/integers/i16/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: i16, b: i16, c: i16) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/add.leo b/tests/pass/parse/integers/i32/add.leo deleted file mode 100644 index 3d8fb1b1d2..0000000000 --- a/tests/pass/parse/integers/i32/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: i32) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/console_assert.leo b/tests/pass/parse/integers/i32/console_assert.leo deleted file mode 100644 index a2d6980e9a..0000000000 --- a/tests/pass/parse/integers/i32/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/div.leo b/tests/pass/parse/integers/i32/div.leo deleted file mode 100644 index 3189a354f0..0000000000 --- a/tests/pass/parse/integers/i32/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: i32) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/eq.leo b/tests/pass/parse/integers/i32/eq.leo deleted file mode 100644 index bac7af0be0..0000000000 --- a/tests/pass/parse/integers/i32/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/ge.leo b/tests/pass/parse/integers/i32/ge.leo deleted file mode 100644 index 362521fc82..0000000000 --- a/tests/pass/parse/integers/i32/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/gt.leo b/tests/pass/parse/integers/i32/gt.leo deleted file mode 100644 index 63ddcaa85c..0000000000 --- a/tests/pass/parse/integers/i32/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/input.leo b/tests/pass/parse/integers/i32/input.leo deleted file mode 100644 index a2d6980e9a..0000000000 --- a/tests/pass/parse/integers/i32/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/le.leo b/tests/pass/parse/integers/i32/le.leo deleted file mode 100644 index 948c66b1fc..0000000000 --- a/tests/pass/parse/integers/i32/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/lt.leo b/tests/pass/parse/integers/i32/lt.leo deleted file mode 100644 index 72a8fb0d53..0000000000 --- a/tests/pass/parse/integers/i32/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/max.leo b/tests/pass/parse/integers/i32/max.leo deleted file mode 100644 index 074c75f1a6..0000000000 --- a/tests/pass/parse/integers/i32/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i32 = 2147483647; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/max_fail.leo b/tests/pass/parse/integers/i32/max_fail.leo deleted file mode 100644 index af2877ff5e..0000000000 --- a/tests/pass/parse/integers/i32/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i32 = 2147483648; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/min.leo b/tests/pass/parse/integers/i32/min.leo deleted file mode 100644 index 8436268ce6..0000000000 --- a/tests/pass/parse/integers/i32/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i32 = -2147483648; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/min_fail.leo b/tests/pass/parse/integers/i32/min_fail.leo deleted file mode 100644 index 11a683b087..0000000000 --- a/tests/pass/parse/integers/i32/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i32 = -2147483649; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/mod.rs b/tests/pass/parse/integers/i32/mod.rs deleted file mode 100644 index ee9e25701a..0000000000 --- a/tests/pass/parse/integers/i32/mod.rs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{I32Type, IntegerType, SignedIntegerType}; - -test_int!( - TestI32, - i32, - IntegerType::Signed(SignedIntegerType::I32Type(I32Type {})), - Int32 -); - -#[test] -fn test_i32_min() { - TestI32::test_min(); -} - -#[test] -fn test_i32_min_fail() { - TestI32::test_min_fail(); -} - -#[test] -fn test_i32_max() { - TestI32::test_max(); -} - -#[test] -fn test_i32_max_fail() { - TestI32::test_max_fail(); -} - -#[test] -fn test_i32_neg() { - TestI32::test_negate(); -} - -#[test] -fn test_i32_neg_max_fail() { - TestI32::test_negate_min_fail(); -} - -#[test] -fn test_i32_neg_zero() { - TestI32::test_negate_zero(); -} - -#[test] -fn test_i32_add() { - TestI32::test_add(); -} - -#[test] -fn test_i32_sub() { - TestI32::test_sub(); -} - -#[test] -fn test_i32_mul() { - TestI32::test_mul(); -} - -#[test] -fn test_i32_div() { - TestI32::test_div(); -} - -#[test] -fn test_i32_pow() { - TestI32::test_pow(); -} - -#[test] -fn test_i32_eq() { - TestI32::test_eq(); -} - -#[test] -fn test_i32_ne() { - TestI32::test_ne(); -} - -#[test] -fn test_i32_ge() { - TestI32::test_ge(); -} - -#[test] -fn test_i32_gt() { - TestI32::test_gt(); -} - -#[test] -fn test_i32_le() { - TestI32::test_le(); -} - -#[test] -fn test_i32_lt() { - TestI32::test_lt(); -} - -#[test] -fn test_i32_console_assert() { - TestI32::test_console_assert(); -} - -#[test] -fn test_i32_ternary() { - TestI32::test_ternary(); -} diff --git a/tests/pass/parse/integers/i32/mul.leo b/tests/pass/parse/integers/i32/mul.leo deleted file mode 100644 index 50ba5b4128..0000000000 --- a/tests/pass/parse/integers/i32/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: i32) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/ne.leo b/tests/pass/parse/integers/i32/ne.leo deleted file mode 100644 index dcc1a185d1..0000000000 --- a/tests/pass/parse/integers/i32/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/negate.leo b/tests/pass/parse/integers/i32/negate.leo deleted file mode 100644 index eef94c934f..0000000000 --- a/tests/pass/parse/integers/i32/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/negate_min.leo b/tests/pass/parse/integers/i32/negate_min.leo deleted file mode 100644 index a96455d57a..0000000000 --- a/tests/pass/parse/integers/i32/negate_min.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a = -2147483648i32; - const b = -a; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/negate_zero.leo b/tests/pass/parse/integers/i32/negate_zero.leo deleted file mode 100644 index a3807b1f8a..0000000000 --- a/tests/pass/parse/integers/i32/negate_zero.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = 0i32; - - console.assert(-a == 0i32); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/pow.leo b/tests/pass/parse/integers/i32/pow.leo deleted file mode 100644 index ebb131e30b..0000000000 --- a/tests/pass/parse/integers/i32/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: i32) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/sub.leo b/tests/pass/parse/integers/i32/sub.leo deleted file mode 100644 index 1f054a5ddf..0000000000 --- a/tests/pass/parse/integers/i32/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i32, b: i32, c: i32) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i32/ternary.leo b/tests/pass/parse/integers/i32/ternary.leo deleted file mode 100644 index 790769d62f..0000000000 --- a/tests/pass/parse/integers/i32/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: i32, b: i32, c: i32) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/add.leo b/tests/pass/parse/integers/i64/add.leo deleted file mode 100644 index aefdbb178f..0000000000 --- a/tests/pass/parse/integers/i64/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: i64) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/console_assert.leo b/tests/pass/parse/integers/i64/console_assert.leo deleted file mode 100644 index ab9a5d6e91..0000000000 --- a/tests/pass/parse/integers/i64/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/div.leo b/tests/pass/parse/integers/i64/div.leo deleted file mode 100644 index 142e4ab801..0000000000 --- a/tests/pass/parse/integers/i64/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: i64) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/eq.leo b/tests/pass/parse/integers/i64/eq.leo deleted file mode 100644 index 86a234c834..0000000000 --- a/tests/pass/parse/integers/i64/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/ge.leo b/tests/pass/parse/integers/i64/ge.leo deleted file mode 100644 index e7b453c5dc..0000000000 --- a/tests/pass/parse/integers/i64/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/gt.leo b/tests/pass/parse/integers/i64/gt.leo deleted file mode 100644 index 9709bad012..0000000000 --- a/tests/pass/parse/integers/i64/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/input.leo b/tests/pass/parse/integers/i64/input.leo deleted file mode 100644 index ab9a5d6e91..0000000000 --- a/tests/pass/parse/integers/i64/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/le.leo b/tests/pass/parse/integers/i64/le.leo deleted file mode 100644 index 3e2cfcb711..0000000000 --- a/tests/pass/parse/integers/i64/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/lt.leo b/tests/pass/parse/integers/i64/lt.leo deleted file mode 100644 index ef4e38eb76..0000000000 --- a/tests/pass/parse/integers/i64/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/max.leo b/tests/pass/parse/integers/i64/max.leo deleted file mode 100644 index 593f91e110..0000000000 --- a/tests/pass/parse/integers/i64/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i64 = 9223372036854775807; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/max_fail.leo b/tests/pass/parse/integers/i64/max_fail.leo deleted file mode 100644 index 362b794a2c..0000000000 --- a/tests/pass/parse/integers/i64/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i64 = 9223372036854775808; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/min.leo b/tests/pass/parse/integers/i64/min.leo deleted file mode 100644 index 794d8fbfac..0000000000 --- a/tests/pass/parse/integers/i64/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i64 = -9223372036854775808; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/min_fail.leo b/tests/pass/parse/integers/i64/min_fail.leo deleted file mode 100644 index bb260ecc3f..0000000000 --- a/tests/pass/parse/integers/i64/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i64 = -9223372036854775809; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/mod.rs b/tests/pass/parse/integers/i64/mod.rs deleted file mode 100644 index 066ac9956f..0000000000 --- a/tests/pass/parse/integers/i64/mod.rs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{I64Type, IntegerType, SignedIntegerType}; - -test_int!( - TestI64, - i64, - IntegerType::Signed(SignedIntegerType::I64Type(I64Type {})), - Int64 -); - -#[test] -fn test_i64_min() { - TestI64::test_min(); -} - -#[test] -fn test_i64_min_fail() { - TestI64::test_min_fail(); -} - -#[test] -fn test_i64_max() { - TestI64::test_max(); -} - -#[test] -fn test_i64_max_fail() { - TestI64::test_max_fail(); -} - -#[test] -fn test_i64_neg() { - TestI64::test_negate(); -} - -#[test] -fn test_i64_neg_max_fail() { - TestI64::test_negate_min_fail(); -} - -#[test] -fn test_i64_neg_zero() { - TestI64::test_negate_zero(); -} - -#[test] -fn test_i64_add() { - TestI64::test_add(); -} - -#[test] -fn test_i64_sub() { - TestI64::test_sub(); -} - -#[test] -fn test_i64_mul() { - TestI64::test_mul(); -} - -#[test] -#[ignore] // takes 2 minutes -fn test_i64_div() { - TestI64::test_div(); -} - -#[test] -fn test_i64_pow() { - TestI64::test_pow(); -} - -#[test] -fn test_i64_eq() { - TestI64::test_eq(); -} - -#[test] -fn test_i64_ne() { - TestI64::test_ne(); -} - -#[test] -fn test_i64_ge() { - TestI64::test_ge(); -} - -#[test] -fn test_i64_gt() { - TestI64::test_gt(); -} - -#[test] -fn test_i64_le() { - TestI64::test_le(); -} - -#[test] -fn test_i64_lt() { - TestI64::test_lt(); -} - -#[test] -fn test_i64_console_assert() { - TestI64::test_console_assert(); -} - -#[test] -fn test_i64_ternary() { - TestI64::test_ternary(); -} diff --git a/tests/pass/parse/integers/i64/mul.leo b/tests/pass/parse/integers/i64/mul.leo deleted file mode 100644 index a3b8bd1da5..0000000000 --- a/tests/pass/parse/integers/i64/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: i64) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/ne.leo b/tests/pass/parse/integers/i64/ne.leo deleted file mode 100644 index a2642bb479..0000000000 --- a/tests/pass/parse/integers/i64/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/negate.leo b/tests/pass/parse/integers/i64/negate.leo deleted file mode 100644 index fe0cdc4d97..0000000000 --- a/tests/pass/parse/integers/i64/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/negate_min.leo b/tests/pass/parse/integers/i64/negate_min.leo deleted file mode 100644 index daf694491b..0000000000 --- a/tests/pass/parse/integers/i64/negate_min.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a: i64 = -9223372036854775808; - const b = -a; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/negate_zero.leo b/tests/pass/parse/integers/i64/negate_zero.leo deleted file mode 100644 index 81f09c19a3..0000000000 --- a/tests/pass/parse/integers/i64/negate_zero.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = 0i64; - - console.assert(-a == 0i64); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/pow.leo b/tests/pass/parse/integers/i64/pow.leo deleted file mode 100644 index dca2dace74..0000000000 --- a/tests/pass/parse/integers/i64/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: i64) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/sub.leo b/tests/pass/parse/integers/i64/sub.leo deleted file mode 100644 index 4d335e504b..0000000000 --- a/tests/pass/parse/integers/i64/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i64, b: i64, c: i64) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i64/ternary.leo b/tests/pass/parse/integers/i64/ternary.leo deleted file mode 100644 index df63b3ad6a..0000000000 --- a/tests/pass/parse/integers/i64/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: i64, b: i64, c: i64) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/add.leo b/tests/pass/parse/integers/i8/add.leo deleted file mode 100644 index dd71bc7f53..0000000000 --- a/tests/pass/parse/integers/i8/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: i8) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/console_assert.leo b/tests/pass/parse/integers/i8/console_assert.leo deleted file mode 100644 index 1fc09cb57d..0000000000 --- a/tests/pass/parse/integers/i8/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/div.leo b/tests/pass/parse/integers/i8/div.leo deleted file mode 100644 index a80d8e6319..0000000000 --- a/tests/pass/parse/integers/i8/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: i8) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/eq.leo b/tests/pass/parse/integers/i8/eq.leo deleted file mode 100644 index 130cc64b89..0000000000 --- a/tests/pass/parse/integers/i8/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/ge.leo b/tests/pass/parse/integers/i8/ge.leo deleted file mode 100644 index 3084692c0c..0000000000 --- a/tests/pass/parse/integers/i8/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/gt.leo b/tests/pass/parse/integers/i8/gt.leo deleted file mode 100644 index d3913b8b24..0000000000 --- a/tests/pass/parse/integers/i8/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/input.leo b/tests/pass/parse/integers/i8/input.leo deleted file mode 100644 index 1fc09cb57d..0000000000 --- a/tests/pass/parse/integers/i8/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/le.leo b/tests/pass/parse/integers/i8/le.leo deleted file mode 100644 index 92e011f206..0000000000 --- a/tests/pass/parse/integers/i8/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/lt.leo b/tests/pass/parse/integers/i8/lt.leo deleted file mode 100644 index eb34b7148e..0000000000 --- a/tests/pass/parse/integers/i8/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/max.leo b/tests/pass/parse/integers/i8/max.leo deleted file mode 100644 index f20d59ddf4..0000000000 --- a/tests/pass/parse/integers/i8/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i8 = 127; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/max_fail.leo b/tests/pass/parse/integers/i8/max_fail.leo deleted file mode 100644 index 9e1956024a..0000000000 --- a/tests/pass/parse/integers/i8/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i8 = 128; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/min.leo b/tests/pass/parse/integers/i8/min.leo deleted file mode 100644 index 7b6db025ea..0000000000 --- a/tests/pass/parse/integers/i8/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i8 = -128; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/min_fail.leo b/tests/pass/parse/integers/i8/min_fail.leo deleted file mode 100644 index 41170e9b93..0000000000 --- a/tests/pass/parse/integers/i8/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: i8 = -129; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/mod.rs b/tests/pass/parse/integers/i8/mod.rs deleted file mode 100644 index 9133a72248..0000000000 --- a/tests/pass/parse/integers/i8/mod.rs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{I8Type, IntegerType, SignedIntegerType}; - -test_int!( - TestI8, - i8, - IntegerType::Signed(SignedIntegerType::I8Type(I8Type {})), - Int8 -); - -#[test] -fn test_i8_min() { - TestI8::test_min(); -} - -#[test] -fn test_i8_min_fail() { - TestI8::test_min_fail(); -} - -#[test] -fn test_i8_max() { - TestI8::test_max(); -} - -#[test] -fn test_i8_max_fail() { - TestI8::test_max_fail(); -} - -#[test] -fn test_i8_neg() { - TestI8::test_negate(); -} - -#[test] -fn test_i8_neg_max_fail() { - TestI8::test_negate_min_fail(); -} - -#[test] -fn test_i8_neg_zero() { - TestI8::test_negate_zero(); -} - -#[test] -fn test_i8_add() { - TestI8::test_add(); -} - -#[test] -fn test_i8_sub() { - TestI8::test_sub(); -} - -#[test] -fn test_i8_mul() { - TestI8::test_mul(); -} - -#[test] -fn test_i8_div() { - TestI8::test_div(); -} - -#[test] -fn test_i8_pow() { - TestI8::test_pow(); -} - -#[test] -fn test_i8_eq() { - TestI8::test_eq(); -} - -#[test] -fn test_i8_ne() { - TestI8::test_ne(); -} - -#[test] -fn test_i8_ge() { - TestI8::test_ge(); -} - -#[test] -fn test_i8_gt() { - TestI8::test_gt(); -} - -#[test] -fn test_i8_le() { - TestI8::test_le(); -} - -#[test] -fn test_i8_lt() { - TestI8::test_lt(); -} - -#[test] -fn test_i8_console_assert() { - TestI8::test_console_assert(); -} - -#[test] -fn test_i8_ternary() { - TestI8::test_ternary(); -} diff --git a/tests/pass/parse/integers/i8/mul.leo b/tests/pass/parse/integers/i8/mul.leo deleted file mode 100644 index 34726fff92..0000000000 --- a/tests/pass/parse/integers/i8/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: i8) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/ne.leo b/tests/pass/parse/integers/i8/ne.leo deleted file mode 100644 index e5028d404a..0000000000 --- a/tests/pass/parse/integers/i8/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/negate.leo b/tests/pass/parse/integers/i8/negate.leo deleted file mode 100644 index 2a2266bc56..0000000000 --- a/tests/pass/parse/integers/i8/negate.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8) { - console.assert(-a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/negate_min.leo b/tests/pass/parse/integers/i8/negate_min.leo deleted file mode 100644 index 7f664a1b78..0000000000 --- a/tests/pass/parse/integers/i8/negate_min.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a = -128i8; - const b = -a; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/negate_zero.leo b/tests/pass/parse/integers/i8/negate_zero.leo deleted file mode 100644 index cc3f4a0828..0000000000 --- a/tests/pass/parse/integers/i8/negate_zero.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - const a = 0i8; - - console.assert(-a == 0i8); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/pow.leo b/tests/pass/parse/integers/i8/pow.leo deleted file mode 100644 index 18aeb44b46..0000000000 --- a/tests/pass/parse/integers/i8/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: i8) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/sub.leo b/tests/pass/parse/integers/i8/sub.leo deleted file mode 100644 index a795bed153..0000000000 --- a/tests/pass/parse/integers/i8/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: i8, b: i8, c: i8) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/i8/ternary.leo b/tests/pass/parse/integers/i8/ternary.leo deleted file mode 100644 index 0956a9cd39..0000000000 --- a/tests/pass/parse/integers/i8/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: i8, b: i8, c: i8) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/add.leo b/tests/pass/parse/integers/u128/add.leo deleted file mode 100644 index 6b32042fd5..0000000000 --- a/tests/pass/parse/integers/u128/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: u128) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/console_assert.leo b/tests/pass/parse/integers/u128/console_assert.leo deleted file mode 100644 index adab295385..0000000000 --- a/tests/pass/parse/integers/u128/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/div.leo b/tests/pass/parse/integers/u128/div.leo deleted file mode 100644 index 0d62054eca..0000000000 --- a/tests/pass/parse/integers/u128/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: u128) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/eq.leo b/tests/pass/parse/integers/u128/eq.leo deleted file mode 100644 index 2c2acd923a..0000000000 --- a/tests/pass/parse/integers/u128/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/ge.leo b/tests/pass/parse/integers/u128/ge.leo deleted file mode 100644 index bff7cd321b..0000000000 --- a/tests/pass/parse/integers/u128/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/gt.leo b/tests/pass/parse/integers/u128/gt.leo deleted file mode 100644 index e8aec0faf2..0000000000 --- a/tests/pass/parse/integers/u128/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/input.leo b/tests/pass/parse/integers/u128/input.leo deleted file mode 100644 index adab295385..0000000000 --- a/tests/pass/parse/integers/u128/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/le.leo b/tests/pass/parse/integers/u128/le.leo deleted file mode 100644 index c9e4609136..0000000000 --- a/tests/pass/parse/integers/u128/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/lt.leo b/tests/pass/parse/integers/u128/lt.leo deleted file mode 100644 index b37057c895..0000000000 --- a/tests/pass/parse/integers/u128/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/max.leo b/tests/pass/parse/integers/u128/max.leo deleted file mode 100644 index b166ede06b..0000000000 --- a/tests/pass/parse/integers/u128/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u128 = 340282366920938463463374607431768211455; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/max_fail.leo b/tests/pass/parse/integers/u128/max_fail.leo deleted file mode 100644 index f51c967925..0000000000 --- a/tests/pass/parse/integers/u128/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u128 = 340282366920938463463374607431768211456; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/min.leo b/tests/pass/parse/integers/u128/min.leo deleted file mode 100644 index 41fbf1a2fe..0000000000 --- a/tests/pass/parse/integers/u128/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u128 = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/min_fail.leo b/tests/pass/parse/integers/u128/min_fail.leo deleted file mode 100644 index b0d17191ff..0000000000 --- a/tests/pass/parse/integers/u128/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u128 = -1; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/mod.rs b/tests/pass/parse/integers/u128/mod.rs deleted file mode 100644 index 2c110af0a5..0000000000 --- a/tests/pass/parse/integers/u128/mod.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{IntegerType, U128Type, UnsignedIntegerType}; - -test_uint!( - TestU128, - u128, - IntegerType::Unsigned(UnsignedIntegerType::U128Type(U128Type {})), - UInt128 -); - -#[test] -fn test_u128_min() { - TestU128::test_min(); -} - -#[test] -fn test_u128_min_fail() { - TestU128::test_min_fail(); -} - -#[test] -fn test_u128_max() { - TestU128::test_max(); -} - -#[test] -fn test_u128_max_fail() { - TestU128::test_max_fail(); -} - -#[test] -fn test_u128_add() { - TestU128::test_add(); -} - -#[test] -fn test_u128_sub() { - TestU128::test_sub(); -} - -#[test] -fn test_u128_mul() { - TestU128::test_mul(); -} - -#[test] -fn test_u128_div() { - TestU128::test_div(); -} - -#[test] -fn test_u128_pow() { - TestU128::test_pow(); -} - -#[test] -fn test_u128_eq() { - TestU128::test_eq(); -} - -#[test] -fn test_u128_ne() { - TestU128::test_ne(); -} - -#[test] -fn test_u128_ge() { - TestU128::test_ge(); -} - -#[test] -fn test_u128_gt() { - TestU128::test_gt(); -} - -#[test] -fn test_u128_le() { - TestU128::test_le(); -} - -#[test] -fn test_u128_lt() { - TestU128::test_lt(); -} - -#[test] -fn test_u128_console_assert() { - TestU128::test_console_assert(); -} - -#[test] -fn test_u128_ternary() { - TestU128::test_ternary(); -} diff --git a/tests/pass/parse/integers/u128/mul.leo b/tests/pass/parse/integers/u128/mul.leo deleted file mode 100644 index c7fdc1530c..0000000000 --- a/tests/pass/parse/integers/u128/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: u128) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/ne.leo b/tests/pass/parse/integers/u128/ne.leo deleted file mode 100644 index da3467d01e..0000000000 --- a/tests/pass/parse/integers/u128/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/pow.leo b/tests/pass/parse/integers/u128/pow.leo deleted file mode 100644 index 27614bfa56..0000000000 --- a/tests/pass/parse/integers/u128/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: u128) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/sub.leo b/tests/pass/parse/integers/u128/sub.leo deleted file mode 100644 index 2374413505..0000000000 --- a/tests/pass/parse/integers/u128/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u128, b: u128, c: u128) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u128/ternary.leo b/tests/pass/parse/integers/u128/ternary.leo deleted file mode 100644 index 99a6b997e0..0000000000 --- a/tests/pass/parse/integers/u128/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: u128, b: u128, c: u128) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/add.leo b/tests/pass/parse/integers/u16/add.leo deleted file mode 100644 index f00701181b..0000000000 --- a/tests/pass/parse/integers/u16/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: u16) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/console_assert.leo b/tests/pass/parse/integers/u16/console_assert.leo deleted file mode 100644 index 761f0639d0..0000000000 --- a/tests/pass/parse/integers/u16/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/div.leo b/tests/pass/parse/integers/u16/div.leo deleted file mode 100644 index f1dd3fa463..0000000000 --- a/tests/pass/parse/integers/u16/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: u16) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/eq.leo b/tests/pass/parse/integers/u16/eq.leo deleted file mode 100644 index a4b4e78b49..0000000000 --- a/tests/pass/parse/integers/u16/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/ge.leo b/tests/pass/parse/integers/u16/ge.leo deleted file mode 100644 index 4b1da1b27b..0000000000 --- a/tests/pass/parse/integers/u16/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/gt.leo b/tests/pass/parse/integers/u16/gt.leo deleted file mode 100644 index 2c5ffbe8eb..0000000000 --- a/tests/pass/parse/integers/u16/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/input.leo b/tests/pass/parse/integers/u16/input.leo deleted file mode 100644 index 761f0639d0..0000000000 --- a/tests/pass/parse/integers/u16/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/le.leo b/tests/pass/parse/integers/u16/le.leo deleted file mode 100644 index 49713482d0..0000000000 --- a/tests/pass/parse/integers/u16/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/lt.leo b/tests/pass/parse/integers/u16/lt.leo deleted file mode 100644 index dae1951231..0000000000 --- a/tests/pass/parse/integers/u16/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/max.leo b/tests/pass/parse/integers/u16/max.leo deleted file mode 100644 index 56cb2af18d..0000000000 --- a/tests/pass/parse/integers/u16/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u16 = 65535; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/max_fail.leo b/tests/pass/parse/integers/u16/max_fail.leo deleted file mode 100644 index bb703210e3..0000000000 --- a/tests/pass/parse/integers/u16/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u16 = 65536; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/min.leo b/tests/pass/parse/integers/u16/min.leo deleted file mode 100644 index 4dee94a1a4..0000000000 --- a/tests/pass/parse/integers/u16/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u16 = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/min_fail.leo b/tests/pass/parse/integers/u16/min_fail.leo deleted file mode 100644 index 0c61dd7ddf..0000000000 --- a/tests/pass/parse/integers/u16/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u16 = -1; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/mod.rs b/tests/pass/parse/integers/u16/mod.rs deleted file mode 100644 index b4b202b9da..0000000000 --- a/tests/pass/parse/integers/u16/mod.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{IntegerType, U16Type, UnsignedIntegerType}; - -test_uint!( - TestU16, - u16, - IntegerType::Unsigned(UnsignedIntegerType::U16Type(U16Type {})), - UInt16 -); - -#[test] -fn test_u16_min() { - TestU16::test_min(); -} - -#[test] -fn test_u16_min_fail() { - TestU16::test_min_fail(); -} - -#[test] -fn test_u16_max() { - TestU16::test_max(); -} - -#[test] -fn test_u16_max_fail() { - TestU16::test_max_fail(); -} - -#[test] -fn test_u16_add() { - TestU16::test_add(); -} - -#[test] -fn test_u16_sub() { - TestU16::test_sub(); -} - -#[test] -fn test_u16_mul() { - TestU16::test_mul(); -} - -#[test] -fn test_u16_div() { - TestU16::test_div(); -} - -#[test] -fn test_u16_pow() { - TestU16::test_pow(); -} - -#[test] -fn test_u16_eq() { - TestU16::test_eq(); -} - -#[test] -fn test_u16_ne() { - TestU16::test_ne(); -} - -#[test] -fn test_u16_ge() { - TestU16::test_ge(); -} - -#[test] -fn test_u16_gt() { - TestU16::test_gt(); -} - -#[test] -fn test_u16_le() { - TestU16::test_le(); -} - -#[test] -fn test_u16_lt() { - TestU16::test_lt(); -} - -#[test] -fn test_u16_console_assert() { - TestU16::test_console_assert(); -} - -#[test] -fn test_u16_ternary() { - TestU16::test_ternary(); -} diff --git a/tests/pass/parse/integers/u16/mul.leo b/tests/pass/parse/integers/u16/mul.leo deleted file mode 100644 index f2c6f0aac8..0000000000 --- a/tests/pass/parse/integers/u16/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: u16) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/ne.leo b/tests/pass/parse/integers/u16/ne.leo deleted file mode 100644 index e90a304cfe..0000000000 --- a/tests/pass/parse/integers/u16/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/pow.leo b/tests/pass/parse/integers/u16/pow.leo deleted file mode 100644 index 564c1c51fe..0000000000 --- a/tests/pass/parse/integers/u16/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: u16) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/sub.leo b/tests/pass/parse/integers/u16/sub.leo deleted file mode 100644 index 92aae9ac2c..0000000000 --- a/tests/pass/parse/integers/u16/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u16, b: u16, c: u16) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u16/ternary.leo b/tests/pass/parse/integers/u16/ternary.leo deleted file mode 100644 index d6131f9f4f..0000000000 --- a/tests/pass/parse/integers/u16/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: u16, b: u16, c: u16) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/add.leo b/tests/pass/parse/integers/u32/add.leo deleted file mode 100644 index 6f6a2454b4..0000000000 --- a/tests/pass/parse/integers/u32/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: u32) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/console_assert.leo b/tests/pass/parse/integers/u32/console_assert.leo deleted file mode 100644 index 32604eb3b8..0000000000 --- a/tests/pass/parse/integers/u32/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/div.leo b/tests/pass/parse/integers/u32/div.leo deleted file mode 100644 index ed689bd408..0000000000 --- a/tests/pass/parse/integers/u32/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: u32) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/eq.leo b/tests/pass/parse/integers/u32/eq.leo deleted file mode 100644 index ca427b3c42..0000000000 --- a/tests/pass/parse/integers/u32/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/ge.leo b/tests/pass/parse/integers/u32/ge.leo deleted file mode 100644 index 35c1c71829..0000000000 --- a/tests/pass/parse/integers/u32/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/gt.leo b/tests/pass/parse/integers/u32/gt.leo deleted file mode 100644 index f76df415c4..0000000000 --- a/tests/pass/parse/integers/u32/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/input.leo b/tests/pass/parse/integers/u32/input.leo deleted file mode 100644 index 32604eb3b8..0000000000 --- a/tests/pass/parse/integers/u32/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/le.leo b/tests/pass/parse/integers/u32/le.leo deleted file mode 100644 index 9a802f896d..0000000000 --- a/tests/pass/parse/integers/u32/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/lt.leo b/tests/pass/parse/integers/u32/lt.leo deleted file mode 100644 index 73e5654470..0000000000 --- a/tests/pass/parse/integers/u32/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/max.leo b/tests/pass/parse/integers/u32/max.leo deleted file mode 100644 index 4a07281b5d..0000000000 --- a/tests/pass/parse/integers/u32/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u32 = 4294967295; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/max_fail.leo b/tests/pass/parse/integers/u32/max_fail.leo deleted file mode 100644 index 6b1631876e..0000000000 --- a/tests/pass/parse/integers/u32/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u32 = 4294967296; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/min.leo b/tests/pass/parse/integers/u32/min.leo deleted file mode 100644 index 8077e0ec02..0000000000 --- a/tests/pass/parse/integers/u32/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u32 = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/min_fail.leo b/tests/pass/parse/integers/u32/min_fail.leo deleted file mode 100644 index c3e3f33225..0000000000 --- a/tests/pass/parse/integers/u32/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u32 = -1; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/mod.rs b/tests/pass/parse/integers/u32/mod.rs deleted file mode 100644 index 920fc6ed5b..0000000000 --- a/tests/pass/parse/integers/u32/mod.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{IntegerType, U32Type, UnsignedIntegerType}; - -test_uint!( - TestU32, - u32, - IntegerType::Unsigned(UnsignedIntegerType::U32Type(U32Type {})), - UInt32 -); - -#[test] -fn test_u32_min() { - TestU32::test_min(); -} - -#[test] -fn test_u32_min_fail() { - TestU32::test_min_fail(); -} - -#[test] -fn test_u32_max() { - TestU32::test_max(); -} - -#[test] -fn test_u32_max_fail() { - TestU32::test_max_fail(); -} - -#[test] -fn test_u32_add() { - TestU32::test_add(); -} - -#[test] -fn test_u32_sub() { - TestU32::test_sub(); -} - -#[test] -fn test_u32_mul() { - TestU32::test_mul(); -} - -#[test] -fn test_u32_div() { - TestU32::test_div(); -} - -#[test] -fn test_u32_pow() { - TestU32::test_pow(); -} - -#[test] -fn test_u32_eq() { - TestU32::test_eq(); -} - -#[test] -fn test_u32_ne() { - TestU32::test_ne(); -} - -#[test] -fn test_u32_ge() { - TestU32::test_ge(); -} - -#[test] -fn test_u32_gt() { - TestU32::test_gt(); -} - -#[test] -fn test_u32_le() { - TestU32::test_le(); -} - -#[test] -fn test_u32_lt() { - TestU32::test_lt(); -} - -#[test] -fn test_u32_console_assert() { - TestU32::test_console_assert(); -} - -#[test] -fn test_u32_ternary() { - TestU32::test_ternary(); -} diff --git a/tests/pass/parse/integers/u32/mul.leo b/tests/pass/parse/integers/u32/mul.leo deleted file mode 100644 index a77a85477b..0000000000 --- a/tests/pass/parse/integers/u32/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: u32) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/ne.leo b/tests/pass/parse/integers/u32/ne.leo deleted file mode 100644 index 00ee1a9989..0000000000 --- a/tests/pass/parse/integers/u32/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/pow.leo b/tests/pass/parse/integers/u32/pow.leo deleted file mode 100644 index b82496ff77..0000000000 --- a/tests/pass/parse/integers/u32/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: u32) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/sub.leo b/tests/pass/parse/integers/u32/sub.leo deleted file mode 100644 index 54480bd4bc..0000000000 --- a/tests/pass/parse/integers/u32/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u32, b: u32, c: u32) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u32/ternary.leo b/tests/pass/parse/integers/u32/ternary.leo deleted file mode 100644 index f32ffc29fe..0000000000 --- a/tests/pass/parse/integers/u32/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: u32, b: u32, c: u32) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/add.leo b/tests/pass/parse/integers/u64/add.leo deleted file mode 100644 index 28abe51201..0000000000 --- a/tests/pass/parse/integers/u64/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: u64) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/console_assert.leo b/tests/pass/parse/integers/u64/console_assert.leo deleted file mode 100644 index ac1d6d40c3..0000000000 --- a/tests/pass/parse/integers/u64/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/div.leo b/tests/pass/parse/integers/u64/div.leo deleted file mode 100644 index 059da236bb..0000000000 --- a/tests/pass/parse/integers/u64/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: u64) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/eq.leo b/tests/pass/parse/integers/u64/eq.leo deleted file mode 100644 index 990b2dad2d..0000000000 --- a/tests/pass/parse/integers/u64/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/ge.leo b/tests/pass/parse/integers/u64/ge.leo deleted file mode 100644 index 46ba36ceff..0000000000 --- a/tests/pass/parse/integers/u64/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/gt.leo b/tests/pass/parse/integers/u64/gt.leo deleted file mode 100644 index 7d3032c7f5..0000000000 --- a/tests/pass/parse/integers/u64/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/input.leo b/tests/pass/parse/integers/u64/input.leo deleted file mode 100644 index ac1d6d40c3..0000000000 --- a/tests/pass/parse/integers/u64/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/le.leo b/tests/pass/parse/integers/u64/le.leo deleted file mode 100644 index 625b38d2d9..0000000000 --- a/tests/pass/parse/integers/u64/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/lt.leo b/tests/pass/parse/integers/u64/lt.leo deleted file mode 100644 index ed379f7341..0000000000 --- a/tests/pass/parse/integers/u64/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/max.leo b/tests/pass/parse/integers/u64/max.leo deleted file mode 100644 index f14ac7ce64..0000000000 --- a/tests/pass/parse/integers/u64/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u64 = 18446744073709551615; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/max_fail.leo b/tests/pass/parse/integers/u64/max_fail.leo deleted file mode 100644 index d606c83585..0000000000 --- a/tests/pass/parse/integers/u64/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u64 = 18446744073709551616; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/min.leo b/tests/pass/parse/integers/u64/min.leo deleted file mode 100644 index b1da40b14c..0000000000 --- a/tests/pass/parse/integers/u64/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u64 = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/min_fail.leo b/tests/pass/parse/integers/u64/min_fail.leo deleted file mode 100644 index e58f1897e6..0000000000 --- a/tests/pass/parse/integers/u64/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u64 = -1; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/mod.rs b/tests/pass/parse/integers/u64/mod.rs deleted file mode 100644 index ec86c868f1..0000000000 --- a/tests/pass/parse/integers/u64/mod.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{IntegerType, U64Type, UnsignedIntegerType}; - -test_uint!( - TestU64, - u64, - IntegerType::Unsigned(UnsignedIntegerType::U64Type(U64Type {})), - UInt64 -); - -#[test] -fn test_u64_min() { - TestU64::test_min(); -} - -#[test] -fn test_u64_min_fail() { - TestU64::test_min_fail(); -} - -#[test] -fn test_u64_max() { - TestU64::test_max(); -} - -#[test] -fn test_u64_max_fail() { - TestU64::test_max_fail(); -} - -#[test] -fn test_u64_add() { - TestU64::test_add(); -} - -#[test] -fn test_u64_sub() { - TestU64::test_sub(); -} - -#[test] -fn test_u64_mul() { - TestU64::test_mul(); -} - -#[test] -fn test_u64_div() { - TestU64::test_div(); -} - -#[test] -fn test_u64_pow() { - TestU64::test_pow(); -} - -#[test] -fn test_u64_eq() { - TestU64::test_eq(); -} - -#[test] -fn test_u64_ne() { - TestU64::test_ne(); -} - -#[test] -fn test_u64_ge() { - TestU64::test_ge(); -} - -#[test] -fn test_u64_gt() { - TestU64::test_gt(); -} - -#[test] -fn test_u64_le() { - TestU64::test_le(); -} - -#[test] -fn test_u64_lt() { - TestU64::test_lt(); -} - -#[test] -fn test_u64_console_assert() { - TestU64::test_console_assert(); -} - -#[test] -fn test_u64_ternary() { - TestU64::test_ternary(); -} diff --git a/tests/pass/parse/integers/u64/mul.leo b/tests/pass/parse/integers/u64/mul.leo deleted file mode 100644 index 2633e6780c..0000000000 --- a/tests/pass/parse/integers/u64/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: u64) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/ne.leo b/tests/pass/parse/integers/u64/ne.leo deleted file mode 100644 index e47acbb1de..0000000000 --- a/tests/pass/parse/integers/u64/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/pow.leo b/tests/pass/parse/integers/u64/pow.leo deleted file mode 100644 index 64f0694ed1..0000000000 --- a/tests/pass/parse/integers/u64/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: u64) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/sub.leo b/tests/pass/parse/integers/u64/sub.leo deleted file mode 100644 index 9961f0f7b7..0000000000 --- a/tests/pass/parse/integers/u64/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u64, b: u64, c: u64) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u64/ternary.leo b/tests/pass/parse/integers/u64/ternary.leo deleted file mode 100644 index 4427cd0466..0000000000 --- a/tests/pass/parse/integers/u64/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: u64, b: u64, c: u64) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/add.leo b/tests/pass/parse/integers/u8/add.leo deleted file mode 100644 index 1b40e304d2..0000000000 --- a/tests/pass/parse/integers/u8/add.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: u8) { - console.assert(a + b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/console_assert.leo b/tests/pass/parse/integers/u8/console_assert.leo deleted file mode 100644 index 4d99dc106c..0000000000 --- a/tests/pass/parse/integers/u8/console_assert.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/div.leo b/tests/pass/parse/integers/u8/div.leo deleted file mode 100644 index 945aa94c30..0000000000 --- a/tests/pass/parse/integers/u8/div.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: u8) { - console.assert(a / b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/eq.leo b/tests/pass/parse/integers/u8/eq.leo deleted file mode 100644 index c2a487b0e7..0000000000 --- a/tests/pass/parse/integers/u8/eq.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: bool) { - console.assert(a == b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/ge.leo b/tests/pass/parse/integers/u8/ge.leo deleted file mode 100644 index d819422276..0000000000 --- a/tests/pass/parse/integers/u8/ge.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: bool) { - console.assert(a >= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/gt.leo b/tests/pass/parse/integers/u8/gt.leo deleted file mode 100644 index 87843f575f..0000000000 --- a/tests/pass/parse/integers/u8/gt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: bool) { - console.assert(a > b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/input.leo b/tests/pass/parse/integers/u8/input.leo deleted file mode 100644 index 4d99dc106c..0000000000 --- a/tests/pass/parse/integers/u8/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8) { - console.assert(a == b); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/le.leo b/tests/pass/parse/integers/u8/le.leo deleted file mode 100644 index 2607b7f3d1..0000000000 --- a/tests/pass/parse/integers/u8/le.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: bool) { - console.assert(a <= b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/lt.leo b/tests/pass/parse/integers/u8/lt.leo deleted file mode 100644 index 7495d0fe37..0000000000 --- a/tests/pass/parse/integers/u8/lt.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: bool) { - console.assert(a < b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/max.leo b/tests/pass/parse/integers/u8/max.leo deleted file mode 100644 index 03e82c9a5e..0000000000 --- a/tests/pass/parse/integers/u8/max.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u8 = 255; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/max_fail.leo b/tests/pass/parse/integers/u8/max_fail.leo deleted file mode 100644 index 01bb544601..0000000000 --- a/tests/pass/parse/integers/u8/max_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u8 = 256; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/min.leo b/tests/pass/parse/integers/u8/min.leo deleted file mode 100644 index 1db08a07b5..0000000000 --- a/tests/pass/parse/integers/u8/min.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u8 = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/min_fail.leo b/tests/pass/parse/integers/u8/min_fail.leo deleted file mode 100644 index 3cd8d46de7..0000000000 --- a/tests/pass/parse/integers/u8/min_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: u8 = -1; -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/mod.rs b/tests/pass/parse/integers/u8/mod.rs deleted file mode 100644 index a61e28246d..0000000000 --- a/tests/pass/parse/integers/u8/mod.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; -use leo_ast::InputValue; -use leo_input::types::{IntegerType, U8Type, UnsignedIntegerType}; - -test_uint!( - TestU8, - u8, - IntegerType::Unsigned(UnsignedIntegerType::U8Type(U8Type {})), - UInt8 -); - -#[test] -fn test_u8_min() { - TestU8::test_min(); -} - -#[test] -fn test_u8_min_fail() { - TestU8::test_min_fail(); -} - -#[test] -fn test_u8_max() { - TestU8::test_max(); -} - -#[test] -fn test_u8_max_fail() { - TestU8::test_max_fail(); -} - -#[test] -fn test_u8_add() { - TestU8::test_add(); -} - -#[test] -fn test_u8_sub() { - TestU8::test_sub(); -} - -#[test] -fn test_u8_mul() { - TestU8::test_mul(); -} - -#[test] -fn test_u8_div() { - TestU8::test_div(); -} - -#[test] -fn test_u8_pow() { - TestU8::test_pow(); -} - -#[test] -fn test_u8_eq() { - TestU8::test_eq(); -} - -#[test] -fn test_u8_ne() { - TestU8::test_ne(); -} - -#[test] -fn test_u8_ge() { - TestU8::test_ge(); -} - -#[test] -fn test_u8_gt() { - TestU8::test_gt(); -} - -#[test] -fn test_u8_le() { - TestU8::test_le(); -} - -#[test] -fn test_u8_lt() { - TestU8::test_lt(); -} - -#[test] -fn test_u8_console_assert() { - TestU8::test_console_assert(); -} - -#[test] -fn test_u8_ternary() { - TestU8::test_ternary(); -} diff --git a/tests/pass/parse/integers/u8/mul.leo b/tests/pass/parse/integers/u8/mul.leo deleted file mode 100644 index 11acf4688b..0000000000 --- a/tests/pass/parse/integers/u8/mul.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: u8) { - console.assert(a * b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/ne.leo b/tests/pass/parse/integers/u8/ne.leo deleted file mode 100644 index e75194a2f2..0000000000 --- a/tests/pass/parse/integers/u8/ne.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: bool) { - console.assert(a != b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/pow.leo b/tests/pass/parse/integers/u8/pow.leo deleted file mode 100644 index 928ab73b0d..0000000000 --- a/tests/pass/parse/integers/u8/pow.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: u8) { - console.assert(a ** b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/sub.leo b/tests/pass/parse/integers/u8/sub.leo deleted file mode 100644 index 1335409c29..0000000000 --- a/tests/pass/parse/integers/u8/sub.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: u8, b: u8, c: u8) { - console.assert(a - b == c); -} \ No newline at end of file diff --git a/tests/pass/parse/integers/u8/ternary.leo b/tests/pass/parse/integers/u8/ternary.leo deleted file mode 100644 index 5123a511cd..0000000000 --- a/tests/pass/parse/integers/u8/ternary.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(s: bool, a: u8, b: u8, c: u8) { - const r = s ? a : b; - - console.assert(r == c); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/array.leo b/tests/pass/parse/mutability/array.leo deleted file mode 100644 index ea63baaad2..0000000000 --- a/tests/pass/parse/mutability/array.leo +++ /dev/null @@ -1,5 +0,0 @@ -// Arrays are immutable by default. -function main() { - const a = [1u32]; - a[0] = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/array_mut.leo b/tests/pass/parse/mutability/array_mut.leo deleted file mode 100644 index 5d4db3b68a..0000000000 --- a/tests/pass/parse/mutability/array_mut.leo +++ /dev/null @@ -1,7 +0,0 @@ -// Adding the `mut` keyword makes an array variable mutable. -function main() { - let a = [1u32]; - a[0] = 0; - - console.assert(a[0] == 0u32); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/array_splice_mut.leo b/tests/pass/parse/mutability/array_splice_mut.leo deleted file mode 100644 index d13216600a..0000000000 --- a/tests/pass/parse/mutability/array_splice_mut.leo +++ /dev/null @@ -1,9 +0,0 @@ -// Adding the `mut` keyword makes an array variable mutable. -function main() { - let a = [1u32, 2u32, 3u32]; - a[0u32..2u32] = [4u32, 5u32]; - - console.assert(a[0] == 4u32); - console.assert(a[1] == 5u32); - console.assert(a[2] == 3u32); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/array_tuple_mut.leo b/tests/pass/parse/mutability/array_tuple_mut.leo deleted file mode 100644 index ed323d46da..0000000000 --- a/tests/pass/parse/mutability/array_tuple_mut.leo +++ /dev/null @@ -1,8 +0,0 @@ -// Adding the `mut` keyword makes an array variable mutable. -function main() { - let a = [(1u32, 2u32)]; - a[0u32].1 = 3u32; - - console.assert(a[0u32].0 == 1u32); - console.assert(a[0u32].1 == 3u32); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/circuit.leo b/tests/pass/parse/mutability/circuit.leo deleted file mode 100644 index 508595ef16..0000000000 --- a/tests/pass/parse/mutability/circuit.leo +++ /dev/null @@ -1,9 +0,0 @@ -// Circuits are immutable by default. -circuit Foo { - x: u32 -} - -function main() { - const a = Foo { x: 1 }; - a.x = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/circuit_function_mut.leo b/tests/pass/parse/mutability/circuit_function_mut.leo deleted file mode 100644 index c1bc941c94..0000000000 --- a/tests/pass/parse/mutability/circuit_function_mut.leo +++ /dev/null @@ -1,9 +0,0 @@ -// Adding the `mut` keyword makes a circuit variable mutable. -circuit Foo { - function bar() {} -} - -function main() { - let a = Foo { x: 1 }; - a.bar = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/circuit_mut.leo b/tests/pass/parse/mutability/circuit_mut.leo deleted file mode 100644 index f7067db11e..0000000000 --- a/tests/pass/parse/mutability/circuit_mut.leo +++ /dev/null @@ -1,11 +0,0 @@ -// Adding the `mut` keyword makes a circuit variable mutable. -circuit Foo { - x: u32 -} - -function main() { - let a = Foo { x: 1 }; - a.x = 0; - - console.assert(a.x == 0u32); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/circuit_static_function_mut.leo b/tests/pass/parse/mutability/circuit_static_function_mut.leo deleted file mode 100644 index c1bc941c94..0000000000 --- a/tests/pass/parse/mutability/circuit_static_function_mut.leo +++ /dev/null @@ -1,9 +0,0 @@ -// Adding the `mut` keyword makes a circuit variable mutable. -circuit Foo { - function bar() {} -} - -function main() { - let a = Foo { x: 1 }; - a.bar = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/circuit_variable_mut.leo b/tests/pass/parse/mutability/circuit_variable_mut.leo deleted file mode 100644 index f7067db11e..0000000000 --- a/tests/pass/parse/mutability/circuit_variable_mut.leo +++ /dev/null @@ -1,11 +0,0 @@ -// Adding the `mut` keyword makes a circuit variable mutable. -circuit Foo { - x: u32 -} - -function main() { - let a = Foo { x: 1 }; - a.x = 0; - - console.assert(a.x == 0u32); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/const.leo b/tests/pass/parse/mutability/const.leo deleted file mode 100644 index 6201e7c5af..0000000000 --- a/tests/pass/parse/mutability/const.leo +++ /dev/null @@ -1,5 +0,0 @@ -// Let variables are immutable by default. -function main() { - const a = 1u32; - a = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/function_input.leo b/tests/pass/parse/mutability/function_input.leo deleted file mode 100644 index 1ef3ce1f02..0000000000 --- a/tests/pass/parse/mutability/function_input.leo +++ /dev/null @@ -1,4 +0,0 @@ -// Function input are immutable by default. -function main(a: bool) { - a = false; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/function_input_mut.leo b/tests/pass/parse/mutability/function_input_mut.leo deleted file mode 100644 index 98739d78c7..0000000000 --- a/tests/pass/parse/mutability/function_input_mut.leo +++ /dev/null @@ -1,6 +0,0 @@ -// Function input are mutable by default. -function main(a: bool) { - a = true; - - console.assert(a == true); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/let.leo b/tests/pass/parse/mutability/let.leo deleted file mode 100644 index 105730adb7..0000000000 --- a/tests/pass/parse/mutability/let.leo +++ /dev/null @@ -1,5 +0,0 @@ -// Variables are immutable by default. -function main() { - const a = 1u32; - a = 0; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/let_mut.leo b/tests/pass/parse/mutability/let_mut.leo deleted file mode 100644 index cd1060d0d2..0000000000 --- a/tests/pass/parse/mutability/let_mut.leo +++ /dev/null @@ -1,7 +0,0 @@ -// Adding the `mut` keyword makes a variable mutable. -function main() { - let a = 1u32; - a = 0; - - console.assert(a == 0u32); -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/let_mut_nested.leo b/tests/pass/parse/mutability/let_mut_nested.leo deleted file mode 100644 index 93236ef4c6..0000000000 --- a/tests/pass/parse/mutability/let_mut_nested.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main () { - let x = 2u8; - let y = x; - const z = y / 2u8; -} \ No newline at end of file diff --git a/tests/pass/parse/mutability/swap.leo b/tests/pass/parse/mutability/swap.leo deleted file mode 100644 index 2d9ddb4279..0000000000 --- a/tests/pass/parse/mutability/swap.leo +++ /dev/null @@ -1,20 +0,0 @@ -// Swap two elements of an array. -function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { - const t = a[i]; - a[i] = a[j]; - a[j] = t; - return a -} - -function main() { - let arr: [u32; 2] = [0, 1]; - const expected: [u32; 2] = [1, 0]; - - // Do swap. - const actual = swap(arr, 0, 1); - - // Check result. - for i in 0..2 { - console.assert(expected[i] == actual[i]); - } -} \ No newline at end of file diff --git a/tests/pass/parse/statements/assert.leo b/tests/pass/parse/statements/assert.leo deleted file mode 100644 index f3d20b461d..0000000000 --- a/tests/pass/parse/statements/assert.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main(a: u32) { - if a == 1 { - console.assert(a == 1); - } else { - console.assert(a == 0); - } -} diff --git a/tests/pass/parse/statements/block.leo b/tests/pass/parse/statements/block.leo deleted file mode 100644 index ca8da645ec..0000000000 --- a/tests/pass/parse/statements/block.leo +++ /dev/null @@ -1,9 +0,0 @@ -function main() { - let x = 4u32; - - { - x = 5u32; - } - - console.assert(x == 5u32); -} \ No newline at end of file diff --git a/tests/pass/parse/statements/chain.leo b/tests/pass/parse/statements/chain.leo deleted file mode 100644 index 44d4e86243..0000000000 --- a/tests/pass/parse/statements/chain.leo +++ /dev/null @@ -1,13 +0,0 @@ -function main(a: u32, b: u32) { - let c = 0u32; - - if a == 1 { - c = 1; - } else if a == 2 { - c = 2; - } else { - c = 3; - } - - console.assert(c == b); -} \ No newline at end of file diff --git a/tests/pass/parse/statements/for_loop.leo b/tests/pass/parse/statements/for_loop.leo deleted file mode 100644 index db307f3c36..0000000000 --- a/tests/pass/parse/statements/for_loop.leo +++ /dev/null @@ -1,13 +0,0 @@ -function main(a: bool) { - let b = 0u32; - - if a { - for i in 0..4 { - b += i; - } - } - - const r: u32 = a ? 6 : 0; - - console.assert(r == b); -} diff --git a/tests/pass/parse/statements/multiple_returns.leo b/tests/pass/parse/statements/multiple_returns.leo deleted file mode 100644 index b8dd869b47..0000000000 --- a/tests/pass/parse/statements/multiple_returns.leo +++ /dev/null @@ -1,7 +0,0 @@ -function main(input) -> u32 { - if input.registers.a == 0u32 { - return 0u32 - } else { - return 1u32 - } -} \ No newline at end of file diff --git a/tests/pass/parse/statements/mutate.leo b/tests/pass/parse/statements/mutate.leo deleted file mode 100644 index 9bb124eefd..0000000000 --- a/tests/pass/parse/statements/mutate.leo +++ /dev/null @@ -1,15 +0,0 @@ -function main(a: u32) { - let b = 5u32; - - if a == 1 { - b = 1; - } else { - b = 0; - } - - if a == 1 { - console.assert(b == 1); - } else { - console.assert(b == 0); - } -} diff --git a/tests/pass/parse/statements/nested.leo b/tests/pass/parse/statements/nested.leo deleted file mode 100644 index 1849c2a339..0000000000 --- a/tests/pass/parse/statements/nested.leo +++ /dev/null @@ -1,12 +0,0 @@ -function main(a: bool, b: bool, c: u32) { - let d = 0u32; - - if a { - d += 1; - if b { - d += 2; - } - } - - console.assert(d == c); -} \ No newline at end of file diff --git a/tests/pass/parse/statements/num_returns_fail.leo b/tests/pass/parse/statements/num_returns_fail.leo deleted file mode 100644 index 14b2fe6ad0..0000000000 --- a/tests/pass/parse/statements/num_returns_fail.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() -> (bool, bool) { - return true -} \ No newline at end of file diff --git a/tests/pass/parse/statements/ternary_basic.leo b/tests/pass/parse/statements/ternary_basic.leo deleted file mode 100644 index 38359004a9..0000000000 --- a/tests/pass/parse/statements/ternary_basic.leo +++ /dev/null @@ -1,5 +0,0 @@ -function main(a: bool, b: bool) { - const c = a ? true : false; - - const d = c == b; -} \ No newline at end of file diff --git a/tests/pass/parse/syntax/compare_mismatched_types.leo b/tests/pass/parse/syntax/compare_mismatched_types.leo deleted file mode 100644 index 1ac81ab098..0000000000 --- a/tests/pass/parse/syntax/compare_mismatched_types.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a = -5i8 > 342u32; -} \ No newline at end of file diff --git a/tests/pass/parse/syntax/undefined.leo b/tests/pass/parse/syntax/undefined.leo deleted file mode 100644 index 856b07589a..0000000000 --- a/tests/pass/parse/syntax/undefined.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() -> bool { - return a -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/access.leo b/tests/pass/parse/tuples/access.leo deleted file mode 100644 index 9277f4ecc5..0000000000 --- a/tests/pass/parse/tuples/access.leo +++ /dev/null @@ -1,6 +0,0 @@ -function main() { - const a = (true, false); - - console.assert(a.0 == true); - console.assert(a.1 == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/basic.leo b/tests/pass/parse/tuples/basic.leo deleted file mode 100644 index 2e777f2797..0000000000 --- a/tests/pass/parse/tuples/basic.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a = (true, false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/function.leo b/tests/pass/parse/tuples/function.leo deleted file mode 100644 index 4222b858cb..0000000000 --- a/tests/pass/parse/tuples/function.leo +++ /dev/null @@ -1,10 +0,0 @@ -function foo() -> (bool, bool) { - return (true, false) -} - -function main() { - const a = foo(); - - console.assert(a.0 == true); - console.assert(a.1 == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/function_multiple.leo b/tests/pass/parse/tuples/function_multiple.leo deleted file mode 100644 index 73fbe277ae..0000000000 --- a/tests/pass/parse/tuples/function_multiple.leo +++ /dev/null @@ -1,10 +0,0 @@ -function foo() -> (bool, bool) { - return (true, false) -} - -function main() { - const (a, b) = foo(); - - console.assert(a == true); - console.assert(b == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/function_typed.leo b/tests/pass/parse/tuples/function_typed.leo deleted file mode 100644 index f89e7a3273..0000000000 --- a/tests/pass/parse/tuples/function_typed.leo +++ /dev/null @@ -1,10 +0,0 @@ -function foo() -> (bool, bool) { - return (true, false) -} - -function main() { - const a: (bool, bool) = foo(); - - console.assert(a.0 == true); - console.assert(a.1 == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/input.leo b/tests/pass/parse/tuples/input.leo deleted file mode 100644 index f7672a3b03..0000000000 --- a/tests/pass/parse/tuples/input.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main(a: (bool, bool)) { - -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/multiple.leo b/tests/pass/parse/tuples/multiple.leo deleted file mode 100644 index 2cb003b0e1..0000000000 --- a/tests/pass/parse/tuples/multiple.leo +++ /dev/null @@ -1,6 +0,0 @@ -function main() { - const (a, b) = (true, false); - - console.assert(a == true); - console.assert(b == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/multiple_typed.leo b/tests/pass/parse/tuples/multiple_typed.leo deleted file mode 100644 index bbe4a01858..0000000000 --- a/tests/pass/parse/tuples/multiple_typed.leo +++ /dev/null @@ -1,6 +0,0 @@ -function main() { - const (a, b): (bool, bool) = (true, false); - - console.assert(a == true); - console.assert(b == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/nested.leo b/tests/pass/parse/tuples/nested.leo deleted file mode 100644 index bbdb2394a8..0000000000 --- a/tests/pass/parse/tuples/nested.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a = (true, false); - const b = (true, a); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/nested_access.leo b/tests/pass/parse/tuples/nested_access.leo deleted file mode 100644 index f21fa59bba..0000000000 --- a/tests/pass/parse/tuples/nested_access.leo +++ /dev/null @@ -1,8 +0,0 @@ -function main() { - const a = (true, false); - const b = (true, a); - - console.assert(b.0 == true); - console.assert(b.1.0 == true); - console.assert(b.1.1 == false); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/nested_typed.leo b/tests/pass/parse/tuples/nested_typed.leo deleted file mode 100644 index 44a10b2a3e..0000000000 --- a/tests/pass/parse/tuples/nested_typed.leo +++ /dev/null @@ -1,4 +0,0 @@ -function main() { - const a = (true, false); - const b: (bool, (bool, bool)) = (true, a); -} \ No newline at end of file diff --git a/tests/pass/parse/tuples/typed.leo b/tests/pass/parse/tuples/typed.leo deleted file mode 100644 index 8f623fc148..0000000000 --- a/tests/pass/parse/tuples/typed.leo +++ /dev/null @@ -1,3 +0,0 @@ -function main() { - const a: (bool, bool) = (true, false); -} \ No newline at end of file