-
Notifications
You must be signed in to change notification settings - Fork 469
False "unused open" warning #6752
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
Labels
Comments
cristianoc
added a commit
that referenced
this issue
May 30, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open.
cristianoc
added a commit
that referenced
this issue
Jun 6, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open.
Fixed in #6798 |
cristianoc
added a commit
that referenced
this issue
Jun 7, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open.
cknitt
pushed a commit
that referenced
this issue
Jun 15, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open. # Conflicts: # CHANGELOG.md # jscomp/test/build.ninja
cknitt
pushed a commit
that referenced
this issue
Jun 16, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open. # Conflicts: # CHANGELOG.md # jscomp/test/build.ninja
cknitt
pushed a commit
that referenced
this issue
Jun 16, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open. # Conflicts: # CHANGELOG.md # jscomp/test/build.ninja
cknitt
pushed a commit
that referenced
this issue
Jun 16, 2024
When disambiguating record types, there's a check that all the labels are supplied when constructing a record. While not supplying all the labels is supported in case of optional labels, the order of disambiguation is affected by the presence of optional labels. Example: ```res type t1 = {x:int, y:int} type t2 = {x:int, y:int, z?:int} let v = {x:3, y:4} ``` Currently `v` has type `t1`, while it's perfectly fine for it to have type `t2`. In particular, the normal shadowing behaviour that applies without optional labels, does not happen. (If you remove `z` from the second type definition, then the normal shadowing happens, and `v` gets type `t2`. This wip changes the disambiguation so that supplying at least all the mandatory labels is enough in disambiguation. The change also addresses the issue #6752 of spurious warning of unused open. # Conflicts: # CHANGELOG.md # jscomp/test/build.ninja
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Examples run in the playground, with v11.1.0.
Consider the following snippet:
Pasting this example code into the playground successfully compiles, but with a warning:
Yet, if we remove this 'unused' open,
we get a compiler error (as expected by module scoping)
Interestingly, the warning disappears if remove the value field:
or pass a value for it:
The text was updated successfully, but these errors were encountered: