Skip to content

Issue with record type spread not as first argument. #6293

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

Closed
cristianoc opened this issue Jun 8, 2023 · 1 comment · Fixed by #6305
Closed

Issue with record type spread not as first argument. #6293

cristianoc opened this issue Jun 8, 2023 · 1 comment · Fixed by #6305
Labels
Milestone

Comments

@cristianoc
Copy link
Collaborator

In the following, the type spread is accepted, so the type definitions type checks.
However, there are errors when trying to use fields from x.

type x = {
  x:int
}

type y = {
  y: int,
  ...x,
}

let getY = (v:y) => v.y

// error: This expression has type y The field x does not belong to type y
// let getX = (v:y) => v.x

//error: Some required record fields are missing:
// let v:y = {y:3}

// error: The field x does not belong to type y
// let v:y = {y:3, x:4}
@cristianoc cristianoc added the bug label Jun 8, 2023
@cristianoc cristianoc added this to the v11.0 milestone Jun 8, 2023
@cristianoc
Copy link
Collaborator Author

cristianoc commented Jun 8, 2023

The type declaration from the example was not allowed in the alpha release, and is allowed in the beta release but causes this issue.

CC @zth

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

Successfully merging a pull request may close this issue.

1 participant