Skip to content

Commit d6d2061

Browse files
ahejlsbergConnormiha
authored andcommitted
Accept new baselines
1 parent f88b52c commit d6d2061

File tree

4 files changed

+363
-3
lines changed

4 files changed

+363
-3
lines changed

tests/baselines/reference/reachabilityChecks4.errors.txt

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
tests/cases/compiler/reachabilityChecks4.ts(6,9): error TS7029: Fallthrough case in switch.
2+
tests/cases/compiler/reachabilityChecks4.ts(22,9): error TS7029: Fallthrough case in switch.
23

34

4-
==== tests/cases/compiler/reachabilityChecks4.ts (1 errors) ====
5+
==== tests/cases/compiler/reachabilityChecks4.ts (2 errors) ====
56
function foo(x, y) {
67
switch (x) {
78
case 1:
@@ -16,4 +17,58 @@ tests/cases/compiler/reachabilityChecks4.ts(6,9): error TS7029: Fallthrough case
1617
case 4:
1718
return 3;
1819
}
19-
}
20+
}
21+
22+
declare function noop(): void;
23+
declare function fail(): never;
24+
25+
function f1(x: 0 | 1 | 2) {
26+
switch (x) {
27+
case 0:
28+
fail();
29+
case 1:
30+
~~~~
31+
!!! error TS7029: Fallthrough case in switch.
32+
noop();
33+
case 2:
34+
return;
35+
}
36+
}
37+
38+
// Repro from #34021
39+
40+
type Behavior = 'SLIDE' | 'SLIDE_OUT'
41+
type Direction = 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'
42+
43+
interface Transition {
44+
behavior: Behavior
45+
direction: Direction
46+
}
47+
48+
function f2(transition: Transition): any {
49+
switch (transition.behavior) {
50+
case 'SLIDE':
51+
switch (transition.direction) {
52+
case 'LEFT':
53+
return []
54+
case 'RIGHT':
55+
return []
56+
case 'TOP':
57+
return []
58+
case 'BOTTOM':
59+
return []
60+
}
61+
case 'SLIDE_OUT':
62+
switch (transition.direction) {
63+
case 'LEFT':
64+
return []
65+
case 'RIGHT':
66+
return []
67+
case 'TOP':
68+
return []
69+
case 'BOTTOM':
70+
return []
71+
}
72+
}
73+
}
74+

tests/baselines/reference/reachabilityChecks4.js

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,59 @@ function foo(x, y) {
1111
case 4:
1212
return 3;
1313
}
14-
}
14+
}
15+
16+
declare function noop(): void;
17+
declare function fail(): never;
18+
19+
function f1(x: 0 | 1 | 2) {
20+
switch (x) {
21+
case 0:
22+
fail();
23+
case 1:
24+
noop();
25+
case 2:
26+
return;
27+
}
28+
}
29+
30+
// Repro from #34021
31+
32+
type Behavior = 'SLIDE' | 'SLIDE_OUT'
33+
type Direction = 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'
34+
35+
interface Transition {
36+
behavior: Behavior
37+
direction: Direction
38+
}
39+
40+
function f2(transition: Transition): any {
41+
switch (transition.behavior) {
42+
case 'SLIDE':
43+
switch (transition.direction) {
44+
case 'LEFT':
45+
return []
46+
case 'RIGHT':
47+
return []
48+
case 'TOP':
49+
return []
50+
case 'BOTTOM':
51+
return []
52+
}
53+
case 'SLIDE_OUT':
54+
switch (transition.direction) {
55+
case 'LEFT':
56+
return []
57+
case 'RIGHT':
58+
return []
59+
case 'TOP':
60+
return []
61+
case 'BOTTOM':
62+
return []
63+
}
64+
}
65+
}
66+
1567

