1/*
2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16function main(): void {
17  let arr1: Int[] = [1,2,3,4,5];
18  let arr2: int[] = [1,2,3,4,5];
19  let object_array: Object[] = arr1 as Object[];
20  let object: Object = arr1 as Object;
21
22// TypeError: Cannot access property of non-object or non-enum type
23// arr1.toString();
24// arr2.toString();
25// object_array.toString();
26
27  object.toString();
28
29//  TypeError: Cannot access property of non-object or non-enum type
30//  arr1.$_hashCode();
31//  arr2.$_hashCode();
32//  object_array.$_hashCode();
33
34  object.$_hashCode();
35
36  assert(arr1 == arr1);
37  assert(arr1 == object_array);
38  assert(arr1 == object);
39  assert(arr1 != arr2);
40
41// Cannot cast type 'int[]' to 'Object[]'
42//  let object_array2: Object[] = arr2 as Object[];
43//  assert(object.equals(arr2 as Object) == false);
44
45  assert(arr2 == arr2);
46  assert(arr2 != new int[5]);
47}
48