summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/integration/run_tests.rs6
-rw-r--r--cli/tests/testdata/error_for_await.ts14
-rw-r--r--cli/tests/testdata/error_for_await.ts.out10
-rw-r--r--cli/tsc/99_main_compiler.js3
4 files changed, 30 insertions, 3 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 88aff0986..14e0e1241 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -622,6 +622,12 @@ itest!(error_026_remote_import_error {
http_server: true,
});
+itest!(error_for_await {
+ args: "run --reload error_for_await.ts",
+ output: "error_for_await.ts.out",
+ exit_code: 1,
+});
+
itest!(error_missing_module_named_import {
args: "run --reload error_missing_module_named_import.ts",
output: "error_missing_module_named_import.ts.out",
diff --git a/cli/tests/testdata/error_for_await.ts b/cli/tests/testdata/error_for_await.ts
new file mode 100644
index 000000000..6e8c5203f
--- /dev/null
+++ b/cli/tests/testdata/error_for_await.ts
@@ -0,0 +1,14 @@
+const listener = Deno.listen({ port: 8080 });
+
+for await (const conn of listener) {
+ handleConn(conn);
+}
+
+function handleConn(conn: Deno.Conn) {
+ const httpConn = Deno.serveHttp(conn);
+ for await (const event of httpConn) {
+ event.respondWith(new Response("html", { status: 200 }));
+ }
+}
+
+export {};
diff --git a/cli/tests/testdata/error_for_await.ts.out b/cli/tests/testdata/error_for_await.ts.out
new file mode 100644
index 000000000..db3cdecb4
--- /dev/null
+++ b/cli/tests/testdata/error_for_await.ts.out
@@ -0,0 +1,10 @@
+[WILDCARD]
+error: TS1103 [ERROR]: 'for await' loops are only allowed within async functions and at the top levels of modules.
+ for await (const event of httpConn) {
+ ~~~~~
+ at [WILDCARD]error_for_await.ts:9:7
+
+TS1356 [ERROR]: Did you mean to mark this function as 'async'?
+ function handleConn(conn: Deno.Conn) {
+ ~~~~~~~~~~
+ at [WILDCARD]error_for_await.ts:7:10
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index c87d091ad..ddc9f3c78 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -148,9 +148,6 @@ delete Object.prototype.__proto__;
// when that file is a module, but this file has no imports or exports.
// Consider adding an empty 'export {}' to make this file a module.
1375,
- // TS1103: 'for-await-of' statement is only allowed within an async function
- // or async generator.
- 1103,
// TS2306: File 'file:///Users/rld/src/deno/cli/tests/testdata/subdir/amd_like.js' is
// not a module.
2306,