-
Notifications
You must be signed in to change notification settings - Fork 455
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
Fix type error for variant constructor args as optional field record #5827
Conversation
7451c6e
to
7185e0a
Compare
I think this PR is ready to get a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great thanks.
Would you add a couple of tests for pattern matching analogous to those for records with optional fields.
Great! |
What branch does this PR go to? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks finished to me.
I think it could go into 10.1 as it's a low-risk change and replaces a type error that surprises users anyway.
If we go with 10.1, this should be based on that branch.
And once the PR is merged, then branch 10.1 should be merged into master again so this last PR is added.
jscomp/test/record_regression.res
Outdated
let foo1 = Foo({name: "foo"}) | ||
let foo2 = Foo({name: "foo", age: 3}) | ||
|
||
// should be type error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed 651ba2b
jscomp/test/record_regression.res
Outdated
@@ -100,3 +100,47 @@ let setAA = (ao: option<int>) => {aa: @ns.optional ao, bb: None} | |||
// @ns.optional bb: int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-existing, but these @ns.optional
in the file above here are unnecessary since there's proper syntax for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed 651ba2b
in the inlined record
71d3033
to
651ba2b
Compare
There were too many conflicts to rebase to Now it is rebased to the |
CHANGELOG.md
Outdated
|
||
#### :bug: Bug Fix | ||
|
||
- Fix issue where optional field in the inlined record caused the type error https://github.com/rescript-lang/rescript-compiler/pull/5827 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix issue where optional fields in inline records were not supported and would cause type errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bbf2397
to
dedc12f
Compare
This PR fixes #5824