Skip to content

Commit 0fe65fd

Browse files
committed
Test multiple commas
1 parent 6c9ec85 commit 0fe65fd

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

tests/baselines/reference/controlFlowCommaExpressionAssertionMultiple.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ function func(foo: any, bar: any) {
66
foo;
77
bar;
88
}
9+
10+
function func2(foo: any, bar: any, baz: any) {
11+
Narrow<number>(foo), Narrow<string>(bar), Narrow<boolean>(baz);
12+
foo;
13+
bar;
14+
baz;
15+
}
916

1017

1118
//// [controlFlowCommaExpressionAssertionMultiple.js]
@@ -15,3 +22,9 @@ function func(foo, bar) {
1522
foo;
1623
bar;
1724
}
25+
function func2(foo, bar, baz) {
26+
Narrow(foo), Narrow(bar), Narrow(baz);
27+
foo;
28+
bar;
29+
baz;
30+
}

tests/baselines/reference/controlFlowCommaExpressionAssertionMultiple.symbols

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,27 @@ function func(foo: any, bar: any) {
2424
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 23))
2525
}
2626

27+
function func2(foo: any, bar: any, baz: any) {
28+
>func2 : Symbol(func2, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 6, 1))
29+
>foo : Symbol(foo, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 15))
30+
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 24))
31+
>baz : Symbol(baz, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 34))
32+
33+
Narrow<number>(foo), Narrow<string>(bar), Narrow<boolean>(baz);
34+
>Narrow : Symbol(Narrow, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 0))
35+
>foo : Symbol(foo, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 15))
36+
>Narrow : Symbol(Narrow, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 0))
37+
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 24))
38+
>Narrow : Symbol(Narrow, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 0))
39+
>baz : Symbol(baz, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 34))
40+
41+
foo;
42+
>foo : Symbol(foo, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 15))
43+
44+
bar;
45+
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 24))
46+
47+
baz;
48+
>baz : Symbol(baz, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 8, 34))
49+
}
50+

tests/baselines/reference/controlFlowCommaExpressionAssertionMultiple.types

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,32 @@ function func(foo: any, bar: any) {
2424
>bar : string
2525
}
2626

27+
function func2(foo: any, bar: any, baz: any) {
28+
>func2 : (foo: any, bar: any, baz: any) => void
29+
>foo : any
30+
>bar : any
31+
>baz : any
32+
33+
Narrow<number>(foo), Narrow<string>(bar), Narrow<boolean>(baz);
34+
>Narrow<number>(foo), Narrow<string>(bar), Narrow<boolean>(baz) : void
35+
>Narrow<number>(foo), Narrow<string>(bar) : void
36+
>Narrow<number>(foo) : void
37+
>Narrow : <T>(value: any) => asserts value is T
38+
>foo : any
39+
>Narrow<string>(bar) : void
40+
>Narrow : <T>(value: any) => asserts value is T
41+
>bar : any
42+
>Narrow<boolean>(baz) : void
43+
>Narrow : <T>(value: any) => asserts value is T
44+
>baz : any
45+
46+
foo;
47+
>foo : number
48+
49+
bar;
50+
>bar : string
51+
52+
baz;
53+
>baz : boolean
54+
}
55+

tests/cases/compiler/controlFlowCommaExpressionAssertionMultiple.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ function func(foo: any, bar: any) {
55
foo;
66
bar;
77
}
8+
9+
function func2(foo: any, bar: any, baz: any) {
10+
Narrow<number>(foo), Narrow<string>(bar), Narrow<boolean>(baz);
11+
foo;
12+
bar;
13+
baz;
14+
}

0 commit comments

Comments
 (0)