1668
//// [reachabilityChecks4.js]
1769
function foo(x, y) {
@@ -27,3 +79,39 @@ function foo(x, y) {
2779
return 3;
2880
}
2981
}
82+
function f1(x) {
83+
switch (x) {
84+
case 0:
85+
fail();
86+
case 1:
87+
noop();
88+
case 2:
89+
return;
90+
}
91+
}
92+
function f2(transition) {
93+
switch (transition.behavior) {
94+
case 'SLIDE':
95+
switch (transition.direction) {
96+
case 'LEFT':
97+
return [];
98+
case 'RIGHT':
99+
return [];
100+
case 'TOP':
101+
return [];
102+
case 'BOTTOM':
103+
return [];
104+
}
105+
case 'SLIDE_OUT':
106+
switch (transition.direction) {
107+
case 'LEFT':
108+
return [];
109+
case 'RIGHT':
110+
return [];
111+
case 'TOP':
112+
return [];
113+
case 'BOTTOM':
114+
return [];
115+
}
116+
}
117+
}

tests/baselines/reference/reachabilityChecks4.symbols

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,93 @@ function foo(x, y) {
2020
return 3;
2121
}
2222
}
23+
24+
declare function noop(): void;
25+
>noop : Symbol(noop, Decl(reachabilityChecks4.ts, 12, 1))
26+
27+
declare function fail(): never;
28+
>fail : Symbol(fail, Decl(reachabilityChecks4.ts, 14, 30))
29+
30+
function f1(x: 0 | 1 | 2) {
31+
>f1 : Symbol(f1, Decl(reachabilityChecks4.ts, 15, 31))
32+
>x : Symbol(x, Decl(reachabilityChecks4.ts, 17, 12))
33+
34+
switch (x) {
35+
>x : Symbol(x, Decl(reachabilityChecks4.ts, 17, 12))
36+
37+
case 0:
38+
fail();
39+
>fail : Symbol(fail, Decl(reachabilityChecks4.ts, 14, 30))
40+
41+
case 1:
42+
noop();
43+
>noop : Symbol(noop, Decl(reachabilityChecks4.ts, 12, 1))
44+
45+
case 2:
46+
return;
47+
}
48+
}
49+
50+
// Repro from #34021
51+
52+
type Behavior = 'SLIDE' | 'SLIDE_OUT'
53+
>Behavior : Symbol(Behavior, Decl(reachabilityChecks4.ts, 26, 1))
54+
55+
type Direction = 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'
56+
>Direction : Symbol(Direction, Decl(reachabilityChecks4.ts, 30, 37))
57+
58+
interface Transition {
59+
>Transition : Symbol(Transition, Decl(reachabilityChecks4.ts, 31, 52))
60+
61+
behavior: Behavior
62+
>behavior : Symbol(Transition.behavior, Decl(reachabilityChecks4.ts, 33, 22))
63+
>Behavior : Symbol(Behavior, Decl(reachabilityChecks4.ts, 26, 1))
64+
65+
direction: Direction
66+
>direction : Symbol(Transition.direction, Decl(reachabilityChecks4.ts, 34, 20))
67+
>Direction : Symbol(Direction, Decl(reachabilityChecks4.ts, 30, 37))
68+
}
69+
70+
function f2(transition: Transition): any {
71+
>f2 : Symbol(f2, Decl(reachabilityChecks4.ts, 36, 1))
72+
>transition : Symbol(transition, Decl(reachabilityChecks4.ts, 38, 12))
73+
>Transition : Symbol(Transition, Decl(reachabilityChecks4.ts, 31, 52))
74+
75+
switch (transition.behavior) {
76+
>transition.behavior : Symbol(Transition.behavior, Decl(reachabilityChecks4.ts, 33, 22))
77+
>transition : Symbol(transition, Decl(reachabilityChecks4.ts, 38, 12))
78+
>behavior : Symbol(Transition.behavior, Decl(reachabilityChecks4.ts, 33, 22))
79+
80+
case 'SLIDE':
81+
switch (transition.direction) {
82+
>transition.direction : Symbol(Transition.direction, Decl(reachabilityChecks4.ts, 34, 20))
83+
>transition : Symbol(transition, Decl(reachabilityChecks4.ts, 38, 12))
84+
>direction : Symbol(Transition.direction, Decl(reachabilityChecks4.ts, 34, 20))
85+
86+
case 'LEFT':
87+
return []
88+
case 'RIGHT':
89+
return []
90+
case 'TOP':
91+
return []
92+
case 'BOTTOM':
93+
return []
94+
}
95+
case 'SLIDE_OUT':
96+
switch (transition.direction) {
97+
>transition.direction : Symbol(Transition.direction, Decl(reachabilityChecks4.ts, 34, 20))
98+
>transition : Symbol(transition, Decl(reachabilityChecks4.ts, 38, 12))
99+
>direction : Symbol(Transition.direction, Decl(reachabilityChecks4.ts, 34, 20))
100+
101+
case 'LEFT':
102+
return []
103+
case 'RIGHT':
104+
return []
105+
case 'TOP':
106+
return []
107+
case 'BOTTOM':
108+
return []
109+
}
110+
}
111+
}
112+

