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

Should the type-checker force returned tuples to be destructed? #383

Open
n-osborne opened this issue Feb 21, 2024 · 0 comments
Open

Should the type-checker force returned tuples to be destructed? #383

n-osborne opened this issue Feb 21, 2024 · 0 comments

Comments

@n-osborne
Copy link
Contributor

n-osborne commented Feb 21, 2024

Currently, Gospel doesn't accept:

val f : int -> int * int
(*@ y = f x *)
$ gospel check file.mli
2 | (*@ y = f x *)
            ^
File "file.mli", line 2, characters 8-9:
Error: Type checking error: too few returned values: when a function returns
       a tuple, the gospel header should name each member of the tuple; so
       the header of a function returning a pair might be "x,y = ...".

But this is not the case for nested tuples, gospel check will be happy with

val f : int -> int * (int * int)
(*@ y,z = f x *)

But raises a syntax error with

val f : int -> int * (int * int)
(*@ y,(a,b) = f x *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant