Permalink
Browse files

Treat arrays-used-as-maps, tuples and shapes as by-value collections

Summary: as in title

Reviewed By: vassilmladenov

Differential Revision: D7629290

fbshipit-source-id: 12d4e35bad1049470a9055e416d5024f968cf419
  • Loading branch information...
vladima authored and hhvm-bot committed Apr 15, 2018
1 parent 4442a6d commit 4edbd25aa0d7c75b084d9feb4dd8ddea7f375b07
@@ -211,7 +211,7 @@ let rec is_byval_collection_type env ty =
x = SN.Collections.cVec ||
x = SN.Collections.cDict ||
x = SN.Collections.cKeyset
| _, (Tarraykind (AKvarray _ | AKdarray _ | AKvarray_or_darray _ | AKvec _))
| _, (Tarraykind _ | Ttuple _ | Tshape _)
-> true
| _, Tunresolved tl -> Core_list.for_all tl ~f:(is_byval_collection_type env)
| _ -> false in
@@ -0,0 +1,18 @@
<?hh // strict
<<__RxLocal>>
function test_function1(array<string, mixed> $arr): void {
// OK
$arr['herp'] = 7;
}
<<__RxLocal>>
function test_function2((int, int) $arr): void {
// OK
$arr[0] = 7;
}
<<__RxLocal>>
function test_function3(shape('x' => int) $arr): void {
// OK
$arr['x'] = 7;
}

0 comments on commit 4edbd25

Please sign in to comment.