diff --git a/rescript-syntax/ppx_rescript_compat/ppx_rescript_compat.ml b/rescript-syntax/ppx_rescript_compat/ppx_rescript_compat.ml index 05109c60df..bad7dd5342 100644 --- a/rescript-syntax/ppx_rescript_compat/ppx_rescript_compat.ml +++ b/rescript-syntax/ppx_rescript_compat/ppx_rescript_compat.ml @@ -44,10 +44,11 @@ let expr_mapper (self : mapper) (expr : Parsetree.expression) = Melange_ppx.Ast_uncurry_apply.property_apply loc self obj name args; } | Pexp_send - ( ({ pexp_desc = Pexp_apply _ | Pexp_ident _; pexp_loc; _ } as subexpr), + ( ({ pexp_desc = Pexp_apply _ | Pexp_ident _ | Pexp_send _; pexp_loc; _ } as subexpr), arg ) -> (* ReScript removed the OCaml object system and abuses `Pexp_send` for `obj##property`. Here, we make that conversion. *) + let subexpr = self.expr self subexpr in { expr with pexp_desc = diff --git a/test/gh489.t b/test/gh489.t index 4872ae23cb..cf6a8f32b7 100644 --- a/test/gh489.t +++ b/test/gh489.t @@ -27,12 +27,15 @@ Now let's try with ReScript syntax type nonrec person = < age: int [@set ] > Js.t type nonrec entry = < person: person [@set ] > Js.t external entry : entry = "entry"[@@val ] - ;;(entry ## person)#age #= 99 + ;;((entry ## person) ## age) #= 99 $ rescript_syntax -print=ml foo.res > foo.ml $ melc foo.ml - melc: internal error, uncaught exception: - File "jscomp/frontend/ast_exp_apply.ml", line 252, characters 17-23: Assertion failed - - [125] + // Generated by Melange + 'use strict'; + + + entry.person.age = 99; + + /* Not a pure module */