fix: issue with tuple clause
It was not consuming the next case if there was no condition being checked in the clause. Now it properly always consumes the next clause unless last clause.
This commit is contained in:
parent
5362714a63
commit
dbfa08a5a7
|
@ -17,6 +17,9 @@
|
||||||
afterwards in nested list cases.
|
afterwards in nested list cases.
|
||||||
- **aiken-lang**: Fix for all elements were being destructured in tuple clauses
|
- **aiken-lang**: Fix for all elements were being destructured in tuple clauses
|
||||||
even if not used.
|
even if not used.
|
||||||
|
- **aiken-lang**: Fix for tuple clause not consuming the next case causing
|
||||||
|
incomplete contracts. Now tuple clause will always consume the next case
|
||||||
|
unless it is the final clause
|
||||||
|
|
||||||
## v1.0.10-alpha - 2023-06-13
|
## v1.0.10-alpha - 2023-06-13
|
||||||
|
|
||||||
|
|
|
@ -969,7 +969,8 @@ impl<'a> CodeGenerator<'a> {
|
||||||
subject_name,
|
subject_name,
|
||||||
indices_to_define,
|
indices_to_define,
|
||||||
prev_defined_tuple_indices,
|
prev_defined_tuple_indices,
|
||||||
*clause_properties.is_complex_clause(),
|
*clause_properties.is_complex_clause()
|
||||||
|
|| (!*clause_properties.is_final_clause()),
|
||||||
clause_pattern_stack,
|
clause_pattern_stack,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
use other.{FFF, GGG}
|
use other.{FFF, GGG}
|
||||||
|
|
||||||
test thing1() {
|
test thing1() {
|
||||||
let x =
|
let x = other.FFF
|
||||||
other.FFF
|
|
||||||
|
|
||||||
x == FFF
|
x == FFF
|
||||||
}
|
}
|
||||||
|
|
||||||
test thing2() {
|
test thing2() {
|
||||||
let x =
|
let x = other.GGG(2)
|
||||||
other.GGG(2)
|
|
||||||
|
|
||||||
x == GGG(2)
|
x == GGG(2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# This file was generated by Aiken
|
||||||
|
# You typically do not need to edit this file
|
||||||
|
|
||||||
|
[[requirements]]
|
||||||
|
name = "aiken-lang/stdlib"
|
||||||
|
version = "main"
|
||||||
|
source = "github"
|
||||||
|
|
||||||
|
[[packages]]
|
||||||
|
name = "aiken-lang/stdlib"
|
||||||
|
version = "main"
|
||||||
|
requirements = []
|
||||||
|
source = "github"
|
|
@ -0,0 +1,8 @@
|
||||||
|
name = "aiken-lang/acceptance_test_083"
|
||||||
|
version = "0.0.0"
|
||||||
|
description = ""
|
||||||
|
|
||||||
|
[[dependencies]]
|
||||||
|
name = 'aiken-lang/stdlib'
|
||||||
|
version = 'main'
|
||||||
|
source = 'github'
|
|
@ -0,0 +1,22 @@
|
||||||
|
use aiken/list
|
||||||
|
|
||||||
|
test tuple_when() {
|
||||||
|
let items =
|
||||||
|
[(#"", #"", 50), (#"aa", #"bb", 70)]
|
||||||
|
|
||||||
|
let amount = 70
|
||||||
|
let policy = #"aa"
|
||||||
|
|
||||||
|
let filtered =
|
||||||
|
list.filter(
|
||||||
|
items,
|
||||||
|
fn(item) {
|
||||||
|
when item is {
|
||||||
|
(token_policy, _, token_amount) ->
|
||||||
|
amount == token_amount && policy == token_policy
|
||||||
|
_ -> False
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
list.length(filtered) > 0
|
||||||
|
}
|
Loading…
Reference in New Issue