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 4040- More autocomplete improvements involving modules and module types. https://github.com/rescript-lang/rescript/pull/7795
4141- Autocomplete ` @react.componentWithProps ` attribute. https://github.com/rescript-lang/rescript/pull/7812
4242- 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
4344
4445#### :house : Internal
4546
Original file line number Diff line number Diff line change @@ -4598,8 +4598,14 @@ let report_error env loc ppf error =
45984598 " @[Exception patterns must be at the top level of a match case.@]"
45994599 | Inlined_record_escape ->
46004600 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"
46034609 | Inlined_record_expected ->
46044610 fprintf ppf " @[This constructor expects an inlined record argument.@]"
46054611 | 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