microsoft / microsoft/TypeScript
Undetected unreachable code
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
These are obvious mistakes.
TypeScript Version: 3.7.x-dev.20191221
Search Terms:
Code
declare const a: boolean;
(() => {
if (a) return;
if (a) {
return; // Unreachable
}
});
while (1) {
if (a) break;
if (a) {
break; // Unreachable
}
}
Expected behavior:
Detect unreachable code.
Actual behavior:
not detected.
Playground Link: http://www.typescriptlang.org/play/index.html?ts=3.8.0-dev.20191221#code/CYUwxgNghgTiAEYD2A7AzgF3lAXPARkkhCFCgNwCwAUABS0CU8AvAHzwDeN8P8AlgDN4tKEzgYArjArdeg4aM6zevcVIrwA9JvgBVFHChgAFlHwll8AL40rDKtQDuxviWEBGJl2or5IpviGANYOvkL+Sj4qvIGkIVo6+oYmZhZRPDbUVkA
Related Issues:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Playground reproduction using TypeScript 3.7.x-dev.20191221 or a current nightly build, and compare diagnostics for the repeated if statements and while-loop branches. Trace the existing unreachable-code diagnostic behavior for these examples and add coverage showing that the marked statements are reported without changing valid control-flow diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100