Skip to content

Commit efc7cb1

Browse files
Accepted baselines.
1 parent 064c5b3 commit efc7cb1

File tree

65 files changed

+4063
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4063
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//// [stringLiteralConstsReturnedFromFunction01.ts]
2+
3+
namespace E {
4+
export const A = "A";
5+
export const B = "B";
6+
export const C = "C";
7+
}
8+
9+
function f1() {
10+
return E.A;
11+
}
12+
13+
function f2(b1: boolean, b2: boolean) {
14+
if (b1) {
15+
return b2 ? E.A : E.B;
16+
}
17+
18+
return b2 ? E.C : E.B;
19+
}
20+
21+
function f3(b1: boolean, b2: boolean) {
22+
if (b1) {
23+
const result1 = b2 ? E.A : E.B;
24+
return result1;
25+
}
26+
27+
const result2 = b2 ? E.C : E.B;
28+
return result2;
29+
}
30+
31+
32+
//// [stringLiteralConstsReturnedFromFunction01.js]
33+
var E;
34+
(function (E) {
35+
E.A = "A";
36+
E.B = "B";
37+
E.C = "C";
38+
})(E || (E = {}));
39+
function f1() {
40+
return E.A;
41+
}
42+
function f2(b1, b2) {
43+
if (b1) {
44+
return b2 ? E.A : E.B;
45+
}
46+
return b2 ? E.C : E.B;
47+
}
48+
function f3(b1, b2) {
49+
if (b1) {
50+
var result1 = b2 ? E.A : E.B;
51+
return result1;
52+
}
53+
var result2 = b2 ? E.C : E.B;
54+
return result2;
55+
}
56+
57+
58+
//// [stringLiteralConstsReturnedFromFunction01.d.ts]
59+
declare namespace E {
60+
const A: "A";
61+
const B: "B";
62+
const C: "C";
63+
}
64+
declare function f1(): "A";
65+
declare function f2(b1: boolean, b2: boolean): string;
66+
declare function f3(b1: boolean, b2: boolean): string;
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
=== tests/cases/conformance/types/stringLiteral/stringLiteralConstsReturnedFromFunction01.ts ===
2+
3+
namespace E {
4+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
5+
6+
export const A = "A";
7+
>A : Symbol(A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
8+
9+
export const B = "B";
10+
>B : Symbol(B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
11+
12+
export const C = "C";
13+
>C : Symbol(C, Decl(stringLiteralConstsReturnedFromFunction01.ts, 4, 16))
14+
}
15+
16+
function f1() {
17+
>f1 : Symbol(f1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 5, 1))
18+
19+
return E.A;
20+
>E.A : Symbol(E.A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
21+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
22+
>A : Symbol(E.A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
23+
}
24+
25+
function f2(b1: boolean, b2: boolean) {
26+
>f2 : Symbol(f2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 9, 1))
27+
>b1 : Symbol(b1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 11, 12))
28+
>b2 : Symbol(b2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 11, 24))
29+
30+
if (b1) {
31+
>b1 : Symbol(b1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 11, 12))
32+
33+
return b2 ? E.A : E.B;
34+
>b2 : Symbol(b2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 11, 24))
35+
>E.A : Symbol(E.A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
36+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
37+
>A : Symbol(E.A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
38+
>E.B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
39+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
40+
>B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
41+
}
42+
43+
return b2 ? E.C : E.B;
44+
>b2 : Symbol(b2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 11, 24))
45+
>E.C : Symbol(E.C, Decl(stringLiteralConstsReturnedFromFunction01.ts, 4, 16))
46+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
47+
>C : Symbol(E.C, Decl(stringLiteralConstsReturnedFromFunction01.ts, 4, 16))
48+
>E.B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
49+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
50+
>B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
51+
}
52+
53+
function f3(b1: boolean, b2: boolean) {
54+
>f3 : Symbol(f3, Decl(stringLiteralConstsReturnedFromFunction01.ts, 17, 1))
55+
>b1 : Symbol(b1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 19, 12))
56+
>b2 : Symbol(b2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 19, 24))
57+
58+
if (b1) {
59+
>b1 : Symbol(b1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 19, 12))
60+
61+
const result1 = b2 ? E.A : E.B;
62+
>result1 : Symbol(result1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 21, 13))
63+
>b2 : Symbol(b2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 19, 24))
64+
>E.A : Symbol(E.A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
65+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
66+
>A : Symbol(E.A, Decl(stringLiteralConstsReturnedFromFunction01.ts, 2, 16))
67+
>E.B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
68+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
69+
>B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
70+
71+
return result1;
72+
>result1 : Symbol(result1, Decl(stringLiteralConstsReturnedFromFunction01.ts, 21, 13))
73+
}
74+
75+
const result2 = b2 ? E.C : E.B;
76+
>result2 : Symbol(result2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 25, 9))
77+
>b2 : Symbol(b2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 19, 24))
78+
>E.C : Symbol(E.C, Decl(stringLiteralConstsReturnedFromFunction01.ts, 4, 16))
79+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
80+
>C : Symbol(E.C, Decl(stringLiteralConstsReturnedFromFunction01.ts, 4, 16))
81+
>E.B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
82+
>E : Symbol(E, Decl(stringLiteralConstsReturnedFromFunction01.ts, 0, 0))
83+
>B : Symbol(E.B, Decl(stringLiteralConstsReturnedFromFunction01.ts, 3, 16))
84+
85+
return result2;
86+
>result2 : Symbol(result2, Decl(stringLiteralConstsReturnedFromFunction01.ts, 25, 9))
87+
}
88+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
=== tests/cases/conformance/types/stringLiteral/stringLiteralConstsReturnedFromFunction01.ts ===
2+
3+
namespace E {
4+
>E : typeof E
5+
6+
export const A = "A";
7+
>A : "A"
8+
>"A" : "A"
9+
10+
export const B = "B";
11+
>B : "B"
12+
>"B" : "B"
13+
14+
export const C = "C";
15+
>C : "C"
16+
>"C" : "C"
17+
}
18+
19+
function f1() {
20+
>f1 : () => "A"
21+
22+
return E.A;
23+
>E.A : "A"
24+
>E : typeof E
25+
>A : "A"
26+
}
27+
28+
function f2(b1: boolean, b2: boolean) {
29+
>f2 : (b1: boolean, b2: boolean) => string
30+
>b1 : boolean
31+
>b2 : boolean
32+
33+
if (b1) {
34+
>b1 : boolean
35+
36+
return b2 ? E.A : E.B;
37+
>b2 ? E.A : E.B : "A" | "B"
38+
>b2 : boolean
39+
>E.A : "A"
40+
>E : typeof E
41+
>A : "A"
42+
>E.B : "B"
43+
>E : typeof E
44+
>B : "B"
45+
}
46+
47+
return b2 ? E.C : E.B;
48+
>b2 ? E.C : E.B : "C" | "B"
49+
>b2 : boolean
50+
>E.C : "C"
51+
>E : typeof E
52+
>C : "C"
53+
>E.B : "B"
54+
>E : typeof E
55+
>B : "B"
56+
}
57+
58+
function f3(b1: boolean, b2: boolean) {
59+
>f3 : (b1: boolean, b2: boolean) => string
60+
>b1 : boolean
61+
>b2 : boolean
62+
63+
if (b1) {
64+
>b1 : boolean
65+
66+
const result1 = b2 ? E.A : E.B;
67+
>result1 : "A" | "B"
68+
>b2 ? E.A : E.B : "A" | "B"
69+
>b2 : boolean
70+
>E.A : "A"
71+
>E : typeof E
72+
>A : "A"
73+
>E.B : "B"
74+
>E : typeof E
75+
>B : "B"
76+
77+
return result1;
78+
>result1 : "A" | "B"
79+
}
80+
81+
const result2 = b2 ? E.C : E.B;
82+
>result2 : "C" | "B"
83+
>b2 ? E.C : E.B : "C" | "B"
84+
>b2 : boolean
85+
>E.C : "C"
86+
>E : typeof E
87+
>C : "C"
88+
>E.B : "B"
89+
>E : typeof E
90+
>B : "B"
91+
92+
return result2;
93+
>result2 : "C" | "B"
94+
}
95+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//// [stringLiteralConstsReturnedFromFunction02.ts]
2+
3+
namespace E {
4+
export const A = "A";
5+
export const B = "B";
6+
}
7+
8+
function f1() {
9+
return E.A;
10+
}
11+
12+
function f2(b1: boolean, b2: boolean) {
13+
if (b1) {
14+
return b2 ? E.A : E.B;
15+
}
16+
17+
return b2 ? E.B : E.A;
18+
}
19+
20+
function f3(b1: boolean, b2: boolean) {
21+
if (b1) {
22+
const result1 = b2 ? E.A : E.B;
23+
return result1;
24+
}
25+
26+
const result2 = b2 ? E.B : E.A;
27+
return result2;
28+
}
29+
30+
31+
//// [stringLiteralConstsReturnedFromFunction02.js]
32+
var E;
33+
(function (E) {
34+
E.A = "A";
35+
E.B = "B";
36+
})(E || (E = {}));
37+
function f1() {
38+
return E.A;
39+
}
40+
function f2(b1, b2) {
41+
if (b1) {
42+
return b2 ? E.A : E.B;
43+
}
44+
return b2 ? E.B : E.A;
45+
}
46+
function f3(b1, b2) {
47+
if (b1) {
48+
var result1 = b2 ? E.A : E.B;
49+
return result1;
50+
}
51+
var result2 = b2 ? E.B : E.A;
52+
return result2;
53+
}
54+
55+
56+
//// [stringLiteralConstsReturnedFromFunction02.d.ts]
57+
declare namespace E {
58+
const A: "A";
59+
const B: "B";
60+
}
61+
declare function f1(): "A";
62+
declare function f2(b1: boolean, b2: boolean): "A" | "B";
63+
declare function f3(b1: boolean, b2: boolean): "A" | "B";

0 commit comments

Comments
 (0)