diff --git a/linter-4.2/test/ESObject.ts b/linter-4.2/test/ESObject.ts new file mode 100644 index 0000000000000000000000000000000000000000..5cbfe92da002254295100d2048301e921b43804d --- /dev/null +++ b/linter-4.2/test/ESObject.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14030 +type ESObject = any + +let a1: ESObject = 1; +let a2: ESObject; + +function foo() { + let a3: ESObject =2; + let a4: ESObject; +} \ No newline at end of file diff --git a/linter-4.2/test/sdk_and_codelinter_diff_1.ts b/linter-4.2/test/sdk_and_codelinter_diff_1.ts new file mode 100644 index 0000000000000000000000000000000000000000..b77e09dad40fba7e26d83af638136c6c6949b82a --- /dev/null +++ b/linter-4.2/test/sdk_and_codelinter_diff_1.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14029 + +import {getData} from "./sdk_and_codelinter_diff_2" +async function getDatas() { + try { + let data: Object[] = await getData() + } catch (err){ + } +} \ No newline at end of file diff --git a/linter-4.2/test/sdk_and_codelinter_diff_2.ts b/linter-4.2/test/sdk_and_codelinter_diff_2.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b1523e1eda95976c26d8837605caa72a2cc9f0a --- /dev/null +++ b/linter-4.2/test/sdk_and_codelinter_diff_2.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14029 + +export async function getData() { + let datas + let data: Object[] = [] + data.forEach(()=>{ + datas.push(1); + }) + return datas +} \ No newline at end of file diff --git a/linter-4.2/test_extended_features/$_operation.ets b/linter-4.2/test_extended_features/dollar_operation.ets similarity index 100% rename from linter-4.2/test_extended_features/$_operation.ets rename to linter-4.2/test_extended_features/dollar_operation.ets diff --git a/linter-4.2/test_extended_features/dollar_operation_TN.ets b/linter-4.2/test_extended_features/dollar_operation_TN.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb14c4fba2cf72dca8a591747af6c9745f324a54 --- /dev/null +++ b/linter-4.2/test_extended_features/dollar_operation_TN.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14031 + +export class Foo1 { + foo1?: string[] = []; +} + +@Component +export struct SomeStruct { + @Link someStruct: Foo1[]; +} + +export class Foo { + SomeStruct({ + someStruct: $someStruct + }); +} + diff --git a/linter-4.2/test_extended_features/$$_operation.ets b/linter-4.2/test_extended_features/double_dollar_operation.ets similarity index 100% rename from linter-4.2/test_extended_features/$$_operation.ets rename to linter-4.2/test_extended_features/double_dollar_operation.ets diff --git a/linter-4.2/test_extended_features/$$_operation1.ets b/linter-4.2/test_extended_features/double_dollar_operation1.ets similarity index 100% rename from linter-4.2/test_extended_features/$$_operation1.ets rename to linter-4.2/test_extended_features/double_dollar_operation1.ets diff --git a/linter-4.2/test_extended_features/object_literals_sdk_diff.ets b/linter-4.2/test_extended_features/object_literals_sdk_diff.ets index 8fd560d31aba10f30d9bfcbbe9e41b572743396f..2af28bc7db70ea120c22390a56105b214ad95e83 100644 --- a/linter-4.2/test_extended_features/object_literals_sdk_diff.ets +++ b/linter-4.2/test_extended_features/object_literals_sdk_diff.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2022-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. + */ + //issue 13689 p4 @Entry @Component diff --git a/linter-4.2/test_extended_features/object_literals_sdk_struct.ets b/linter-4.2/test_extended_features/object_literals_sdk_struct.ets index ea998c9e009a6b771a78dec386c8e313a19c0e6d..a757730f4a7f7b3b9b6abd081d36df0317071eb0 100644 --- a/linter-4.2/test_extended_features/object_literals_sdk_struct.ets +++ b/linter-4.2/test_extended_features/object_literals_sdk_struct.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2022-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. + */ + //issue 13689 p3 @Entry @Component diff --git a/linter/test/ESObject.ts b/linter/test/ESObject.ts new file mode 100644 index 0000000000000000000000000000000000000000..5cbfe92da002254295100d2048301e921b43804d --- /dev/null +++ b/linter/test/ESObject.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14030 +type ESObject = any + +let a1: ESObject = 1; +let a2: ESObject; + +function foo() { + let a3: ESObject =2; + let a4: ESObject; +} \ No newline at end of file diff --git a/linter/test/sdk_and_codelinter_diff_1.ts b/linter/test/sdk_and_codelinter_diff_1.ts new file mode 100644 index 0000000000000000000000000000000000000000..b77e09dad40fba7e26d83af638136c6c6949b82a --- /dev/null +++ b/linter/test/sdk_and_codelinter_diff_1.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14029 + +import {getData} from "./sdk_and_codelinter_diff_2" +async function getDatas() { + try { + let data: Object[] = await getData() + } catch (err){ + } +} \ No newline at end of file diff --git a/linter/test/sdk_and_codelinter_diff_2.ts b/linter/test/sdk_and_codelinter_diff_2.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b1523e1eda95976c26d8837605caa72a2cc9f0a --- /dev/null +++ b/linter/test/sdk_and_codelinter_diff_2.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022-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. + */ +//test for defect 14029 + +export async function getData() { + let datas + let data: Object[] = [] + data.forEach(()=>{ + datas.push(1); + }) + return datas +} \ No newline at end of file