Skip to content

Commit

Permalink
Ban varray/darray intrinsic in the typechecker
Browse files Browse the repository at this point in the history
Summary: ^

Reviewed By: vassilmladenov

Differential Revision: D51563045

fbshipit-source-id: 87a6d5a73507f191407c504d82a0e8eab0c533f7
  • Loading branch information
Scott Owens authored and facebook-github-bot committed Dec 1, 2023
1 parent 848bbb8 commit bcbf500
Show file tree
Hide file tree
Showing 37 changed files with 475 additions and 475 deletions.
2 changes: 1 addition & 1 deletion src/os/sockaddr_in.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final public function getAddress(): in_addr {
}

final public function __debugInfo(): darray<string, mixed> {
return darray[
return dict[
'port (host byte order)' => $this->port,
'address (uint32)' => $this->address,
'address (presentation format)' =>
Expand Down
2 changes: 1 addition & 1 deletion src/os/sockaddr_in6.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ final public function getScopeID(): int {
}

final public function __debugInfo(): darray<string, mixed> {
return darray[
return dict[
'port (host byte order)' => $this->port,
'flow info (host byte order)' => $this->flowInfo,
'scope ID (host byte order)' => $this->scopeID,
Expand Down
32 changes: 16 additions & 16 deletions tests/async/PollTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,40 @@ public static function provideTestInputs(
): varray<(varray<Awaitable<int>>, varray<int>, bool)> {
$block = async (int $prio) ==> await RescheduleWaitHandle::create(0, $prio);

return varray[
return vec[
// Empty
tuple(
varray[],
varray[],
vec[],
vec[],
false,
),
// One eager success
tuple(
varray[async { return 42; }],
varray[42],
vec[async { return 42; }],
vec[42],
false,
),
// One resumed success
tuple(
varray[async { await $block(0); return 42; }],
varray[42],
vec[async { await $block(0); return 42; }],
vec[42],
false,
),
// One eager failure
tuple(
varray[async { throw new Exception(); }],
varray[],
vec[async { throw new Exception(); }],
vec[],
true,
),
// One resumed failure
tuple(
varray[async { await $block(0); throw new Exception(); }],
varray[],
vec[async { await $block(0); throw new Exception(); }],
vec[],
true,
),
// Combination
tuple(
varray[
vec[
async { return 1; },
async { await $block(1); return 2; },
async { return 3; },
Expand All @@ -73,7 +73,7 @@ public static function provideTestInputs(
async { await $block(0); return 5; },
async { return 6; },
],
varray[1, 3, 6, 5, 2],
vec[1, 3, 6, 5, 2],
true,
),
];
Expand All @@ -85,7 +85,7 @@ public static function provideTestInputs(
varray<int> $expected_results,
bool $expected_exception,
): Awaitable<void> {
$results = varray[];
$results = vec[];
$exception = false;
try {
foreach (Async\Poll::from($awaitables) await as $value) {
Expand All @@ -103,7 +103,7 @@ public static function provideTestInputs(
}

public async function testKeyed(): Awaitable<void> {
$poll = Async\KeyedPoll::from(darray[
$poll = Async\KeyedPoll::from(dict[
'k1' => async {
return 1;
},
Expand All @@ -118,7 +118,7 @@ public static function provideTestInputs(
break;
case 'k2':
expect($value)->toBePHPEqual(2);
$poll->addMulti(darray['k3' => async { return 3; }]);
$poll->addMulti(dict['k3' => async { return 3; }]);
break;
case 'k3':
expect($value)->toBePHPEqual(3);
Expand Down
40 changes: 20 additions & 20 deletions tests/c/CIntrospectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
final class CIntrospectTest extends HackTest {

public static function provideTestAny(): varray<mixed> {
return varray[
return vec[
tuple(
Vector {2, 4, 6, 8, 9, 10, 12},
$v ==> $v % 2 === 1,
Expand All @@ -39,18 +39,18 @@ public function testAny<T>(
}

public static function provideTestAnyWithoutPredicate(): varray<mixed> {
return varray[
return vec[
tuple(
varray[],
vec[],
false,
),
tuple(
varray[null, 0, '0', ''],
vec[null, 0, '0', ''],
false,
),
tuple(
HackLibTestTraversables::getIterator(
varray[null, 0, '0', '', 1],
vec[null, 0, '0', '', 1],
),
true,
),
Expand All @@ -67,7 +67,7 @@ public function testAnyWithoutPredicate<T>(

public static function provideTestContains(
): varray<(Traversable<mixed>, mixed, bool)> {
return varray[
return vec[
tuple(
vec[1, 2, 3, 4, 5],
3,
Expand Down Expand Up @@ -109,13 +109,13 @@ public static function provideTestContains(
true,
),
tuple(
varray[dict[1 => 2, 3 => 4]],
vec[dict[1 => 2, 3 => 4]],
dict[1 => 2, 3 => 4],
true,
),
tuple(
varray[varray[3]],
varray[4],
vec[vec[3]],
vec[4],
false,
),
tuple(
Expand Down Expand Up @@ -166,9 +166,9 @@ public function testContains<T>(
}

public static function provideTestContainsKey(): varray<mixed> {
return varray[
return vec[
tuple(
darray[3 => 3],
dict[3 => 3],
3,
true,
),
Expand Down Expand Up @@ -210,8 +210,8 @@ public function testContainsKey<Tk as arraykey, Tv>(
}

public static function provideTestCount(): varray<mixed> {
return varray[
tuple(varray[], 0),
return vec[
tuple(vec[], 0),
tuple(Vec\range(1, 10), 10),
tuple(Set {1, 2}, 2),
tuple(Vector {1, 2}, 2),
Expand All @@ -231,7 +231,7 @@ public function testCount<T>(
}

public static function provideTestEvery(): varray<mixed> {
return varray[
return vec[
tuple(
Vector {2, 4, 6, 8, 9, 10, 12},
$v ==> $v % 2 === 0,
Expand All @@ -255,9 +255,9 @@ public function testEvery<T>(
}

public static function provideTestEveryWithoutPredicate(): varray<mixed> {
return varray[
return vec[
tuple(
varray[],
vec[],
true,
),
tuple(
Expand All @@ -276,10 +276,10 @@ public function testEveryWithoutPredicate<T>(
}

public static function provideTestIsEmpty(): varray<mixed> {
return varray[
tuple(varray[], true),
tuple(varray[1], false),
tuple(darray['foo' => 'bar'], false),
return vec[
tuple(vec[], true),
tuple(vec[1], false),
tuple(dict['foo' => 'bar'], false),
tuple(dict[], true),
tuple(dict['foo' => 'bar'], false),
tuple(vec[], true),
Expand Down
10 changes: 5 additions & 5 deletions tests/c/CReduceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
final class CReduceTest extends HackTest {

public static function provideTestReduce(): varray<mixed> {
return varray[
return vec[
tuple(
Set {'the', ' quick', ' brown', ' fox'},
($a, $s) ==> $a.$s,
Expand All @@ -24,14 +24,14 @@ public static function provideTestReduce(): varray<mixed> {
),
tuple(
HackLibTestTraversables::getIterator(
varray['the', ' quick', ' brown', ' fox'],
vec['the', ' quick', ' brown', ' fox'],
),
($a, $s) ==> $a.$s,
'',
'the quick brown fox',
),
tuple(
varray['the', 'quick', 'brown', 'fox'],
vec['the', 'quick', 'brown', 'fox'],
/* HH_FIXME[4297] The type of the lambda argument(s) could not be inferred */
($a, $s) ==> $a->add($s),
Vector {},
Expand All @@ -51,7 +51,7 @@ public function testReduce<Tv, Ta>(
}

public static function provideTestReduceWithKey(): varray<mixed> {
return varray[
return vec[
tuple(
'dict',
dict[1 => 2, 2 => 3, 3 => 4, 4 => 5],
Expand All @@ -60,7 +60,7 @@ public static function provideTestReduceWithKey(): varray<mixed> {
),
tuple(
'array',
darray[1 => 2, 2 => 3, 3 => 4, 4 => 5],
dict[1 => 2, 2 => 3, 3 => 4, 4 => 5],
dict[1 => 0, 4 => 6, 8 => 10],
dict[1 => 0],
),
Expand Down
Loading

0 comments on commit bcbf500

Please sign in to comment.