Verse: nested coroutine not getting cancelled by a race expression

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Summary

It is possible to cancel an async function with a race expression, but async functions called by the cancelled function continue running. (Note this is not using spawn{}, it is a nested async function call)

Steps to Reproduce

Create a new device called test_device with the following code:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

test_device := class(creative_device):

    TestEvent : event() = event(){}

    OnBegin<override>()<suspends>:void=
        Sleep(1.0)
        Print("Starting race")
        race:
            TestEvent.Await()
            block:
                Sleep(0.0)
                Func1()
        Print("Finished race")
        
    Func1()<suspends>:void=
        Print("Enter Func1")
        race:
            block:
                TestEvent.Signal()
                Sleep(Inf)
            Func2()

    Func2()<suspends>:void=
        Print("Enter Func2")
        loop:
            Print("Ping")
            Sleep(1.0)

Expected Result

I would expect the following output:
LogVerse: : Starting race
LogVerse: : Enter Func1
LogVerse: : Enter Func2
LogVerse: : Ping
LogVerse: : Finished race

Observed Result

I get the following output:
LogVerse: : Starting race
LogVerse: : Enter Func1
LogVerse: : Finished race
LogVerse: : Enter Func2
LogVerse: : Ping
LogVerse: : Ping
LogVerse: : Ping
LogVerse: : Ping

Platform(s)

Windows PC

Additional Notes

This may be related to this issue I posted a few days ago regarding defer not working in async functions that self-cancel using Signal/Await:

The status of FORT-747656 incident has been moved from ‘Unconfirmed’ to ‘Closed’. Resolution Reason: ‘Fixed’

Thank you so much for the report, we are working on a fix for a future update.