From 5e1d89c429478bd60009cc0a88d4c831223eda9e Mon Sep 17 00:00:00 2001 From: Ilya Zabolotin Date: Thu, 19 Oct 2023 14:53:14 +0300 Subject: [PATCH 1/3] added new tests and renamed '$' into 'dollar' Signed-off-by: Ilya Zabolotin --- linter-4.2/test/ESObject.ts | 10 ++++++++++ linter-4.2/test/sdk_and_codelinter_diff_1.ts | 9 +++++++++ linter-4.2/test/sdk_and_codelinter_diff_2.ts | 10 ++++++++++ .../{$_operation.ets => dollar_operation.ets} | 0 .../dollar_operation_TN.ets | 17 +++++++++++++++++ ...peration.ets => double_dollar_operation.ets} | 0 ...ration1.ets => double_dollar_operation1.ets} | 0 linter/test/ESObject.ts | 10 ++++++++++ linter/test/sdk_and_codelinter_diff_1.ts | 9 +++++++++ linter/test/sdk_and_codelinter_diff_2.ts | 10 ++++++++++ 10 files changed, 75 insertions(+) create mode 100644 linter-4.2/test/ESObject.ts create mode 100644 linter-4.2/test/sdk_and_codelinter_diff_1.ts create mode 100644 linter-4.2/test/sdk_and_codelinter_diff_2.ts rename linter-4.2/test_extended_features/{$_operation.ets => dollar_operation.ets} (100%) create mode 100644 linter-4.2/test_extended_features/dollar_operation_TN.ets rename linter-4.2/test_extended_features/{$$_operation.ets => double_dollar_operation.ets} (100%) rename linter-4.2/test_extended_features/{$$_operation1.ets => double_dollar_operation1.ets} (100%) create mode 100644 linter/test/ESObject.ts create mode 100644 linter/test/sdk_and_codelinter_diff_1.ts create mode 100644 linter/test/sdk_and_codelinter_diff_2.ts diff --git a/linter-4.2/test/ESObject.ts b/linter-4.2/test/ESObject.ts new file mode 100644 index 000000000..e6060e7ef --- /dev/null +++ b/linter-4.2/test/ESObject.ts @@ -0,0 +1,10 @@ +//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 000000000..8927116fe --- /dev/null +++ b/linter-4.2/test/sdk_and_codelinter_diff_1.ts @@ -0,0 +1,9 @@ +//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 000000000..f9cb18134 --- /dev/null +++ b/linter-4.2/test/sdk_and_codelinter_diff_2.ts @@ -0,0 +1,10 @@ +//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 000000000..9027c10dd --- /dev/null +++ b/linter-4.2/test_extended_features/dollar_operation_TN.ets @@ -0,0 +1,17 @@ +//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/test/ESObject.ts b/linter/test/ESObject.ts new file mode 100644 index 000000000..e6060e7ef --- /dev/null +++ b/linter/test/ESObject.ts @@ -0,0 +1,10 @@ +//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 000000000..8927116fe --- /dev/null +++ b/linter/test/sdk_and_codelinter_diff_1.ts @@ -0,0 +1,9 @@ +//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 000000000..f9cb18134 --- /dev/null +++ b/linter/test/sdk_and_codelinter_diff_2.ts @@ -0,0 +1,10 @@ +//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 -- Gitee From 49886a86f60d1bedffa34b74d8c1029b2977c8fc Mon Sep 17 00:00:00 2001 From: Ilya Zabolotin Date: Thu, 19 Oct 2023 14:53:14 +0300 Subject: [PATCH 2/3] added new tests and renamed '$' into 'dollar' Signed-off-by: Ilya Zabolotin --- linter-4.2/test/ESObject.ts | 25 +++++++++++++++ linter-4.2/test/sdk_and_codelinter_diff_1.ts | 24 ++++++++++++++ linter-4.2/test/sdk_and_codelinter_diff_2.ts | 25 +++++++++++++++ .../{$_operation.ets => dollar_operation.ets} | 0 .../dollar_operation_TN.ets | 32 +++++++++++++++++++ ...ration.ets => double_dollar_operation.ets} | 0 ...tion1.ets => double_dollar_operation1.ets} | 0 .../object_literals_sdk_diff.ets | 15 +++++++++ .../object_literals_sdk_struct.ets | 15 +++++++++ linter/test/ESObject.ts | 25 +++++++++++++++ linter/test/sdk_and_codelinter_diff_1.ts | 24 ++++++++++++++ linter/test/sdk_and_codelinter_diff_2.ts | 25 +++++++++++++++ 12 files changed, 210 insertions(+) create mode 100644 linter-4.2/test/ESObject.ts create mode 100644 linter-4.2/test/sdk_and_codelinter_diff_1.ts create mode 100644 linter-4.2/test/sdk_and_codelinter_diff_2.ts rename linter-4.2/test_extended_features/{$_operation.ets => dollar_operation.ets} (100%) create mode 100644 linter-4.2/test_extended_features/dollar_operation_TN.ets rename linter-4.2/test_extended_features/{$$_operation.ets => double_dollar_operation.ets} (100%) rename linter-4.2/test_extended_features/{$$_operation1.ets => double_dollar_operation1.ets} (100%) create mode 100644 linter/test/ESObject.ts create mode 100644 linter/test/sdk_and_codelinter_diff_1.ts create mode 100644 linter/test/sdk_and_codelinter_diff_2.ts diff --git a/linter-4.2/test/ESObject.ts b/linter-4.2/test/ESObject.ts new file mode 100644 index 000000000..74c9f1186 --- /dev/null +++ b/linter-4.2/test/ESObject.ts @@ -0,0 +1,25 @@ +/* + * 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 000000000..b90fbb52d --- /dev/null +++ b/linter-4.2/test/sdk_and_codelinter_diff_1.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 + +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 000000000..3771a4819 --- /dev/null +++ b/linter-4.2/test/sdk_and_codelinter_diff_2.ts @@ -0,0 +1,25 @@ +/* + * 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 000000000..a3fa5bcc4 --- /dev/null +++ b/linter-4.2/test_extended_features/dollar_operation_TN.ets @@ -0,0 +1,32 @@ +/* + * 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 8fd560d31..2af28bc7d 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 ea998c9e0..a757730f4 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 000000000..dd29d3e12 --- /dev/null +++ b/linter/test/ESObject.ts @@ -0,0 +1,25 @@ +/* + * 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 000000000..b90fbb52d --- /dev/null +++ b/linter/test/sdk_and_codelinter_diff_1.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 + +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 000000000..3771a4819 --- /dev/null +++ b/linter/test/sdk_and_codelinter_diff_2.ts @@ -0,0 +1,25 @@ +/* + * 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 -- Gitee From 859b7137c22944f545827f06250958c9821dc50b Mon Sep 17 00:00:00 2001 From: Ilya Zabolotin Date: Thu, 19 Oct 2023 19:19:28 +0300 Subject: [PATCH 3/3] added new tests and renamed '$' into 'dollar' Signed-off-by: Ilya Zabolotin --- linter-4.2/test/ESObject.ts | 3 +++ linter-4.2/test/sdk_and_codelinter_diff_1.ts | 3 +++ linter-4.2/test/sdk_and_codelinter_diff_2.ts | 3 +++ linter-4.2/test_extended_features/dollar_operation_TN.ets | 3 +++ linter/test/ESObject.ts | 3 +++ linter/test/sdk_and_codelinter_diff_1.ts | 3 +++ linter/test/sdk_and_codelinter_diff_2.ts | 3 +++ 7 files changed, 21 insertions(+) diff --git a/linter-4.2/test/ESObject.ts b/linter-4.2/test/ESObject.ts index 74c9f1186..5d51c77d7 100644 --- a/linter-4.2/test/ESObject.ts +++ b/linter-4.2/test/ESObject.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14030 type ESObject = any diff --git a/linter-4.2/test/sdk_and_codelinter_diff_1.ts b/linter-4.2/test/sdk_and_codelinter_diff_1.ts index b90fbb52d..34b9be542 100644 --- a/linter-4.2/test/sdk_and_codelinter_diff_1.ts +++ b/linter-4.2/test/sdk_and_codelinter_diff_1.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14029 import {getData} from "./sdk_and_codelinter_diff_2" diff --git a/linter-4.2/test/sdk_and_codelinter_diff_2.ts b/linter-4.2/test/sdk_and_codelinter_diff_2.ts index 3771a4819..47d4d6720 100644 --- a/linter-4.2/test/sdk_and_codelinter_diff_2.ts +++ b/linter-4.2/test/sdk_and_codelinter_diff_2.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14029 export async function getData() { diff --git a/linter-4.2/test_extended_features/dollar_operation_TN.ets b/linter-4.2/test_extended_features/dollar_operation_TN.ets index a3fa5bcc4..fbbc0cbfc 100644 --- a/linter-4.2/test_extended_features/dollar_operation_TN.ets +++ b/linter-4.2/test_extended_features/dollar_operation_TN.ets @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14031 export class Foo1 { diff --git a/linter/test/ESObject.ts b/linter/test/ESObject.ts index dd29d3e12..af4d7b27a 100644 --- a/linter/test/ESObject.ts +++ b/linter/test/ESObject.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14030 type ESObject = any diff --git a/linter/test/sdk_and_codelinter_diff_1.ts b/linter/test/sdk_and_codelinter_diff_1.ts index b90fbb52d..34b9be542 100644 --- a/linter/test/sdk_and_codelinter_diff_1.ts +++ b/linter/test/sdk_and_codelinter_diff_1.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14029 import {getData} from "./sdk_and_codelinter_diff_2" diff --git a/linter/test/sdk_and_codelinter_diff_2.ts b/linter/test/sdk_and_codelinter_diff_2.ts index 3771a4819..47d4d6720 100644 --- a/linter/test/sdk_and_codelinter_diff_2.ts +++ b/linter/test/sdk_and_codelinter_diff_2.ts @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +14,8 @@ * limitations under the License. */ +======= +>>>>>>> 5e1d89c4 (added new tests and renamed '$' into 'dollar') //test for defect 14029 export async function getData() { -- Gitee