chore: update changelog

fix: Minor improvement to record update to use empty list instead of the null list from a record fields list.
This commit is contained in:
microproofs 2023-06-01 12:22:42 -04:00
parent fb5f81d634
commit 6955f79035
3 changed files with 18 additions and 8 deletions

View File

@ -12,6 +12,10 @@
- **aiken-lang**: forced new line in formatter for assignments
- **aiken-lang**: Incorrect parsing of generic type annotation prefixed with module
- **aiken-lang**: Incorrect handling of comments at end of a file when newline not present
- **aiken-lang**: Record update in code gen is now flexible enough to support fields being passed in any order.
- **aiken-lang**: Record update now produces better uplc code then creating a record by the normal instantiation.
- **aiken-lang**: Issue with Constructors being passed as functions to other function arguments was fixed.
## v1.0.6-alpha - 2023-05-17

View File

@ -206,6 +206,7 @@ impl<'a> CodeGenerator<'a> {
version: (1, 0, 0),
term,
};
program = aiken_optimize_and_intern(program);
// This is very important to call here.
@ -4777,11 +4778,16 @@ impl<'a> CodeGenerator<'a> {
Air::RecordUpdate {
highest_index,
indices,
tipo,
..
} => {
self.needs_field_access = true;
let tail_name_prefix = "__tail_index";
let data_type = lookup_data_type_by_tipo(&self.data_types, &tipo)
.unwrap_or_else(|| panic!("HOW DID YOU DO THIS ON BOOL OR VOID"));
let constructor_field_count = data_type.constructors[0].arguments.len();
let record = arg_stack.pop().unwrap();
let mut args = IndexMap::new();
@ -4842,11 +4848,13 @@ impl<'a> CodeGenerator<'a> {
let mut tail_list = Term::var(tail);
if index < prev_index {
for _ in index..prev_index {
tail_list = Term::tail_list().apply(tail_list);
}
tail_list = tail_list.repeat_tail_list(prev_index - index);
term = term.lambda(suffix_tail).apply(tail_list);
if prev_index == constructor_field_count {
term = term.lambda(suffix_tail).apply(Term::empty_list());
} else {
term = term.lambda(suffix_tail).apply(tail_list);
}
}
prev_index = index;
}

View File

@ -2783,7 +2783,7 @@ fn record_update_output_first_last_val() {
}
let next_output =
Output { ..prev_output, address: Address{thing: "script_hash_0"}, script_ref: None }
Output { ..prev_output, script_ref: None, address: Address{thing: "script_hash_0"} }
prev_output == next_output
}
@ -2821,9 +2821,7 @@ fn record_update_output_first_last_val() {
),
)
.lambda("tail_index_4")
.apply(
Term::tail_list().apply(Term::tail_list().apply(Term::var("tail_index_2"))),
)
.apply(Term::empty_list())
.lambda("tail_index_2")
.apply(Term::tail_list().apply(Term::var("tail_index_1")))
.lambda("tail_index_1")