Conversation
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
536855c to
2245765
Compare
| construct ~loc ~attrs (map_loc sub l) (map_opt (sub.pat sub) p) | ||
| | Ppat_variant (l, p) -> variant ~loc ~attrs l (map_opt (sub.pat sub) p) | ||
| | Ppat_record (lpl, cf) -> | ||
| | Ppat_record (lpl, cf, _rest) -> |
There was a problem hiding this comment.
I'm not sure about what should be done here
There was a problem hiding this comment.
good question: it goes to ast0 and then back during ppx, so any use of a ppx would discard this at the moment, and change the code
normally, one tries to encode additional ast information in special annotations, so they can be recovered on the way back (from_0)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 224576540e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| match pat.pat_desc with | ||
| | Tpat_record (_, _, Some rest) -> |
There was a problem hiding this comment.
Bind rest variables in nested record patterns
inject_record_rest_binding only handles cases where the top-level pattern is Tpat_record (_, _, Some rest). When a record-rest appears inside another pattern shape (for example a tuple, constructor, or-or pattern), no Precord_spread_new binding is emitted even though typing has already introduced rest as a bound identifier. This causes incorrect code generation for valid nested destructuring forms because the rest variable is referenced without being initialized from the matched record.
Useful? React with 👍 / 👎.
| | Ppat_record (pl, _, _rest) -> | ||
| List.iter | ||
| (fun {lid = lbl; x = p} -> | ||
| add bv lbl; |
There was a problem hiding this comment.
Track dependencies from record-rest annotations
The dependency walker now matches Ppat_record (pl, _, _rest) but never visits _rest. As a result, module/type paths used only in record-rest annotations (e.g. ...M.t as rest) are omitted from dependency collection, so changing those modules may not trigger recompilation or proper dependency invalidation.
Useful? React with 👍 / 👎.
| | PatRest rest_pat -> (fields, flag, Some rest_pat) | ||
| | PatUnderscore -> (fields, flag, rest)) |
There was a problem hiding this comment.
Reject duplicate record-rest clauses during parsing
parse_record_pattern stores rest as Some rest_pat every time it sees PatRest and does not check whether a previous rest was already parsed. This lets patterns with multiple rest clauses be accepted while silently discarding one clause, which is ambiguous and can mask user mistakes instead of producing a syntax error.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f835e3f28e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let rest_field_names = | ||
| List.map | ||
| (fun (l : Types.label_declaration) -> Ident.name l.ld_id) | ||
| rest_labels |
There was a problem hiding this comment.
Check rest record field types, not just field names
The new rest-pattern validation only compares field names (rest_field_names) and never unifies the rest type’s field types with the source record’s field types. That lets incompatible rest annotations type-check (for example, source b: string with rest type b: int), so rest.b is typed incorrectly and can break soundness at runtime.
Useful? React with 👍 / 👎.
| simplify ((p :: patl, bind Alias id arg action) :: rem) | ||
| | Tpat_record ([], _) -> (omega :: patl, action) :: simplify rem | ||
| | Tpat_record (lbls, closed) -> | ||
| | Tpat_record ([], _, _rest) -> (omega :: patl, action) :: simplify rem |
There was a problem hiding this comment.
Preserve rest binding for empty-field record patterns
The Tpat_record ([], _, _rest) fast path drops the rest binder entirely, so a pattern like {...Sub.t as rest} is simplified to _ without generating the rest binding. If such a pattern is accepted by parsing/type-checking, code that uses rest in the branch can compile to incorrect/unbound behavior.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da71513258
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73a9b5dd3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73a9b5dd3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 792d7084c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef14238e21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a54691411c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
dbe99a2 to
84b5246
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8317 +/- ##
==========================================
+ Coverage 74.42% 74.67% +0.25%
==========================================
Files 451 454 +3
Lines 61459 61990 +531
==========================================
+ Hits 45743 46294 +551
+ Misses 15716 15696 -20
🚀 New features to boost your workflow:
|
5b5fae2 to
9d0c34d
Compare
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8317 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0029c8382c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95022a9352
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe82b90d26
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2250243f9a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a87f7f9406
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | Tpat_record (fields, _, _rest) -> | ||
| List.concat (List.map (fun (_, _, p, _) -> pattern_variables p) fields) |
There was a problem hiding this comment.
Include rest binders in let-rec checks
For recursive value bindings that use a record-rest pattern, the rest identifier is a real binding but it is dropped here. In a case like let rec {...config as rest}: config = rest or an and binding that refers to rest, the let-rec safety pass builds ids without the rest binder, so it can treat the recursive reference as non-recursive and accept code that later emits a TDZ/self-reference instead of raising Illegal_letrec_expr.
Useful? React with 👍 / 👎.
| let pos_from = pat.Typedtree.pat_loc.loc_start in | ||
| (match pat.pat_desc with | ||
| | Typedtree.Tpat_record (cases, _clodsedFlag) -> | ||
| | Typedtree.Tpat_record (cases, _clodsedFlag, _rest) -> |
There was a problem hiding this comment.
Track rest type annotations in dead-type analysis
When analyze_types is enabled, this branch records only the explicit record field labels and ignores the new _rest payload. Since the typed-tree mapper also leaves record_pat_rest untouched, a type referenced only by a rest annotation such as ...SubConfig.t as rest gets no reference recorded and can be reported or removed as dead even though the code needs it.
Useful? React with 👍 / 👎.
fixes #8311