Skip to content

Commit d1befef

Browse files
committed
Accept new baselines
1 parent 319ad71 commit d1befef

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//// [switchWithConstrainedTypeVariable.ts]
2+
// Repro from #20840
3+
4+
function function1<T extends 'a' | 'b'>(key: T) {
5+
switch (key) {
6+
case 'a':
7+
key.toLowerCase();
8+
break;
9+
default:
10+
key.toLowerCase();
11+
break;
12+
}
13+
}
14+
15+
16+
//// [switchWithConstrainedTypeVariable.js]
17+
"use strict";
18+
// Repro from #20840
19+
function function1(key) {
20+
switch (key) {
21+
case 'a':
22+
key.toLowerCase();
23+
break;
24+
default:
25+
key.toLowerCase();
26+
break;
27+
}
28+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
=== tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts ===
2+
// Repro from #20840
3+
4+
function function1<T extends 'a' | 'b'>(key: T) {
5+
>function1 : Symbol(function1, Decl(switchWithConstrainedTypeVariable.ts, 0, 0))
6+
>T : Symbol(T, Decl(switchWithConstrainedTypeVariable.ts, 2, 19))
7+
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
8+
>T : Symbol(T, Decl(switchWithConstrainedTypeVariable.ts, 2, 19))
9+
10+
switch (key) {
11+
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
12+
13+
case 'a':
14+
key.toLowerCase();
15+
>key.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
16+
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
17+
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
18+
19+
break;
20+
default:
21+
key.toLowerCase();
22+
>key.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
23+
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
24+
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
25+
26+
break;
27+
}
28+
}
29+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=== tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts ===
2+
// Repro from #20840
3+
4+
function function1<T extends 'a' | 'b'>(key: T) {
5+
>function1 : <T extends "a" | "b">(key: T) => void
6+
>T : T
7+
>key : T
8+
>T : T
9+
10+
switch (key) {
11+
>key : T
12+
13+
case 'a':
14+
>'a' : "a"
15+
16+
key.toLowerCase();
17+
>key.toLowerCase() : string
18+
>key.toLowerCase : () => string
19+
>key : T
20+
>toLowerCase : () => string
21+
22+
break;
23+
default:
24+
key.toLowerCase();
25+
>key.toLowerCase() : string
26+
>key.toLowerCase : () => string
27+
>key : T
28+
>toLowerCase : () => string
29+
30+
break;
31+
}
32+
}
33+

0 commit comments

Comments
 (0)