fix: builtins using the incorrect data to type conversion when used as a function param.
This commit is contained in:
parent
db369da96e
commit
226556bdd6
|
@ -22,6 +22,7 @@
|
|||
- **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
|
||||
- **aiken-lang**: Fix for builtins using the incorrect data to type conversion when used as a function param.
|
||||
|
||||
## v1.0.10-alpha - 2023-06-13
|
||||
|
||||
|
|
|
@ -4168,6 +4168,11 @@ impl<'a> CodeGenerator<'a> {
|
|||
arg_vec.push(arg_stack.pop().unwrap());
|
||||
}
|
||||
|
||||
let tipo = match tipo.as_ref() {
|
||||
Type::Fn { ret, .. } => ret,
|
||||
_ => &tipo,
|
||||
};
|
||||
|
||||
let term = match &func {
|
||||
DefaultFunction::IfThenElse
|
||||
| DefaultFunction::ChooseUnit
|
||||
|
@ -4181,11 +4186,11 @@ impl<'a> CodeGenerator<'a> {
|
|||
DefaultFunction::FstPair
|
||||
| DefaultFunction::SndPair
|
||||
| DefaultFunction::HeadList => {
|
||||
builder::undata_builtin(&func, count, &tipo, arg_vec)
|
||||
builder::undata_builtin(&func, count, tipo, arg_vec)
|
||||
}
|
||||
|
||||
DefaultFunction::MkCons | DefaultFunction::MkPairData => {
|
||||
builder::to_data_builtin(&func, count, &tipo, arg_vec)
|
||||
builder::to_data_builtin(&func, count, tipo, arg_vec)
|
||||
}
|
||||
_ => {
|
||||
let mut term: Term<Name> = func.into();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use aiken/builtin.{snd_pair}
|
||||
use aiken/cbor
|
||||
use aiken/list
|
||||
|
||||
test tuple_when() {
|
||||
|
@ -20,3 +22,8 @@ test tuple_when() {
|
|||
)
|
||||
list.length(filtered) > 0
|
||||
}
|
||||
|
||||
test t() {
|
||||
trace cbor.diagnostic(list.map([(#"", 20)], snd_pair))
|
||||
True
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue