-
Notifications
You must be signed in to change notification settings - Fork 469
Cannot instantiate variant with inline record that has optional fields #5824
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
Comments
Quick peek, I guess type declaration for optional field record as constructor argument is needed. I think cristianoc can fix super fast, but I'll look at it too. |
Another quick look, then I thought we need to add more information to and record_representation =
...
| Record_inlined of (* Inlined record *)
{ tag : int ; name : string; num_nonconsts : int; optional_labels : string list} (* <- here *)
...
| Record_optional_labels of string list (* List of optional labels *) |
That looks like a good way to go. |
Thanks for your feedback. OK I'll take and try to fix it. |
@tsnobip Can you try it again with |
I tried on master, it worked and generated this as expected: // Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
var foo = /* Foo */{
name: "foo"
};
exports.foo = foo;
/* No side effect */ |
I've noticed you can define a variant with an inline record that optional fields, but you can't instantiate it.
Example:
We should either forbid the creation of such a type or allow to instantiate it.
The text was updated successfully, but these errors were encountered: