-
Notifications
You must be signed in to change notification settings - Fork 473
Open
Description
- In my example the deprecated warning and migration will only happen for
externalfunctions. I'd expect this to also work with top-levelletfunctions. - The migration will not create pipes unless used by the deprecated code. Somehow allowing migrating to pipes would be very helpful for migrating old pipe-last code that has been formatted into direct function calls.
- The migrated code retains unnecessary underscores. This is again something prevalent in code manually migrated from the pipe-last to pipe-first operator.
Example tested on ReScript 12 RC3:
@deprecated({
reason: "something",
migrate: %insert.unlabelledArgument(1)->map2(%insert.unlabelledArgument(0)),
})
@val
external map: ('a => 'b, 'a) => 'b = "something"
/* let map = (fn, a) => fn(a) */
let map2 = (a, fn) => fn(a)
let test = a => {
let fn = x => x * x
map(fn, a) + a->map(fn, _)
}Output:
let test = a => {
let fn = x => x * x
map2(a, fn) + a->map2(_, fn)
}Desired output:
let test = a => {
let fn = x => x * x
a->map2(fn) + a->map2(fn)
}Metadata
Metadata
Assignees
Labels
No labels