Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad error message when applying a function to too many arguments #446

Open
n-osborne opened this issue Jan 23, 2025 · 0 comments
Open

Bad error message when applying a function to too many arguments #446

n-osborne opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working type-checker

Comments

@n-osborne
Copy link
Contributor

Running the Gospel type-checker on a file foo.mli containing:

(*@ open Sequence *)

(*@ function f (s : 'a sequence) : integer = length empty empty *)

will display the following error message:

$ deq gospel check foo.mli 
File "foo.mli", line 3, characters 45-51:
3 | (*@ function f (s : 'a sequence) : integer = length empty empty *)
                                                 ^^^^^^
Error: This term has type integer but a term was expected of type
       'a657 sequence -> 'a658.

In contrast, running ocamlc on the corresponding foo.ml file containing:

let f x = List.length x x

will display the more informative messages:

λ ocamlc foo.ml 
File "foo.ml", line 1, characters 10-25:
1 | let f x = List.length x x
              ^^^^^^^^^^^^^^^
Error: The function List.length has type 'a list -> int
       It is applied to too many arguments
File "foo.ml", line 1, characters 24-25:
1 | let f x = List.length x x
                            ^
  This extra argument is not expected.
@n-osborne n-osborne added bug Something isn't working type-checker labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type-checker
Projects
None yet
Development

No branches or pull requests

1 participant