Closed
Description
// ReScript
let add = x=>async(y)=> x+y
let method = @this this=> async arg=>await this->add(arg)
In rescript v10.1.3
, the example above will fail as the following :
FAILED:
We've found a bug for you!
1 │ // ReScript
2 │ let add = x=>async(y)=> x+y
3 │ let method = @this this=> async arg=>await this->add(arg)
4 │
Await on expression not in an async context
By the way, the following ReScript code will generate JavaScript code without async
:
// ReScript
let method = @this this=> async arg=>this+arg
// JavaScript
function method(arg) {
var $$this = this ;
return $$this + arg | 0;
}