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 of type inference with repeated variables #1007

Open
kyoDralliam opened this issue Apr 21, 2017 · 3 comments
Open

Failure of type inference with repeated variables #1007

kyoDralliam opened this issue Apr 21, 2017 · 3 comments

Comments

@kyoDralliam
Copy link
Contributor

Lax-typechecking the following snippet

let f (x y : int) (w:(b:bool & (if b then equals x y else equals y x))) =
  match w with
  | (| b, Refl |) -> ()

fails with the error

(Error) (equals (?26524 x y w b) (?26524 x y w b)) is not a subtype of the expected type (match b with
	| true  -> (equals x y)
	|_  -> (equals y x))
@kyoDralliam
Copy link
Contributor Author

kyoDralliam commented Aug 9, 2017

The error has changed to Expected a trivial pre-condition in current master.

Note that there is now a way to bypass the error by encapsulating the if b then equals x y else equals y x :

let t x y b = if b then x == y else y == x

let f (x y : int) (w:(b:bool & t x y b)) =
  match w with
  | (| b, Refl #int #x |) -> ()

note that the explicit annotations on the Refl are compulsory...

@kyoDralliam
Copy link
Contributor Author

Going back to this issue, it seems strange that you need to introduce names that are not constrained nor used anywhere (in the previous code #int #x are just fresh variable names...)

@kyoDralliam
Copy link
Contributor Author

Actually, these variables should just not be bindable in pattern since they comes from parameters (related to #65)

@aseemr aseemr self-assigned this Mar 23, 2020
@aseemr aseemr added the milestone/everest-v1 We expect to solve this issue by the Everest v1 release. label Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants