parent
80858387f6
commit
96387e3437
|
@ -42,6 +42,7 @@
|
|||
- **aiken-lang**: function aliases now resolved to the module and function name in codegen. @Microproofs
|
||||
- **aiken-lang**: fix indentation of pipelines to remain a multiple of the base indent increment. @KtorZ
|
||||
- **aiken-lang**: forbid presence of non-serialisable data-types in compound structures like List and Tuple. @KtorZ
|
||||
- **aiken-lang**: fix 'given' arity reported by 'incorrect arity' error message. @rvcas
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -1595,6 +1595,57 @@ fn pipe_with_wrong_type_and_full_args() {
|
|||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pipe_wrong_arity_partially_applied() {
|
||||
let source_code = r#"
|
||||
fn f(_a: Int, _b: Int, _c: Int) -> Int {
|
||||
todo
|
||||
}
|
||||
|
||||
test foo() {
|
||||
0 |> f(0)
|
||||
}
|
||||
"#;
|
||||
|
||||
assert!(matches!(
|
||||
check(parse(source_code)),
|
||||
Err((_, Error::IncorrectFieldsArity { given, expected, .. })) if given == 2 && expected == 3
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pipe_wrong_arity_fully_saturated() {
|
||||
let source_code = r#"
|
||||
fn f(_a: Int, _b: Int, _c: Int) -> Int {
|
||||
todo
|
||||
}
|
||||
|
||||
test foo() {
|
||||
0 |> f(0, 0, 0)
|
||||
}
|
||||
"#;
|
||||
|
||||
assert!(matches!(
|
||||
check(parse(source_code)),
|
||||
Err((_, Error::NotFn { .. }))
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pipe_wrong_arity_fully_saturated_return_fn() {
|
||||
let source_code = r#"
|
||||
fn f(_a: Int, _b: Int, _c: Int) -> fn(Int) -> Int {
|
||||
todo
|
||||
}
|
||||
|
||||
test foo() {
|
||||
(0 |> f(0, 0, 0)) == 0
|
||||
}
|
||||
"#;
|
||||
|
||||
assert!(check(parse(source_code)).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fuzzer_ok_basic() {
|
||||
let source_code = r#"
|
||||
|
|
|
@ -92,7 +92,7 @@ impl<'a, 'b, 'c> PipeTyper<'a, 'b, 'c> {
|
|||
|
||||
match fun.tipo().fn_arity() {
|
||||
// Rewrite as right(left, ..args)
|
||||
Some(arity) if arity == arguments.len() + 1 => {
|
||||
Some(arity) if arguments.len() < arity => {
|
||||
self.infer_insert_pipe(fun, arguments, location)?
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue