Skip to content

Commit f2b3e06

Browse files
committed
Accept new baselines
1 parent 03a5a27 commit f2b3e06

File tree

3 files changed

+365
-0
lines changed

3 files changed

+365
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
//// [tryCatchFinallyControlFlow.ts]
2+
// Repro from #34797
3+
4+
function f1() {
5+
let a: number | null = null;
6+
try {
7+
a = 123;
8+
return a;
9+
}
10+
catch (e) {
11+
throw e;
12+
}
13+
finally {
14+
if (a != null && a.toFixed(0) == "123") {
15+
}
16+
}
17+
}
18+
19+
function f2() {
20+
let x: 0 | 1 | 2 | 3 = 0;
21+
try {
22+
x = 1;
23+
}
24+
catch (e) {
25+
x = 2;
26+
throw e;
27+
}
28+
finally {
29+
x; // 0 | 1 | 2
30+
}
31+
x; // 1
32+
}
33+
34+
function f3() {
35+
let x: 0 | 1 | 2 | 3 = 0;
36+
try {
37+
x = 1;
38+
}
39+
catch (e) {
40+
x = 2;
41+
return;
42+
}
43+
finally {
44+
x; // 0 | 1 | 2
45+
}
46+
x; // 1
47+
}
48+
49+
function f4() {
50+
let x: 0 | 1 | 2 | 3 = 0;
51+
try {
52+
x = 1;
53+
}
54+
catch (e) {
55+
x = 2;
56+
}
57+
finally {
58+
x; // 0 | 1 | 2
59+
}
60+
x; // 1 | 2
61+
}
62+
63+
64+
//// [tryCatchFinallyControlFlow.js]
65+
"use strict";
66+
// Repro from #34797
67+
function f1() {
68+
var a = null;
69+
try {
70+
a = 123;
71+
return a;
72+
}
73+
catch (e) {
74+
throw e;
75+
}
76+
finally {
77+
if (a != null && a.toFixed(0) == "123") {
78+
}
79+
}
80+
}
81+
function f2() {
82+
var x = 0;
83+
try {
84+
x = 1;
85+
}
86+
catch (e) {
87+
x = 2;
88+
throw e;
89+
}
90+
finally {
91+
x; // 0 | 1 | 2
92+
}
93+
x; // 1
94+
}
95+
function f3() {
96+
var x = 0;
97+
try {
98+
x = 1;
99+
}
100+
catch (e) {
101+
x = 2;
102+
return;
103+
}
104+
finally {
105+
x; // 0 | 1 | 2
106+
}
107+
x; // 1
108+
}
109+
function f4() {
110+
var x = 0;
111+
try {
112+
x = 1;
113+
}
114+
catch (e) {
115+
x = 2;
116+
}
117+
finally {
118+
x; // 0 | 1 | 2
119+
}
120+
x; // 1 | 2
121+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
=== tests/cases/compiler/tryCatchFinallyControlFlow.ts ===
2+
// Repro from #34797
3+
4+
function f1() {
5+
>f1 : Symbol(f1, Decl(tryCatchFinallyControlFlow.ts, 0, 0))
6+
7+
let a: number | null = null;
8+
>a : Symbol(a, Decl(tryCatchFinallyControlFlow.ts, 3, 7))
9+
10+
try {
11+
a = 123;
12+
>a : Symbol(a, Decl(tryCatchFinallyControlFlow.ts, 3, 7))
13+
14+
return a;
15+
>a : Symbol(a, Decl(tryCatchFinallyControlFlow.ts, 3, 7))
16+
}
17+
catch (e) {
18+
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 8, 11))
19+
20+
throw e;
21+
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 8, 11))
22+
}
23+
finally {
24+
if (a != null && a.toFixed(0) == "123") {
25+
>a : Symbol(a, Decl(tryCatchFinallyControlFlow.ts, 3, 7))
26+
>a.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --))
27+
>a : Symbol(a, Decl(tryCatchFinallyControlFlow.ts, 3, 7))
28+
>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --))
29+
}
30+
}
31+
}
32+
33+
function f2() {
34+
>f2 : Symbol(f2, Decl(tryCatchFinallyControlFlow.ts, 15, 1))
35+
36+
let x: 0 | 1 | 2 | 3 = 0;
37+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 18, 7))
38+
39+
try {
40+
x = 1;
41+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 18, 7))
42+
}
43+
catch (e) {
44+
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 22, 11))
45+
46+
x = 2;
47+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 18, 7))
48+
49+
throw e;
50+
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 22, 11))
51+
}
52+
finally {
53+
x; // 0 | 1 | 2
54+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 18, 7))
55+
}
56+
x; // 1
57+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 18, 7))
58+
}
59+
60+
function f3() {
61+
>f3 : Symbol(f3, Decl(tryCatchFinallyControlFlow.ts, 30, 1))
62+
63+
let x: 0 | 1 | 2 | 3 = 0;
64+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 33, 7))
65+
66+
try {
67+
x = 1;
68+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 33, 7))
69+
}
70+
catch (e) {
71+
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 37, 11))
72+
73+
x = 2;
74+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 33, 7))
75+
76+
return;
77+
}
78+
finally {
79+
x; // 0 | 1 | 2
80+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 33, 7))
81+
}
82+
x; // 1
83+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 33, 7))
84+
}
85+
86+
function f4() {
87+
>f4 : Symbol(f4, Decl(tryCatchFinallyControlFlow.ts, 45, 1))
88+
89+
let x: 0 | 1 | 2 | 3 = 0;
90+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 48, 7))
91+
92+
try {
93+
x = 1;
94+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 48, 7))
95+
}
96+
catch (e) {
97+
>e : Symbol(e, Decl(tryCatchFinallyControlFlow.ts, 52, 11))
98+
99+
x = 2;
100+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 48, 7))
101+
}
102+
finally {
103+
x; // 0 | 1 | 2
104+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 48, 7))
105+
}
106+
x; // 1 | 2
107+
>x : Symbol(x, Decl(tryCatchFinallyControlFlow.ts, 48, 7))
108+
}
109+
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
=== tests/cases/compiler/tryCatchFinallyControlFlow.ts ===
2+
// Repro from #34797
3+
4+
function f1() {
5+
>f1 : () => number
6+
7+
let a: number | null = null;
8+
>a : number | null
9+
>null : null
10+
>null : null
11+
12+
try {
13+
a = 123;
14+
>a = 123 : 123
15+
>a : number | null
16+
>123 : 123
17+
18+
return a;
19+
>a : number
20+
}
21+
catch (e) {
22+
>e : any
23+
24+
throw e;
25+
>e : any
26+
}
27+
finally {
28+
if (a != null && a.toFixed(0) == "123") {
29+
>a != null && a.toFixed(0) == "123" : boolean
30+
>a != null : boolean
31+
>a : number | null
32+
>null : null
33+
>a.toFixed(0) == "123" : boolean
34+
>a.toFixed(0) : string
35+
>a.toFixed : (fractionDigits?: number | undefined) => string
36+
>a : number
37+
>toFixed : (fractionDigits?: number | undefined) => string
38+
>0 : 0
39+
>"123" : "123"
40+
}
41+
}
42+
}
43+
44+
function f2() {
45+
>f2 : () => void
46+
47+
let x: 0 | 1 | 2 | 3 = 0;
48+
>x : 0 | 1 | 2 | 3
49+
>0 : 0
50+
51+
try {
52+
x = 1;
53+
>x = 1 : 1
54+
>x : 0 | 1 | 2 | 3
55+
>1 : 1
56+
}
57+
catch (e) {
58+
>e : any
59+
60+
x = 2;
61+
>x = 2 : 2
62+
>x : 0 | 1 | 2 | 3
63+
>2 : 2
64+
65+
throw e;
66+
>e : any
67+
}
68+
finally {
69+
x; // 0 | 1 | 2
70+
>x : 0 | 1 | 2
71+
}
72+
x; // 1
73+
>x : 1
74+
}
75+
76+
function f3() {
77+
>f3 : () => void
78+
79+
let x: 0 | 1 | 2 | 3 = 0;
80+
>x : 0 | 1 | 2 | 3
81+
>0 : 0
82+
83+
try {
84+
x = 1;
85+
>x = 1 : 1
86+
>x : 0 | 1 | 2 | 3
87+
>1 : 1
88+
}
89+
catch (e) {
90+
>e : any
91+
92+
x = 2;
93+
>x = 2 : 2
94+
>x : 0 | 1 | 2 | 3
95+
>2 : 2
96+
97+
return;
98+
}
99+
finally {
100+
x; // 0 | 1 | 2
101+
>x : 0 | 1 | 2
102+
}
103+
x; // 1
104+
>x : 1
105+
}
106+
107+
function f4() {
108+
>f4 : () => void
109+
110+
let x: 0 | 1 | 2 | 3 = 0;
111+
>x : 0 | 1 | 2 | 3
112+
>0 : 0
113+
114+
try {
115+
x = 1;
116+
>x = 1 : 1
117+
>x : 0 | 1 | 2 | 3
118+
>1 : 1
119+
}
120+
catch (e) {
121+
>e : any
122+
123+
x = 2;
124+
>x = 2 : 2
125+
>x : 0 | 1 | 2 | 3
126+
>2 : 2
127+
}
128+
finally {
129+
x; // 0 | 1 | 2
130+
>x : 0 | 1 | 2
131+
}
132+
x; // 1 | 2
133+
>x : 1 | 2
134+
}
135+

0 commit comments

Comments
 (0)