Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Error message for optional arguments is incorrect. #459

Closed
johnridesabike opened this issue Sep 2, 2021 · 2 comments
Closed

Error message for optional arguments is incorrect. #459

johnridesabike opened this issue Sep 2, 2021 · 2 comments

Comments

@johnridesabike
Copy link

johnridesabike commented Sep 2, 2021

module M: {
  let f: (~a: int) => int
} = {
  let f = (~a=1) => 1
}

Error message:

Signature mismatch:
  ...
  Values do not match:
    let f: (~?a: int) => int
  is not included in
    let f: (~a: int) => int

If the user tries to use the syntax in the message, let f: (~?a: int) => int, then it does not fix the error. To make it weirder, it seems like the parser just ignores the ? in ~?a and reports it as if it was written ~a.

Edit: here's a possibly related issue:

the rescript dump command for the implementation will output the interface without “=?” part, and it will not compile.

@amiralies
Copy link
Contributor

I think this is related to #447 (unreleased)

@IwanKaramazow
Copy link
Contributor

IwanKaramazow commented Sep 6, 2021

Added an extra test case, this was already fixed in master.
#447 fixes the errors not being reported. (Thanks to @amiralies)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants