Skip to content

panic: trying to make exported function async #733

@kevin-matthew

Description

@kevin-matthew

I'm back with more weekend-ruining excitement.

I put a channel receive inside a method that cannot be directly called from the javascript. When compiling I get the following error. I notice that if I start putting other channel receives inside of arbitrary functions than I can't reproduce the error.

I'm not sure if this is a bug or the compiler is trying to tell me to stop what I'm doing.

panic: trying to make exported function async: (StructName).FunctionName$invoke

goroutine 1 [running]:
github.com/tinygo-org/tinygo/compiler.(*Compiler).markAsyncFunctions(0xc0001421e0, 0xc000000180, 0xc000036000, 0xc0064ff0d0)
	/home/circleci/project/compiler/goroutine-lowering.go:852 +0x5ae6
github.com/tinygo-org/tinygo/compiler.(*Compiler).lowerCoroutines(0xc0001421e0, 0xa9bf6b, 0x7fc8e8090a90)
	/home/circleci/project/compiler/goroutine-lowering.go:180 +0x40
github.com/tinygo-org/tinygo/compiler.(*Compiler).LowerGoroutines(0xc0001421e0, 0x7fc8e8091580, 0x7fc8e808f360)
	/home/circleci/project/compiler/goroutine-lowering.go:131 +0x6d
github.com/tinygo-org/tinygo/compiler.(*Compiler).Optimize(0xc0001421e0, 0x2, 0x2, 0x5, 0x0, 0x0)
	/home/circleci/project/compiler/optimizer.go:83 +0x5b7
main.Compile(0x7ffdf414c21f, 0x10, 0x7ffdf414c205, 0x19, 0xc000142000, 0xc0064ffe98, 0xc0064ffc68, 0x0, 0x0)
	/home/circleci/project/main.go:188 +0x370b
main.Build(0x7ffdf414c21f, 0x10, 0x7ffdf414c205, 0x19, 0x7ffdf414c1fd, 0x4, 0xc0000e7e98, 0xc0000ee250, 0x8cd78e)
	/home/circleci/project/main.go:343 +0xe2
main.main()
	/home/circleci/project/main.go:836 +0x128d

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions