From 0e2675d44816c62953aba258cd3d941cc6c5aba9 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Sun, 27 Sep 2026 15:09:15 +0200 Subject: [PATCH 1/2] Make parsetree expression attributes immutable Signed-off-by: Christoph Knittel --- compiler/ml/parsetree.ml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/ml/parsetree.ml b/compiler/ml/parsetree.ml index c1fed9be38..f8e771eee8 100644 --- a/compiler/ml/parsetree.ml +++ b/compiler/ml/parsetree.ml @@ -262,8 +262,7 @@ and pattern_desc = and expression = { pexp_desc: expression_desc; pexp_loc: Location.t; - (* Hack: made pexp_attributes mutable for use in analysis exe. Please do not use elsewhere! *) - mutable pexp_attributes: attributes; (* ... [@id1] [@id2] *) + pexp_attributes: attributes; (* ... [@id1] [@id2] *) } and expression_desc = From cfd2c2ab8b0845ee6af2b02292b2a976e3553a56 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Sun, 27 Sep 2026 15:12:28 +0200 Subject: [PATCH 2/2] Document immutable expression attributes Signed-off-by: Christoph Knittel --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a81f259ce0..e9732e00ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ #### :house: Internal +- Make expression attributes immutable in the current parsetree, now that editor refactors construct new expression nodes. https://github.com/rescript-lang/rescript/pull/8685 - Remove the unused `pat_record_label` alias from the current parsetree. https://github.com/rescript-lang/rescript/pull/8684 - Remove the unused `Ppat_open` and `Tpat_open` AST nodes, with current-AST and CMT format bumps. https://github.com/rescript-lang/rescript/pull/8682 - Represent ternary expressions with a dedicated parsetree node. https://github.com/rescript-lang/rescript/pull/8674