Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit f92d517

Browse files
committed
array => varray or darray
1 parent c3ed43c commit f92d517

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

tests/TypeStructureTest.hack

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
6666
),
6767
'array as Container<int>' => tuple(
6868
type_structure(TypeConstants::class, 'TIntContainer'),
69-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
70-
array(123, 456),
69+
varray[123, 456],
7170
),
7271
'Container<int>' => tuple(
7372
type_structure(TypeConstants::class, 'TIntContainer'),
@@ -81,10 +80,9 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
8180
type_structure(TypeConstants::class, 'TStringIntKeyedContainer'),
8281
Map {'foo' => 123},
8382
),
84-
'PHP array as KeyedContainer<string, int>' => tuple(
83+
'darray as KeyedContainer<string, int>' => tuple(
8584
type_structure(TypeConstants::class, 'TStringIntKeyedContainer'),
86-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
87-
array('foo' => 123),
85+
darray['foo' => 123],
8886
),
8987
'empty Map<string, string>' =>
9088
tuple(type_structure(TypeConstants::class, 'TStringStringMap'), Map {}),
@@ -358,14 +356,12 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
358356
),
359357
'shape with missing container field' => tuple(
360358
type_structure(TypeConstants::class, 'TShapeWithContainer'),
361-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
362-
array(),
359+
darray[],
363360
vec['shape[container]'],
364361
),
365362
'shape with container of wrong kind' => tuple(
366363
type_structure(TypeConstants::class, 'TShapeWithContainer'),
367-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
368-
array('container' => Vector {123}),
364+
darray['container' => Vector {123}],
369365
vec['shape[container]', 'HH\\Vector<T>'],
370366
),
371367
'enum' => tuple(
@@ -452,21 +448,19 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
452448
vec[new TestStringable('foo')],
453449
keyset['foo'],
454450
),
455-
'array<intish string> to vec<int>' => tuple(
451+
'varray<intish string> to vec<int>' => tuple(
456452
type_structure(TypeConstants::class, 'TIntVec'),
457-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
458-
array('123'),
453+
varray['123'],
459454
vec[123],
460455
),
461456
'array<intish string> to keyset<string>' => tuple(
462457
type_structure(TypeConstants::class, 'TStringKeyset'),
463458
vec['123'],
464459
keyset['123'],
465460
),
466-
'array<string, int> to dict<string, string>' => tuple(
461+
'darray<string, int> to dict<string, string>' => tuple(
467462
type_structure(TypeConstants::class, 'TStringStringDict'),
468-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
469-
array('foo' => 123, 'bar' => 456),
463+
darray['foo' => 123, 'bar' => 456],
470464
dict['foo' => '123', 'bar' => '456'],
471465
),
472466
'shape with implicit subtyping and extra fields' => tuple(
@@ -529,8 +523,7 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
529523
// - likely future changes to the implementation of shapes
530524
$shape = shape('someString' => 'foobar', 'someNullable' => null);
531525
$dict = dict['someString' => 'foobar', 'someNullable' => null];
532-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
533-
$array = array('someString' => 'foobar', 'someNullable' => null);
526+
$array = darray['someString' => 'foobar', 'someNullable' => null];
534527
$ts = type_structure(TypeConstants::class, 'TFlatShape');
535528

536529
expect(TypeAssert\matches_type_structure($ts, $dict))->toBeSame($shape);
@@ -543,8 +536,7 @@ final class TypeStructureTest extends \Facebook\HackTest\HackTest {
543536
// - likely future changes to the implementation of tuples
544537
$tuple = tuple('foo', 123);
545538
$vec = vec['foo', 123];
546-
/* HHAST_IGNORE_ERROR[NoPHPArrayLiterals] */
547-
$array = array('foo', 123);
539+
$array = varray['foo', 123];
548540
$ts = type_structure(TypeConstants::class, 'TTuple');
549541

550542
expect(TypeAssert\matches_type_structure($ts, $vec))->toBeSame($tuple);

0 commit comments

Comments
 (0)