Skip to content

{.async.} pragma cannot be used for proc types #8042

@leo-cydar

Description

@leo-cydar

Description

The {.async.} pragma cannot be used in conjunction with the proc type. This is unlike other pragmas such as {.gcsafe.} or {.locks.}.

Repro

type Route = tuple[path: Regex, handler: proc(req:Request) {.async.}]
===
"attempting to call undeclared routine: 'async'"

Workaround

Declare proc as having return type Future[T]. Doesn't looks like this then accurately represents the procedure, if it has {.async.} applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AsyncEverything related to Nim's async

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions