Skip to content

CFA failure with fallthrough clauses in switch statements #23818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
falsandtru opened this issue May 2, 2018 · 1 comment
Open

CFA failure with fallthrough clauses in switch statements #23818

falsandtru opened this issue May 2, 2018 · 1 comment
Labels
Bug A bug in TypeScript
Milestone

Comments

@falsandtru
Copy link
Contributor

TypeScript Version: master

Search Terms:

Code

declare const o: { c?: 1; };
switch (0) {
  case 0:
    break;
  case o.c && o.c.valueOf():
  case o.c && o.c.valueOf():
    break;
}

Expected behavior:

pass

Actual behavior:

$ node built/local/tsc.js index.ts --strictNullChecks
index.ts:5:15 - error TS2532: Object is possibly 'undefined'.

5   case o.c && o.c.valueOf():
                ~~~

Playground Link:

Related Issues:

@ghost ghost added the Bug A bug in TypeScript label May 2, 2018
@ghost
Copy link

ghost commented May 2, 2018

Also reproduces with declare const c?: number; and removing o. everywhere

@falsandtru falsandtru changed the title CFA failure with fallthrough cases in switch statements CFA failure with fallthrough clauses in switch statements May 10, 2018
@mhegazy mhegazy added this to the Future milestone Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants