File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed
tests/build_tests/super_errors Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 40
40
- More autocomplete improvements involving modules and module types. https://github.com/rescript-lang/rescript/pull/7795
41
41
- Autocomplete ` @react.componentWithProps ` attribute. https://github.com/rescript-lang/rescript/pull/7812
42
42
- Add some missing iframe attributes to ` domProps ` . https://github.com/rescript-lang/rescript/pull/7813
43
+ - Polish error message for inline record escaping scope. https://github.com/rescript-lang/rescript/pull/7808
43
44
44
45
#### :house : Internal
45
46
Original file line number Diff line number Diff line change @@ -4598,8 +4598,14 @@ let report_error env loc ppf error =
4598
4598
" @[Exception patterns must be at the top level of a match case.@]"
4599
4599
| Inlined_record_escape ->
4600
4600
fprintf ppf
4601
- " @[This form is not allowed as the type of the inlined record could \
4602
- escape.@]"
4601
+ " @[This use of an inlined record is not allowed: its anonymous type \
4602
+ would escape its constructor scope.@,\
4603
+ @,\
4604
+ Possible solutions: @,\
4605
+ - Destructure the fields you're interested in from the inline record@,\
4606
+ - Change the underlying type to use a defined record as payload instead \
4607
+ of an inline record. That will let you use the payload without \
4608
+ destructuring it first"
4603
4609
| Inlined_record_expected ->
4604
4610
fprintf ppf " @[This constructor expects an inlined record argument.@]"
4605
4611
| Invalid_extension_constructor_payload ->
Original file line number Diff line number Diff line change
1
+
2
+ [1;31mWe've found a bug for you![0m
3
+ [36m/.../fixtures/inline_record_escape.res[0m:[2m5:15[0m
4
+
5
+ 3 [2m│[0m let g = (v: x) =>
6
+ 4 [2m│[0m switch v {
7
+ [1;31m5[0m [2m│[0m | One(r) => [1;31mr[0m
8
+ 6 [2m│[0m }
9
+ 7 [2m│[0m
10
+
11
+ This use of an inlined record is not allowed: its anonymous type would escape its constructor scope.
12
+ Possible solutions:
13
+ - Destructure the fields you're interested in from the inline record
14
+ - Change the underlying type to use a defined record as payload instead of an inline record. That will let you use the payload without destructuring it first
Original file line number Diff line number Diff line change
1
+ type x = One ({test : bool })
2
+
3
+ let g = (v : x ) =>
4
+ switch v {
5
+ | One (r ) => r
6
+ }
You can’t perform that action at this time.
0 commit comments