Skip to content

Commit

Permalink
[flow] remove stale comment from flowlib
Browse files Browse the repository at this point in the history
Summary:
The change is in core.js. Type-guards are enabled by default.

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D56506510

fbshipit-source-id: a6114936f7daeb4e2c018c838425037b3a7331d1
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Apr 24, 2024
1 parent 804757c commit f54d634
Show file tree
Hide file tree
Showing 44 changed files with 455 additions and 463 deletions.
8 changes: 0 additions & 8 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,6 @@ declare class $ReadOnlyArray<+T> {
* @param callbackfn A predicate function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
* @returns An array whose type is specified by the predicate function passed as callbackfn.
*
* NOTE: type-guards are not enabled by default.
* As such, this overload will not be used by default in source files. Support for type guards can be enabled
* everywhere with the use of the `type_guards=true` flag.
*/
filter<This, S: T>(callbackfn: (this: This, value: T, index: number, array: $ReadOnlyArray<T>) => value is S, thisArg: This): Array<S>;
/**
Expand Down Expand Up @@ -992,10 +988,6 @@ declare class Array<T> extends $ReadOnlyArray<T> {
* @param callbackfn A predicate function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
* @returns An array whose type is specified by the predicate function passed as callbackfn.
*
* NOTE: type-guards are not enabled by default.
* As such, this overload will not be used by default in source files. Support for type guards can be enabled
* everywhere with the use of the `type_guards=true` flag.
*/
filter<This, S: T>(callbackfn: (this: This, value: T, index: number, array: $ReadOnlyArray<T>) => value is S, thisArg: This): Array<S>;
/**
Expand Down
20 changes: 10 additions & 10 deletions tests/arraylib/arraylib.exp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ References:
array_lib.js:55:4
55| [''].reduce((acc, str) => acc * str.length); // error, string ~> number
^^ [1]
<BUILTINS>/core.js:1374:13
1374| length: number;
<BUILTINS>/core.js:1366:13
1366| length: number;
^^^^^^ [2]


Expand All @@ -124,8 +124,8 @@ References:
array_lib.js:56:4
56| [''].reduceRight((acc, str) => acc * str.length); // error, string ~> number
^^ [1]
<BUILTINS>/core.js:1374:13
1374| length: number;
<BUILTINS>/core.js:1366:13
1366| length: number;
^^^^^^ [2]


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

References:
<BUILTINS>/core.js:1147:37
1147| static from(str: string): Array<string>;
<BUILTINS>/core.js:1139:37
1139| static from(str: string): Array<string>;
^^^^^^ [1]
array_lib.js:68:31
68| Array.from('abcd') as Array<empty>; // ERROR
Expand Down Expand Up @@ -364,8 +364,8 @@ Cannot assign `arr3.flat(...)` to `result3_2` because mixed [1] is incompatible
^^^^^^^^^^^^

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

References:
<BUILTINS>/core.js:862:32
862| flat(depth: number): Array<mixed>;
<BUILTINS>/core.js:858:32
858| flat(depth: number): Array<mixed>;
^^^^^ [1]
flat.js:25:24
25| const result2_6: Array<number> = arr2.flat(x); // Error - don't support this
Expand Down
4 changes: 2 additions & 2 deletions tests/arrows/arrows.exp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ return value. [incompatible-call]
^^^^^^^^^^^^^^^^^^^^^^^^ [1]

References:
<BUILTINS>/core.js:1100:38
1100| sort(compareFn?: (a: T, b: T) => number): Array<T>;
<BUILTINS>/core.js:1092:38
1092| sort(compareFn?: (a: T, b: T) => number): Array<T>;
^^^^^^ [2]


Expand Down
36 changes: 18 additions & 18 deletions tests/async/async.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ References:
async.js:9:30
9| async function f1(): Promise<boolean> {
^^^^^^^ [2]
<BUILTINS>/core.js:1937:24
1937| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:1929:24
1929| declare class Promise<+R = mixed> {
^ [3]


Expand All @@ -31,8 +31,8 @@ References:
async.js:28:48
28| async function f4(p: Promise<number>): Promise<boolean> {
^^^^^^^ [2]
<BUILTINS>/core.js:1937:24
1937| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:1929:24
1929| declare class Promise<+R = mixed> {
^ [3]


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

References:
<BUILTINS>/core.js:1937:24
1937| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:1929:24
1929| declare class Promise<+R = mixed> {
^ [2]


Expand Down Expand Up @@ -142,8 +142,8 @@ References:
async_return_void.js:1:32
1| async function foo1(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:1937:24
1937| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:1929:24
1929| declare class Promise<+R = mixed> {
^ [3]


Expand All @@ -160,8 +160,8 @@ References:
async_return_void.js:5:32
5| async function foo2(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:1937:24
1937| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:1929:24
1929| declare class Promise<+R = mixed> {
^ [3]


Expand All @@ -181,8 +181,8 @@ References:
async_return_void.js:9:32
9| async function foo3(): Promise<string> {
^^^^^^ [2]
<BUILTINS>/core.js:1937:24
1937| declare class Promise<+R = mixed> {
<BUILTINS>/core.js:1929:24
1929| declare class Promise<+R = mixed> {
^ [3]


Expand Down Expand Up @@ -223,8 +223,8 @@ References:
generator.js:22:31
22| yield* await Promise.all(["a"]); // error string ~> number
^^^ [2]
<BUILTINS>/core.js:1784:27
1784| interface AsyncGenerator<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1776:27
1776| interface AsyncGenerator<+Yield,+Return,-Next> {
^^^^^ [3]


Expand All @@ -243,8 +243,8 @@ References:
generator.js:21:45
21| async function *genError1(): AsyncGenerator<number, void, void> {
^^^^^^ [2]
<BUILTINS>/core.js:1784:27
1784| interface AsyncGenerator<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1776:27
1776| interface AsyncGenerator<+Yield,+Return,-Next> {
^^^^^ [3]


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

References:
<BUILTINS>/core.js:1797:7
1797| : $Iterable<Yield, Return, Next>;
<BUILTINS>/core.js:1789:7
1789| : $Iterable<Yield, Return, Next>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]


Expand Down
4 changes: 2 additions & 2 deletions tests/async_iteration/async_iteration.exp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ Cannot cast `result.value` to string because undefined [1] is incompatible with
^^^^^^^^^^^^

References:
<BUILTINS>/core.js:1742:14
1742| +value?: Return,
<BUILTINS>/core.js:1734:14
1734| +value?: Return,
^^^^^^ [1]
return.js:20:20
20| (result.value: string); // error: number | void ~> string
Expand Down
12 changes: 6 additions & 6 deletions tests/babel_loose_array_spread/babel_loose_array_spread.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ References:
apply.js:3:11
3| const it: Iterable<number> = [7,8,9];
^^^^^^^^^^^^^^^^ [1]
<BUILTINS>/core.js:1155:22
<BUILTINS>/core.js:1147:22
v----------
1155| type $ArrayLike<T> = interface {
1156| +[indexer: number]: T;
1157| @@iterator(): Iterator<T>;
1158| length: number;
1159| }
1147| type $ArrayLike<T> = interface {
1148| +[indexer: number]: T;
1149| @@iterator(): Iterator<T>;
1150| length: number;
1151| }
^ [2]


Expand Down
24 changes: 12 additions & 12 deletions tests/bigint/bigint.exp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ Cannot call `BigInt` with `null` bound to `value` because: [incompatible-call]
^^^^ [1]

References:
<BUILTINS>/core.js:2738:18
2738| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:2730:18
2730| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^^ [2]
<BUILTINS>/core.js:2738:28
2738| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:2730:28
2730| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^ [3]
<BUILTINS>/core.js:2738:37
2738| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:2730:37
2730| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^ [4]
<BUILTINS>/core.js:2738:46
2738| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:2730:46
2730| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^ [5]
<BUILTINS>/core.js:2738:55
2738| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:2730:55
2730| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^^^^^^^ [6]
<BUILTINS>/core.js:2738:70
2738| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
<BUILTINS>/core.js:2730:70
2730| static (value: boolean | string | number | bigint | interface {} | $ReadOnlyArray<mixed>): bigint;
^^^^^^^^^^^^^^^^^^^^^ [7]


Expand Down
4 changes: 2 additions & 2 deletions tests/computed_props/computed_props.exp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ Cannot assign `arr[0]()` to `y` because number [1] is incompatible with string [
^^^^^^^^

References:
<BUILTINS>/core.js:1109:13
1109| length: number;
<BUILTINS>/core.js:1101:13
1101| length: number;
^^^^^^ [1]
test7.js:5:10
5| const y: string = arr[0](); // error: number ~> string
Expand Down
24 changes: 12 additions & 12 deletions tests/contextual_typing/contextual_typing.exp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ expression to your expected type. [underconstrained-implicit-instantiation]
^^^

References:
<BUILTINS>/core.js:1895:19
1895| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:1887:19
1887| declare class Set<T> extends $ReadOnlySet<T> {
^ [1]
arr_rest.js:9:16
9| const [...y] = new Set() // still error
Expand Down Expand Up @@ -322,8 +322,8 @@ Property `@@iterator` is missing in function [1] but exists in `$Iterable` [2].
^^^^^^^^^^^ [1]

References:
<BUILTINS>/core.js:1757:11
1757| interface $Iterable<+Yield,+Return,-Next> {
<BUILTINS>/core.js:1749:11
1749| interface $Iterable<+Yield,+Return,-Next> {
^^^^^^^^^ [2]


Expand Down Expand Up @@ -461,8 +461,8 @@ References:
implicit_instantiation.js:150:11
150| (a: Set<empty>); // error Set<string> ~> Set<empty>
^^^^^ [2]
<BUILTINS>/core.js:1895:19
1895| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:1887:19
1887| declare class Set<T> extends $ReadOnlySet<T> {
^ [3]


Expand All @@ -481,8 +481,8 @@ References:
implicit_instantiation.js:151:11
151| (b: Set<empty>); // error Set<string> ~> Set<empty>
^^^^^ [2]
<BUILTINS>/core.js:1895:19
1895| declare class Set<T> extends $ReadOnlySet<T> {
<BUILTINS>/core.js:1887:19
1887| declare class Set<T> extends $ReadOnlySet<T> {
^ [3]


Expand Down Expand Up @@ -736,8 +736,8 @@ References:
lits.js:52:27
52| s2.values() as Iterator<string>; // error number ~> string
^^^^^^ [2]
<BUILTINS>/core.js:1755:16
1755| type Iterator<+T> = $Iterator<T,void,void>;
<BUILTINS>/core.js:1747:16
1747| type Iterator<+T> = $Iterator<T,void,void>;
^ [3]


Expand Down Expand Up @@ -1046,8 +1046,8 @@ defined. [method-unbinding]
^^^^^^ [1]

References:
<BUILTINS>/core.js:989:5
989| filter(callbackfn: typeof Boolean): Array<$NonMaybeType<T>>;
<BUILTINS>/core.js:985:5
985| filter(callbackfn: typeof Boolean): Array<$NonMaybeType<T>>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]


Expand Down
Loading

0 comments on commit f54d634

Please sign in to comment.