Skip to content

Fix issue where an empty record literal {} expected to have a non-record type would type check #5729

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

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Fix printing of comments inside JSX tag https://github.com/rescript-lang/syntax/pull/664
- Fix issue where formatter erases tail comments inside JSX tag https://github.com/rescript-lang/syntax/issues/663
- Fix issue where the JSX prop has type annotation of the first class module https://github.com/rescript-lang/syntax/pull/666
- Fix issue where an empty record literal {} expected to have a non-record type would type check https://github.com/rescript-lang/rescript-compiler/pull/5729

#### :eyeglasses: Spec Compliance

Expand Down
4 changes: 2 additions & 2 deletions jscomp/main/builtin_cmi_datasets.ml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jscomp/ml/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ and type_expect_ ?in_function ?(recarg=Rejected) env sexp ty_expected =
raise(Error(loc, env, Labels_missing labels_missing));
[||], representation
| [], _ ->
if fields = [] then
if fields = [] && repr_opt <> None then
[||], Record_optional_labels []
else
raise(Error(loc, env, Empty_record_literal)) in
Expand Down
6 changes: 3 additions & 3 deletions lib/4.06.1/unstable/js_compiler.ml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/4.06.1/unstable/js_playground_compiler.ml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/4.06.1/whole_compiler.ml

Large diffs are not rendered by default.