Skip to content

Commit d8b9337

Browse files
gkzfacebook-github-bot
authored andcommitted
[flow][enums] Add Enum and EnumValue to $NotNullOrVoid
Summary: Changelog: [fix] Add `Enum` and `EnumValue` to `$NotNullOrVoid` - previously they were missing from this type as there was no supertype for all enum values or enums. Separate diff as lots of churn due to pushing down lib def definitions. Reviewed By: SamChou19815 Differential Revision: D55657988 fbshipit-source-id: 6ac079931e790efa8e54ab98e0808f3d01cacc8d
1 parent 9c027d6 commit d8b9337

File tree

56 files changed

+639
-623
lines changed

Some content is hidden

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

56 files changed

+639
-623
lines changed

lib/core.js

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ type $NotNullOrVoid =
9090
| $ReadOnlyArray<mixed>
9191
| symbol
9292
| bigint
93+
| EnumValue<>
94+
| Enum<>;
9395

9496
declare class Object {
9597
static (o: ?void): { [key: any]: any, ... };

tests/arith/arith.exp

+4-4
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,8 @@ Cannot get `(x + y).length` because property `length` is missing in `Number` [1]
647647
^^^^^^
648648

649649
References:
650-
<BUILTINS>/core.js:383:15
651-
383| declare class Number {
650+
<BUILTINS>/core.js:385:15
651+
385| declare class Number {
652652
^^^^^^ [1]
653653

654654

@@ -661,8 +661,8 @@ Cannot get `(1 + 2).length` because property `length` is missing in `Number` [1]
661661
^^^^^^
662662

663663
References:
664-
<BUILTINS>/core.js:383:15
665-
383| declare class Number {
664+
<BUILTINS>/core.js:385:15
665+
385| declare class Number {
666666
^^^^^^ [1]
667667

668668

tests/arraylib/arraylib.exp

+18-18
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ References:
107107
array_lib.js:55:4
108108
55| [''].reduce((acc, str) => acc * str.length); // error, string ~> number
109109
^^ [1]
110-
<BUILTINS>/core.js:1372:13
111-
1372| length: number;
110+
<BUILTINS>/core.js:1374:13
111+
1374| length: number;
112112
^^^^^^ [2]
113113

114114

@@ -124,8 +124,8 @@ References:
124124
array_lib.js:56:4
125125
56| [''].reduceRight((acc, str) => acc * str.length); // error, string ~> number
126126
^^ [1]
127-
<BUILTINS>/core.js:1372:13
128-
1372| length: number;
127+
<BUILTINS>/core.js:1374:13
128+
1374| length: number;
129129
^^^^^^ [2]
130130

131131

@@ -139,8 +139,8 @@ Cannot cast `Array.from(...)` to array type because string [1] is incompatible w
139139
^^^^^^^^^^^^^^^^^^
140140

141141
References:
142-
<BUILTINS>/core.js:1145:37
143-
1145| static from(str: string): Array<string>;
142+
<BUILTINS>/core.js:1147:37
143+
1147| static from(str: string): Array<string>;
144144
^^^^^^ [1]
145145
array_lib.js:68:31
146146
68| Array.from('abcd') as Array<empty>; // ERROR
@@ -184,8 +184,8 @@ Cannot call `arr.at` because function [1] requires another argument. [incompatib
184184
^^
185185

186186
References:
187-
<BUILTINS>/core.js:708:5
188-
708| at(index: number): T | void;
187+
<BUILTINS>/core.js:710:5
188+
710| at(index: number): T | void;
189189
^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
190190

191191

@@ -198,8 +198,8 @@ Cannot call `arr.at` with `"1"` bound to `index` because string [1] is incompati
198198
^^^ [1]
199199

200200
References:
201-
<BUILTINS>/core.js:708:15
202-
708| at(index: number): T | void;
201+
<BUILTINS>/core.js:710:15
202+
710| at(index: number): T | void;
203203
^^^^^^ [2]
204204

205205

@@ -212,8 +212,8 @@ Cannot call `roArr.at` because function [1] requires another argument. [incompat
212212
^^
213213

214214
References:
215-
<BUILTINS>/core.js:708:5
216-
708| at(index: number): T | void;
215+
<BUILTINS>/core.js:710:5
216+
710| at(index: number): T | void;
217217
^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
218218

219219

@@ -227,8 +227,8 @@ Cannot call `roArr.at` with `"1"` bound to `index` because string [1] is incompa
227227
^^^ [1]
228228

229229
References:
230-
<BUILTINS>/core.js:708:15
231-
708| at(index: number): T | void;
230+
<BUILTINS>/core.js:710:15
231+
710| at(index: number): T | void;
232232
^^^^^^ [2]
233233

234234

@@ -364,8 +364,8 @@ Cannot assign `arr3.flat(...)` to `result3_2` because mixed [1] is incompatible
364364
^^^^^^^^^^^^
365365

366366
References:
367-
<BUILTINS>/core.js:860:32
368-
860| flat(depth: number): Array<mixed>;
367+
<BUILTINS>/core.js:862:32
368+
862| flat(depth: number): Array<mixed>;
369369
^^^^^ [1]
370370
flat.js:20:24
371371
20| const result3_2: Array<number> = arr3.flat(2); // Error - don't support this
@@ -382,8 +382,8 @@ Cannot assign `arr2.flat(...)` to `result2_6` because mixed [1] is incompatible
382382
^^^^^^^^^^^^
383383

384384
References:
385-
<BUILTINS>/core.js:860:32
386-
860| flat(depth: number): Array<mixed>;
385+
<BUILTINS>/core.js:862:32
386+
862| flat(depth: number): Array<mixed>;
387387
^^^^^ [1]
388388
flat.js:25:24
389389
25| const result2_6: Array<number> = arr2.flat(x); // Error - don't support this

tests/arrows/arrows.exp

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ return value. [incompatible-call]
4242
^^^^^^^^^^^^^^^^^^^^^^^^ [1]
4343

4444
References:
45-
<BUILTINS>/core.js:1098:38
46-
1098| sort(compareFn?: (a: T, b: T) => number): Array<T>;
45+
<BUILTINS>/core.js:1100:38
46+
1100| sort(compareFn?: (a: T, b: T) => number): Array<T>;
4747
^^^^^^ [2]
4848

4949

tests/async/async.exp

+18-18
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ References:
1010
async.js:9:30
1111
9| async function f1(): Promise<boolean> {
1212
^^^^^^^ [2]
13-
<BUILTINS>/core.js:1935:24
14-
1935| declare class Promise<+R = mixed> {
13+
<BUILTINS>/core.js:1937:24
14+
1937| declare class Promise<+R = mixed> {
1515
^ [3]
1616

1717

@@ -31,8 +31,8 @@ References:
3131
async.js:28:48
3232
28| async function f4(p: Promise<number>): Promise<boolean> {
3333
^^^^^^^ [2]
34-
<BUILTINS>/core.js:1935:24
35-
1935| declare class Promise<+R = mixed> {
34+
<BUILTINS>/core.js:1937:24
35+
1937| declare class Promise<+R = mixed> {
3636
^ [3]
3737

3838

@@ -99,8 +99,8 @@ undefined in type argument `R` [2]. [incompatible-return]
9999
^^^^^^ [1]
100100

101101
References:
102-
<BUILTINS>/core.js:1935:24
103-
1935| declare class Promise<+R = mixed> {
102+
<BUILTINS>/core.js:1937:24
103+
1937| declare class Promise<+R = mixed> {
104104
^ [2]
105105

106106

@@ -142,8 +142,8 @@ References:
142142
async_return_void.js:1:32
143143
1| async function foo1(): Promise<string> {
144144
^^^^^^ [2]
145-
<BUILTINS>/core.js:1935:24
146-
1935| declare class Promise<+R = mixed> {
145+
<BUILTINS>/core.js:1937:24
146+
1937| declare class Promise<+R = mixed> {
147147
^ [3]
148148

149149

@@ -160,8 +160,8 @@ References:
160160
async_return_void.js:5:32
161161
5| async function foo2(): Promise<string> {
162162
^^^^^^ [2]
163-
<BUILTINS>/core.js:1935:24
164-
1935| declare class Promise<+R = mixed> {
163+
<BUILTINS>/core.js:1937:24
164+
1937| declare class Promise<+R = mixed> {
165165
^ [3]
166166

167167

@@ -181,8 +181,8 @@ References:
181181
async_return_void.js:9:32
182182
9| async function foo3(): Promise<string> {
183183
^^^^^^ [2]
184-
<BUILTINS>/core.js:1935:24
185-
1935| declare class Promise<+R = mixed> {
184+
<BUILTINS>/core.js:1937:24
185+
1937| declare class Promise<+R = mixed> {
186186
^ [3]
187187

188188

@@ -223,8 +223,8 @@ References:
223223
generator.js:22:31
224224
22| yield* await Promise.all(["a"]); // error string ~> number
225225
^^^ [2]
226-
<BUILTINS>/core.js:1782:27
227-
1782| interface AsyncGenerator<+Yield,+Return,-Next> {
226+
<BUILTINS>/core.js:1784:27
227+
1784| interface AsyncGenerator<+Yield,+Return,-Next> {
228228
^^^^^ [3]
229229

230230

@@ -243,8 +243,8 @@ References:
243243
generator.js:21:45
244244
21| async function *genError1(): AsyncGenerator<number, void, void> {
245245
^^^^^^ [2]
246-
<BUILTINS>/core.js:1782:27
247-
1782| interface AsyncGenerator<+Yield,+Return,-Next> {
246+
<BUILTINS>/core.js:1784:27
247+
1784| interface AsyncGenerator<+Yield,+Return,-Next> {
248248
^^^^^ [3]
249249

250250

@@ -258,8 +258,8 @@ Cannot yield `1` because number [1], a primitive, cannot be used as a subtype of
258258
^ [1]
259259

260260
References:
261-
<BUILTINS>/core.js:1795:7
262-
1795| : $Iterable<Yield, Return, Next>;
261+
<BUILTINS>/core.js:1797:7
262+
1797| : $Iterable<Yield, Return, Next>;
263263
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
264264

265265

tests/async_iteration/async_iteration.exp

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ Cannot cast `result.value` to string because undefined [1] is incompatible with
113113
^^^^^^^^^^^^
114114

115115
References:
116-
<BUILTINS>/core.js:1740:14
117-
1740| +value?: Return,
116+
<BUILTINS>/core.js:1742:14
117+
1742| +value?: Return,
118118
^^^^^^ [1]
119119
return.js:20:20
120120
20| (result.value: string); // error: number | void ~> string

tests/automatic_require_default/automatic_require_default.exp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Cannot get `Default.T` because property `T` is missing in `Number` [1]. [prop-mi
77
^
88

99
References:
10-
<BUILTINS>/core.js:383:15
11-
383| declare class Number {
10+
<BUILTINS>/core.js:385:15
11+
385| declare class Number {
1212
^^^^^^ [1]
1313

1414

tests/babel_loose_array_spread/babel_loose_array_spread.exp

+26-26
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ References:
1010
apply.js:3:11
1111
3| const it: Iterable<number> = [7,8,9];
1212
^^^^^^^^^^^^^^^^ [1]
13-
<BUILTINS>/core.js:1153:22
13+
<BUILTINS>/core.js:1155:22
1414
v----------
15-
1153| type $ArrayLike<T> = interface {
16-
1154| +[indexer: number]: T;
17-
1155| @@iterator(): Iterator<T>;
18-
1156| length: number;
19-
1157| }
15+
1155| type $ArrayLike<T> = interface {
16+
1156| +[indexer: number]: T;
17+
1157| @@iterator(): Iterator<T>;
18+
1158| length: number;
19+
1159| }
2020
^ [2]
2121

2222

@@ -32,8 +32,8 @@ References:
3232
iterables.js:1:11
3333
1| const it: Iterable<number> = [7,8,9];
3434
^^^^^^^^^^^^^^^^ [1]
35-
<BUILTINS>/core.js:698:15
36-
698| declare class $ReadOnlyArray<+T> {
35+
<BUILTINS>/core.js:700:15
36+
700| declare class $ReadOnlyArray<+T> {
3737
^^^^^^^^^^^^^^ [2]
3838

3939

@@ -49,8 +49,8 @@ References:
4949
iterables.js:1:11
5050
1| const it: Iterable<number> = [7,8,9];
5151
^^^^^^^^^^^^^^^^ [1]
52-
<BUILTINS>/core.js:698:15
53-
698| declare class $ReadOnlyArray<+T> {
52+
<BUILTINS>/core.js:700:15
53+
700| declare class $ReadOnlyArray<+T> {
5454
^^^^^^^^^^^^^^ [2]
5555

5656

@@ -66,8 +66,8 @@ References:
6666
iterables.js:1:11
6767
1| const it: Iterable<number> = [7,8,9];
6868
^^^^^^^^^^^^^^^^ [1]
69-
<BUILTINS>/core.js:698:15
70-
698| declare class $ReadOnlyArray<+T> {
69+
<BUILTINS>/core.js:700:15
70+
700| declare class $ReadOnlyArray<+T> {
7171
^^^^^^^^^^^^^^ [2]
7272

7373

@@ -83,8 +83,8 @@ References:
8383
opaque.js:6:30
8484
6| export const opaqueIterable: OpaqueIterable = [];
8585
^^^^^^^^^^^^^^ [1]
86-
<BUILTINS>/core.js:698:15
87-
698| declare class $ReadOnlyArray<+T> {
86+
<BUILTINS>/core.js:700:15
87+
700| declare class $ReadOnlyArray<+T> {
8888
^^^^^^^^^^^^^^ [2]
8989

9090

@@ -100,8 +100,8 @@ References:
100100
opaque.js:6:30
101101
6| export const opaqueIterable: OpaqueIterable = [];
102102
^^^^^^^^^^^^^^ [1]
103-
<BUILTINS>/core.js:698:15
104-
698| declare class $ReadOnlyArray<+T> {
103+
<BUILTINS>/core.js:700:15
104+
700| declare class $ReadOnlyArray<+T> {
105105
^^^^^^^^^^^^^^ [2]
106106

107107

@@ -117,8 +117,8 @@ References:
117117
opaque.js:6:30
118118
6| export const opaqueIterable: OpaqueIterable = [];
119119
^^^^^^^^^^^^^^ [1]
120-
<BUILTINS>/core.js:698:15
121-
698| declare class $ReadOnlyArray<+T> {
120+
<BUILTINS>/core.js:700:15
121+
700| declare class $ReadOnlyArray<+T> {
122122
^^^^^^^^^^^^^^ [2]
123123

124124

@@ -134,8 +134,8 @@ References:
134134
maps.js:1:14
135135
1| const map1 = new Map<string, string>();
136136
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
137-
<BUILTINS>/core.js:698:15
138-
698| declare class $ReadOnlyArray<+T> {
137+
<BUILTINS>/core.js:700:15
138+
700| declare class $ReadOnlyArray<+T> {
139139
^^^^^^^^^^^^^^ [2]
140140

141141

@@ -151,8 +151,8 @@ References:
151151
maps.js:2:14
152152
2| const map2 = new Map<string, string>();
153153
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
154-
<BUILTINS>/core.js:698:15
155-
698| declare class $ReadOnlyArray<+T> {
154+
<BUILTINS>/core.js:700:15
155+
700| declare class $ReadOnlyArray<+T> {
156156
^^^^^^^^^^^^^^ [2]
157157

158158

@@ -168,8 +168,8 @@ References:
168168
maps.js:1:14
169169
1| const map1 = new Map<string, string>();
170170
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
171-
<BUILTINS>/core.js:698:15
172-
698| declare class $ReadOnlyArray<+T> {
171+
<BUILTINS>/core.js:700:15
172+
700| declare class $ReadOnlyArray<+T> {
173173
^^^^^^^^^^^^^^ [2]
174174

175175

@@ -185,8 +185,8 @@ References:
185185
maps.js:2:14
186186
2| const map2 = new Map<string, string>();
187187
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
188-
<BUILTINS>/core.js:698:15
189-
698| declare class $ReadOnlyArray<+T> {
188+
<BUILTINS>/core.js:700:15
189+
700| declare class $ReadOnlyArray<+T> {
190190
^^^^^^^^^^^^^^ [2]
191191

192192

0 commit comments

Comments
 (0)