Closed
Description
This:
@send external reduce: (array<'b>, ('a, 'b) => 'a, ~initialValue: 'a=?) => 'a = "reduce"
let reduce = (arr, initialValue, f) => reduce(arr, f, ~initialValue)
compiles fine:
function reduce(arr, initialValue, f) {
return arr.reduce(f, initialValue);
}
However, when I change the label name:
@send external reduce: (array<'b>, ('a, 'b) => 'a, ~wrongLabelName: 'a=?) => 'a = "reduce"
let reduce = (arr, initialValue, f) => reduce(arr, f, ~initialValue)
- the code compiles (which it shouldn't, because the label name does not match)
- I get the following incorrect output (v12):
function reduce(arr, initialValue, f) {
return arr.reduce(f)(initialValue);
}
Metadata
Metadata
Assignees
Type
Projects
Status
Done