-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
read_only_array_polarity.exp
46 lines (27 loc) · 1.37 KB
/
read_only_array_polarity.exp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Error ---------------------------------------------------------------------------------------------------- test.js:16:38
Cannot use `T` [1] in an output position because `T` [1] is expected to occur only in input positions.
test.js:16:38
16| bad (x: number) : $ReadOnlyArray<T> {// Error: T in covariant position
^
References:
test.js:15:12
15| class Baz<-T> {
^ [1]
Error ---------------------------------------------------------------------------------------------------- test.js:22:28
Cannot use `T` [1] in an output position because `T` [1] is expected to occur only in input positions.
test.js:22:28
22| bad (x: $ReadOnlyArray<T> => number) : number {// Error: T used covariantly
^
References:
test.js:21:18
21| class ContraBaz<-T> {
^ [1]
Error ----------------------------------------------------------------------------------------------------- test.js:38:1
Cannot assign `42` to `x[0]` because read-only arrays cannot be written to.
38| x[0] = 42;
^^^^
Error ----------------------------------------------------------------------------------------------------- test.js:39:1
Cannot assign `42` to `x[0]` because read-only arrays cannot be written to.
39| x[(0: any)] = 42;
^^^^^^^^^^^
Found 4 errors