From 97eab214b4249ed41d4faa188a72581c3b33f6fd Mon Sep 17 00:00:00 2001 From: Vassil Mladenov Date: Mon, 2 Mar 2020 11:44:52 -0800 Subject: [PATCH] Remove array(...) in typecheck tests that result in test differences Summary: These changes resulted in differences to the typecheck:typecheck* tests Reviewed By: billf Differential Revision: D19964991 fbshipit-source-id: 97a4737ed50ab55caafba80411985c6e119417ab --- hphp/hack/test/typecheck/akempty/akempty_promotion_0.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_0.php.exp | 4 ++-- hphp/hack/test/typecheck/akempty/akempty_promotion_1.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_11.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_13.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_14.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_3.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_3.php.exp | 6 +++--- hphp/hack/test/typecheck/akempty/akempty_promotion_5.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_5.php.exp | 4 ++-- hphp/hack/test/typecheck/akempty/akempty_promotion_9.php | 2 +- hphp/hack/test/typecheck/akempty/akempty_promotion_9.php.exp | 4 ++-- hphp/hack/test/typecheck/akempty_promotion_15.php | 2 +- hphp/hack/test/typecheck/akempty_promotion_15.php.exp | 4 ++-- hphp/hack/test/typecheck/akempty_promotion_8.php | 2 +- hphp/hack/test/typecheck/akempty_promotion_8.php.exp | 7 +------ hphp/hack/test/typecheck/akempty_tuple_bad.php | 2 +- hphp/hack/test/typecheck/akempty_tuple_bad.php.exp | 4 ++-- hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php | 2 +- hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php.exp | 2 +- .../hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php | 2 +- .../test/typecheck/aktuple/dynamic_index_non_lvalue_error.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php | 2 +- .../test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/foreach_error.php | 2 +- hphp/hack/test/typecheck/aktuple/foreach_error.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/list_error.php | 2 +- hphp/hack/test/typecheck/aktuple/list_error.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/list_ok.php | 2 +- hphp/hack/test/typecheck/aktuple/list_ok.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/local_vs_nested.php | 4 ++-- hphp/hack/test/typecheck/aktuple/local_vs_nested.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php | 2 +- .../test/typecheck/aktuple/nested_dynamic_index_lvalue.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php | 2 +- hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/unify_error1.php | 4 ++-- hphp/hack/test/typecheck/aktuple/unify_error1.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/unify_error2.php | 4 ++-- hphp/hack/test/typecheck/aktuple/unify_error2.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/unify_error3.php | 4 ++-- hphp/hack/test/typecheck/aktuple/unify_error3.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/unify_ok.php | 4 ++-- hphp/hack/test/typecheck/aktuple/unify_ok.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/vec_literal_error.php | 2 +- hphp/hack/test/typecheck/aktuple/vec_literal_error.php.exp | 2 +- hphp/hack/test/typecheck/aktuple/vec_literal_ok.php | 2 +- hphp/hack/test/typecheck/aktuple/vec_literal_ok.php.exp | 2 +- .../disallow_php_array_when_dictionary_like_array_is_required.php | 2 +- .../disallow_php_array_when_vector_like_array_is_required.php | 2 +- ..._an_array_of_string_when_array_of_int_to_string_is_required.php | 2 +- ...array_of_string_when_array_of_int_to_string_is_required.php.exp | 4 ++-- hphp/hack/test/typecheck/array_sub.php | 2 +- hphp/hack/test/typecheck/array_sub2.php | 2 +- hphp/hack/test/typecheck/assignment1.php | 2 +- hphp/hack/test/typecheck/assignment1.php.exp | 2 +- hphp/hack/test/typecheck/call_user_func_array.php | 2 +- hphp/hack/test/typecheck/call_user_func_array.php.exp | 2 +- hphp/hack/test/typecheck/classname/array_literal_bad.php | 2 +- hphp/hack/test/typecheck/classname/array_literal_bad.php.exp | 4 ++-- hphp/hack/test/typecheck/classname/typename_array_literal_bad.php | 2 +- .../test/typecheck/classname/typename_array_literal_bad.php.exp | 4 ++-- hphp/hack/test/typecheck/disallow_array/literal1.php | 5 ----- hphp/hack/test/typecheck/disallow_array/literal1.php.exp | 2 -- hphp/hack/test/typecheck/disallow_array/literal2.php | 5 ----- hphp/hack/test/typecheck/disallow_array/literal2.php.exp | 2 -- hphp/hack/test/typecheck/fun_generics_bad.php | 5 ++--- hphp/hack/test/typecheck/global_const2.php | 2 +- hphp/hack/test/typecheck/global_const2.php.exp | 4 ++-- hphp/hack/test/typecheck/instantiate_unresolved5.php | 2 +- .../hack/test/typecheck/instantiate_unresolved5.php.like_types.exp | 4 ++-- hphp/hack/test/typecheck/integrate_null4.php | 4 ++-- hphp/hack/test/typecheck/integrate_unify.php | 6 +++--- hphp/hack/test/typecheck/invalid_arraykey/invalid_arraykey.php | 2 +- hphp/hack/test/typecheck/invalid_arraykey/invalid_arraykey.php.exp | 4 ++-- hphp/hack/test/typecheck/keys.php | 2 +- hphp/hack/test/typecheck/keys.php.exp | 2 +- .../lambda/lambda_contextual/lambda_bad_as_maparray_argument.php | 4 ++-- hphp/hack/test/typecheck/new_inference/string_expressions4b.php | 2 +- .../hack/test/typecheck/new_inference/string_expressions4b.php.exp | 2 +- .../typecheck/reactive/mut_collections/mutable_in_collections1.php | 6 +++--- .../reactive/mut_collections/mutable_in_collections1.php.exp | 6 +++--- .../typecheck/reactive/mut_collections/mutable_in_collections2.php | 4 ++-- .../reactive/mut_collections/mutable_in_collections2.php.exp | 4 ++-- .../test/typecheck/shape/nullable_shape_disallows_indexing.php | 2 +- .../test/typecheck/shape/nullable_shape_disallows_indexing.php.exp | 4 ++-- hphp/hack/test/typecheck/string_expressions4b.php | 2 +- hphp/hack/test/typecheck/string_expressions4b.php.exp | 2 +- hphp/hack/test/typecheck/subtype_array2.php | 2 +- hphp/hack/test/typecheck/subtype_array4.php | 4 ++-- hphp/hack/test/typecheck/test_array13.php | 2 +- hphp/hack/test/typecheck/test_array13.php.exp | 2 +- hphp/hack/test/typecheck/test_array9.php | 2 +- hphp/hack/test/typecheck/test_array9.php.exp | 2 +- hphp/hack/test/typecheck/test_consts2.php | 2 +- hphp/hack/test/typecheck/union/arrays.php | 6 +++--- hphp/hack/test/typecheck/union/arrays.php.exp | 4 ++-- hphp/hack/test/typecheck/union/arrays.php.like_types.exp | 4 ++-- hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php | 6 +++--- hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php.exp | 2 +- hphp/hack/test/typecheck/void_usage_5.php | 2 +- hphp/hack/test/typecheck/void_usage_5.php.exp | 2 +- 102 files changed, 135 insertions(+), 155 deletions(-) delete mode 100644 hphp/hack/test/typecheck/disallow_array/literal1.php delete mode 100644 hphp/hack/test/typecheck/disallow_array/literal1.php.exp delete mode 100644 hphp/hack/test/typecheck/disallow_array/literal2.php delete mode 100644 hphp/hack/test/typecheck/disallow_array/literal2.php.exp diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php index 0c7a04e17be..75b855c1821 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php @@ -5,7 +5,7 @@ * error message points to [] as the reason */ function test(): void { - $a = array(); + $a = varray[]; $a[] = 'aaa'; f($a); } diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php.exp b/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php.exp index 73f9a0dd2d6..db98a4dd95b 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php.exp +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_0.php.exp @@ -2,5 +2,5 @@ File "akempty_promotion_0.php", line 10, characters 5-6: Invalid argument (Typing[4110]) File "akempty_promotion_0.php", line 13, characters 12-14: Expected int -File "akempty_promotion_0.php", line 9, characters 3-6: -But got varray because a value is appended to it +File "akempty_promotion_0.php", line 8, characters 8-15: +But got varray diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_1.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_1.php index 836ed325e29..10f61f1894f 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_1.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_1.php @@ -4,7 +4,7 @@ * Test if the inner value type of AKvarray is correctly inferred */ function test(): void { - $a = array(); + $a = varray[]; $a[] = 'aaa'; // should error, because it's an array (used like a vector) containing strings f($a); diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_11.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_11.php index 5a60fb81c6d..d8f2e4b3580 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_11.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_11.php @@ -5,7 +5,7 @@ * intermediate assignment */ function test(): ConstVector> { - $v = Vector { array() }; + $v = Vector { darray[] }; $a = $v[0]; $a['aaa'] = 4; // no error "$a =" assignment created a copy of an array inside $v, and diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_13.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_13.php index c905e0e0d82..16ea07aa4da 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_13.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_13.php @@ -6,7 +6,7 @@ */ function test(): ConstVector>> { - $v1 = Vector { Vector { array() } }; + $v1 = Vector { Vector { darray[] } }; $v2 = $v1[0]; $v3 = $v2[0]; $v3['aaa'] = 4; diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_14.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_14.php index 6b508484b7f..fee5ae556fb 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_14.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_14.php @@ -5,7 +5,7 @@ * of array when dealing with nested types =( */ function test(): ConstVector>> { - $v = Vector { array(array()) }; + $v = Vector { varray[darray[]] }; $a = $v[0]; $a[0]['aaa'] = 4; return $v; diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php index 3642502acd9..dbda00f677d 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php @@ -4,7 +4,7 @@ * Test AKempty to AKvarray upgrade when inside typevar and unresolved type */ function test(bool $b): void { - $a = array(); + $a = varray[]; if ($b) { } hh_show($a); // should by unresolved type inside a typevar diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php.exp b/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php.exp index f70522acb26..3dda4e3b6d5 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php.exp +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_3.php.exp @@ -1,8 +1,8 @@ File "akempty_promotion_3.php", line 10, characters 3-13: - array (empty) + varray File "akempty_promotion_3.php", line 12, characters 5-6: Invalid argument (Typing[4110]) File "akempty_promotion_3.php", line 15, characters 12-14: Expected int -File "akempty_promotion_3.php", line 11, characters 3-6: -But got varray because a value is appended to it +File "akempty_promotion_3.php", line 7, characters 8-15: +But got varray diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php index c515a9eacf2..569d7ac509c 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php @@ -5,7 +5,7 @@ * and error message points to [...] as the reason */ function test(int $i): void { - $a = array(); + $a = darray[]; $a[$i] = 'aaa'; f($a); } diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php.exp b/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php.exp index 9fbd8dc55f0..f55adfa70a3 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php.exp +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_5.php.exp @@ -2,5 +2,5 @@ File "akempty_promotion_5.php", line 10, characters 5-6: Invalid argument (Typing[4110]) File "akempty_promotion_5.php", line 13, characters 12-14: Expected int -File "akempty_promotion_5.php", line 9, characters 3-8: -But got darray because it is used as map here +File "akempty_promotion_5.php", line 8, characters 8-15: +But got darray diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php b/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php index 83e5fabf7d4..9d900a5bd93 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php @@ -5,7 +5,7 @@ * AKvarray, in another to AKdarray. Should be unresolved of those two afterwards. */ function test(bool $b): void { - $a = array(); + $a = varray[]; if ($b) { $a[] = 'aaa'; } else { diff --git a/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php.exp b/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php.exp index 35f51b42134..083415abc72 100644 --- a/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php.exp +++ b/hphp/hack/test/typecheck/akempty/akempty_promotion_9.php.exp @@ -2,5 +2,5 @@ File "akempty_promotion_9.php", line 15, characters 5-6: Invalid argument (Typing[4110]) File "akempty_promotion_9.php", line 18, characters 12-29: Expected darray -File "akempty_promotion_9.php", line 10, characters 5-8: -But got varray because a value is appended to it +File "akempty_promotion_9.php", line 8, characters 8-15: +But got varray diff --git a/hphp/hack/test/typecheck/akempty_promotion_15.php b/hphp/hack/test/typecheck/akempty_promotion_15.php index 7955a5b45db..97757f7c3ca 100644 --- a/hphp/hack/test/typecheck/akempty_promotion_15.php +++ b/hphp/hack/test/typecheck/akempty_promotion_15.php @@ -1,7 +1,7 @@ { - $a = array(); + $a = darray[]; if ($b) { $a[4] = 'aaa'; } diff --git a/hphp/hack/test/typecheck/akempty_promotion_15.php.exp b/hphp/hack/test/typecheck/akempty_promotion_15.php.exp index cf43294b605..141aad08b44 100644 --- a/hphp/hack/test/typecheck/akempty_promotion_15.php.exp +++ b/hphp/hack/test/typecheck/akempty_promotion_15.php.exp @@ -2,5 +2,5 @@ File "akempty_promotion_15.php", line 8, characters 10-11: Invalid return type (Typing[4110]) File "akempty_promotion_15.php", line 3, characters 25-37: Expected varray -File "akempty_promotion_15.php", line 6, characters 5-9: -But got darray because it is used as map here +File "akempty_promotion_15.php", line 4, characters 8-15: +But got darray diff --git a/hphp/hack/test/typecheck/akempty_promotion_8.php b/hphp/hack/test/typecheck/akempty_promotion_8.php index 42a389ca1da..02856792ab3 100644 --- a/hphp/hack/test/typecheck/akempty_promotion_8.php +++ b/hphp/hack/test/typecheck/akempty_promotion_8.php @@ -5,7 +5,7 @@ * AKvarray, in another to AKdarray. Should be unresolved of those two afterwards. */ function test(bool $b): void { - $a = array(); + $a = varray[]; if ($b) { $a[] = 'aaa'; } else { diff --git a/hphp/hack/test/typecheck/akempty_promotion_8.php.exp b/hphp/hack/test/typecheck/akempty_promotion_8.php.exp index d8ad05cf7dc..4269126fceb 100644 --- a/hphp/hack/test/typecheck/akempty_promotion_8.php.exp +++ b/hphp/hack/test/typecheck/akempty_promotion_8.php.exp @@ -1,6 +1 @@ -File "akempty_promotion_8.php", line 15, characters 5-6: -Invalid argument (Typing[4110]) -File "akempty_promotion_8.php", line 18, characters 12-24: -Expected varray -File "akempty_promotion_8.php", line 12, characters 5-9: -But got darray because it is used as map here +No errors diff --git a/hphp/hack/test/typecheck/akempty_tuple_bad.php b/hphp/hack/test/typecheck/akempty_tuple_bad.php index e3abbef59e9..46fb9b7bcee 100644 --- a/hphp/hack/test/typecheck/akempty_tuple_bad.php +++ b/hphp/hack/test/typecheck/akempty_tuple_bad.php @@ -2,7 +2,7 @@ // Copyright 2004-present Facebook. All Rights Reserved. function omg(): (?string, array) { - $x = array(); + $x = varray[]; return $x; } diff --git a/hphp/hack/test/typecheck/akempty_tuple_bad.php.exp b/hphp/hack/test/typecheck/akempty_tuple_bad.php.exp index d15686104e1..13220a670ec 100644 --- a/hphp/hack/test/typecheck/akempty_tuple_bad.php.exp +++ b/hphp/hack/test/typecheck/akempty_tuple_bad.php.exp @@ -2,5 +2,5 @@ File "akempty_tuple_bad.php", line 6, characters 10-11: Invalid return type (Typing[4110]) File "akempty_tuple_bad.php", line 4, characters 17-37: Expected (?string, varray) -File "akempty_tuple_bad.php", line 5, characters 8-14: -But got array (empty) +File "akempty_tuple_bad.php", line 5, characters 8-15: +But got varray diff --git a/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php b/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php index fa7ffc4dec4..18cff8189bf 100644 --- a/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php +++ b/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php @@ -6,7 +6,7 @@ */ function test(int $key): void { - $a = array(4, 'aaa'); + $a = varray[4, 'aaa']; $a[$key] = 4; hh_show($a); take_string($a[1]); diff --git a/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php.exp b/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php.exp index 488bb6cec61..40a780bc1cd 100644 --- a/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php.exp +++ b/hphp/hack/test/typecheck/aktuple/dynamic_index_lvalue.php.exp @@ -4,5 +4,5 @@ File "dynamic_index_lvalue.php", line 12, characters 15-19: Invalid argument (Typing[4110]) File "dynamic_index_lvalue.php", line 15, characters 22-27: Expected string -File "dynamic_index_lvalue.php", line 9, characters 14-14: +File "dynamic_index_lvalue.php", line 9, characters 15-15: But got int diff --git a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php index 371c06b55c4..65d81e7dc73 100644 --- a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php +++ b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php @@ -6,7 +6,7 @@ */ function test(int $key): void { - $a = array(4, 'aaa'); + $a = varray[4, 'aaa']; $_ = $a[$key]; take_string($a[0]); diff --git a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php.exp b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php.exp index 235c991ce94..d4cfa192d1d 100644 --- a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php.exp +++ b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_error.php.exp @@ -2,5 +2,5 @@ File "dynamic_index_non_lvalue_error.php", line 12, characters 15-19: Invalid argument (Typing[4110]) File "dynamic_index_non_lvalue_error.php", line 15, characters 22-27: Expected string -File "dynamic_index_non_lvalue_error.php", line 9, characters 14-14: +File "dynamic_index_non_lvalue_error.php", line 9, characters 15-15: But got int diff --git a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php index d9ef6d8fe19..be8286ca1ee 100644 --- a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php +++ b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php @@ -6,7 +6,7 @@ */ function test(int $key): void { - $a = array(4, 'aaa'); + $a = varray[4, 'aaa']; $_ = $a[$key]; take_int($a[0]); diff --git a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php.exp b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php.exp index cfa7eb0607f..ca514030141 100644 --- a/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php.exp +++ b/hphp/hack/test/typecheck/aktuple/dynamic_index_non_lvalue_ok.php.exp @@ -2,5 +2,5 @@ File "dynamic_index_non_lvalue_ok.php", line 12, characters 12-16: Invalid argument (Typing[4110]) File "dynamic_index_non_lvalue_ok.php", line 16, characters 19-21: Expected int -File "dynamic_index_non_lvalue_ok.php", line 9, characters 17-21: +File "dynamic_index_non_lvalue_ok.php", line 9, characters 18-22: But got string diff --git a/hphp/hack/test/typecheck/aktuple/foreach_error.php b/hphp/hack/test/typecheck/aktuple/foreach_error.php index 8cd641943f5..4bbcfad21b1 100644 --- a/hphp/hack/test/typecheck/aktuple/foreach_error.php +++ b/hphp/hack/test/typecheck/aktuple/foreach_error.php @@ -6,7 +6,7 @@ */ function test(): void { - $a = array(4, 3.14); + $a = varray[4, 3.14]; foreach ($a as $v) { take_int($v); diff --git a/hphp/hack/test/typecheck/aktuple/foreach_error.php.exp b/hphp/hack/test/typecheck/aktuple/foreach_error.php.exp index b185cd82a1f..87237fe1789 100644 --- a/hphp/hack/test/typecheck/aktuple/foreach_error.php.exp +++ b/hphp/hack/test/typecheck/aktuple/foreach_error.php.exp @@ -2,5 +2,5 @@ File "foreach_error.php", line 12, characters 14-15: Invalid argument (Typing[4110]) File "foreach_error.php", line 16, characters 19-21: Expected int -File "foreach_error.php", line 9, characters 17-20: +File "foreach_error.php", line 9, characters 18-21: But got num diff --git a/hphp/hack/test/typecheck/aktuple/list_error.php b/hphp/hack/test/typecheck/aktuple/list_error.php index af55537da2e..cd209106cf3 100644 --- a/hphp/hack/test/typecheck/aktuple/list_error.php +++ b/hphp/hack/test/typecheck/aktuple/list_error.php @@ -3,7 +3,7 @@ /* Tuple-like arrays can be used with list(...) statement - usage that should * report errors. */ function test(): void { - $a = array(4, 'aaa'); + $a = varray[4, 'aaa']; list($int, $string) = $a; take_string($int); diff --git a/hphp/hack/test/typecheck/aktuple/list_error.php.exp b/hphp/hack/test/typecheck/aktuple/list_error.php.exp index 3c50b5d0139..5487a22caea 100644 --- a/hphp/hack/test/typecheck/aktuple/list_error.php.exp +++ b/hphp/hack/test/typecheck/aktuple/list_error.php.exp @@ -2,5 +2,5 @@ File "list_error.php", line 9, characters 15-18: Invalid argument (Typing[4110]) File "list_error.php", line 12, characters 22-27: Expected string -File "list_error.php", line 6, characters 14-14: +File "list_error.php", line 6, characters 15-15: But got int diff --git a/hphp/hack/test/typecheck/aktuple/list_ok.php b/hphp/hack/test/typecheck/aktuple/list_ok.php index ef104c05eee..25e85ff7e8a 100644 --- a/hphp/hack/test/typecheck/aktuple/list_ok.php +++ b/hphp/hack/test/typecheck/aktuple/list_ok.php @@ -3,7 +3,7 @@ /* Tuple-like arrays can be used with list(...) statement - usage with no * errors. */ function test(): void { - $a = array(4, 'aaa'); + $a = varray[4, 'aaa']; list($int, $string) = $a; take_string($string); diff --git a/hphp/hack/test/typecheck/aktuple/list_ok.php.exp b/hphp/hack/test/typecheck/aktuple/list_ok.php.exp index 1650edbdde7..0866cbe8771 100644 --- a/hphp/hack/test/typecheck/aktuple/list_ok.php.exp +++ b/hphp/hack/test/typecheck/aktuple/list_ok.php.exp @@ -2,5 +2,5 @@ File "list_ok.php", line 9, characters 15-21: Invalid argument (Typing[4110]) File "list_ok.php", line 13, characters 22-27: Expected string -File "list_ok.php", line 6, characters 14-14: +File "list_ok.php", line 6, characters 15-15: But got int diff --git a/hphp/hack/test/typecheck/aktuple/local_vs_nested.php b/hphp/hack/test/typecheck/aktuple/local_vs_nested.php index 717228ac541..2e2a51c0ea8 100644 --- a/hphp/hack/test/typecheck/aktuple/local_vs_nested.php +++ b/hphp/hack/test/typecheck/aktuple/local_vs_nested.php @@ -5,12 +5,12 @@ */ function test(int $i, int $j, int $k): void { - $a = array(4); + $a = varray[4]; $a[0] = 'aaa'; // $a is a local variable, so at this point we can forget // about 0 prevoiusly storing an int take_string($a[0]); // no error - $v = Vector { array(4) }; + $v = Vector { varray[4] }; $v[$i][0] = 'aaa'; // we don't know anything about $i and $j, so // $v[$j][0] can be both string and int take_string($v[$j][0]); // should be an error diff --git a/hphp/hack/test/typecheck/aktuple/local_vs_nested.php.exp b/hphp/hack/test/typecheck/aktuple/local_vs_nested.php.exp index 36d34daf85c..feca60ab2b2 100644 --- a/hphp/hack/test/typecheck/aktuple/local_vs_nested.php.exp +++ b/hphp/hack/test/typecheck/aktuple/local_vs_nested.php.exp @@ -2,5 +2,5 @@ File "local_vs_nested.php", line 11, characters 15-19: Invalid argument (Typing[4110]) File "local_vs_nested.php", line 20, characters 22-27: Expected string -File "local_vs_nested.php", line 8, characters 14-14: +File "local_vs_nested.php", line 8, characters 15-15: But got int diff --git a/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php b/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php index 3ace3fa413b..e28fc2da66e 100644 --- a/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php +++ b/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php @@ -6,7 +6,7 @@ */ function test(int $key): void { - $a = Vector { array(4, 'aaa') }; + $a = Vector { varray[4, 'aaa'] }; $a[0][$key] = 4; take_string($a[0][1]); } diff --git a/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php.exp b/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php.exp index 972d6a18b01..d6e21b807b0 100644 --- a/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php.exp +++ b/hphp/hack/test/typecheck/aktuple/nested_dynamic_index_lvalue.php.exp @@ -2,5 +2,5 @@ File "nested_dynamic_index_lvalue.php", line 11, characters 15-22: Invalid argument (Typing[4110]) File "nested_dynamic_index_lvalue.php", line 14, characters 22-27: Expected string -File "nested_dynamic_index_lvalue.php", line 9, characters 23-23: +File "nested_dynamic_index_lvalue.php", line 9, characters 24-24: But got int diff --git a/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php b/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php index 7b8bb36d5b7..57f2b5fd77e 100644 --- a/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php +++ b/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php @@ -6,7 +6,7 @@ */ function test(): void { - $a = array(4, 'aaa'); + $a = varray[4, 'aaa']; $a[99] = 4; hh_show($a); take_string($a[1]); diff --git a/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php.exp b/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php.exp index d15a598a659..5d8c98be47f 100644 --- a/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php.exp +++ b/hphp/hack/test/typecheck/aktuple/out_of_range_index_lvalue.php.exp @@ -4,5 +4,5 @@ File "out_of_range_index_lvalue.php", line 12, characters 15-19: Invalid argument (Typing[4110]) File "out_of_range_index_lvalue.php", line 15, characters 22-27: Expected string -File "out_of_range_index_lvalue.php", line 9, characters 14-14: +File "out_of_range_index_lvalue.php", line 9, characters 15-15: But got int diff --git a/hphp/hack/test/typecheck/aktuple/unify_error1.php b/hphp/hack/test/typecheck/aktuple/unify_error1.php index 5227d13c21e..822b4a4c416 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_error1.php +++ b/hphp/hack/test/typecheck/aktuple/unify_error1.php @@ -5,9 +5,9 @@ function take_int(int $_): void {} function test(bool $b): void { if ($b) { - $a = array(4); + $a = varray[4]; } else { - $a = array(3.14, 'aaa'); + $a = varray[3.14, 'aaa']; } take_int($a[0]); diff --git a/hphp/hack/test/typecheck/aktuple/unify_error1.php.exp b/hphp/hack/test/typecheck/aktuple/unify_error1.php.exp index 817b5873bf3..6f426b0df6d 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_error1.php.exp +++ b/hphp/hack/test/typecheck/aktuple/unify_error1.php.exp @@ -2,5 +2,5 @@ File "unify_error1.php", line 13, characters 12-16: Invalid argument (Typing[4110]) File "unify_error1.php", line 3, characters 19-21: Expected int -File "unify_error1.php", line 8, characters 16-16: +File "unify_error1.php", line 8, characters 17-17: But got num diff --git a/hphp/hack/test/typecheck/aktuple/unify_error2.php b/hphp/hack/test/typecheck/aktuple/unify_error2.php index b57434cb086..d494a89456d 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_error2.php +++ b/hphp/hack/test/typecheck/aktuple/unify_error2.php @@ -5,9 +5,9 @@ function take_float(float $_): void {} function test(bool $b): void { if ($b) { - $a = array(4); + $a = varray[4]; } else { - $a = array(3.14, 'aaa'); + $a = varray[3.14, 'aaa']; } take_float($a[0]); diff --git a/hphp/hack/test/typecheck/aktuple/unify_error2.php.exp b/hphp/hack/test/typecheck/aktuple/unify_error2.php.exp index 3fd2bd4389f..5e3315bb893 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_error2.php.exp +++ b/hphp/hack/test/typecheck/aktuple/unify_error2.php.exp @@ -2,5 +2,5 @@ File "unify_error2.php", line 13, characters 14-18: Invalid argument (Typing[4110]) File "unify_error2.php", line 3, characters 21-25: Expected float -File "unify_error2.php", line 8, characters 16-16: +File "unify_error2.php", line 8, characters 17-17: But got num diff --git a/hphp/hack/test/typecheck/aktuple/unify_error3.php b/hphp/hack/test/typecheck/aktuple/unify_error3.php index 099c2dc0713..7a1f2d57676 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_error3.php +++ b/hphp/hack/test/typecheck/aktuple/unify_error3.php @@ -5,9 +5,9 @@ function take_int(int $_): void {} function test(bool $b): void { if ($b) { - $a = array(4); + $a = varray[4]; } else { - $a = array(3.14, 'aaa'); + $a = varray[3.14, 'aaa']; } take_int($a[1]); diff --git a/hphp/hack/test/typecheck/aktuple/unify_error3.php.exp b/hphp/hack/test/typecheck/aktuple/unify_error3.php.exp index 7eb2285014d..f94fcd29d1c 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_error3.php.exp +++ b/hphp/hack/test/typecheck/aktuple/unify_error3.php.exp @@ -2,5 +2,5 @@ File "unify_error3.php", line 13, characters 12-16: Invalid argument (Typing[4110]) File "unify_error3.php", line 3, characters 19-21: Expected int -File "unify_error3.php", line 8, characters 16-16: +File "unify_error3.php", line 8, characters 17-17: But got num diff --git a/hphp/hack/test/typecheck/aktuple/unify_ok.php b/hphp/hack/test/typecheck/aktuple/unify_ok.php index 451cb192bcd..754953f4d80 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_ok.php +++ b/hphp/hack/test/typecheck/aktuple/unify_ok.php @@ -6,9 +6,9 @@ function take_string(string $_): void {} function test(bool $b): void { if ($b) { - $a = array(4); + $a = varray[4]; } else { - $a = array(3.14, 'aaa'); + $a = varray[3.14, 'aaa']; } take_num($a[0]); diff --git a/hphp/hack/test/typecheck/aktuple/unify_ok.php.exp b/hphp/hack/test/typecheck/aktuple/unify_ok.php.exp index 41c20dd80d3..562c6bad292 100644 --- a/hphp/hack/test/typecheck/aktuple/unify_ok.php.exp +++ b/hphp/hack/test/typecheck/aktuple/unify_ok.php.exp @@ -2,5 +2,5 @@ File "unify_ok.php", line 14, characters 12-16: Invalid argument (Typing[4110]) File "unify_ok.php", line 3, characters 19-21: Expected num -File "unify_ok.php", line 11, characters 22-26: +File "unify_ok.php", line 11, characters 23-27: But got string diff --git a/hphp/hack/test/typecheck/aktuple/vec_literal_error.php b/hphp/hack/test/typecheck/aktuple/vec_literal_error.php index de89d6b4cdd..0a216f967b6 100644 --- a/hphp/hack/test/typecheck/aktuple/vec_literal_error.php +++ b/hphp/hack/test/typecheck/aktuple/vec_literal_error.php @@ -1,7 +1,7 @@ $array): void {} function providesArrayOfUnknown(): array { - return array("tingley"); + return varray["tingley"]; } function test(): void { diff --git a/hphp/hack/test/typecheck/array/disallow_php_array_when_vector_like_array_is_required.php b/hphp/hack/test/typecheck/array/disallow_php_array_when_vector_like_array_is_required.php index 1de9ac439c2..99e1edb16af 100644 --- a/hphp/hack/test/typecheck/array/disallow_php_array_when_vector_like_array_is_required.php +++ b/hphp/hack/test/typecheck/array/disallow_php_array_when_vector_like_array_is_required.php @@ -3,7 +3,7 @@ function consumesArrayOfInt(array $array): void {} function providesArrayOfUnknown(): array { - return array("tingley"); + return varray["tingley"]; } function test(): void { diff --git a/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php b/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php index bd9a9df809a..af49cc695e1 100644 --- a/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php +++ b/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php @@ -7,7 +7,7 @@ function consumeArrayOfIntToString(array $_): void {} * AKvarray, in another to AKdarray. Should be unresolved of those two afterwards. */ function test(): void { - $array = array(); + $array = varray[]; if (true) { $array[] = ''; } else { diff --git a/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php.exp b/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php.exp index c9dc27b14e1..731d73b86ae 100644 --- a/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php.exp +++ b/hphp/hack/test/typecheck/array/safe_vector_array/disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php.exp @@ -2,5 +2,5 @@ File "disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_s Invalid argument (Typing[4110]) File "disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php", line 3, characters 36-53: Expected darray -File "disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php", line 12, characters 5-12: -But got varray because a value is appended to it +File "disallows_a_variable_that_may_be_an_array_of_string_when_array_of_int_to_string_is_required.php", line 10, characters 12-19: +But got varray diff --git a/hphp/hack/test/typecheck/array_sub.php b/hphp/hack/test/typecheck/array_sub.php index e8ae9e18c63..e25b279cc26 100644 --- a/hphp/hack/test/typecheck/array_sub.php +++ b/hphp/hack/test/typecheck/array_sub.php @@ -10,7 +10,7 @@ */ function get_keys(array $x): array { - $result = array(); + $result = varray[]; foreach ($x as $k => $v) { $result[] = $k; } diff --git a/hphp/hack/test/typecheck/array_sub2.php b/hphp/hack/test/typecheck/array_sub2.php index 7b0a747ade5..1aa2d01d858 100644 --- a/hphp/hack/test/typecheck/array_sub2.php +++ b/hphp/hack/test/typecheck/array_sub2.php @@ -10,7 +10,7 @@ */ function get_keys(array $x): array { - $result = array(); + $result = varray[]; foreach ($x as $k => $v) { $result[] = $k; } diff --git a/hphp/hack/test/typecheck/assignment1.php b/hphp/hack/test/typecheck/assignment1.php index 5eb9e667ff1..25740e09fdf 100644 --- a/hphp/hack/test/typecheck/assignment1.php +++ b/hphp/hack/test/typecheck/assignment1.php @@ -10,6 +10,6 @@ */ function main() { - $arr = array(); + $arr = darray[]; $arr[$arr->getLength()] = 1; } diff --git a/hphp/hack/test/typecheck/assignment1.php.exp b/hphp/hack/test/typecheck/assignment1.php.exp index 2fd9ea6cf88..ceb6731c065 100644 --- a/hphp/hack/test/typecheck/assignment1.php.exp +++ b/hphp/hack/test/typecheck/assignment1.php.exp @@ -1,4 +1,4 @@ File "assignment1.php", line 14, characters 14-22: You are trying to access the method 'getLength' but this is a darray (Typing[4062]) -File "assignment1.php", line 14, characters 3-25: +File "assignment1.php", line 13, characters 10-17: Definition is here diff --git a/hphp/hack/test/typecheck/call_user_func_array.php b/hphp/hack/test/typecheck/call_user_func_array.php index b1d34732d6e..5fa17da9ed3 100644 --- a/hphp/hack/test/typecheck/call_user_func_array.php +++ b/hphp/hack/test/typecheck/call_user_func_array.php @@ -10,5 +10,5 @@ */ function test(): void { - call_user_func(array('my_object', 'my_method')); + call_user_func(varray['my_object', 'my_method']); } diff --git a/hphp/hack/test/typecheck/call_user_func_array.php.exp b/hphp/hack/test/typecheck/call_user_func_array.php.exp index 0ca50775d14..e5ba2ba3033 100644 --- a/hphp/hack/test/typecheck/call_user_func_array.php.exp +++ b/hphp/hack/test/typecheck/call_user_func_array.php.exp @@ -1,2 +1,2 @@ -File "call_user_func_array.php", line 13, characters 3-49: +File "call_user_func_array.php", line 13, characters 3-50: This call is invalid, this is not a function, it is a varray (Typing[4009]) diff --git a/hphp/hack/test/typecheck/classname/array_literal_bad.php b/hphp/hack/test/typecheck/classname/array_literal_bad.php index 99b3b27fb6f..c4253b283c3 100644 --- a/hphp/hack/test/typecheck/classname/array_literal_bad.php +++ b/hphp/hack/test/typecheck/classname/array_literal_bad.php @@ -6,7 +6,7 @@ class C2 implements I {} class D {} function f(string $good1): array> { - $arr = array($good1 => C1::class, 'bad' => D::class, 'good2' => C2::class); + $arr = darray[$good1 => C1::class, 'bad' => D::class, 'good2' => C2::class]; hh_show($arr); return $arr; } diff --git a/hphp/hack/test/typecheck/classname/array_literal_bad.php.exp b/hphp/hack/test/typecheck/classname/array_literal_bad.php.exp index 3e91ac96c9f..4269fd49ca4 100644 --- a/hphp/hack/test/typecheck/classname/array_literal_bad.php.exp +++ b/hphp/hack/test/typecheck/classname/array_literal_bad.php.exp @@ -4,7 +4,7 @@ File "array_literal_bad.php", line 11, characters 10-13: Invalid return type (Typing[4110]) File "array_literal_bad.php", line 8, characters 52-52: Expected I -File "array_literal_bad.php", line 9, characters 46-46: +File "array_literal_bad.php", line 9, characters 47-47: But got D -File "array_literal_bad.php", line 9, characters 46-46: +File "array_literal_bad.php", line 9, characters 47-47: where the class 'D' was referenced here diff --git a/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php b/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php index 0a9588852a0..22db85b4649 100644 --- a/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php +++ b/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php @@ -6,7 +6,7 @@ newtype C2 = I; class D {} function f(string $good1): array> { - $arr = array($good1 => C1::class, 'bad' => D::class, 'good2' => C2::class); + $arr = darray[$good1 => C1::class, 'bad' => D::class, 'good2' => C2::class]; hh_show($arr); return $arr; } diff --git a/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php.exp b/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php.exp index 6d1f75d0ba0..ef6d74941b2 100644 --- a/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php.exp +++ b/hphp/hack/test/typecheck/classname/typename_array_literal_bad.php.exp @@ -4,9 +4,9 @@ File "typename_array_literal_bad.php", line 11, characters 10-13: Invalid return type (Typing[4110]) File "typename_array_literal_bad.php", line 8, characters 51-51: Expected I -File "typename_array_literal_bad.php", line 9, characters 46-46: +File "typename_array_literal_bad.php", line 9, characters 47-47: But got D -File "typename_array_literal_bad.php", line 9, characters 46-46: +File "typename_array_literal_bad.php", line 9, characters 47-47: where the class 'D' was referenced here File "classname.hhi", line 17, characters 35-35: via this generic T diff --git a/hphp/hack/test/typecheck/disallow_array/literal1.php b/hphp/hack/test/typecheck/disallow_array/literal1.php deleted file mode 100644 index b60d6f13339..00000000000 --- a/hphp/hack/test/typecheck/disallow_array/literal1.php +++ /dev/null @@ -1,5 +0,0 @@ - 'bar'); -} diff --git a/hphp/hack/test/typecheck/disallow_array/literal2.php.exp b/hphp/hack/test/typecheck/disallow_array/literal2.php.exp deleted file mode 100644 index 789e33c1f75..00000000000 --- a/hphp/hack/test/typecheck/disallow_array/literal2.php.exp +++ /dev/null @@ -1,2 +0,0 @@ -File "literal2.php", line 4, characters 15-35: -Array literals are no longer legal; use varray or darray instead (Naming[2083]) diff --git a/hphp/hack/test/typecheck/fun_generics_bad.php b/hphp/hack/test/typecheck/fun_generics_bad.php index b11bb2bbc9c..10cb86c0b92 100644 --- a/hphp/hack/test/typecheck/fun_generics_bad.php +++ b/hphp/hack/test/typecheck/fun_generics_bad.php @@ -12,8 +12,9 @@ function special_array_map( ): array { } +<<__EntryPoint>> function demo(): bool { - $array = array(); + $array = darray[]; for ($k = 0; $k < 10; $k++) { $array[$k] = null; @@ -26,5 +27,3 @@ function demo(): bool { return (bool)$val1; } -/* HH_FIXME[1002] Just a demo */ -demo(); diff --git a/hphp/hack/test/typecheck/global_const2.php b/hphp/hack/test/typecheck/global_const2.php index 9d437b43e4a..4c132b3a1a9 100644 --- a/hphp/hack/test/typecheck/global_const2.php +++ b/hphp/hack/test/typecheck/global_const2.php @@ -1,3 +1,3 @@ diff --git a/hphp/hack/test/typecheck/instantiate_unresolved5.php b/hphp/hack/test/typecheck/instantiate_unresolved5.php index 7ff6fe43bd7..290c5a94e95 100644 --- a/hphp/hack/test/typecheck/instantiate_unresolved5.php +++ b/hphp/hack/test/typecheck/instantiate_unresolved5.php @@ -13,7 +13,7 @@ function any() { } function arr(array $x): array> { - return array($x); + return varray[$x]; } function f(): void { diff --git a/hphp/hack/test/typecheck/instantiate_unresolved5.php.like_types.exp b/hphp/hack/test/typecheck/instantiate_unresolved5.php.like_types.exp index 213a2577f00..5788e75ee95 100644 --- a/hphp/hack/test/typecheck/instantiate_unresolved5.php.like_types.exp +++ b/hphp/hack/test/typecheck/instantiate_unresolved5.php.like_types.exp @@ -1,5 +1,5 @@ -File "instantiate_unresolved5.php", line 16, characters 10-18: -Incompatible field values (Typing[4110]) +File "instantiate_unresolved5.php", line 16, characters 10-19: +Some elements in this collection are incompatible (Typing[4110]) File "instantiate_unresolved5.php", line 15, characters 37-44: Expected varray File "instantiate_unresolved5.php", line 15, characters 17-24: diff --git a/hphp/hack/test/typecheck/integrate_null4.php b/hphp/hack/test/typecheck/integrate_null4.php index 3240709a697..bd4ce753bb5 100644 --- a/hphp/hack/test/typecheck/integrate_null4.php +++ b/hphp/hack/test/typecheck/integrate_null4.php @@ -10,8 +10,8 @@ */ function f() { - $x = array(); - foreach (array(1, 2, 3) as $y) { + $x = darray[]; + foreach (varray[1, 2, 3] as $y) { $z = $x['test']; if (true) { $x = null; diff --git a/hphp/hack/test/typecheck/integrate_unify.php b/hphp/hack/test/typecheck/integrate_unify.php index 3560aceca20..c7f0e1e49c9 100644 --- a/hphp/hack/test/typecheck/integrate_unify.php +++ b/hphp/hack/test/typecheck/integrate_unify.php @@ -10,10 +10,10 @@ */ function f() { - $arr = array(); - foreach (array() as $x) { + $arr = darray[]; + foreach (varray[] as $x) { if (true) { - foreach (array() as $y) { + foreach (varray[] as $y) { } continue; diff --git a/hphp/hack/test/typecheck/invalid_arraykey/invalid_arraykey.php b/hphp/hack/test/typecheck/invalid_arraykey/invalid_arraykey.php index 6d1dc575014..9260362178d 100644 --- a/hphp/hack/test/typecheck/invalid_arraykey/invalid_arraykey.php +++ b/hphp/hack/test/typecheck/invalid_arraykey/invalid_arraykey.php @@ -1,7 +1,7 @@ -File "keys.php", line 8, characters 8-18: +File "keys.php", line 8, characters 8-19: But got varray diff --git a/hphp/hack/test/typecheck/lambda/lambda_contextual/lambda_bad_as_maparray_argument.php b/hphp/hack/test/typecheck/lambda/lambda_contextual/lambda_bad_as_maparray_argument.php index 3da9ce9998b..94248aa267a 100644 --- a/hphp/hack/test/typecheck/lambda/lambda_contextual/lambda_bad_as_maparray_argument.php +++ b/hphp/hack/test/typecheck/lambda/lambda_contextual/lambda_bad_as_maparray_argument.php @@ -26,14 +26,14 @@ function expectsMyClosureRunnerMyClass( } function getThing1(): MyClosureRunner { $var = expectsMyClosureRunnerMyClass( - array( + darray[ 'a' => new MyClosureRunner( function($arg) { $arg->missing_method(); return "ok"; }, ), - ), + ], ); return $var; } diff --git a/hphp/hack/test/typecheck/new_inference/string_expressions4b.php b/hphp/hack/test/typecheck/new_inference/string_expressions4b.php index fd020fd4311..cca7008283e 100644 --- a/hphp/hack/test/typecheck/new_inference/string_expressions4b.php +++ b/hphp/hack/test/typecheck/new_inference/string_expressions4b.php @@ -28,7 +28,7 @@ class Meh { } public function foo() { - $b = array("blah" => new Other()); + $b = darray["blah" => new Other()]; print "$b[blah]$this"; } } diff --git a/hphp/hack/test/typecheck/new_inference/string_expressions4b.php.exp b/hphp/hack/test/typecheck/new_inference/string_expressions4b.php.exp index ed287d8b73a..2ff33f71afe 100644 --- a/hphp/hack/test/typecheck/new_inference/string_expressions4b.php.exp +++ b/hphp/hack/test/typecheck/new_inference/string_expressions4b.php.exp @@ -1,6 +1,6 @@ File "string_expressions4b.php", line 32, characters 12-19: You cannot use this object as a string (Typing[4067]) -File "string_expressions4b.php", line 31, characters 10-37: +File "string_expressions4b.php", line 31, characters 10-38: This object doesn't implement __toString File "string_expressions4b.php", line 32, characters 20-24: You cannot use this object as a string diff --git a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php index ca10630b514..153761c4e75 100644 --- a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php +++ b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php @@ -5,7 +5,7 @@ class A {} <<__Rx>> function f(): void { $a = \HH\Rx\mutable(new A()); - $b = array($a); + $b = varray[$a]; $b1 = varray[$a]; $c = Vector {$a}; $d = Map {"x" => $a}; @@ -17,7 +17,7 @@ function f(): void { <<__Rx>> function g(<<__MaybeMutable>> A $a): void { - $b = array($a); + $b = varray[$a]; $b1 = varray[$a]; $c = Vector {$a}; $d = Map {"x" => $a}; @@ -29,7 +29,7 @@ function g(<<__MaybeMutable>> A $a): void { <<__Rx>> function h(<<__OwnedMutable>> A $a): void { - $b = array($a); + $b = varray[$a]; $b1 = varray[$a]; $c = Vector {$a}; $d = Map {"x" => $a}; diff --git a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php.exp b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php.exp index a85c622e004..2db171e1405 100644 --- a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php.exp +++ b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections1.php.exp @@ -1,4 +1,4 @@ -File "mutable_in_collections1.php", line 8, characters 14-15: +File "mutable_in_collections1.php", line 8, characters 15-16: This variable is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4210]) File "mutable_in_collections1.php", line 9, characters 16-17: This variable is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4210]) @@ -12,7 +12,7 @@ File "mutable_in_collections1.php", line 13, characters 23-24: This variable is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4210]) File "mutable_in_collections1.php", line 15, characters 21-22: This variable is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4210]) -File "mutable_in_collections1.php", line 20, characters 14-15: +File "mutable_in_collections1.php", line 20, characters 15-16: This variable is maybe mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4258]) File "mutable_in_collections1.php", line 21, characters 16-17: This variable is maybe mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4258]) @@ -26,7 +26,7 @@ File "mutable_in_collections1.php", line 25, characters 23-24: This variable is maybe mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4258]) File "mutable_in_collections1.php", line 27, characters 21-22: This variable is maybe mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4258]) -File "mutable_in_collections1.php", line 32, characters 14-15: +File "mutable_in_collections1.php", line 32, characters 15-16: This variable is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4210]) File "mutable_in_collections1.php", line 33, characters 16-17: This variable is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4210]) diff --git a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php index 5a8b2b6fe93..9c63d5aef32 100644 --- a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php +++ b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php @@ -3,7 +3,7 @@ class A { <<__Rx, __Mutable>> public function f(): void { - $b = array($this); + $b = varray[$this]; $b1 = varray[$this]; $c = Vector {$this}; $d = Map {"x" => $this}; @@ -18,7 +18,7 @@ class A { <<__Rx, __MaybeMutable>> public function g(): void { - $b = array($this); + $b = varray[$this]; $b1 = varray[$this]; $c = Vector {$this}; $d = Map {"x" => $this}; diff --git a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php.exp b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php.exp index 9663f552949..8c704350f67 100644 --- a/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php.exp +++ b/hphp/hack/test/typecheck/reactive/mut_collections/mutable_in_collections2.php.exp @@ -2,7 +2,7 @@ File "mutable_in_collections2.php", line 16, characters 5-6: $this here is mutable. You cannot create a new reference to it. (Typing[4268]) File "mutable_in_collections2.php", line 31, characters 5-6: $this here is maybe mutable. You cannot create a new reference to it. (Typing[4268]) -File "mutable_in_collections2.php", line 6, characters 16-20: +File "mutable_in_collections2.php", line 6, characters 17-21: $this here is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4268]) File "mutable_in_collections2.php", line 7, characters 18-22: $this here is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4268]) @@ -18,7 +18,7 @@ File "mutable_in_collections2.php", line 13, characters 23-27: $this here is mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4268]) File "mutable_in_collections2.php", line 15, characters 19-23: Neither a Mutable nor MaybeMutable object may be captured by an anonymous function. (Typing[4283]) -File "mutable_in_collections2.php", line 21, characters 16-20: +File "mutable_in_collections2.php", line 21, characters 17-21: $this here is maybe mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4268]) File "mutable_in_collections2.php", line 22, characters 18-22: $this here is maybe mutable. You cannot create a new reference to it by putting it into the collection. (Typing[4268]) diff --git a/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php b/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php index 13198d2f09e..9263cfde7cb 100644 --- a/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php +++ b/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php @@ -1,5 +1,5 @@ 5) : null)['a']; + $bar = ($b ? darray['a' => 5] : null)['a']; } diff --git a/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php.exp b/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php.exp index afb52f29414..b544c0de3f8 100644 --- a/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php.exp +++ b/hphp/hack/test/typecheck/shape/nullable_shape_disallows_indexing.php.exp @@ -1,4 +1,4 @@ -File "nullable_shape_disallows_indexing.php", line 4, characters 10-43: +File "nullable_shape_disallows_indexing.php", line 4, characters 10-44: You are trying to access an element of this container but the container could be null. (Typing[4063]) -File "nullable_shape_disallows_indexing.php", line 4, characters 34-37: +File "nullable_shape_disallows_indexing.php", line 4, characters 35-38: This is what makes me believe it can be null diff --git a/hphp/hack/test/typecheck/string_expressions4b.php b/hphp/hack/test/typecheck/string_expressions4b.php index fd020fd4311..cca7008283e 100644 --- a/hphp/hack/test/typecheck/string_expressions4b.php +++ b/hphp/hack/test/typecheck/string_expressions4b.php @@ -28,7 +28,7 @@ class Meh { } public function foo() { - $b = array("blah" => new Other()); + $b = darray["blah" => new Other()]; print "$b[blah]$this"; } } diff --git a/hphp/hack/test/typecheck/string_expressions4b.php.exp b/hphp/hack/test/typecheck/string_expressions4b.php.exp index 42185161015..dbdea9ebbcb 100644 --- a/hphp/hack/test/typecheck/string_expressions4b.php.exp +++ b/hphp/hack/test/typecheck/string_expressions4b.php.exp @@ -1,4 +1,4 @@ File "string_expressions4b.php", line 32, characters 12-19: You cannot use this object as a string (Typing[4067]) -File "string_expressions4b.php", line 31, characters 10-37: +File "string_expressions4b.php", line 31, characters 10-38: This object doesn't implement __toString diff --git a/hphp/hack/test/typecheck/subtype_array2.php b/hphp/hack/test/typecheck/subtype_array2.php index 99bf892fe8f..c7e98c164af 100644 --- a/hphp/hack/test/typecheck/subtype_array2.php +++ b/hphp/hack/test/typecheck/subtype_array2.php @@ -10,7 +10,7 @@ */ function get_arr(): array { - return array(1, 2, 3); + return varray[1, 2, 3]; } function use_arr(array $arr): void {} diff --git a/hphp/hack/test/typecheck/subtype_array4.php b/hphp/hack/test/typecheck/subtype_array4.php index 0914d9a8441..4b6d7e8b9aa 100644 --- a/hphp/hack/test/typecheck/subtype_array4.php +++ b/hphp/hack/test/typecheck/subtype_array4.php @@ -10,10 +10,10 @@ */ function get_arr(): array { - return array( + return darray[ 'foo' => true, 'bar' => false, - ); + ]; } function use_arr(array $arr): void { diff --git a/hphp/hack/test/typecheck/test_array13.php b/hphp/hack/test/typecheck/test_array13.php index 6d6ce34a8e7..0f1b461dd17 100644 --- a/hphp/hack/test/typecheck/test_array13.php +++ b/hphp/hack/test/typecheck/test_array13.php @@ -10,6 +10,6 @@ */ function test(): void { - $v = array('f' => array(1, 2), 'b' => 0); + $v = darray['f' => varray[1, 2], 'b' => 0]; $v['f'][0] = 1; } diff --git a/hphp/hack/test/typecheck/test_array13.php.exp b/hphp/hack/test/typecheck/test_array13.php.exp index 5b8848d4588..419fa5ec593 100644 --- a/hphp/hack/test/typecheck/test_array13.php.exp +++ b/hphp/hack/test/typecheck/test_array13.php.exp @@ -1,4 +1,4 @@ File "test_array13.php", line 14, characters 3-16: This is not an object of type KeyedContainer, this is an int (Typing[4005]) -File "test_array13.php", line 13, characters 41-41: +File "test_array13.php", line 13, characters 43-43: Definition is here diff --git a/hphp/hack/test/typecheck/test_array9.php b/hphp/hack/test/typecheck/test_array9.php index e7762289ef0..75b39aecd52 100644 --- a/hphp/hack/test/typecheck/test_array9.php +++ b/hphp/hack/test/typecheck/test_array9.php @@ -12,6 +12,6 @@ class A {} function test(string $field1): void { - $v = array($field1 => 1, 'field2' => new A()); + $v = darray[$field1 => 1, 'field2' => new A()]; $v[$field1]->unknownFunction(); } diff --git a/hphp/hack/test/typecheck/test_array9.php.exp b/hphp/hack/test/typecheck/test_array9.php.exp index ee8e1e7b911..1fe3c50733a 100644 --- a/hphp/hack/test/typecheck/test_array9.php.exp +++ b/hphp/hack/test/typecheck/test_array9.php.exp @@ -1,6 +1,6 @@ File "test_array9.php", line 16, characters 16-30: No method 'unknownFunction' in A (Typing[4053]) -File "test_array9.php", line 15, characters 44-44: +File "test_array9.php", line 15, characters 45-45: This is why I think it is an object of type A File "test_array9.php", line 12, characters 7-7: Declaration of A is here diff --git a/hphp/hack/test/typecheck/test_consts2.php b/hphp/hack/test/typecheck/test_consts2.php index 703d26279a7..a68468b0561 100644 --- a/hphp/hack/test/typecheck/test_consts2.php +++ b/hphp/hack/test/typecheck/test_consts2.php @@ -10,7 +10,7 @@ */ class A { - const array X = array('test'); + const array X = varray['test']; } function foo(): bool { diff --git a/hphp/hack/test/typecheck/union/arrays.php b/hphp/hack/test/typecheck/union/arrays.php index 7d0a7fce728..0e4920e3207 100644 --- a/hphp/hack/test/typecheck/union/arrays.php +++ b/hphp/hack/test/typecheck/union/arrays.php @@ -26,16 +26,16 @@ function test1( darray $darray3, ): void { if ($b) { - $x = array(); // AKempty + $x = varray[]; // AKvarray } else { - $x = array(); // AKempty + $x = varray[]; // AKvarray } hh_show($x); hh_show($x[0]); expect_array($x); if ($b) { - $x = array(); // AKempty + $x = varray[]; // AKvarray } else { $x = varray[1]; // AKvarray } diff --git a/hphp/hack/test/typecheck/union/arrays.php.exp b/hphp/hack/test/typecheck/union/arrays.php.exp index 35a8817a9ea..132999717e2 100644 --- a/hphp/hack/test/typecheck/union/arrays.php.exp +++ b/hphp/hack/test/typecheck/union/arrays.php.exp @@ -1,7 +1,7 @@ File "arrays.php", line 33, characters 3-13: - array (empty) + varray File "arrays.php", line 34, characters 3-16: - _ + nothing File "arrays.php", line 42, characters 3-13: varray File "arrays.php", line 43, characters 3-16: diff --git a/hphp/hack/test/typecheck/union/arrays.php.like_types.exp b/hphp/hack/test/typecheck/union/arrays.php.like_types.exp index c9f9b709137..7cec1b8a42d 100644 --- a/hphp/hack/test/typecheck/union/arrays.php.like_types.exp +++ b/hphp/hack/test/typecheck/union/arrays.php.like_types.exp @@ -1,7 +1,7 @@ File "arrays.php", line 33, characters 3-13: - array (empty) + varray File "arrays.php", line 34, characters 3-16: - _ + nothing File "arrays.php", line 42, characters 3-13: varray File "arrays.php", line 43, characters 3-16: diff --git a/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php b/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php index e8694d5f005..323bc92d9d9 100644 --- a/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php +++ b/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php @@ -2,15 +2,15 @@ function f(): void { // Unsetting array indexes should be fine - $a = array('hi'); + $a = varray['hi']; unset($a[0]); } function g(bool $cond): void { if ($cond) { - $arr = array('foo'); + $arr = varray['foo']; } else { - $arr = array(0); + $arr = varray[0]; } unset($arr[0]); } diff --git a/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php.exp b/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php.exp index b839ecf8ec4..84d6ab0c951 100644 --- a/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php.exp +++ b/hphp/hack/test/typecheck/unset_array_idx_in_strict_mode.php.exp @@ -1,4 +1,4 @@ File "unset_array_idx_in_strict_mode.php", line 6, characters 3-15: In strict mode, unset is banned except on dynamic, darray, keyset, or dict indexing (Typing[4135]) -File "unset_array_idx_in_strict_mode.php", line 5, characters 8-18: +File "unset_array_idx_in_strict_mode.php", line 5, characters 8-19: This is a varray diff --git a/hphp/hack/test/typecheck/void_usage_5.php b/hphp/hack/test/typecheck/void_usage_5.php index 978455e1287..185dec52018 100644 --- a/hphp/hack/test/typecheck/void_usage_5.php +++ b/hphp/hack/test/typecheck/void_usage_5.php @@ -7,7 +7,7 @@ function test(bool $b): void { return $x; } }, - array('test'), + varray['test'], ); foreach ($arr as $x) { if ($x) { diff --git a/hphp/hack/test/typecheck/void_usage_5.php.exp b/hphp/hack/test/typecheck/void_usage_5.php.exp index 8af0fad9b5c..00c15e42f62 100644 --- a/hphp/hack/test/typecheck/void_usage_5.php.exp +++ b/hphp/hack/test/typecheck/void_usage_5.php.exp @@ -2,5 +2,5 @@ File "void_usage_5.php", line 5, characters 5-61: Invalid return type (Typing[4336]) File "void_usage_5.php", line 5, characters 5-61: Expected void because this function does not always return a value -File "void_usage_5.php", line 10, characters 11-16: +File "void_usage_5.php", line 10, characters 12-17: But got string -- 2.11.4.GIT