tests/baselines/reference/reachabilityChecks4.types

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,130 @@ function foo(x, y) {
3232
>3 : 3
3333
}
3434
}
35+
36+
declare function noop(): void;
37+
>noop : () => void
38+
39+
declare function fail(): never;
40+
>fail : () => never
41+
42+
function f1(x: 0 | 1 | 2) {
43+
>f1 : (x: 0 | 1 | 2) => void
44+
>x : 0 | 1 | 2
45+
46+
switch (x) {
47+
>x : 0 | 1 | 2
48+
49+
case 0:
50+
>0 : 0
51+
52+
fail();
53+
>fail() : never
54+
>fail : () => never
55+
56+
case 1:
57+
>1 : 1
58+
59+
noop();
60+
>noop() : void
61+
>noop : () => void
62+
63+
case 2:
64+
>2 : 2
65+
66+
return;
67+
}
68+
}
69+
70+
// Repro from #34021
71+
72+
type Behavior = 'SLIDE' | 'SLIDE_OUT'
73+
>Behavior : Behavior
74+
75+
type Direction = 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'
76+
>Direction : Direction
77+
78+
interface Transition {
79+
behavior: Behavior
80+
>behavior : Behavior
81+
82+
direction: Direction
83+
>direction : Direction
84+
}
85+
86+
function f2(transition: Transition): any {
87+
>f2 : (transition: Transition) => any
88+
>transition : Transition
89+
90+
switch (transition.behavior) {
91+
>transition.behavior : Behavior
92+
>transition : Transition
93+
>behavior : Behavior
94+
95+
case 'SLIDE':
96+
>'SLIDE' : "SLIDE"
97+
98+
switch (transition.direction) {
99+
>transition.direction : Direction
100+
>transition : Transition
101+
>direction : Direction
102+
103+
case 'LEFT':
104+
>'LEFT' : "LEFT"
105+
106+
return []
107+
>[] : undefined[]
108+
109+
case 'RIGHT':
110+
>'RIGHT' : "RIGHT"
111+
112+
return []
113+
>[] : undefined[]
114+
115+
case 'TOP':
116+
>'TOP' : "TOP"
117+
118+
return []
119+
>[] : undefined[]
120+
121+
case 'BOTTOM':
122+
>'BOTTOM' : "BOTTOM"
123+
124+
return []
125+
>[] : undefined[]
126+
}
127+
case 'SLIDE_OUT':
128+
>'SLIDE_OUT' : "SLIDE_OUT"
129+
130+
switch (transition.direction) {
131+
>transition.direction : Direction
132+
>transition : Transition
133+
>direction : Direction
134+
135+
case 'LEFT':
136+
>'LEFT' : "LEFT"
137+
138+
return []
139+
>[] : undefined[]
140+
141+
case 'RIGHT':
142+
>'RIGHT' : "RIGHT"
143+
144+
return []
145+
>[] : undefined[]
146+
147+
case 'TOP':
148+
>'TOP' : "TOP"
149+
150+
return []
151+
>[] : undefined[]
152+
153+
case 'BOTTOM':
154+
>'BOTTOM' : "BOTTOM"
155+
156+
return []
157+
>[] : undefined[]
158+
}
159+
}
160+
}
161+

0 commit comments

Comments
 (0)