Skip to content

Commit b4f2f8c

Browse files
committed
update test case
1 parent c14d573 commit b4f2f8c

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

tests/baselines/reference/controlFlowForInStatement2.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ let stringB: string = 'b';
2020
if ((stringB as 'b') in c) {
2121
c; // narrowed to `B`
2222
}
23-
23+
24+
if ((stringB as ('a' | 'b')) in c) {
25+
c; // not narrowed
26+
}
2427

2528
//// [controlFlowForInStatement2.js]
2629
var keywordA = 'a';
@@ -35,3 +38,6 @@ var stringB = 'b';
3538
if (stringB in c) {
3639
c; // narrowed to `B`
3740
}
41+
if (stringB in c) {
42+
c; // not narrowed
43+
}

tests/baselines/reference/controlFlowForInStatement2.symbols

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@ if ((stringB as 'b') in c) {
4646
>c : Symbol(c, Decl(controlFlowForInStatement2.ts, 6, 13))
4747
}
4848

49+
if ((stringB as ('a' | 'b')) in c) {
50+
>stringB : Symbol(stringB, Decl(controlFlowForInStatement2.ts, 16, 3))
51+
>c : Symbol(c, Decl(controlFlowForInStatement2.ts, 6, 13))
52+
53+
c; // not narrowed
54+
>c : Symbol(c, Decl(controlFlowForInStatement2.ts, 6, 13))
55+
}

tests/baselines/reference/controlFlowForInStatement2.types

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,13 @@ if ((stringB as 'b') in c) {
5353
>c : B
5454
}
5555

56+
if ((stringB as ('a' | 'b')) in c) {
57+
>(stringB as ('a' | 'b')) in c : boolean
58+
>(stringB as ('a' | 'b')) : "a" | "b"
59+
>stringB as ('a' | 'b') : "a" | "b"
60+
>stringB : string
61+
>c : A | B
62+
63+
c; // not narrowed
64+
>c : A | B
65+
}

tests/cases/conformance/controlFlow/controlFlowForInStatement2.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ let stringB: string = 'b';
1919
if ((stringB as 'b') in c) {
2020
c; // narrowed to `B`
2121
}
22+
23+
if ((stringB as ('a' | 'b')) in c) {
24+
c; // not narrowed
25+
}

0 commit comments

Comments
 (0)