Fix inlining copying a record literal to each use
Why
When Lam_beta_reduce inlines a call, it substituted a constant argument for each use of its parameter. A record, tuple or option literal compiles to a new object at each copy, so b === b on the parameter was false and each use allocated.
Beta reduction now substitutes only constants that allocate nothing. Other constants are bound to a variable, like any other argument.
A switch on the copied literal used to fold. To keep that, Lam_pass_remove_alias now folds a switch on a variable bound to a constant, as it already did for a string switch. This also folds switches on top-level variant constants in several existing tests.
modifiedJS record literal argument
type xy = {x: int, y: int} @inlinelet same = (b: xy) => b === b Console.log(same({x: 1, y: 2}))
js
Fixes #9490