Skip to content

async function containing locally abstract type is not considered an async context #5974

Closed
@glennsl

Description

@glennsl

Repro

let f = async (type a, ()) => {
  await Js.Promise.resolve(())
}

causes the error:

Await on expression not in an async context

Workaround

Make the function explicitly curried and move the async specifier after the locally abstract type.

let f = (type a) => async () => {
  await Js.Promise.resolve(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions