Skip to content

Commit 9b143be

Browse files
gkzmeta-codesync[bot]
authored andcommitted
[flow] Move tests/record into tests/indexer
Summary: Move tests/record into tests/indexer. To reduce future confusion. Changelog: [internal] Reviewed By: SamChou19815, marcoww6 Differential Revision: D85729244 fbshipit-source-id: 97a46bcedf18b42c29c635e2d2049e3814ee8d2c
1 parent 0adee0c commit 9b143be

5 files changed

Lines changed: 89 additions & 94 deletions

File tree

tests/indexer/.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[options]
22
all=true
3+
no_flowlib=false

tests/indexer/indexer.exp

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,90 @@ Multiple indexers are not supported. [unsupported-syntax]
105105
^^^^^^^^^^^^^^^^^^^^
106106

107107

108+
Error ------------------------------------------------------------------------------------------------------ test.js:4:8
108109

109-
Found 7 errors
110+
Cannot assign object literal to `o1` because in property `bar`: string [1] is incompatible with number [2].
111+
[incompatible-type]
112+
113+
test.js:4:8
114+
4| bar: "", // error: string ~/~ number
115+
^^ [1]
116+
117+
References:
118+
test.js:2:23
119+
2| var o1: {[key: Key1]: number} = {
120+
^^^^^^ [2]
121+
122+
123+
Error ------------------------------------------------------------------------------------------------------ test.js:7:4
124+
125+
Cannot get `o1.qux` because property `qux` is missing in object type [1]. [prop-missing]
126+
127+
test.js:7:4
128+
7| o1.qux; // error: qux not found
129+
^^^
130+
131+
References:
132+
test.js:2:9
133+
2| var o1: {[key: Key1]: number} = {
134+
^^^^^^^^^^^^^^^^^^^^^ [1]
135+
136+
137+
Error ----------------------------------------------------------------------------------------------------- test.js:14:4
138+
139+
Cannot get `o2.qux` because property `qux` is missing in object type [1]. [prop-missing]
140+
141+
test.js:14:4
142+
14| o2.qux; // error: qux not found
143+
^^^
144+
145+
References:
146+
test.js:12:9
147+
12| var o2: {[key: Key2]: number} = { foo: 0 }; // OK to leave out bar
148+
^^^^^^^^^^^^^^^^^^^^^ [1]
149+
150+
151+
Error ----------------------------------------------------------------------------------------------------- test.js:19:1
152+
153+
Cannot extend `C` [1] with `D` because in property `x` > the indexer property's key: property `qux` is missing in object
154+
type [2]. [prop-missing]
155+
156+
test.js:19:1
157+
v---------------------------------------------------
158+
19| class D extends C<{foo: number, bar: string, ...}> {
159+
20| x: { foo: number, qux: boolean, ... }; // error: qux not found
160+
21| }
161+
^
162+
163+
References:
164+
test.js:19:17
165+
19| class D extends C<{foo: number, bar: string, ...}> {
166+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
167+
test.js:19:19
168+
19| class D extends C<{foo: number, bar: string, ...}> {
169+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
170+
171+
172+
Error ----------------------------------------------------------------------------------------------------- test.js:20:6
173+
174+
Cannot extend `C` [1] with `D` because in property `x`: an index signature declaring the expected key / value type is
175+
missing in object type [2] but exists in object type [3]. [incompatible-type]
176+
177+
This property is invariantly typed. See
178+
https://flow.org/en/docs/faq/#why-cant-i-pass-a-string-to-a-function-that-takes-a-string-number.
179+
180+
test.js:20:6
181+
20| x: { foo: number, qux: boolean, ... }; // error: qux not found
182+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
183+
184+
References:
185+
test.js:19:17
186+
19| class D extends C<{foo: number, bar: string, ...}> {
187+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
188+
test.js:17:6
189+
17| x: {[key: $Keys<X>]: any}; // object with larger key set than X's
190+
^^^^^^^^^^^^^^^^^^^^^^ [3]
191+
192+
193+
194+
Found 12 errors
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ o2.qux; // error: qux not found
1616
class C<X> {
1717
x: {[key: $Keys<X>]: any}; // object with larger key set than X's
1818
}
19-
class D extends C<{foo: number, bar: string}> {
20-
x: { foo: number, qux: boolean }; // error: qux not found
19+
class D extends C<{foo: number, bar: string, ...}> {
20+
x: { foo: number, qux: boolean, ... }; // error: qux not found
2121
}
2222

2323
type AnyKey = $Keys<Object>;

tests/record/.flowconfig

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/record/record.exp

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)