feat(parser): add support for and/or chaining

This commit is contained in:
rvcas
2023-08-14 17:18:11 -04:00
committed by Lucas
parent 4a1ae9f412
commit ab3a418b9c
9 changed files with 53 additions and 9 deletions

View File

@@ -945,12 +945,12 @@ fn trace_non_strings() {
#[test]
fn trace_if_false_ok() {
let source_code = r#"
fn or(a: Bool, b: Bool) {
fn or_func(a: Bool, b: Bool) {
(a || b)?
}
test foo() {
or(True, False)?
or_func(True, False)?
}
test bar() {

View File

@@ -250,7 +250,7 @@ fn format_nested_function_calls() {
_ -> fail "expected inline datum"
},
]
|> list.and
|> list.and_func
}
"#
);

View File

@@ -1,6 +1,6 @@
---
source: crates/aiken-lang/src/tests/format.rs
description: "Code:\n\nfn foo(output) {\n [\n output.address.stake_credential == Some(\n Inline(\n VerificationKeyCredential(\n #\"66666666666666666666666666666666666666666666666666666666\",\n ))\n )\n ,\n when output.datum is {\n InlineDatum(_) -> True\n _ -> fail \"expected inline datum\"\n },\n ]\n |> list.and\n}\n"
description: "Code:\n\nfn foo(output) {\n [\n output.address.stake_credential == Some(\n Inline(\n VerificationKeyCredential(\n #\"66666666666666666666666666666666666666666666666666666666\",\n ))\n )\n ,\n when output.datum is {\n InlineDatum(_) -> True\n _ -> fail \"expected inline datum\"\n },\n ]\n |> list.and_func\n}\n"
---
fn foo(output) {
[
@@ -16,6 +16,6 @@ fn foo(output) {
_ -> fail @"expected inline datum"
},
]
|> list.and
|> list.and_func
}