Skip to content

Commit 54f9ddb

Browse files
committed
Add baseline
1 parent 5e25bbe commit 54f9ddb

7 files changed

+531
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/compiler/declaration.d.ts ===
2+
export declare class C {
3+
>C : Symbol(C, Decl(declaration.d.ts, 0, 0))
4+
5+
[x]: string;
6+
>[x] : Symbol(C[x], Decl(declaration.d.ts, 0, 24))
7+
>x : Symbol(x, Decl(declaration.d.ts, 3, 20))
8+
}
9+
export declare const x: unique symbol;
10+
>x : Symbol(x, Decl(declaration.d.ts, 3, 20))
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/compiler/declaration.d.ts ===
2+
export declare class C {
3+
>C : C
4+
5+
[x]: string;
6+
>[x] : string
7+
>x : unique symbol
8+
}
9+
export declare const x: unique symbol;
10+
>x : unique symbol
11+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class C {}
2+
/**/
3+
4+
5+
class C {}↲
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(11,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
2+
Type 'void' is not assignable to type 'A'.
3+
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(13,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A'.
4+
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(38,4): error TS2349: This expression is not callable.
5+
Each member of the union type 'F3 | F4' has signatures, but none of those signatures are compatible with each other.
6+
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(39,1): error TS2684: The 'this' context of type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' is not assignable to method's 'this' of type 'B'.
7+
Property 'b' is missing in type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' but required in type 'B'.
8+
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(48,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
9+
Type 'void' is not assignable to type 'A'.
10+
tests/cases/conformance/types/union/unionTypeCallSignatures6.ts(55,1): error TS2769: No overload matches this call.
11+
Overload 1 of 2, '(this: A & B & C): void', gave the following error.
12+
The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B & C'.
13+
Type 'void' is not assignable to type 'A'.
14+
Overload 2 of 2, '(this: A & B): void', gave the following error.
15+
The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
16+
Type 'void' is not assignable to type 'A'.
17+
18+
19+
==== tests/cases/conformance/types/union/unionTypeCallSignatures6.ts (6 errors) ====
20+
type A = { a: string };
21+
type B = { b: number };
22+
type C = { c: string };
23+
type D = { d: number };
24+
type F0 = () => void;
25+
26+
// #31547
27+
type F1 = (this: A) => void;
28+
type F2 = (this: B) => void;
29+
declare var f1: F1 | F2;
30+
f1(); // error
31+
~~~~
32+
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
33+
!!! error TS2684: Type 'void' is not assignable to type 'A'.
34+
declare var f2: F0 | F1;
35+
f2(); // error
36+
~~~~
37+
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A'.
38+
39+
interface F3 {
40+
(this: A): void;
41+
(this: B): void;
42+
}
43+
interface F4 {
44+
(this: C): void;
45+
(this: D): void;
46+
}
47+
interface F5 {
48+
(this: C): void;
49+
(this: B): void;
50+
}
51+
52+
declare var x1: A & C & {
53+
f0: F0 | F3;
54+
f1: F1 | F3;
55+
f2: F1 | F4;
56+
f3: F3 | F4;
57+
f4: F3 | F5;
58+
}
59+
x1.f0();
60+
x1.f1();
61+
x1.f2();
62+
x1.f3(); // error
63+
~~
64+
!!! error TS2349: This expression is not callable.
65+
!!! error TS2349: Each member of the union type 'F3 | F4' has signatures, but none of those signatures are compatible with each other.
66+
x1.f4(); // error
67+
~~
68+
!!! error TS2684: The 'this' context of type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' is not assignable to method's 'this' of type 'B'.
69+
!!! error TS2684: Property 'b' is missing in type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' but required in type 'B'.
70+
!!! related TS2728 tests/cases/conformance/types/union/unionTypeCallSignatures6.ts:2:12: 'b' is declared here.
71+
72+
declare var x2: A & B & {
73+
f4: F3 | F5;
74+
}
75+
x2.f4();
76+
77+
type F6 = (this: A & B) => void;
78+
declare var f3: F1 | F6;
79+
f3(); // error
80+
~~~~
81+
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
82+
!!! error TS2684: Type 'void' is not assignable to type 'A'.
83+
84+
interface F7 {
85+
(this: A & B & C): void;
86+
(this: A & B): void;
87+
}
88+
declare var f4: F6 | F7;
89+
f4(); // error
90+
~~~~
91+
!!! error TS2769: No overload matches this call.
92+
!!! error TS2769: Overload 1 of 2, '(this: A & B & C): void', gave the following error.
93+
!!! error TS2769: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B & C'.
94+
!!! error TS2769: Type 'void' is not assignable to type 'A'.
95+
!!! error TS2769: Overload 2 of 2, '(this: A & B): void', gave the following error.
96+
!!! error TS2769: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'.
97+
!!! error TS2769: Type 'void' is not assignable to type 'A'.
98+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
//// [unionTypeCallSignatures6.ts]
2+
type A = { a: string };
3+
type B = { b: number };
4+
type C = { c: string };
5+
type D = { d: number };
6+
type F0 = () => void;
7+
8+
// #31547
9+
type F1 = (this: A) => void;
10+
type F2 = (this: B) => void;
11+
declare var f1: F1 | F2;
12+
f1(); // error
13+
declare var f2: F0 | F1;
14+
f2(); // error
15+
16+
interface F3 {
17+
(this: A): void;
18+
(this: B): void;
19+
}
20+
interface F4 {
21+
(this: C): void;
22+
(this: D): void;
23+
}
24+
interface F5 {
25+
(this: C): void;
26+
(this: B): void;
27+
}
28+
29+
declare var x1: A & C & {
30+
f0: F0 | F3;
31+
f1: F1 | F3;
32+
f2: F1 | F4;
33+
f3: F3 | F4;
34+
f4: F3 | F5;
35+
}
36+
x1.f0();
37+
x1.f1();
38+
x1.f2();
39+
x1.f3(); // error
40+
x1.f4(); // error
41+
42+
declare var x2: A & B & {
43+
f4: F3 | F5;
44+
}
45+
x2.f4();
46+
47+
type F6 = (this: A & B) => void;
48+
declare var f3: F1 | F6;
49+
f3(); // error
50+
51+
interface F7 {
52+
(this: A & B & C): void;
53+
(this: A & B): void;
54+
}
55+
declare var f4: F6 | F7;
56+
f4(); // error
57+
58+
59+
//// [unionTypeCallSignatures6.js]
60+
f1(); // error
61+
f2(); // error
62+
x1.f0();
63+
x1.f1();
64+
x1.f2();
65+
x1.f3(); // error
66+
x1.f4(); // error
67+
x2.f4();
68+
f3(); // error
69+
f4(); // error
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
=== tests/cases/conformance/types/union/unionTypeCallSignatures6.ts ===
2+
type A = { a: string };
3+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
4+
>a : Symbol(a, Decl(unionTypeCallSignatures6.ts, 0, 10))
5+
6+
type B = { b: number };
7+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
8+
>b : Symbol(b, Decl(unionTypeCallSignatures6.ts, 1, 10))
9+
10+
type C = { c: string };
11+
>C : Symbol(C, Decl(unionTypeCallSignatures6.ts, 1, 23))
12+
>c : Symbol(c, Decl(unionTypeCallSignatures6.ts, 2, 10))
13+
14+
type D = { d: number };
15+
>D : Symbol(D, Decl(unionTypeCallSignatures6.ts, 2, 23))
16+
>d : Symbol(d, Decl(unionTypeCallSignatures6.ts, 3, 10))
17+
18+
type F0 = () => void;
19+
>F0 : Symbol(F0, Decl(unionTypeCallSignatures6.ts, 3, 23))
20+
21+
// #31547
22+
type F1 = (this: A) => void;
23+
>F1 : Symbol(F1, Decl(unionTypeCallSignatures6.ts, 4, 21))
24+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 7, 11))
25+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
26+
27+
type F2 = (this: B) => void;
28+
>F2 : Symbol(F2, Decl(unionTypeCallSignatures6.ts, 7, 28))
29+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 8, 11))
30+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
31+
32+
declare var f1: F1 | F2;
33+
>f1 : Symbol(f1, Decl(unionTypeCallSignatures6.ts, 9, 11))
34+
>F1 : Symbol(F1, Decl(unionTypeCallSignatures6.ts, 4, 21))
35+
>F2 : Symbol(F2, Decl(unionTypeCallSignatures6.ts, 7, 28))
36+
37+
f1(); // error
38+
>f1 : Symbol(f1, Decl(unionTypeCallSignatures6.ts, 9, 11))
39+
40+
declare var f2: F0 | F1;
41+
>f2 : Symbol(f2, Decl(unionTypeCallSignatures6.ts, 11, 11))
42+
>F0 : Symbol(F0, Decl(unionTypeCallSignatures6.ts, 3, 23))
43+
>F1 : Symbol(F1, Decl(unionTypeCallSignatures6.ts, 4, 21))
44+
45+
f2(); // error
46+
>f2 : Symbol(f2, Decl(unionTypeCallSignatures6.ts, 11, 11))
47+
48+
interface F3 {
49+
>F3 : Symbol(F3, Decl(unionTypeCallSignatures6.ts, 12, 5))
50+
51+
(this: A): void;
52+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 15, 3))
53+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
54+
55+
(this: B): void;
56+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 16, 3))
57+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
58+
}
59+
interface F4 {
60+
>F4 : Symbol(F4, Decl(unionTypeCallSignatures6.ts, 17, 1))
61+
62+
(this: C): void;
63+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 19, 3))
64+
>C : Symbol(C, Decl(unionTypeCallSignatures6.ts, 1, 23))
65+
66+
(this: D): void;
67+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 20, 3))
68+
>D : Symbol(D, Decl(unionTypeCallSignatures6.ts, 2, 23))
69+
}
70+
interface F5 {
71+
>F5 : Symbol(F5, Decl(unionTypeCallSignatures6.ts, 21, 1))
72+
73+
(this: C): void;
74+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 23, 3))
75+
>C : Symbol(C, Decl(unionTypeCallSignatures6.ts, 1, 23))
76+
77+
(this: B): void;
78+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 24, 3))
79+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
80+
}
81+
82+
declare var x1: A & C & {
83+
>x1 : Symbol(x1, Decl(unionTypeCallSignatures6.ts, 27, 11))
84+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
85+
>C : Symbol(C, Decl(unionTypeCallSignatures6.ts, 1, 23))
86+
87+
f0: F0 | F3;
88+
>f0 : Symbol(f0, Decl(unionTypeCallSignatures6.ts, 27, 25))
89+
>F0 : Symbol(F0, Decl(unionTypeCallSignatures6.ts, 3, 23))
90+
>F3 : Symbol(F3, Decl(unionTypeCallSignatures6.ts, 12, 5))
91+
92+
f1: F1 | F3;
93+
>f1 : Symbol(f1, Decl(unionTypeCallSignatures6.ts, 28, 14))
94+
>F1 : Symbol(F1, Decl(unionTypeCallSignatures6.ts, 4, 21))
95+
>F3 : Symbol(F3, Decl(unionTypeCallSignatures6.ts, 12, 5))
96+
97+
f2: F1 | F4;
98+
>f2 : Symbol(f2, Decl(unionTypeCallSignatures6.ts, 29, 14))
99+
>F1 : Symbol(F1, Decl(unionTypeCallSignatures6.ts, 4, 21))
100+
>F4 : Symbol(F4, Decl(unionTypeCallSignatures6.ts, 17, 1))
101+
102+
f3: F3 | F4;
103+
>f3 : Symbol(f3, Decl(unionTypeCallSignatures6.ts, 30, 14))
104+
>F3 : Symbol(F3, Decl(unionTypeCallSignatures6.ts, 12, 5))
105+
>F4 : Symbol(F4, Decl(unionTypeCallSignatures6.ts, 17, 1))
106+
107+
f4: F3 | F5;
108+
>f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 31, 14))
109+
>F3 : Symbol(F3, Decl(unionTypeCallSignatures6.ts, 12, 5))
110+
>F5 : Symbol(F5, Decl(unionTypeCallSignatures6.ts, 21, 1))
111+
}
112+
x1.f0();
113+
>x1.f0 : Symbol(f0, Decl(unionTypeCallSignatures6.ts, 27, 25))
114+
>x1 : Symbol(x1, Decl(unionTypeCallSignatures6.ts, 27, 11))
115+
>f0 : Symbol(f0, Decl(unionTypeCallSignatures6.ts, 27, 25))
116+
117+
x1.f1();
118+
>x1.f1 : Symbol(f1, Decl(unionTypeCallSignatures6.ts, 28, 14))
119+
>x1 : Symbol(x1, Decl(unionTypeCallSignatures6.ts, 27, 11))
120+
>f1 : Symbol(f1, Decl(unionTypeCallSignatures6.ts, 28, 14))
121+
122+
x1.f2();
123+
>x1.f2 : Symbol(f2, Decl(unionTypeCallSignatures6.ts, 29, 14))
124+
>x1 : Symbol(x1, Decl(unionTypeCallSignatures6.ts, 27, 11))
125+
>f2 : Symbol(f2, Decl(unionTypeCallSignatures6.ts, 29, 14))
126+
127+
x1.f3(); // error
128+
>x1.f3 : Symbol(f3, Decl(unionTypeCallSignatures6.ts, 30, 14))
129+
>x1 : Symbol(x1, Decl(unionTypeCallSignatures6.ts, 27, 11))
130+
>f3 : Symbol(f3, Decl(unionTypeCallSignatures6.ts, 30, 14))
131+
132+
x1.f4(); // error
133+
>x1.f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 31, 14))
134+
>x1 : Symbol(x1, Decl(unionTypeCallSignatures6.ts, 27, 11))
135+
>f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 31, 14))
136+
137+
declare var x2: A & B & {
138+
>x2 : Symbol(x2, Decl(unionTypeCallSignatures6.ts, 40, 11))
139+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
140+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
141+
142+
f4: F3 | F5;
143+
>f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 40, 25))
144+
>F3 : Symbol(F3, Decl(unionTypeCallSignatures6.ts, 12, 5))
145+
>F5 : Symbol(F5, Decl(unionTypeCallSignatures6.ts, 21, 1))
146+
}
147+
x2.f4();
148+
>x2.f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 40, 25))
149+
>x2 : Symbol(x2, Decl(unionTypeCallSignatures6.ts, 40, 11))
150+
>f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 40, 25))
151+
152+
type F6 = (this: A & B) => void;
153+
>F6 : Symbol(F6, Decl(unionTypeCallSignatures6.ts, 43, 8))
154+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 45, 11))
155+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
156+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
157+
158+
declare var f3: F1 | F6;
159+
>f3 : Symbol(f3, Decl(unionTypeCallSignatures6.ts, 46, 11))
160+
>F1 : Symbol(F1, Decl(unionTypeCallSignatures6.ts, 4, 21))
161+
>F6 : Symbol(F6, Decl(unionTypeCallSignatures6.ts, 43, 8))
162+
163+
f3(); // error
164+
>f3 : Symbol(f3, Decl(unionTypeCallSignatures6.ts, 46, 11))
165+
166+
interface F7 {
167+
>F7 : Symbol(F7, Decl(unionTypeCallSignatures6.ts, 47, 5))
168+
169+
(this: A & B & C): void;
170+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 50, 3))
171+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
172+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
173+
>C : Symbol(C, Decl(unionTypeCallSignatures6.ts, 1, 23))
174+
175+
(this: A & B): void;
176+
>this : Symbol(this, Decl(unionTypeCallSignatures6.ts, 51, 3))
177+
>A : Symbol(A, Decl(unionTypeCallSignatures6.ts, 0, 0))
178+
>B : Symbol(B, Decl(unionTypeCallSignatures6.ts, 0, 23))
179+
}
180+
declare var f4: F6 | F7;
181+
>f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 53, 11))
182+
>F6 : Symbol(F6, Decl(unionTypeCallSignatures6.ts, 43, 8))
183+
>F7 : Symbol(F7, Decl(unionTypeCallSignatures6.ts, 47, 5))
184+
185+
f4(); // error
186+
>f4 : Symbol(f4, Decl(unionTypeCallSignatures6.ts, 53, 11))
187+

0 commit comments

Comments
 (0)