Skip to content

Wasm: Panic trying to make exported function async #1409

@asdine

Description

@asdine

The compiler panics trying to compile what it appears to be functions that expect other functions.

Target: wasm
Tinygo version: Docker version of 0.15.0

Stacktrace:

panic: trying to make exported function async: (github.com/genjidb/genji/document.Stream).Iterate$invoke

goroutine 1 [running]:
github.com/tinygo-org/tinygo/transform.(*coroutineLoweringPass).findAsyncFuncs(0xc008591040)
        /home/circleci/project/transform/coroutines.go:186 +0xa64
github.com/tinygo-org/tinygo/transform.(*coroutineLoweringPass).load(0xc008591040, 0x20, 0x9a16790)
        /home/circleci/project/transform/coroutines.go:305 +0x36c
github.com/tinygo-org/tinygo/transform.LowerCoroutines(0x8be16c0, 0x8be1601, 0x0, 0x0)
        /home/circleci/project/transform/coroutines.go:70 +0x15f
github.com/tinygo-org/tinygo/transform.Optimize(0x8be16c0, 0xc000336060, 0x2, 0x2, 0x5, 0x0, 0x0, 0x0)
        /home/circleci/project/transform/optimizer.go:120 +0xef0
github.com/tinygo-org/tinygo/builder.Build(0x7ffd9a4f9efb, 0x21, 0x7ffd9a4f9ed2, 0x10, 0xc000336060, 0xc008591ba8, 0x0, 0x0)
        /home/circleci/project/builder/build.go:109 +0x337a
main.Build(0x7ffd9a4f9efb, 0x21, 0x7ffd9a4f9ed2, 0x10, 0xc000300000, 0x0, 0x12)
        /home/circleci/project/main.go:94 +0xc5
main.main()
        /home/circleci/project/main.go:856 +0x1f96

Besides the error and the stacktrace above, it is impossible for me to write a simple code sample for you to reproduce it because the behavior of the compiler is really difficult to grasp: Two statements cause the compiler to fail, but if I use statement A or statement B separately, the compilation succeeds. If you have any tips on how I could debug this more efficiently I will try to give more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about usage of TinyGowasmWebAssembly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions