@@ -46,6 +46,10 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
46
46
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
47
47
[' 123' , ' 456' ],
48
48
),
49
+ ' varray<string>' => tuple (
50
+ type_structure (TypeConstants :: class , ' TStringVArray' ),
51
+ varray [' 123' , ' 456' ],
52
+ ),
49
53
' empty array<string, string>' => tuple (
50
54
type_structure (TypeConstants :: class , ' TStringStringArray' ),
51
55
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
@@ -56,6 +60,10 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
56
60
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
57
61
[' foo' => ' bar' , ' herp' => ' derp' ],
58
62
),
63
+ ' darray<string, string>' => tuple (
64
+ type_structure (TypeConstants :: class , ' TStringStringDArray' ),
65
+ darray [' foo' => ' bar' , ' herp' => ' derp' ],
66
+ ),
59
67
' string as ?string' => tuple (
60
68
type_structure (TypeConstants :: class , ' TNullableString' ),
61
69
' hello, world' ,
@@ -70,11 +78,11 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
70
78
tuple (type_structure (TypeConstants :: class , ' TStringVector' ), Vector {}),
71
79
' Vector<string>' => tuple (
72
80
type_structure (TypeConstants :: class , ' TStringVector' ),
73
- Vector { ' foo' , ' bar' },
81
+ Vector {' foo' , ' bar' },
74
82
),
75
83
' Traversable<int>' => tuple (
76
84
type_structure (TypeConstants :: class , ' TIntTraversable' ),
77
- Vector { 123 , 456 },
85
+ Vector {123 , 456 },
78
86
),
79
87
' array as Container<int>' => tuple (
80
88
type_structure (TypeConstants :: class , ' TIntContainer' ),
@@ -83,15 +91,15 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
83
91
),
84
92
' Container<int>' => tuple (
85
93
type_structure (TypeConstants :: class , ' TIntContainer' ),
86
- Vector { 123 , 456 },
94
+ Vector {123 , 456 },
87
95
),
88
96
' KeyedTraversable<string, int>' => tuple (
89
97
type_structure (TypeConstants :: class , ' TStringIntKeyedTraversable' ),
90
- Map { ' foo' => 123 },
98
+ Map {' foo' => 123 },
91
99
),
92
100
' KeyedContainer<string, int>' => tuple (
93
101
type_structure (TypeConstants :: class , ' TStringIntKeyedContainer' ),
94
- Map { ' foo' => 123 },
102
+ Map {' foo' => 123 },
95
103
),
96
104
' PHP array as KeyedContainer<string, int>' => tuple (
97
105
type_structure (TypeConstants :: class , ' TStringIntKeyedContainer' ),
@@ -102,19 +110,19 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
102
110
tuple (type_structure (TypeConstants :: class , ' TStringStringMap' ), Map {}),
103
111
' Map<string, string>' => tuple (
104
112
type_structure (TypeConstants :: class , ' TStringStringMap' ),
105
- Map { ' foo' => ' bar' , ' herp' => ' derp' },
113
+ Map {' foo' => ' bar' , ' herp' => ' derp' },
106
114
),
107
115
' Vector<Vector<string>>' => tuple (
108
116
type_structure (TypeConstants :: class , ' TStringVectorVector' ),
109
- Vector { Vector { ' foo' } },
117
+ Vector {Vector {' foo' } },
110
118
),
111
119
' Vector<Vector<string>> with no outer elems' => tuple (
112
120
type_structure (TypeConstants :: class , ' TStringVectorVector' ),
113
121
Vector {},
114
122
),
115
123
' Vector<Vector<string>> with no inner elems' => tuple (
116
124
type_structure (TypeConstants :: class , ' TStringVectorVector' ),
117
- Vector { Vector {} },
125
+ Vector {Vector {}},
118
126
),
119
127
' shape with missing string ?field' => tuple (
120
128
type_structure (TypeConstants :: class , ' TFlatShape' ),
@@ -162,7 +170,7 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
162
170
' shape with non-empty container' => tuple (
163
171
type_structure (TypeConstants :: class , ' TShapeWithContainer' ),
164
172
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
165
- array (' container' => Vector { ' foo' }),
173
+ array (' container' => Vector {' foo' }),
166
174
),
167
175
' enum' =>
168
176
tuple (type_structure (TypeConstants :: class , ' TEnum' ), ExampleEnum :: DERP ),
@@ -209,6 +217,14 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
209
217
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
210
218
[' foo' => ' bar' ],
211
219
),
220
+ ' varray<int> as varray_or_darray<int>' => tuple (
221
+ type_structure (TypeConstants :: class , ' TVArrayOrDArray' ),
222
+ varray [123 ],
223
+ ),
224
+ ' darray<int> as varray_or_darray<int>' => tuple (
225
+ type_structure (TypeConstants :: class , ' TVArrayOrDArray' ),
226
+ darray [' foo' => 123 ],
227
+ ),
212
228
' empty array in array<> shape field' => tuple (
213
229
type_structure (TypeConstants :: class , ' TShapeWithArrayWithoutGenerics' ),
214
230
shape (
@@ -306,17 +322,17 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
306
322
),
307
323
' ints in Vector<string>' => tuple (
308
324
type_structure (TypeConstants :: class , ' TStringVector' ),
309
- Vector { ' foo' , 123 },
325
+ Vector {' foo' , 123 },
310
326
vec [' HH\\ Vector<T>' ],
311
327
),
312
328
' int keys in Map<string, string>' => tuple (
313
329
type_structure (TypeConstants :: class , ' TStringStringMap' ),
314
- Map { 123 => ' foo' },
330
+ Map {123 => ' foo' },
315
331
vec [' HH\\ Map<Tk, _>' ],
316
332
),
317
333
' int values in Map<string, string>' => tuple (
318
334
type_structure (TypeConstants :: class , ' TStringStringMap' ),
319
- Map { ' foo' => ' bar' , ' herp' => 123 },
335
+ Map {' foo' => ' bar' , ' herp' => 123 },
320
336
vec [' HH\\ Map<_, Tv>' ],
321
337
),
322
338
' shape with missing field' => tuple (
@@ -363,42 +379,42 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
363
379
),
364
380
' string in Traversable<int>' => tuple (
365
381
type_structure (TypeConstants :: class , ' TIntTraversable' ),
366
- Vector { 123 , ' 456' },
382
+ Vector {123 , ' 456' },
367
383
vec [' HH\\ Traversable<T>' ],
368
384
),
369
385
' string in Container<int>' => tuple (
370
386
type_structure (TypeConstants :: class , ' TIntContainer' ),
371
- Vector { 123 , ' 456' },
387
+ Vector {123 , ' 456' },
372
388
vec [' HH\\ Container<T>' ],
373
389
),
374
390
' string value in KeyedTraversable<string, int>' => tuple (
375
391
type_structure (TypeConstants :: class , ' TStringIntKeyedTraversable' ),
376
- Map { ' foo' => ' bar' },
392
+ Map {' foo' => ' bar' },
377
393
vec [' HH\\ KeyedTraversable<_, Tv>' ],
378
394
),
379
395
' int key in KeyedTraversable<string, int>' => tuple (
380
396
type_structure (TypeConstants :: class , ' TStringIntKeyedTraversable' ),
381
- Map { 123 => 456 },
397
+ Map {123 => 456 },
382
398
vec [' HH\\ KeyedTraversable<Tk, _>' ],
383
399
),
384
400
' string value in KeyedContainer<string, int>' => tuple (
385
401
type_structure (TypeConstants :: class , ' TStringIntKeyedContainer' ),
386
- Map { ' foo' => ' bar' },
402
+ Map {' foo' => ' bar' },
387
403
vec [' HH\\ KeyedContainer<_, Tv>' ],
388
404
),
389
405
' int key in KeyedContainer<string, int>' => tuple (
390
406
type_structure (TypeConstants :: class , ' TStringIntKeyedContainer' ),
391
- Map { 123 => 456 },
407
+ Map {123 => 456 },
392
408
vec [' HH\\ KeyedContainer<Tk, _>' ],
393
409
),
394
410
' Vector<Vector<string>> with non-container child' => tuple (
395
411
type_structure (TypeConstants :: class , ' TStringVectorVector' ),
396
- Vector { ' foo' },
412
+ Vector {' foo' },
397
413
vec [' HH\\ Vector<T>' ],
398
414
),
399
415
' Vector<Vector<string>> with incorrect container child' => tuple (
400
416
type_structure (TypeConstants :: class , ' TStringVectorVector' ),
401
- Vector { ImmVector { ' foo' } },
417
+ Vector {ImmVector {' foo' } },
402
418
vec [' HH\\ Vector<T>' ],
403
419
),
404
420
' nested shape with missing field' => tuple (
@@ -426,7 +442,7 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
426
442
' shape with container of wrong kind' => tuple (
427
443
type_structure (TypeConstants :: class , ' TShapeWithContainer' ),
428
444
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
429
- array (' container' => Vector { 123 }),
445
+ array (' container' => Vector {123 }),
430
446
vec [' shape[container]' , ' HH\\ Vector<T>' ],
431
447
),
432
448
' enum' => tuple (
0 commit comments