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

failure to infer that a type is a pair #333

Closed
oskgo opened this issue Feb 3, 2023 · 4 comments
Closed

failure to infer that a type is a pair #333

oskgo opened this issue Feb 3, 2023 · 4 comments

Comments

@oskgo
Copy link
Contributor

oskgo commented Feb 3, 2023

The following code fails even though it should be possible to infer that x is a tuple:

op foo ['a]: ('a -> bool) -> 'a -> bool.

op bar = foo (fun x => x.`1 = x.`2) (true, true).

Adding a type annotation makes this succeed:

op bar = foo (fun (x: _ * _) => x.`1 = x.`2) (true, true).
@fdupress
Copy link
Member

fdupress commented Feb 3, 2023

Unfortunately, we can't infer that it's a pair: the projectors are generic in the size of the tuple.

You can fix it for pairs by using fst and snd instead of the generic projectors.

@oskgo
Copy link
Contributor Author

oskgo commented Feb 3, 2023

EasyCrypt cannot infer the size of the tuple from the (true, true) input? This also fails if you reorder the inputs of foo btw.

@fdupress
Copy link
Member

fdupress commented Feb 3, 2023

Yes, our type inference is simpler that it needs to be.
It is also not used to inform operator selection, which could be where it fails in this instance. (It tries to select which projection operator should be used, and stops when it can't even tell that the input is not a tuple.)

@oskgo oskgo changed the title failure to infer that a type is a tuple failure to infer that a type is a pair Feb 3, 2023
@strub
Copy link
Member

strub commented Sep 26, 2024

Superseded by #630

As François said, we are not even using a bidirectional type-checker.

@strub strub closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
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

3 participants