Skip to content

Bug : currying async function #6032

Closed
Closed
@Mepy

Description

@Mepy

Update: will be fixed in v10.1.3, see also #5980

// rescript
let add = x=>async(y)=> x+y
let g = add(0)
let h = x=>async(y)=>3+await x->add(y)

The minimal example above compiled into the following code in rescript v10.1.2 :

// javascript
function add(x, y) {
  return x + y | 0;
}

function g(param) {
  return 0 + param | 0;
}

function h(x, y) {
  return 3 + await (x + y | 0) | 0; 
}
/*
  return 3 + await (x + y | 0) | 0;
             ^^^^^

SyntaxError: Unexpected reserved word
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)
    at async link (node:internal/modules/esm/module_job:67:21)

Node.js v18.12.1

*/

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