From 468f7a0a8e03a5db9d5e3385cb4efff17d7aa583 Mon Sep 17 00:00:00 2001 From: beratagaca_9a91 Date: Mon, 23 Jun 2025 15:05:12 +0300 Subject: [PATCH] fix arkts-limited-stdlib-no-import-concurrency Description: merged pr !6283 resolved Issue: #ICH82P Signed-off-by: beratagaca_9a91 --- ets2panda/linter/src/lib/TypeScriptLinter.ts | 3 +- .../src/lib/utils/consts/LimitedStdAPI.ts | 3 +- ...t_arktsutils_locks_asynclock.ets.args.json | 19 ++++++++++ ...arktsutils_locks_asynclock.ets.arkts2.json | 16 ++++---- ...rktsutils_locks_asynclock.ets.autofix.json | 38 ------------------- ...arktsutils_locks_asynclock.ets.migrate.ets | 20 ---------- ...rktsutils_locks_asynclock.ets.migrate.json | 38 ------------------- 7 files changed, 29 insertions(+), 108 deletions(-) create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.args.json delete mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json delete mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets delete mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 84b5a362bf..2750864cc3 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -70,7 +70,6 @@ import { LIMITED_STD_PROXYHANDLER_API, LIMITED_STD_REFLECT_API, MODULE_IMPORTS, - ARKTSUTILS_TEXT, ARKTSUTILS_MODULES, ARKTSUTILS_LOCKS_MEMBER } from './utils/consts/LimitedStdAPI'; @@ -7245,7 +7244,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } }; - this.checkSymbolAndExecute(symbol, ARKTSUTILS_TEXT, ARKTSUTILS_MODULES, cb); + this.checkSymbolAndExecute(symbol, ARKTSUTILS_LOCKS_MEMBER, ARKTSUTILS_MODULES, cb); } private checkSymbolAndExecute(symbol: ts.Symbol, symbolName: string, modules: string[], cb: () => void): void { diff --git a/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts b/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts index 21007148eb..eeef04d78d 100644 --- a/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts @@ -158,6 +158,5 @@ export const MODULE_IMPORTS: Record = { '@ohos.taskpool': ['taskpool'] }; -export const ARKTSUTILS_TEXT = 'ArkTSUtils'; -export const ARKTSUTILS_MODULES = ['@arkts.utils']; +export const ARKTSUTILS_MODULES = ['@arkts.utils', '@kit.ArkTS']; export const ARKTSUTILS_LOCKS_MEMBER = 'locks'; diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.args.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.args.json new file mode 100644 index 0000000000..3ef4496a81 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 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." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json index c38018cfbc..31d218b8f0 100644 --- a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json @@ -15,20 +15,20 @@ ], "result": [ { - "line": 3, - "column": 17, - "endLine": 3, - "endColumn": 27, + "line": 18, + "column": 28, + "endLine": 18, + "endColumn": 33, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", "severity": "ERROR" }, { - "line": 5, - "column": 17, - "endLine": 5, - "endColumn": 27, + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 33, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json deleted file mode 100644 index c38018cfbc..0000000000 --- a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "copyright": [ - "Copyright (c) 2025 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." - ], - "result": [ - { - "line": 3, - "column": 17, - "endLine": 3, - "endColumn": 27, - "problem": "LimitedStdLibNoImportConcurrency", - "suggest": "", - "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", - "severity": "ERROR" - }, - { - "line": 5, - "column": 17, - "endLine": 5, - "endColumn": 27, - "problem": "LimitedStdLibNoImportConcurrency", - "suggest": "", - "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", - "severity": "ERROR" - } - ] -} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets deleted file mode 100644 index c8cd4f5b48..0000000000 --- a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2025 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 { ArkTSUtils } from '../main/oh_modules/@kit.ArkTS'; - -let lock1 = new ArkTSUtils.locks.AsyncLock(); - -let lock2 = new ArkTSUtils.locks.AsyncLock(); \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json deleted file mode 100644 index c38018cfbc..0000000000 --- a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "copyright": [ - "Copyright (c) 2025 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." - ], - "result": [ - { - "line": 3, - "column": 17, - "endLine": 3, - "endColumn": 27, - "problem": "LimitedStdLibNoImportConcurrency", - "suggest": "", - "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", - "severity": "ERROR" - }, - { - "line": 5, - "column": 17, - "endLine": 5, - "endColumn": 27, - "problem": "LimitedStdLibNoImportConcurrency", - "suggest": "", - "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", - "severity": "ERROR" - } - ] -} \ No newline at end of file -- Gitee