sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Wrong implementation of yield/yield* in dartdevk

Open sgrekhov opened this issue 3 years ago • 0 comments

dartdevk doesn't implement yield/yield* behavior described in https://github.com/dart-lang/language/blob/master/accepted/future-releases/async-star-behavior/feature-specification.md

There are several issues.

  1. If execution is paused on yield/yield* and stream is cancelled, then yield* should act like a return; statement. But it isn't so and it causes failure of the following co19 tests

co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A03_t01 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A03_t01 co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_A03_t07 co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_A03_t08 co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_A03_t09

  1. In an asynchronous function, an await for (var event in stream) ... loop first listens on the iterated stream, then for each data event, it executes the body. If the body performs any asynchronous operation (that is, it does not complete synchronously because it executes any await, wait for or yield* operation, or it blocks at a yield), then the stream subscription must be paused. It is resumed again when the body completes normally. But it isn't so and it causes failure of

co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A05_t02

  1. If execution is paused then execution should be blocked at yield. See failures of

co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t01 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t02 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t03 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t04 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t05 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t06 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t07 co19/Language/Statements/Yield_and_Yield_Each/Yield/execution_async_A01_t08

See full log at https://dart-ci.firebaseapp.com/cl/253664/1

sgrekhov avatar Aug 09 '22 12:08 sgrekhov