Skip to content

Commit c5c8808

Browse files
authored
Tweak error message for not found record fields/constructors
Primarily, use the actual field or constructor names for more clarity. Also tweak the wording of the message slightly.
1 parent 8834a45 commit c5c8808

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jscomp/super_errors/super_typetexp.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ let report_error env ppf = function
109109
fprintf ppf "@[<v>\
110110
@{<info>The variant constructor %a can't be found.@}@,@,\
111111
@[<v 2>- If it's defined in another module or file, bring it into scope by:@,\
112-
@[- Annotating it with said module name:@ @{<info>let food = MyModule.Apple@}@]@,\
113-
@[- Or specifying its type:@ @{<info>let food: MyModule.fruit = Apple@}@]\
112+
@[- Prefixing it with said module name:@ @{<info>TheModule.%a@}@]@,\
113+
@[- Or specifying its type:@ @{<info>let theValue: TheModule.theType = %a@}@]\
114114
@]@,\
115115
- @[Constructors and modules are both capitalized.@ Did you want the latter?@ Then instead of @{<dim>let foo = Bar@}, try @{<info>module Foo = Bar@}.@]\
116116
@]"
@@ -121,8 +121,8 @@ let report_error env ppf = function
121121
fprintf ppf "@[<v>\
122122
@{<info>The record field %a can't be found.@}@,@,\
123123
If it's defined in another module or file, bring it into scope by:@,\
124-
@[- Annotating it with said module name:@ @{<info>let baby = {MyModule.age: 3}@}@]@,\
125-
@[- Or specifying its type:@ @{<info>let baby: MyModule.person = {age: 3}@}@]\
124+
@[- Prefixing it with said module name:@ @{<info>TheModule.%a@}@]@,\
125+
@[- Or specifying its type:@ @{<info>let theValue: TheModule.theType = {%a: VALUE}@}@]\
126126
@]"
127127
longident lid;
128128
Typetexp.spellcheck ppf fold_labels env lid

0 commit comments

Comments
 (0)