-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
If the continue keyword is used outside of a loop, and there's an await on the other side of the conditional (see sample code below), this causes an ugly error.
TypeScript Version: 2.4.2
Code
function dummyPromise() {
return new Promise((resolve, reject) => {});
}
async function func() {
if (true) {
continue;
} else {
await dummyPromise();
}
}Expected behavior:
This should print error TS1107: Jump target cannot cross function boundary. (this is usually the message when continue is wrongly used outside of a loop)
Actual behavior:
afischer-mba ~/ts-bug-report $ tsc -v
Version 2.4.2
afischer-mba ~/ts-bug-report $ tsc src/test.ts
/usr/local/lib/node_modules/typescript/lib/tsc.js:55776
throw e;
^
Error: Debug Failure.
at findContinueTarget (/usr/local/lib/node_modules/typescript/lib/tsc.js:48265:22)
at transformAndEmitContinueStatement (/usr/local/lib/node_modules/typescript/lib/tsc.js:47796:25)
at transformAndEmitStatementWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:47551:28)
at transformAndEmitStatement (/usr/local/lib/node_modules/typescript/lib/tsc.js:47531:13)
at transformAndEmitStatements (/usr/local/lib/node_modules/typescript/lib/tsc.js:47515:17)
at transformAndEmitEmbeddedStatement (/usr/local/lib/node_modules/typescript/lib/tsc.js:47520:17)
at transformAndEmitIfStatement (/usr/local/lib/node_modules/typescript/lib/tsc.js:47617:21)
at transformAndEmitStatementWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:47541:28)
at transformAndEmitStatement (/usr/local/lib/node_modules/typescript/lib/tsc.js:47531:13)
at transformAndEmitStatements (/usr/local/lib/node_modules/typescript/lib/tsc.js:47515:17)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue