Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tslang/lib/TypeScript/MLIRGenExpressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,10 @@ namespace mlirgen
builder.create<mlir::async::YieldOp>(location, mlir::ValueRange{});
}
});
EXIT_IF_FAILED_OR_NO_VALUE(result)
// a call to a void function succeeds with no value, and is awaited all the same: leaving
// here dropped the token, so nothing waited for the task and `await f()` went straight
// on (#440)
EXIT_IF_FAILED(result)

// Registered only now, and only if the store above actually happened: an owned slot is
// released at scope exit whatever is in it, and a slot nothing wrote holds whatever the
Expand Down
3 changes: 3 additions & 0 deletions tslang/test/tester/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ tslang_add_test(NAME test-compile-00-array-literal-copy COMMAND test-runner "${P
tslang_add_test(NAME test-compile-00-tuple-runtime-arrays COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00tuple_runtime_arrays.ts")
tslang_add_test(NAME test-compile-00-record-to-class COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00record_to_class.ts")
tslang_add_test(NAME test-compile-00-array-insert-functions COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00array_insert_functions.ts")
tslang_add_test(NAME test-compile-00-await-void COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00await_void.ts")
tslang_add_test(NAME test-compile-00-const-record-owned-fields COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00const_record_owned_fields.ts")
tslang_add_test(NAME test-compile-00-array-length-valid COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00array_length_valid.ts")
tslang_add_test(NAME test-compile-00-string-view-copy COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00string_view_copy.ts")
Expand Down Expand Up @@ -859,6 +860,7 @@ tslang_add_test(NAME test-jit-00-array-literal-copy COMMAND test-runner -jit "${
tslang_add_test(NAME test-jit-00-tuple-runtime-arrays COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00tuple_runtime_arrays.ts")
tslang_add_test(NAME test-jit-00-record-to-class COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00record_to_class.ts")
tslang_add_test(NAME test-jit-00-array-insert-functions COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00array_insert_functions.ts")
tslang_add_test(NAME test-jit-00-await-void COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00await_void.ts")
tslang_add_test(NAME test-jit-00-const-record-owned-fields COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00const_record_owned_fields.ts")
tslang_add_test(NAME test-jit-00-array-length-valid COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00array_length_valid.ts")
tslang_add_test(NAME test-jit-00-string-view-copy COMMAND test-runner -jit "${PROJECT_SOURCE_DIR}/test/tester/tests/00string_view_copy.ts")
Expand Down Expand Up @@ -1696,6 +1698,7 @@ set(TSLANG_CORPUS
00tuple_runtime_arrays.ts
00record_to_class.ts
00array_insert_functions.ts
00await_void.ts
00const_record_owned_fields.ts
00array_length_valid.ts
00string_view_copy.ts
Expand Down
26 changes: 26 additions & 0 deletions tslang/test/tester/tests/00await_void.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// `await` of an async function that returns nothing runs it, and in order (#440): the await
// left before its `async.await`, so nothing waited for the task and the awaiting function went
// straight on.
let log = "";
async function step(s: string) { log += s; }
async function twice() {
await step("b");
await step("c");
}
class C {
async run() { log += "m"; }
}
async function main() {
await step("a");
await twice();
for (let i = 0; i < 3; i++) {
await step("" + i);
}
const c = new C();
await c.run();
const g = async () => { log += "g"; };
await g();
print(log);
assert(log == "abc012mg", "in order");
print("done.");
}
Loading