E4188

E4188#

Compiler diagnostic name: async_with_error_poly.

async functions cannot use error polymorphism.

MoonBit currently does not support combining async with raise?. An async function is raising by default, so use an ordinary async fn when the function may raise, or remove async if the function is not asynchronous.

Erroneous example#

The following function combines async with raise?:

///|
async fn load() -> Unit raise? {
  ()
}

///|
test {
  ignore(load)
}

MoonBit will report an error.

Suggestion#

Remove raise? from the async function, or remove async if the function does not need asynchronous behavior:

///|
fn load() -> Unit {
  ()
}

///|
test {
  ignore(load)
}