-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed By: samwgoldman Differential Revision: D5722285 fbshipit-source-id: 72c9377102e74b53099573c43693d789b7cccef6
- Loading branch information
1 parent
bd938ab
commit ac7d9ac
Showing
11 changed files
with
309 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
Error: test.js:7 | ||
7: type A = $Call; // Error: one or more arguments are required. | ||
^^^^^ Incorrect number of type parameters (expected at least 1) | ||
|
||
Error: test.js:8 | ||
8: type B = $Call<>; // Error: one or more arguments are required. | ||
^^^^^^^ Incorrect number of type parameters (expected at least 1) | ||
|
||
Error: test.js:13 | ||
13: ((null: mixed): C); // Error: mixed ~> number | ||
^^^^^ mixed. This type is incompatible with | ||
13: ((null: mixed): C); // Error: mixed ~> number | ||
^ number | ||
|
||
Error: test.js:15 | ||
15: (c: empty); // Error: number ~> empty | ||
^ number. This type is incompatible with | ||
15: (c: empty); // Error: number ~> empty | ||
^^^^^ empty | ||
|
||
Error: test.js:19 | ||
19: (42: D); // Error: function called with to few arguments. | ||
^^ number. This type is incompatible with | ||
19: (42: D); // Error: function called with to few arguments. | ||
^ undefined (too few arguments, expected default/rest parameters) | ||
|
||
Error: test.js:24 | ||
24: ((null: mixed): E); // Error: mixed ~> number | ||
^^^^^ mixed. This type is incompatible with | ||
24: ((null: mixed): E); // Error: mixed ~> number | ||
^ number | ||
|
||
Error: test.js:26 | ||
26: (e: empty); // Error: number ~> empty | ||
^ number. This type is incompatible with | ||
26: (e: empty); // Error: number ~> empty | ||
^^^^^ empty | ||
|
||
Error: test.js:31 | ||
31: ((null: mixed): F); // Error: mixed ~> number | ||
^^^^^ mixed. This type is incompatible with | ||
31: ((null: mixed): F); // Error: mixed ~> number | ||
^ number | ||
|
||
Error: test.js:33 | ||
33: (f: empty); // Error: number ~> empty | ||
^ number. This type is incompatible with | ||
33: (f: empty); // Error: number ~> empty | ||
^^^^^ empty | ||
|
||
Error: test.js:38 | ||
38: ((null: mixed): G); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
38: ((null: mixed): G); // Error: mixed ~> number | string | ||
^ union: type parameter `A` of function call | type parameter `B` of function call | ||
Member 1: | ||
35: type G = $Call<Fn2, number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `A` of function call | ||
Error: | ||
38: ((null: mixed): G); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
35: type G = $Call<Fn2, number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^ number | ||
Member 2: | ||
35: type G = $Call<Fn2, number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `B` of function call | ||
Error: | ||
38: ((null: mixed): G); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
35: type G = $Call<Fn2, number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^ string | ||
|
||
Error: test.js:39 | ||
39: (g: number); // Error: number | string ~> number | ||
^ string. This type is incompatible with | ||
39: (g: number); // Error: number | string ~> number | ||
^^^^^^ number | ||
|
||
Error: test.js:41 | ||
41: (g: empty); // Error: number | string ~> empty | ||
^ number. This type is incompatible with | ||
41: (g: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: test.js:41 | ||
41: (g: empty); // Error: number | string ~> empty | ||
^ string. This type is incompatible with | ||
41: (g: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: union.js:6 | ||
6: ((null: mixed): A); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
6: ((null: mixed): A); // Error: mixed ~> number | string | ||
^ union: function call(s) | ||
Member 1: | ||
3: type A = $Call<(() => number) | (() => string)>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function call | ||
Error: | ||
6: ((null: mixed): A); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
3: type A = $Call<(() => number) | (() => string)>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ number | ||
Member 2: | ||
3: type A = $Call<(() => number) | (() => string)>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function call | ||
Error: | ||
6: ((null: mixed): A); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
3: type A = $Call<(() => number) | (() => string)>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string | ||
|
||
Error: union.js:7 | ||
7: (a: number); // Error: number | string ~> number | ||
^ string. This type is incompatible with | ||
7: (a: number); // Error: number | string ~> number | ||
^^^^^^ number | ||
|
||
Error: union.js:9 | ||
9: (a: empty); // Error: number | string ~> empty | ||
^ number. This type is incompatible with | ||
9: (a: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: union.js:9 | ||
9: (a: empty); // Error: number | string ~> empty | ||
^ string. This type is incompatible with | ||
9: (a: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: union.js:14 | ||
14: ((null: mixed): B); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
14: ((null: mixed): B); // Error: mixed ~> number | string | ||
^ union: function call(s) | ||
Member 1: | ||
11: type B = $Call<(<T>(T) => T) | (<T>(any, T) => T), number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function call | ||
Error: | ||
14: ((null: mixed): B); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
11: type B = $Call<(<T>(T) => T) | (<T>(any, T) => T), number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ number | ||
Member 2: | ||
11: type B = $Call<(<T>(T) => T) | (<T>(any, T) => T), number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function call | ||
Error: | ||
14: ((null: mixed): B); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
11: type B = $Call<(<T>(T) => T) | (<T>(any, T) => T), number, string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string | ||
|
||
Error: union.js:15 | ||
15: (b: number); // Error: number | string ~> number | ||
^ string. This type is incompatible with | ||
15: (b: number); // Error: number | string ~> number | ||
^^^^^^ number | ||
|
||
Error: union.js:17 | ||
17: (b: empty); // Error: number | string ~> empty | ||
^ number. This type is incompatible with | ||
17: (b: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: union.js:17 | ||
17: (b: empty); // Error: number | string ~> empty | ||
^ string. This type is incompatible with | ||
17: (b: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: union.js:22 | ||
22: ((null: mixed): C); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
22: ((null: mixed): C); // Error: mixed ~> number | string | ||
^ union: number | string | ||
Member 1: | ||
19: type C = $Call<<T>(T) => T, number | string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ number | ||
Error: | ||
22: ((null: mixed): C); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
19: type C = $Call<<T>(T) => T, number | string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ number | ||
Member 2: | ||
19: type C = $Call<<T>(T) => T, number | string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string | ||
Error: | ||
22: ((null: mixed): C); // Error: mixed ~> number | string | ||
^^^^^ mixed. This type is incompatible with | ||
19: type C = $Call<<T>(T) => T, number | string>; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string | ||
|
||
Error: union.js:23 | ||
23: (c: number); // Error: number | string ~> number | ||
^ string. This type is incompatible with | ||
23: (c: number); // Error: number | string ~> number | ||
^^^^^^ number | ||
|
||
Error: union.js:25 | ||
25: (c: empty); // Error: number | string ~> empty | ||
^ number. This type is incompatible with | ||
25: (c: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
Error: union.js:25 | ||
25: (c: empty); // Error: number | string ~> empty | ||
^ string. This type is incompatible with | ||
25: (c: empty); // Error: number | string ~> empty | ||
^^^^^ empty | ||
|
||
|
||
Found 25 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// @flow | ||
|
||
type Fn0 = () => number; | ||
type Fn1 = <T>(T) => T; | ||
type Fn2 = <A, B>(A, B) => A | B; | ||
|
||
type A = $Call; // Error: one or more arguments are required. | ||
type B = $Call<>; // Error: one or more arguments are required. | ||
|
||
type C = $Call<Fn0>; | ||
declare var c: C; | ||
(42: C); // OK | ||
((null: mixed): C); // Error: mixed ~> number | ||
(c: number); // OK | ||
(c: empty); // Error: number ~> empty | ||
|
||
type D = $Call<Fn1>; | ||
declare var d: D; | ||
(42: D); // Error: function called with to few arguments. | ||
|
||
type E = $Call<Fn1, number>; | ||
declare var e: E; | ||
(42: E); // OK | ||
((null: mixed): E); // Error: mixed ~> number | ||
(e: number); // OK | ||
(e: empty); // Error: number ~> empty | ||
|
||
type F = $Call<Fn1, number, string>; | ||
declare var f: F; | ||
(42: F); // OK | ||
((null: mixed): F); // Error: mixed ~> number | ||
(f: number); // OK | ||
(f: empty); // Error: number ~> empty | ||
|
||
type G = $Call<Fn2, number, string>; | ||
declare var g: G; | ||
(42: G); // OK | ||
((null: mixed): G); // Error: mixed ~> number | string | ||
(g: number); // Error: number | string ~> number | ||
(g: number | string); // OK | ||
(g: empty); // Error: number | string ~> empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow | ||
|
||
type A = $Call<(() => number) | (() => string)>; | ||
declare var a: A; | ||
(42: A); // OK | ||
((null: mixed): A); // Error: mixed ~> number | string | ||
(a: number); // Error: number | string ~> number | ||
(a: number | string); // OK | ||
(a: empty); // Error: number | string ~> empty | ||
|
||
type B = $Call<(<T>(T) => T) | (<T>(any, T) => T), number, string>; | ||
declare var b: B; | ||
(42: B); // OK | ||
((null: mixed): B); // Error: mixed ~> number | string | ||
(b: number); // Error: number | string ~> number | ||
(b: number | string); // OK | ||
(b: empty); // Error: number | string ~> empty | ||
|
||
type C = $Call<<T>(T) => T, number | string>; | ||
declare var c: C; | ||
(42: C); // OK | ||
((null: mixed): C); // Error: mixed ~> number | string | ||
(c: number); // Error: number | string ~> number | ||
(c: number | string); // OK | ||
(c: empty); // Error: number | string ~> empty |
ac7d9ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation updates?