Commit 8da810b
disambiguate optional labels
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.ninja1 parent 4989831 commit 8da810b
File tree
5 files changed
+50
-4
lines changed- jscomp
- ml
- test
5 files changed
+50
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
314 | 320 | | |
315 | 321 | | |
316 | 322 | | |
| |||
843 | 849 | | |
844 | 850 | | |
845 | 851 | | |
846 | | - | |
847 | | - | |
848 | | - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
849 | 861 | | |
850 | 862 | | |
851 | 863 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Large diffs are not rendered by default.
0 commit comments