From 1607d1bafb0bf0386997b86601007fe7398406ad Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 7 Feb 2025 11:39:19 +0100 Subject: [PATCH] singular on 1 args --- compiler/ml/typecore.ml | 2 +- .../super_errors/expected/arity_mismatch.res.expected | 2 +- .../super_errors/expected/method_arity_mismatch.res.expected | 2 +- .../super_errors/expected/moreArguments1.res.expected | 2 +- .../super_errors/expected/moreArguments2.res.expected | 2 +- .../super_errors/expected/moreArguments3.res.expected | 2 +- .../super_errors/expected/moreArguments4.res.expected | 2 +- .../super_errors/expected/moreArguments5.res.expected | 2 +- .../super_errors/expected/opt_args_arity.res.expected | 3 ++- .../super_errors/expected/recursive_type.res.expected | 2 +- tests/build_tests/super_errors/expected/warnings1.res.expected | 2 +- tests/build_tests/super_errors/fixtures/opt_args_arity.res | 2 +- 12 files changed, 13 insertions(+), 12 deletions(-) diff --git a/compiler/ml/typecore.ml b/compiler/ml/typecore.ml index 55806aa33b..bf53609b9f 100644 --- a/compiler/ml/typecore.ml +++ b/compiler/ml/typecore.ml @@ -4464,7 +4464,7 @@ let report_error env ppf error = "@ @[It is applied with @{%d@} argument%s but it requires \ @{%d@}.@]@]" args - (if args = 0 then "" else "s") + (if args = 1 then "" else "s") arity | Field_not_optional (name, typ) -> fprintf ppf "Field @{%s@} is not optional in type %a. Use without ?" diff --git a/tests/build_tests/super_errors/expected/arity_mismatch.res.expected b/tests/build_tests/super_errors/expected/arity_mismatch.res.expected index 0bef35b03c..40b7bc2359 100644 --- a/tests/build_tests/super_errors/expected/arity_mismatch.res.expected +++ b/tests/build_tests/super_errors/expected/arity_mismatch.res.expected @@ -7,4 +7,4 @@ 3 │ This function has type (~f: 'a => 'a, unit) => int - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/method_arity_mismatch.res.expected b/tests/build_tests/super_errors/expected/method_arity_mismatch.res.expected index 62429ee2f4..03f0671056 100644 --- a/tests/build_tests/super_errors/expected/method_arity_mismatch.res.expected +++ b/tests/build_tests/super_errors/expected/method_arity_mismatch.res.expected @@ -9,4 +9,4 @@ 5 │ This function has type (int, int) => unit - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/moreArguments1.res.expected b/tests/build_tests/super_errors/expected/moreArguments1.res.expected index 7741f1c020..4e97918003 100644 --- a/tests/build_tests/super_errors/expected/moreArguments1.res.expected +++ b/tests/build_tests/super_errors/expected/moreArguments1.res.expected @@ -7,4 +7,4 @@ 3 │ This function has type (~a: int, ~b: int) => int - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/moreArguments2.res.expected b/tests/build_tests/super_errors/expected/moreArguments2.res.expected index 4ce85c8818..90b03e1d46 100644 --- a/tests/build_tests/super_errors/expected/moreArguments2.res.expected +++ b/tests/build_tests/super_errors/expected/moreArguments2.res.expected @@ -7,4 +7,4 @@ 3 │ This function has type (int, int) => int - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/moreArguments3.res.expected b/tests/build_tests/super_errors/expected/moreArguments3.res.expected index bb9eec13f8..9bbbaca9a3 100644 --- a/tests/build_tests/super_errors/expected/moreArguments3.res.expected +++ b/tests/build_tests/super_errors/expected/moreArguments3.res.expected @@ -7,4 +7,4 @@ 3 │ This function has type (int, int, 'a, 'b) => int - It is applied with 1 arguments but it requires 4. \ No newline at end of file + It is applied with 1 argument but it requires 4. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/moreArguments4.res.expected b/tests/build_tests/super_errors/expected/moreArguments4.res.expected index ac90eb4320..17fa54bee7 100644 --- a/tests/build_tests/super_errors/expected/moreArguments4.res.expected +++ b/tests/build_tests/super_errors/expected/moreArguments4.res.expected @@ -7,4 +7,4 @@ 3 │ This function has type (int, ~b: int, ~c: 'a, ~d: 'b) => int - It is applied with 1 arguments but it requires 4. \ No newline at end of file + It is applied with 1 argument but it requires 4. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/moreArguments5.res.expected b/tests/build_tests/super_errors/expected/moreArguments5.res.expected index 0def8a7959..e0ec49e0d5 100644 --- a/tests/build_tests/super_errors/expected/moreArguments5.res.expected +++ b/tests/build_tests/super_errors/expected/moreArguments5.res.expected @@ -8,4 +8,4 @@ 6 │ This function has type (int, 'a, 'b, 'c) => Sub.a - It is applied with 1 arguments but it requires 4. \ No newline at end of file + It is applied with 1 argument but it requires 4. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/opt_args_arity.res.expected b/tests/build_tests/super_errors/expected/opt_args_arity.res.expected index 3d2fbdd0ff..67fc28c1ab 100644 --- a/tests/build_tests/super_errors/expected/opt_args_arity.res.expected +++ b/tests/build_tests/super_errors/expected/opt_args_arity.res.expected @@ -4,6 +4,7 @@ 1 │ let f = (~a=0, b, c) => a + b + c 2 │ let x = f(42) + 3 │ This function has type (~a: int=?, int, int) => int - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/recursive_type.res.expected b/tests/build_tests/super_errors/expected/recursive_type.res.expected index 9631bcfa3f..ebb72770eb 100644 --- a/tests/build_tests/super_errors/expected/recursive_type.res.expected +++ b/tests/build_tests/super_errors/expected/recursive_type.res.expected @@ -10,4 +10,4 @@ This function has type ((option<'a>, ([> #List(list<'b>)] as 'b)) => 'c, 'd) => 'c - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/expected/warnings1.res.expected b/tests/build_tests/super_errors/expected/warnings1.res.expected index 3916a8625b..4b94a89f5a 100644 --- a/tests/build_tests/super_errors/expected/warnings1.res.expected +++ b/tests/build_tests/super_errors/expected/warnings1.res.expected @@ -9,4 +9,4 @@ 5 │ } This function has type (int, int) => int - It is applied with 1 arguments but it requires 2. \ No newline at end of file + It is applied with 1 argument but it requires 2. \ No newline at end of file diff --git a/tests/build_tests/super_errors/fixtures/opt_args_arity.res b/tests/build_tests/super_errors/fixtures/opt_args_arity.res index 98dc43e248..14dc2994d8 100644 --- a/tests/build_tests/super_errors/fixtures/opt_args_arity.res +++ b/tests/build_tests/super_errors/fixtures/opt_args_arity.res @@ -1,2 +1,2 @@ let f = (~a=0, b, c) => a + b + c -let x = f(42) \ No newline at end of file +let x = f(42)