!6806 Remove typeinfer tests

Merge pull request !6806 from huoqingyi/remove_typeinfer
This commit is contained in:
openharmony_ci 2024-04-08 04:23:49 +00:00 committed by Gitee
commit ccdedde06e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
175 changed files with 0 additions and 5267 deletions

View File

@ -205,7 +205,6 @@ group("ark_runtime_host_unittest") {
#"$js_root/test/moduletest:ark_asm_single_step_test",
"$js_root/test/deopttest:ark_deopt_test",
"$js_root/test/moduletest:ark_asm_test",
"$js_root/test/typeinfer:ark_typeinfer_test",
]
if (is_mac) {

View File

@ -4101,148 +4101,6 @@ template("host_aot_assert_test_action") {
}
}
template("host_typeinfer_test_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps
_host_aot_target_ =
"$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
_test_ts_path_ = "./${_target_name_}.ts"
_test_es2abc_abc_path_ = "$target_out_dir/es2abc/${_target_name_}.abc"
es2abc_gen_abc("es2abc_gen_${_target_name_}_abc") {
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = _deps_
if (defined(invoker.is_multi_file_tests) && invoker.is_multi_file_tests) {
_test_es2abc_ts_path_ = "."
} else {
_test_es2abc_ts_path_ = _test_ts_path_
}
src_js = rebase_path(_test_es2abc_ts_path_)
dst_file = rebase_path(_test_es2abc_abc_path_)
extension = "ts"
extra_args = [
"--module",
"--merge-abc",
"--type-extractor",
]
in_puts = [ _test_ts_path_ ]
out_puts = [ _test_es2abc_abc_path_ ]
}
action("${_target_name_}Es2abcAotTypeInferAction") {
testonly = true
_script_args_ = rebase_path(_test_es2abc_abc_path_)
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":es2abc_gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
if (target_cpu == "x64") {
deps += [ ":${_target_name_}Es2abcAotTypeInferActionWithLiteCG" ]
}
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_compile_options_ = " --compiler-assert-types=true" +
" --compiler-opt-type-lowering=false" +
" --compiler-opt-loop-peeling=false"
if (defined(invoker.is_enable_builtins_dts) &&
invoker.is_enable_builtins_dts) {
deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
_aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
}
if (defined(invoker.is_enable_global_typeinfer) &&
invoker.is_enable_global_typeinfer) {
_aot_compile_options_ += " --compiler-opt-global-typeinfer=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-output",
"0",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_es2abc_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/es2abc/" ]
}
action("${_target_name_}Es2abcAotTypeInferActionWithLiteCG") {
testonly = true
_script_args_ = rebase_path(_test_es2abc_abc_path_)
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":es2abc_gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_compile_options_ =
" --compiler-assert-types=true" +
" --compiler-opt-type-lowering=false" +
" --compiler-opt-loop-peeling=false" + " --compiler-enable-litecg=true"
if (defined(invoker.is_enable_builtins_dts) &&
invoker.is_enable_builtins_dts) {
deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
_aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
}
if (defined(invoker.is_enable_global_typeinfer) &&
invoker.is_enable_global_typeinfer) {
_aot_compile_options_ += " --compiler-opt-global-typeinfer=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-output",
"0",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_es2abc_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/es2abc/LiteCG/" ]
}
}
template("host_pgotypeinfer_test_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps

View File

@ -1,89 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
group("ark_typeinfer_test") {
testonly = true
test_list = [
"add2dyn",
"assertTypeRules",
"binarysearch",
"bitwise_op",
"builtins",
"callarg0dyn",
"callarg1dyn",
"callargs2dyn",
"callargs3dyn",
"callirangedyn",
"callithisrange",
"callprimitivebuiltin",
"class",
"classwithproperty",
"createemptyarray",
"createemptyobject",
"createobjecthavingmethod",
"defineasyncfunc",
"defineclasswithbuffer",
"definefunctiondyn",
"definegeneratorfunc",
"div2dyn",
"getiterator",
"infergetterfunc",
"interface",
"ldboolean",
"ldglobalvar",
"ldinfinity",
"ldnan",
"ldnull",
"ldobjbyindex",
"ldobjbyname",
"ldobjbyvalue",
"ldsuperproperty",
"ldundefined",
"lex_env_var",
"lex_env_var_class",
"lex_env_var_duplication",
"lex_env_var_multiple",
"logic_op",
"loopbeginphi",
"mod2dyn",
"mul2dyn",
"newobjdynrange",
"parainfer",
"parainfer_class",
"phiwithloop",
"phiwithnumber",
"stconsttoglobalrecord",
"stglobalvar",
"stlettoglobalrecord",
"sub2dyn",
"supercall",
"superclass",
"throwdyn_1",
"throwdyn_2",
"tryldglobalbyname",
"trystglobalbyname",
"tsarraytobuiltin",
"typeof",
"variable_after_loops",
"workload1",
]
deps = []
foreach(test, test_list) {
deps += [ "${test}:${test}Es2abcAotTypeInferAction" ]
}
deps += [ "module_test:ark_typeinfer_module_test" ]
deps += [ "es2abc_feature:ark_typeinfer_es2abc_feature_test" ]
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_pgotypeinfer_test_action("add") {
deps = []
}

View File

@ -1,28 +0,0 @@
let x = 0
let y = 3.14
let z = x + y
ArkTools.pgoAssertType(z, "number"); // int + int -> int
y = 0
z = x + y
ArkTools.pgoAssertType(z, "int");
x = 3.14
y = 3.14
z = x + y
ArkTools.pgoAssertType(z, "double");
class A {
constructor(a, b) {
this.a = 1
this.b = 2.2
}
}
let instanceA = new A();
let resultA = instanceA.a + 1;
ArkTools.pgoAssertType(resultA, "int");
let resultB = instanceA.b + 3.2;
ArkTools.pgoAssertType(resultB, "double");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("add2dyn") {
deps = []
}

View File

@ -1,79 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let num1 : number = 1;
let num2 : number = 2;
let ans1 = num1 + num2;
AssertType(ans1, "int");
let arr1 : number[] = [1, 2];
let arr2 : number[] = [1, 2];
let ans2 = arr1[0] + arr2[0];
AssertType(ans2, "number");
let arr3 : string[] = ['1'];
let arr4 : string[] = ['1'];
let ans3 = arr3[0] + arr4[0];
AssertType(ans3, "string");
let str1 : string = '1';
let str2 : string = '2';
let ans4 = str1 + str2;
AssertType(ans4, "string");
let ans5 = arr1[0] + arr3[0];
AssertType(ans5, "string");
let double1 : number = 0.1;
let double2 : number = 0.2;
let double3 : number = 0.8;
let ans6 = double1 + double2;
let ans7 = double2 + double3;
AssertType(ans6, "double");
AssertType(ans7, "double");
let ans8 = double1 + num1;
AssertType(ans8, "double");
let ans9 = num1 + double1;
AssertType(ans9, "double");
let inf1 : number = Infinity;
let nan1 : number = NaN;
let ans10 = inf1 + inf1;
let ans11 = inf1 + nan1;
let ans12 = nan1 + inf1;
let ans13 = num1 + inf1;
let ans14 = inf1 + num1;
let ans15 = num1 + nan1;
let ans16 = nan1 + num1;
let ans17 = double1 + inf1;
let ans18 = inf1 + double1;
let ans19 = double1 + nan1;
let ans20 = nan1 + double1;
AssertType(ans10, "number");
AssertType(ans11, "number");
AssertType(ans12, "number");
AssertType(ans13, "number");
AssertType(ans14, "number");
AssertType(ans15, "number");
AssertType(ans16, "number");
AssertType(ans17, "double");
AssertType(ans18, "double");
AssertType(ans19, "double");
AssertType(ans20, "double");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("assertTypeRules") {
deps = []
}

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* | AssertType rules | |
* | class Student {} | AssertType(Student, "typeof Student") |
* | let stu = new Studnet() | AssertType(stu, "Studnet") |
* | interface face {} | AssertType(face, "interface") |
* | function add(num: number,
* | str: string) : string {} | AssertType(add, "(number, string) => string") |
* | let arr : number[] = [1] | AssertType(arr, "number[]") |
* | let test : number | string | AssertType(test, "union") |
* | let num = 1; | AssertType(num, "int") |
* | let str : string = "" | AssertType(num, "string") |
*/
declare function AssertType(value:any, type:string):void;
{
class Student {}
let stu = new Student();
AssertType(Student, "typeof Student")
AssertType(stu, "Student")
interface Face {}
function testInterface(obj : Face) {
AssertType(obj, "interface");
}
function add(num : number, str : string) : string {
return num + str;
}
AssertType(add(1, ""), "string");
AssertType(add, "(number, string) => string");
let arr : number[] = [1];
AssertType(arr, "number[]");
let vec : number[][] = [[1]];
AssertType(vec, "number[][]");
let num = 1;
AssertType(num, "int");
let str : string = "";
AssertType(str, "string");
}

View File

@ -1,19 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("binarysearch") {
deps = []
is_enable_builtins_dts = true
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function bs(array:number[], value:number, ep:number = 1e-6) : number {
let low = 0;
let high = array.length - 1;
let middle = high >>> 1;
for(;low <= high; middle = (low + high) >>> 1){
const test = array[middle];
AssertType(low, "int");
AssertType(high, "int");
AssertType(middle, "int");
if (test > (value + ep)) {
high = middle - 1;
} else if (test < (value - ep)) {
low = middle + 1;
} else {
return middle;
}
AssertType(high, "int");
AssertType(low, "int");
}
return ~low;
}
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("bitwise_op") {
deps = []
}

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let x:number = 123;
let y:number = 2;
let andRes = x & y;
AssertType(andRes, "int");
let orRes = x | y;
AssertType(orRes, "int");
let xorRes = x ^ y;
AssertType(xorRes, "int");
let shlRes = x << y;
AssertType(shlRes, "int");
let ashrRes = x >> y;
AssertType(ashrRes, "int");
let shrRes = x >>> y;
AssertType(shrRes, "int");
let notRes = ~x;
AssertType(notRes, "int");
}

View File

@ -1,19 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("builtins") {
deps = []
is_enable_builtins_dts = true
}

View File

@ -1,229 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value: any, type: string): void;
{
let anyArr: any[] = [];
let it = anyArr[Symbol.iterator]();
// Object
let obj = new Object();
AssertType(obj.toString(), "string");
AssertType(obj.toLocaleString(), "string");
AssertType(obj.hasOwnProperty("key"), "boolean");
AssertType(obj.isPrototypeOf({}), "boolean");
AssertType(obj.propertyIsEnumerable(""), "boolean");
AssertType(Object.getOwnPropertyDescriptor({}, "str"), "union");
AssertType(Object.getOwnPropertyNames({}), "string[]");
AssertType(Object.getOwnPropertySymbols({})[0], "symbol");
AssertType(Object.getPrototypeOf({}), "union");
AssertType(Object.is("arg1", "arg2"), "boolean");
AssertType(Object.entries({}), "any[]");
AssertType(Object.fromEntries(it), "any");
// Call Object
let obj2 = Object();
AssertType(obj2.toString(), "string");
AssertType(obj2.toLocaleString(), "string");
AssertType(obj2.hasOwnProperty("key"), "boolean");
AssertType(obj2.isPrototypeOf({}), "boolean");
AssertType(obj2.propertyIsEnumerable(""), "boolean");
// Function
let f = new Function();
AssertType(f.toString(), "string");
AssertType(f.length, "number");
// Call Function
let fun2 = Function();
AssertType(fun2.length, "number");
// Error
let err = new Error();
AssertType(err.message, "string");
AssertType(err.toString(), "string");
// Call Error
let err2 = Error("err2");
AssertType(err2.message, "string");
AssertType(err2.name, "string");
AssertType(err2.stack, "string");
// RangeError
let rangeErr = new RangeError();
AssertType(rangeErr.message, "string");
AssertType(rangeErr.toString(), "string");
// Call RangeError
let rangeErr2 = RangeError("RangeError");
AssertType(rangeErr2.message, "string");
AssertType(rangeErr2.name, "string");
AssertType(rangeErr2.stack, "string");
// Boolean
let bool = new Boolean(4);
AssertType(bool.toString(), "string");
AssertType(bool.valueOf(), "boolean");
// Call Boolean
let bool2 = Boolean();
AssertType(bool2.valueOf(), "boolean");
// Date
let date = new Date();
AssertType(date.getDate(), "number");
AssertType(date.setDate(111), "number");
AssertType(date.toDateString(), "string");
AssertType(date.toISOString(), "string");
AssertType(date.valueOf(), "number");
AssertType(Date.parse(""), "number");
AssertType(Date.UTC(1, 1), "number");
AssertType(Date.now(), "number");
// Math
AssertType(Math.E, "number");
AssertType(Math.acos(1), "number");
AssertType(Math.atan2(1, 2), "number");
// JSON
AssertType(JSON.stringify("111"), "string");
AssertType(JSON.parse("111"), "any");
// Number
let n = new Number(123);
AssertType(n.toExponential(123), "string");
AssertType(n.toFixed(), "string");
AssertType(n.toPrecision(), "string");
AssertType(n.toString(111), "string");
AssertType(n.valueOf(), "number");
AssertType(Number.isFinite(1), "boolean");
AssertType(Number.isSafeInteger(1), "boolean");
AssertType(Number.parseFloat("1.2"), "number");
AssertType(Number.MAX_VALUE, "number");
// Call Number
let num2 = Number(1);
AssertType(num2.toExponential(), "string");
AssertType(num2.toFixed(), "string");
AssertType(num2.toLocaleString(), "string");
AssertType(num2.toPrecision(), "string");
AssertType(num2.valueOf(), "number");
// Set
let set = new Set();
AssertType(set.size, "number");
AssertType(set.add(1), "Set");
AssertType(set.delete(1), "boolean");
AssertType(set.entries(), "interface");
AssertType(set.clear(), "void");
AssertType(set.forEach(e => { }), "void");
AssertType(set.has(1), "boolean");
AssertType(set.values(), "interface");
// WeakSet
let weakset = new WeakSet();
AssertType(weakset.add(obj), "WeakSet");
AssertType(weakset.delete(obj), "boolean");
AssertType(weakset.has(obj), "boolean");
// Array
let arr = new Array();
AssertType(arr.length, "int");
AssertType(arr.concat([1, 2, 3]), "any[]");
AssertType(arr.copyWithin(0, 1), "any[]");
AssertType(arr.entries(), "interface");
AssertType(arr.every((v: any, i: number, arr: any[]) => { }), "boolean");
AssertType(arr.fill(1), "any[]");
AssertType(arr.filter((v: any, i: number, arr: any[]) => { }), "any[]");
AssertType(arr.findIndex((v: any, i: number, arr: any[]) => { }), "number");
AssertType(arr.forEach((v: any, i: number, arr: any[]) => { }), "void");
AssertType(arr.indexOf(1), "number");
AssertType(arr.join(","), "string");
AssertType(arr.keys(), "interface");
AssertType(arr.lastIndexOf(1), "number");
AssertType(arr.map(((v: any, i: number, arry: any[]) => { })), "any[]");
AssertType(arr.pop(), "union");
AssertType(arr.push([1, 2, 3]), "number");
AssertType(arr.reduce((p: any, cv: any, ci: any, arr: any[]) => { }), "any");
AssertType(arr.reduceRight((p: any, cv: any, ci: any, arr: any[]) => { }), "any");
AssertType(arr.reverse(), "any[]");
AssertType(arr.shift(), "union");
AssertType(arr.slice(), "any[]");
AssertType(arr.some((v: any, i: number, arr: any[]) => { }), "boolean");
AssertType(arr.sort(), "any[]");
AssertType(arr.splice(1, 2, [1, 2]), "any[]");
AssertType(arr.toLocaleString(), "string");
AssertType(arr.toString(), "string");
AssertType(arr.unshift([1, 2, 3]), "number");
AssertType(arr.values(), "interface");
AssertType(arr.includes(1), "boolean");
AssertType(arr.flatMap((x) => [x]), "any[]");
AssertType(arr.flat(), "any[]");
// Call Array
let arr2 = Array();
AssertType(arr2.length, "int");
AssertType(arr2.concat([1, 2, 3]), "any[]");
AssertType(arr2.copyWithin(0, 1), "any[]");
// ArrayBuffer
let arrBuf = new ArrayBuffer(5);
AssertType(arrBuf.byteLength, "number");
AssertType(arrBuf.slice(1), "ArrayBuffer");
AssertType(ArrayBuffer.isView(1), "boolean");
// SharedArrayBuffer
let sharedArrBuf = new SharedArrayBuffer(5);
AssertType(sharedArrBuf.byteLength, "number");
AssertType(sharedArrBuf.slice(2), "SharedArrayBuffer");
// String
let str = new String("111");
AssertType(str.length, "number");
AssertType(str.charAt(1), "string");
AssertType(str.charCodeAt(1), "number");
AssertType(str.concat("123"), "string");
AssertType(str.includes("123"), "boolean");
AssertType(str.indexOf("123"), "number");
AssertType(str.localeCompare("123"), "number");
AssertType(str.match("123"), "union");
AssertType(str.matchAll(/e/), "interface");
AssertType(str.normalize("123"), "string");
AssertType(str.repeat(0), "string");
AssertType(str.replace("111", "222"), "string");
AssertType(str.search("123"), "number");
AssertType(str.slice(), "string");
AssertType(str.split("1"), "string[]");
AssertType(str.startsWith("123"), "boolean");
AssertType(str.substring(1), "string");
AssertType(str.toLocaleLowerCase(), "string");
AssertType(str.toLowerCase(), "string");
AssertType(str.trim(), "string");
AssertType(str.valueOf(), "string");
AssertType(String.fromCharCode(1,2), "string");
AssertType(String.raw`Multiline\nstring`, "string");
// Call String
let str2 = String("str2");
AssertType(str2.charAt(2), "string");
AssertType(str2.endsWith("2"), "boolean");
AssertType(str2.substring(2, 3), "string");
// Symbol
let sym = Symbol.prototype;
AssertType(sym.description, "union");
AssertType(sym.valueOf(), "symbol");
AssertType(sym.toString(), "string");
AssertType(Symbol.for("11"), "symbol");
AssertType(Symbol.keyFor(Symbol.iterator), "union");
AssertType(Symbol.iterator, "symbol");
AssertType(Symbol.prototype, "Symbol");
// WeakRef
let werkRef = new WeakRef(str);
AssertType(werkRef.deref(), "union");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callarg0dyn") {
deps = []
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function foo():string
{
return "pass";
}
let value = foo();
AssertType(value, "string");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callarg1dyn") {
deps = []
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function foo(v:number):number
{
return v + 1;
}
let value = foo(1);
AssertType(value, "number");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callargs2dyn") {
deps = []
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function foo(flag1:boolean, flag2:boolean):boolean
{
return flag1 && flag2;
}
let value = foo(true, false);
AssertType(value, "boolean");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callargs3dyn") {
deps = []
}

View File

@ -1,25 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function foo(v1:number, v2:number, v3:number):number[]
{
let arr:number[] = [v1, v2, v3];
return arr;
}
let value = foo(1, 2, 3);
AssertType(value, "number[]");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callirangedyn") {
deps = []
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class A {
v1:number;
v2:string;
v3:boolean;
v4:number;
constructor(v1:number, v2:string, v3:boolean, v4:number) {
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
}
}
function foo(v1:number, v2:string, v3:boolean, v4:number):A
{
let a = new A(v1, v2, v3, v4);
return a;
}
let value = foo(0, "1", true, 3);
AssertType(value, "A");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callithisrange") {
deps = []
}

View File

@ -1,58 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class A {
v:number;
constructor(v:number) {
this.v = v;
}
fun(value:number):number {
return this.v + value;
}
fun1():void {
this.v += 1;
}
fun2():string {
return "hello";
}
fun3():boolean {
return true;
}
fun4():B {
let b = new B(this.v);
return b;
}
fun5():number[] {
return [this.v, this.v];
}
}
class B {
v:number;
constructor(v:number) {
this.v = v + 1;
}
}
let a = new A(1);
AssertType(a.fun(2), "number");
AssertType(a.fun1(), "void");
AssertType(a.fun2(), "string");
AssertType(a.fun3(), "boolean");
AssertType(a.fun4(), "B");
AssertType(a.fun5(), "number[]");
}

View File

@ -1,19 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("callprimitivebuiltin") {
deps = []
is_enable_builtins_dts = true
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value: any, type: string): void;
{
let str = "abcd"
AssertType(str, "string");
let strEle1 = str.indexOf("a");
AssertType(strEle1, "number");
let strEle2 = str.toUpperCase();
AssertType(strEle2, "string");
let num = 1234;
AssertType(num, "int");
let numEle1 = num.toString();
AssertType(numEle1, "string");
let numEle2 = num.valueOf();
AssertType(numEle2, "number");
let boolValue : boolean = true;
AssertType(boolValue, "boolean");
let boolEle = boolValue.valueOf();
AssertType(boolEle, "boolean");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("class") {
deps = []
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
class A {
t1:number;
constructor(t1:number) {
this.t1 = t1;
}
fun1():boolean {
return true;
}
static fun2():void {
return;
}
static t2:string = "aot";
}
let s1 = new A(1).t1;
let s2 = new A(1).fun1();
let s3 = A.t2;
let s4 = A.fun2();
AssertType(s1, "number");
AssertType(s2, "boolean");
AssertType(s3, "string");
AssertType(s4, "void");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("classwithproperty") {
deps = []
}

View File

@ -1,73 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
class C {
public x;
public b: string = '';
public c(): string {
AssertType('', "string");
return ''
}
public static e;
public static f() : string {
AssertType('', "string");
return ''
}
}
let c = new C();
AssertType(c, "C");
AssertType(new C(), "C");
AssertType(C, "typeof C");
let r1: string = c.x;
AssertType(r1, "string");
AssertType(c.x, "any");
let tmp = "x";
let value1: string = c[tmp]
AssertType(c[tmp], "any");
AssertType(value1, "string");
let r3: string = c.b;
AssertType(r3, "string");
AssertType(c.b, "string");
tmp = "b";
let value2: string = c[tmp]
AssertType(c[tmp], "string");
AssertType(value2, "string");
let r4: string = c.c();
AssertType(r4, "string");
AssertType(c.c(), "string");
AssertType(c.c, "() => string");
let r6: string = C.e;
AssertType(r6, "string");
AssertType(C.e, "any");
tmp = "e";
let value3: string = c[tmp]
AssertType(c[tmp], "any");
AssertType(value3, "string");
let r7: string = C.f();
AssertType(r7, "string");
AssertType(C.f(), "string");
AssertType(C.f, "() => string");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("createemptyarray") {
deps = []
}

View File

@ -1,20 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let arr:boolean[]= [];
AssertType(arr, "boolean[]");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("createemptyobject") {
deps = []
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let obj : {
} = {
};
AssertType(obj, "object");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("createobjecthavingmethod") {
deps = []
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let xiaoming : {
age : number,
fun() : number,
} = {
age : 1,
fun() {
return 1;
},
}
AssertType(xiaoming, "object");
AssertType(xiaoming.age, "number");
}

View File

@ -1,19 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("defineasyncfunc") {
deps = []
is_enable_builtins_dts = true
}

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
async function add(num1:number, num2:number):Promise<number> {
let ans = num1 + num2;
return ans;
}
AssertType(add, "(number, number) => Promise");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("defineclasswithbuffer") {
deps = []
}

View File

@ -1,26 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class Student {
name : number;
constructor(name : number) {
this.name = name;
}
}
let stu = new Student(10);
AssertType(stu, "Student");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("definefunctiondyn") {
deps = []
}

View File

@ -1,27 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function add():string {
return 1 + '2';
}
function sub(a:number, b:number):number {
return a + b;
}
AssertType(add, "() => string");
AssertType(sub, "(number, number) => number");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("definegeneratorfunc") {
deps = []
}

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
function* genfunc() {
yield "1";
yield "2";
}
AssertType(genfunc, "() => any");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("div2dyn") {
deps = []
}

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let num1 : number = 1;
let num2 : number = 2;
let ans1 = num1 / num2;
AssertType(ans1, "double");
let double1 : number = 1.5;
let double2 : number = 0.5;
let ans2 = num1 / double1;
let ans3 = double1 / num1;
let ans4 = double1 / double2;
let ans5 = double2 / double1;
AssertType(ans2, "double");
AssertType(ans3, "double");
AssertType(ans4, "double");
AssertType(ans5, "double");
let zero1 : number = 0;
let ans6 = num1 / zero1;
let ans7 = double1 / zero1;
AssertType(ans6, "double");
AssertType(ans7, "double");
let inf1 : number = Infinity;
let nan1 : number = NaN;
let ans8 = inf1 / inf1;
let ans9 = inf1 / nan1;
let ans10 = nan1 / inf1;
let ans11 = num1 / inf1;
let ans12 = inf1 / num1;
let ans13 = num1 / nan1;
let ans14 = nan1 / num1;
let ans15 = double1 / inf1;
let ans16 = inf1 / double1;
let ans17 = double1 / nan1;
let ans18 = nan1 / double1;
AssertType(ans8, "double");
AssertType(ans9, "double");
AssertType(ans10, "double");
AssertType(ans11, "double");
AssertType(ans12, "double");
AssertType(ans13, "double");
AssertType(ans14, "double");
AssertType(ans15, "double");
AssertType(ans16, "double");
AssertType(ans17, "double");
AssertType(ans18, "double");
}

View File

@ -1,33 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
group("ark_typeinfer_es2abc_feature_test") {
testonly = true
test_list = [
"arrow_function",
"arrow_function_in_foreach",
"indexsignature_class",
"indexsignature_object",
"namespace_multiple",
"namespace_nested",
"namespace_type",
"namespace_variable",
"type_alias",
"type_assertion",
]
deps = []
foreach(test, test_list) {
deps += [ "${test}:${test}Es2abcAotTypeInferAction" ]
}
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("arrow_function") {
deps = []
}

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let sum = (a:number, b:number):number => {
return a + b;
}
let combine = (v1:number, v2:number, v3:number):number[] => {
let arr:number[] = [v1, v2, v3];
return arr;
}
AssertType(sum, "(number, number) => number");
AssertType(sum(1, 2), "number");
AssertType(combine, "(number, number, number) => number[]");
AssertType(combine(1, 2, 3), "number[]");
}

View File

@ -1,19 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("arrow_function_in_foreach") {
deps = []
is_enable_builtins_dts = true
}

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class A {
a1 : number;
a2 : string;
}
class B {
b1 : A[]
}
function C() {
let d = new B();
d.b1.forEach((value, index, arr)=>{
AssertType(value, "A");
AssertType(index, "int");
AssertType(arr, "A[]");
let e = arr[index].a1 + value.a1;
AssertType(e, "number");
return e
});
}
let f : number[] = [1,2,3]
f.forEach(value => {
AssertType(value, "number");
return value + 1;
})
f.forEach((value, index)=>{
AssertType(value, "number");
AssertType(index, "int");
AssertType(f[index], "number");
return value + f[index];
})
f.forEach((value, index, arr)=>{
AssertType(value, "number");
AssertType(index, "int");
AssertType(arr, "number[]");
return value + arr[index];})
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("generics") {
deps = []
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
class Test<T> {
value:T;
name:string;
constructor(value:T, name:string){
this.value = value;
this.name = name;
}
foo ():number {
return 123;
}
bar ():T {
return this.value;
}
}
let numberObj = new Test<number> (123, "abc");
let stringObj = new Test<string> ("aot", "abc");
let booleanObj = new Test<boolean> (true, "abc");
AssertType(numberObj, "Test");
AssertType(numberObj.value, "number");
AssertType(numberObj.name, "string");
AssertType(numberObj.foo(), "number");
AssertType(numberObj.bar(), "number");
AssertType(numberObj.foo, "() => number");
AssertType(numberObj.bar, "() => number");
AssertType(stringObj, "Test");
AssertType(stringObj.value, "string");
AssertType(stringObj.name, "string");
AssertType(stringObj.foo(), "number");
AssertType(stringObj.bar(), "string");
AssertType(stringObj.foo, "() => number");
AssertType(stringObj.bar, "() => string");
AssertType(booleanObj, "Test");
AssertType(booleanObj.value, "boolean");
AssertType(booleanObj.name, "string");
AssertType(booleanObj.foo(), "number");
AssertType(booleanObj.bar(), "boolean");
AssertType(booleanObj.foo, "() => number");
AssertType(booleanObj.bar, "() => boolean");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("generics_multiple") {
deps = []
}

View File

@ -1,38 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
class A{};
class Test<T1, T2, T3, T4> {
value1:T1;
value2:T2;
value3:T3;
value4:T4;
constructor(value1:T1, value2:T2, value3:T3, value4:T4){
this.value1 = value1;
this.value2 = value2;
this.value3 = value3;
this.value4 = value4;
}
}
let obj = new Test<number, number, string, A> (1, 2, "", new A());
AssertType(obj, "Test");
AssertType(obj.value1, "number");
AssertType(obj.value2, "number");
AssertType(obj.value3, "string");
AssertType(obj.value4, "A");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("indexsignature_class") {
deps = []
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class TestNumber {
[v:number]:string;
value:number;
constructor(value:number) {
this.value = value;
}
}
class TestString {
[v:string]:number;
value:number;
constructor(value:number) {
this.value = value;
}
}
let t1:TestNumber = new TestNumber(123);
t1[1] = "abc";
t1[2] = "def";
let t2:TestString = new TestString(123);
t2.value1 = 123;
t2.value2 = 456;
let t3:TestString = new TestString(123);
t3.value1 = 456;
t3.value2 = 2;
AssertType(t1.value, "number");
AssertType(t1[1], "string");
AssertType(t1[2], "string");
AssertType(t2.value, "number");
AssertType(t2.value1, "number");
AssertType(t2.value2, "number");
AssertType(t3.value1, "number");
AssertType(t3.value2, "number");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("indexsignature_object") {
deps = []
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let obj1 : { [v:string]:number } = {value1: 123, value2: 456};
let obj2 : { [v:string]:boolean } = {value1: true, value2: false};
let obj3 : { [v:number]:number } = [1, 2, 3];
let t:number = 0;
let s:number = 1;
AssertType(obj1.value1, "number");
AssertType(obj1.value2, "number");
AssertType(obj2.value1, "boolean");
AssertType(obj2.value2, "boolean");
AssertType(obj3[0], "number");
AssertType(obj3[1], "number");
AssertType(obj3[2], "number");
AssertType(obj3[t], "number");
AssertType(obj3[s], "number");
}

View File

@ -1,19 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("namespace_multiple") {
deps = []
is_enable_global_typeinfer = true
}

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
namespace A {
export let a = 123;
export let b = "abc";
}
namespace B {
export let c = 456;
export let d = "def";
}
AssertType(A.a + B.c, "int");
AssertType(A.a + A.b, "string");
AssertType(A.a + B.d, "string");
AssertType(A.b + B.c, "string");
AssertType(A.b + B.d, "string");
AssertType(B.c + B.d, "string");

View File

@ -1,19 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("namespace_nested") {
deps = []
is_enable_global_typeinfer = true
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
namespace Test {
export namespace C {
export let a = 123;
export let b = "abc";
AssertType(a, "int");
AssertType(b, "string");
}
AssertType(C.a, "int");
AssertType(C.b, "string");
}
AssertType(Test.C.a, "int");
AssertType(Test.C.b, "string");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("namespace_type") {
deps = []
}

View File

@ -1,32 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
namespace Test {
export class C {
value:number;
flag:boolean;
constructor(value:number, flag:boolean) {
this.value = value;
this.flag = flag;
}
}
}
let c:Test.C = new Test.C(123, true);
AssertType(c.value, "number");
AssertType(c.flag, "boolean");

View File

@ -1,19 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("namespace_variable") {
deps = []
is_enable_global_typeinfer = true
}

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let a: number = 1;
let b = a + 1;
AssertType(a, "int");
AssertType(b, "int");
namespace A {
AssertType(a, "int");
AssertType(b, "int");
export let c = a + b;
export let d = "abc";
AssertType(d, "string");
}
AssertType(A.c, "int");
AssertType(A.d, "string");
AssertType(a, "int");
AssertType(b, "int");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("type_alias") {
deps = []
}

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
type T1 = string;
let a:T1 = "AOT";
AssertType(a, "string");
interface Test {
value:number;
flag:boolean;
}
type T2 = Test;
let inst:T2 = {value: 123, flag: true};
AssertType(inst.value, "number");
AssertType(inst.flag, "boolean");
class C {
value:number;
constructor(value:number) {
this.value = value;
}
}
type T3 = C;
let c:T3 = new C(10);
AssertType(c.value, "number");
type T4 = (a:number) => number;
let f:T4 = (a) => {
return a
};
AssertType(f, "(number) => number");
AssertType(f(123), "number");
type T5 = {name:string, age:number};
let obj:T5 = {name:"abc", age:10};
AssertType(obj.name, "string");
AssertType(obj.age, "number");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("type_assertion") {
deps = []
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let a = "aot";
let b = a as string
let c = true;
let d = c as boolean;
AssertType(d, "boolean");
AssertType(b, "string");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("getiterator") {
deps = []
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value: any, type: string): void;
{
let arr : number[] = [1, 2, 3, 4, 5];
for (let tmp of arr) {
AssertType(tmp, "number");
}
let str = "hello"
for (let tmp of str) {
AssertType(tmp, "string");
}
class Student {}
let stu : Student[] = [new Student()];
for (let tmp of stu) {
AssertType(tmp, "Student");
}
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("infergetterfunc") {
deps = []
}

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class Student {
age : number;
name : string;
constructor(ageIn : number, nameIn : string) {
this.age = ageIn;
this.name = nameIn;
}
get studentAge() : number {
return this.age;
}
get studentName() : string {
return this.name
}
}
let obj = new Student(15, "xiaoming");
let a = obj.studentAge;
let b = obj.studentName;
AssertType(a, "number");
AssertType(b, "string");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("interface") {
deps = []
}

View File

@ -1,123 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class low {
lowP : string;
constructor(l : string) {
this.lowP = l;
}
lowMethod() : string {
return "";
}
}
class subC extends low {
claN : number
constructor(tmp : number) {
super("");
this.claN = tmp;
}
subMethod() : string {
return "";
}
}
interface A extends low, subC {
bb : number
}
interface C extends A {}
interface D extends C {}
interface common extends D {
male : boolean;
isMale() : boolean;
}
interface base extends common {
age : number;
getAge() : number;
}
class otherClass {
oth : number;
constructor(tmp : number) {
this.oth = tmp;
}
otherMethod() : string{
return "";
}
}
interface otherInterface extends otherClass{
face : number;
}
interface other extends otherInterface {
height : number;
getHeight() : number;
}
interface student extends base, other{
name : string;
getName() : string;
}
let stu : student = {
face : 1,
oth : 1,
otherMethod() {
return "";
},
lowP : "hh",
lowMethod() {return ""},
claN : 1,
subMethod() {return ""},
bb : 2,
name :"hello",
getName() {
return this.name;
},
age : 10,
getAge() {
return this.age;
},
male : true,
isMale() {
return this.male;
},
height : 100,
getHeight() {
return this.height;
}
};
// test ldobjbyname for interface
AssertType(stu.lowP, "string");
AssertType(stu.lowMethod(), "string");
AssertType(stu.subMethod(), "string");
AssertType(stu.claN, "number");
AssertType(stu.bb, "number");
AssertType(stu.name, "string");
AssertType(stu.getName(), "string");
AssertType(stu.age, "number");
AssertType(stu.getAge(), "number");
AssertType(stu.male, "boolean");
AssertType(stu.isMale(), "boolean");
AssertType(stu.height, "number");
AssertType(stu.getHeight(), "number");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldboolean") {
deps = []
}

View File

@ -1,22 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let variable = true;
AssertType(variable, "boolean");
variable = false;
typeof(variable);
AssertType(variable, "boolean");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldglobalvar") {
deps = []
}

View File

@ -1,22 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
var num1:number = 1;
num1 = 2;
num1 = 3;
num1 =10;
var ans = num1;
AssertType(ans, "int");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldinfinity") {
deps = []
}

View File

@ -1,18 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let num = Infinity;
AssertType(num, "number");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldnan") {
deps = []
}

View File

@ -1,18 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let num = NaN;
AssertType(num, "number");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldnull") {
deps = []
}

View File

@ -1,18 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let num = null;
AssertType(num, "null");

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldobjbyindex") {
deps = []
}

View File

@ -1,88 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
let arr : string[] = ['1'];
let ans = arr[0];
AssertType(ans, "string");
let ans2 = arr["0"]
AssertType(ans2, "string");
class C {
_array: Float32Array;
constructor() {
this._array = new Float32Array(2);
}
}
function test(c:C) {
AssertType(c._array[0], "double");
AssertType(c._array[1], "double");
AssertType(c._array["1"], "double");
}
let obj : {
10 : number,
"abc" : number,
10.13 : number,
9 : "bb",
100.3e2 : string,
} = {
10 : 13,
"abc" : 13,
10.13 : 13,
9 : "bb",
100.3e2 : "abc"
}
let index = 10.13;
let index02 = 100.3e2;
AssertType(obj[10], "number");
AssertType(obj[10.13], "number");
AssertType(obj[9], "string");
AssertType(obj[index], "number");
AssertType(obj[index02], "string");
class Stu {
8 : number;
static 9() : string {
return "str";
}
10() : number {
return 10;
}
static 9.1() : string {
return "9.1";
}
10.1() : number {
Stu[8] = 11;
return 1;
}
}
AssertType(Stu[9](), "string");
AssertType(Stu[9.1](), "string");
let stu = new Stu();
let index2 = 10.1;
AssertType(stu[10](), "number");
AssertType(stu[10.1](), "number");
AssertType(stu[8], "number");
AssertType(stu[index2](), "number");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldobjbyname") {
deps = []
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class Student {
static age : string = "18";
}
let stu = new Student()
AssertType(Student.age, "string");
let obj : {
num : number,
str : string,
} = {
num : 1,
str : "hello",
}
AssertType(obj.num, "number");
AssertType(obj.str, "string");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldobjbyvalue") {
deps = []
}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class A {
v1:number;
constructor(v1:number) {
this.v1 = v1;
}
5() : number {
return this.v1;
}
}
let arr1:string[] = ["a", "b", "c"];
let arr2:number[] = [1, 2, 3, 4];
let arr3:boolean[] = [true, false, false];
let a1 = new A(0);
let a2 = new A(1);
let arr4:A[] = [a1, a2];
let t = 1;
let name = "v1";
let value = 5;
let a3 = a1[name];
let a4 = a2[value]();
AssertType(arr1[t], "string");
AssertType(arr2[t], "number");
AssertType(arr3[t], "boolean");
AssertType(arr4[t], "A");
AssertType(a3, "number");
AssertType(a4, "number");
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldsuperproperty") {
deps = []
}

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
{
class A {
a1 : number;
a2 : string;
static a3 : string = "abc";
constructor(a11 : number) {
this.a1 = a11;
this.a2 = "abc";
}
getA() : number {
return this.a1;
}
get geta2() : string {
return this.a2;
}
2() : string {
return this.a2;
}
}
class B extends A {
b : number;
constructor(a1 : number, b1 : number) {
super(a1);
this.b = b1;
}
getD() {
let d1 = super.a1;
AssertType(d1, "undefined");
let d2 = super.a2;
AssertType(d2, "undefined");
let d3 = super.geta2;
AssertType(d3, "string");
let d4 = super.getA();
AssertType(d4, "number");
}
static getA3() {
let d5 = super.a3;
AssertType(d5, "string");
}
getc() {
let a = "getA";
let b = 2;
let a2 = super[a]();
AssertType(a2, "number")
let a3 = super[b]();
AssertType(a3, "string")
let a4 = this[a]();
AssertType(a4, "number")
let a5 = this[b]();
AssertType(a5, "string")
}
}
let d = new B(1,2);
d.getD();
B.getA3();
}

View File

@ -1,18 +0,0 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_typeinfer_test_action("ldundefined") {
deps = []
}

View File

@ -1,18 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare function AssertType(value:any, type:string):void;
let num = undefined;
AssertType(num, "undefined");

Some files were not shown because too many files have changed in this diff Show More