Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

We've found a bug for you!
/.../fixtures/unbound_record_field.res:3:6-21

1 │ let foo = x =>
2 │ switch x {
3 │ | {someUnknownField: 123} => ()
4 │ }
5 │

someUnknownField refers to a record field, but no corresponding record type is in scope.

If it's defined in another module or file, bring it into scope by:
- Prefixing the field name with the module name: TheModule.someUnknownField
- Or specifying the record type explicitly:
let theValue: TheModule.theType = {someUnknownField: VALUE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let foo = x =>
switch x {
| {someUnknownField: 123} => ()
}
6 changes: 3 additions & 3 deletions jscomp/ml/typetexp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -910,10 +910,10 @@ let report_error env ppf = function
| Unbound_label lid ->
(* modified *)
Format.fprintf ppf "@[<v>\
@{<info>The record field %a can't be found.@}@,@,\
@{<info>%a@} refers to a record field, but no corresponding record type is in scope.@,@,\
If it's defined in another module or file, bring it into scope by:@,\
@[- Prefixing it with said module name:@ @{<info>TheModule.%a@}@]@,\
@[- Or specifying its type:@ @{<info>let theValue: TheModule.theType = {%a: VALUE}@}@]\
@[- Prefixing the field name with the module name:@ @{<info>TheModule.%a@}@]@,\
@[- Or specifying the record type explicitly:@ @{<info>let theValue: TheModule.theType = {%a: VALUE}@}@]\
@]"
Printtyp.longident lid
Printtyp.longident lid
Expand Down