Files
wren/test/core/fiber/call_root.wren
Bob Nystrom f23c82071a Don't allow calling the root fiber.
The VM used to not detect this case. It meant you could get into a
situation where another fiber's caller had completed. Then, when it
tried to resume that fiber, the VM would crash because there was nothing
to resume to.

This is part of thinking through all the cases around re-entrancy. Added
some notes for that too.
2018-07-21 10:02:29 -07:00

9 lines
248 B
Plaintext

var root = Fiber.current
System.print("begin root") // expect: begin root
Fiber.new {
System.print("in new fiber") // expect: in new fiber
root.call() // expect runtime error: Cannot call root fiber.
System.print("called root")
}.transfer()