Skip to content

Js.Array2.spliceInPlace not compiling without using "add" argument if it is ignored #6991

Description

@JonoPrest

See playground:
https://rescript-lang.org/try?version=v11.1.3&code=DYUwLgBATiC2D2A3EBJAdgExADwgXggAoBDKKAGggEtMcBKfAPgCgIJSoBaRgKQGcAdAEEyxAJ4AmAXwAOwKgGNUaAArBiSwgD8Z8PnhpZslLTATI8ARjrcqAczTwYzZqEhmkyowHUqYABZCGBj4RByUhvRMrOxk3PzCopLScorKahog2rr6kcYQpnCeVibEwXgA2gC6Noz2jjBAA

let removeIndex = (arr, index) =>
  arr->Js.Array2.spliceInPlace(~pos=index, ~remove=1)->ignore

let removeIndexWithAdd = (arr, index) =>
  arr->Js.Array2.spliceInPlace(~pos=index, ~remove=1, ~add=[])->ignore

Compiles to

// Generated by ReScript, PLEASE EDIT WITH CARE


function removeIndex(arr, index) {
  
}

function removeIndexWithAdd(arr, index) {
  arr.splice(index, 1);
}

export {
  removeIndex ,
  removeIndexWithAdd ,
}
/* No side effect */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions