diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 2ba0b44631f3953bfa413deeb00e38fd87fb9191..416721234fc318b7e4306785e034a5e8df072d76 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -8812,27 +8812,18 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const namedImports = namedBindings && ts.isNamedImports(namedBindings) ? namedBindings.elements : []; - const defaultIsForbidden = defaultImport && expectedImports.includes(defaultImport.getText()); + const FORBIDDEN_DEFAULT_IMPORT_MODULES = Object.keys(MODULE_IMPORTS).filter((name) => { + return name !== '@kit.ArkTS'; + }); + + const defaultIsForbidden = defaultImport && FORBIDDEN_DEFAULT_IMPORT_MODULES.includes(moduleName); const forbiddenNamed = namedImports.filter((spec) => { const name = spec.propertyName ? spec.propertyName.getText() : spec.name.getText(); return expectedImports.includes(name); }); - if ( - TypeScriptLinter.shouldRemoveWholeImport( - defaultIsForbidden, - forbiddenNamed.length, - namedImports.length, - defaultImport - ) - ) { - const autofix = this.autofixer?.removeNode(importDeclaration); - this.incrementCounters(importDeclaration, FaultID.LimitedStdLibNoImportConcurrency, autofix); - return; - } - if (defaultIsForbidden) { - const autofix = this.autofixer?.removeDefaultImport(importDeclaration, defaultImport); + const autofix = this.autofixer?.removeDefaultImport(importDeclaration, defaultImport, expectedImports[0]); this.incrementCounters(defaultImport, FaultID.LimitedStdLibNoImportConcurrency, autofix); } @@ -8842,19 +8833,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } - private static shouldRemoveWholeImport( - defaultIsForbidden: boolean | undefined, - forbiddenNamedCount: number, - namedImportsCount: number, - defaultImport: ts.Identifier | undefined - ): boolean { - return ( - defaultIsForbidden && forbiddenNamedCount === namedImportsCount || - defaultIsForbidden && namedImportsCount === 0 || - !defaultImport && forbiddenNamedCount === namedImportsCount && namedImportsCount > 0 - ); - } - /** * Checks for missing super() call in child classes that extend a parent class * with parameterized constructors. If parent class only has parameterized constructors diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index a29f4742e47f407ad4db9cf4e8c7cddbfe64aea1..ba19039e8e1b54f137fca5a5256df383ba2eb548 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -2423,20 +2423,14 @@ export class Autofixer { return [{ start: node.getStart(), end: node.getEnd(), replacementText }]; } - removeImportSpecifier( - specToRemove: ts.ImportSpecifier, - importDeclaration: ts.ImportDeclaration - ): Autofix[] | undefined { - if (!importDeclaration) { - return undefined; - } - - const importClause = importDeclaration.importClause; - if (!importClause?.namedBindings || !ts.isNamedImports(importClause.namedBindings)) { + removeImportSpecifier(specToRemove: ts.ImportSpecifier, importDecl: ts.ImportDeclaration): Autofix[] | undefined { + const importClause = importDecl.importClause; + const namedBindings = importClause?.namedBindings; + if (!importClause || !namedBindings || !ts.isNamedImports(namedBindings)) { return undefined; } - const namedBindings = importClause.namedBindings; + const fixes: Autofix[] = []; const allSpecifiers = namedBindings.elements; const remainingSpecifiers = allSpecifiers.filter((spec) => { return spec !== specToRemove; @@ -2444,48 +2438,88 @@ export class Autofixer { // If none are valid, remove all named imports. if (remainingSpecifiers.length === 0) { - if (importClause.name) { - const start = importClause.name.end; - const end = namedBindings.end; - return [{ start, end, replacementText: '' }]; - } - return this.removeNode(importDeclaration); - } - - const specIndex = allSpecifiers.findIndex((spec) => { - return spec === specToRemove; - }); - const isLast = specIndex === allSpecifiers.length - 1; - const isFirst = specIndex === 0; + fixes.push({ + start: importClause.name ? importClause.name.end : importDecl.getStart(), + end: importClause.name ? namedBindings.end : importDecl.getEnd(), + replacementText: '' + }); + } else { + const specIndex = allSpecifiers.findIndex((spec) => { + return spec === specToRemove; + }); + const isLast = specIndex === allSpecifiers.length - 1; + const isFirst = specIndex === 0; - let start = specToRemove.getStart(); - let end = specToRemove.getEnd(); + let start = specToRemove.getStart(); + let end = specToRemove.getEnd(); - if (!isLast) { - end = allSpecifiers[specIndex + 1].getStart(); - } else if (!isFirst) { - const prev = allSpecifiers[specIndex - 1]; - start = prev.getEnd(); + if (!isLast) { + end = allSpecifiers[specIndex + 1].getStart(); + } else if (!isFirst) { + const prev = allSpecifiers[specIndex - 1]; + start = prev.getEnd(); + } + fixes.push({ + start: start, + end: end, + replacementText: '' + }); } - return [{ start, end, replacementText: '' }]; + const alias = specToRemove.name; + const original = specToRemove.propertyName ?? specToRemove.name; + const replacements = this.replaceIdentifierUsages(alias, original.getText()); + fixes.push(...replacements); + return fixes; } - removeDefaultImport(importDecl: ts.ImportDeclaration, defaultImport: ts.Identifier): Autofix[] | undefined { + removeDefaultImport( + importDecl: ts.ImportDeclaration, + defaultImport: ts.Identifier, + replacementName: string + ): Autofix[] | undefined { const importClause = importDecl.importClause; if (!importClause || !defaultImport) { return undefined; } - + const fixes: Autofix[] = []; const namedBindings = importClause.namedBindings; + fixes.push({ + start: namedBindings ? defaultImport.getStart() : importDecl.getStart(), + end: namedBindings ? namedBindings.getStart() : importDecl.getEnd(), + replacementText: '' + }); + + const replacements = this.replaceIdentifierUsages(defaultImport, replacementName); + fixes.push(...replacements); - if (!namedBindings) { - return this.removeNode(importDecl); + return fixes; + } + + replaceIdentifierUsages(importedIdentifier: ts.Identifier, replacementName: string): Autofix[] { + const fixes: Autofix[] = []; + const file = importedIdentifier.getSourceFile(); + const originalSymbol = this.typeChecker.getSymbolAtLocation(importedIdentifier); + if (!originalSymbol) { + return fixes; } - const start = defaultImport.getStart(); - const end = namedBindings.getStart(); - return [{ start, end, replacementText: '' }]; + const visit = (node: ts.Node): void => { + if (ts.isIdentifier(node) && !ts.isImportClause(node.parent) && !ts.isImportSpecifier(node.parent)) { + const nodeSymbol = this.typeChecker.getSymbolAtLocation(node); + if (nodeSymbol === originalSymbol) { + fixes.push({ + start: node.getStart(), + end: node.getEnd(), + replacementText: replacementName + }); + } + } + ts.forEachChild(node, visit); + }; + + visit(file); + return fixes; } fixSendableExplicitFieldType(node: ts.PropertyDeclaration): Autofix[] | undefined { diff --git a/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts b/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts index eeef04d78df87d0a676563451045d17de67445df..3149a493a1a8b608a3dafec14c6a44298cf12594 100644 --- a/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts @@ -153,9 +153,11 @@ export const LIMITED_STD_API = new Map = { - '@kit.ArkTS': ['taskpool', 'ArkTSUtils', 'process'], + '@kit.ArkTS': ['taskpool', 'ArkTSUtils', 'process', 'collections'], '@ohos.process': ['process'], - '@ohos.taskpool': ['taskpool'] + '@ohos.taskpool': ['taskpool'], + '@arkts.utils': ['ArkTSUtils'], + '@arkts.collections': ['collections'] }; export const ARKTSUTILS_MODULES = ['@arkts.utils', '@kit.ArkTS']; diff --git a/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json b/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json index bba96543288bcd93a29d4f09544654ae204a573f..bdaa7adb276280f91a4179d9ca43c5c773e77131 100755 --- a/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json +++ b/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json @@ -16,9 +16,9 @@ "result": [ { "line": 15, - "column": 1, + "column": 10, "endLine": 15, - "endColumn": 43, + "endColumn": 18, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", diff --git a/ets2panda/linter/test/main/no_import_concurrency.ets b/ets2panda/linter/test/main/no_import_concurrency.ets index d6f173602ac9b97d67ee5a86e8c873a096fc19ad..9eb3c99118766d1011341a40fe3f2976f2df5c9d 100644 --- a/ets2panda/linter/test/main/no_import_concurrency.ets +++ b/ets2panda/linter/test/main/no_import_concurrency.ets @@ -17,10 +17,27 @@ import { foo, util, taskpool as tpp } from '@ohos.taskpool'; import { anyClass } from '@kit.ArkTS'; //legal import foo2, { fooClass } from '@ohos.taskpool'; //legal -import taskpool, { ArkTSUtils as Atu, roo } from '@kit.ArkTS'; +import defaultImport, { ArkTSUtils as Atu, roo } from '@kit.ArkTS'; import koo, { ArkTSUtils as Ark, process as pr } from '@kit.ArkTS'; -import doo, { ArkTSUtils as Ats, too } from '@kit.ArkTS'; -import fooke from '@ohos.process'; //legal -import { process as ps } from '@ohos.process'; +import doo, { fooModule as fooAs, too } from '@kit.ArkTS'; +import bbbb, { taskpool as tsk, process as prs } from '@kit.ArkTS'; +import fooke from '@ohos.process'; +import { process as ps, collections as clt } from '@kit.ArkTS'; import process from '@ohos.process'; -import ArkTSUtils, { taskpool as tsk, process as prs } from '@kit.ArkTS'; \ No newline at end of file +import aaa from '@ohos.taskpool' +import aa from '@arkts.utils' +import aaaa from '@arkts.collections'; + +aaa.getTaskPoolInfo() + +function concurrency () { + const aaa = 123; + console.log(aaa); +} + +ps.isIsolatedProcess(); +tsk.cancel(); +aa.locks.AsyncLock +aaaa.Set() +clt.Set() +fooAs.getFoo(); diff --git a/ets2panda/linter/test/main/no_import_concurrency.ets.arkts2.json b/ets2panda/linter/test/main/no_import_concurrency.ets.arkts2.json index 7d90da63697aff2fcbf4ea04318ef9be41fd6d1a..d3aaa8c933a1854550d6ae1f5078a23c6f554af5 100644 --- a/ets2panda/linter/test/main/no_import_concurrency.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_import_concurrency.ets.arkts2.json @@ -25,10 +25,10 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 8, - "endLine": 20, - "endColumn": 16, + "endLine": 19, + "endColumn": 12, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", @@ -36,9 +36,9 @@ }, { "line": 20, - "column": 20, + "column": 25, "endLine": 20, - "endColumn": 37, + "endColumn": 42, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", @@ -65,10 +65,20 @@ "severity": "ERROR" }, { - "line": 22, - "column": 15, - "endLine": 22, - "endColumn": 32, + "line": 23, + "column": 16, + "endLine": 23, + "endColumn": 31, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 33, + "endLine": 23, + "endColumn": 47, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", @@ -76,9 +86,9 @@ }, { "line": 24, - "column": 1, + "column": 8, "endLine": 24, - "endColumn": 47, + "endColumn": 13, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", @@ -86,9 +96,19 @@ }, { "line": 25, - "column": 1, + "column": 10, "endLine": 25, - "endColumn": 37, + "endColumn": 23, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 43, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", @@ -96,13 +116,63 @@ }, { "line": 26, - "column": 1, + "column": 8, "endLine": 26, - "endColumn": 74, + "endColumn": 15, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", "severity": "ERROR" + }, + { + "line": 27, + "column": 8, + "endLine": 27, + "endColumn": 11, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 8, + "endLine": 28, + "endColumn": 10, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 8, + "endLine": 29, + "endColumn": 12, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 11, + "endLine": 34, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 17, + "endLine": 34, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_import_concurrency.ets.autofix.json b/ets2panda/linter/test/main/no_import_concurrency.ets.autofix.json index 2a756c0a4edcbb1429418311fc03b308492aa42e..6c5606e0185c023b67988ae8be32675471370e3b 100644 --- a/ets2panda/linter/test/main/no_import_concurrency.ets.autofix.json +++ b/ets2panda/linter/test/main/no_import_concurrency.ets.autofix.json @@ -24,7 +24,11 @@ { "start": 629, "end": 646, - "replacementText": "" + "replacementText": "", + "line": 17, + "column": 21, + "endLine": 17, + "endColumn": 36 } ], "suggest": "", @@ -32,16 +36,20 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 8, - "endLine": 20, - "endColumn": 16, + "endLine": 19, + "endColumn": 12, "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 783, - "end": 793, - "replacementText": "" + "start": 726, + "end": 732, + "replacementText": "", + "line": 19, + "column": 8, + "endLine": 19, + "endColumn": 12 } ], "suggest": "", @@ -50,15 +58,19 @@ }, { "line": 20, - "column": 20, + "column": 25, "endLine": 20, - "endColumn": 37, + "endColumn": 42, "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 795, - "end": 814, - "replacementText": "" + "start": 800, + "end": 819, + "replacementText": "", + "line": 20, + "column": 25, + "endLine": 20, + "endColumn": 42 } ], "suggest": "", @@ -73,9 +85,13 @@ "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 853, - "end": 872, - "replacementText": "" + "start": 858, + "end": 877, + "replacementText": "", + "line": 21, + "column": 15, + "endLine": 21, + "endColumn": 32 } ], "suggest": "", @@ -90,9 +106,13 @@ "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 870, - "end": 885, - "replacementText": "" + "start": 875, + "end": 890, + "replacementText": "", + "line": 21, + "column": 34, + "endLine": 21, + "endColumn": 47 } ], "suggest": "", @@ -100,16 +120,50 @@ "severity": "ERROR" }, { - "line": 22, - "column": 15, - "endLine": 22, - "endColumn": 32, + "line": 23, + "column": 16, + "endLine": 23, + "endColumn": 31, + "problem": "LimitedStdLibNoImportConcurrency", + "autofix": [ + { + "start": 986, + "end": 1003, + "replacementText": "", + "line": 23, + "column": 16, + "endLine": 23, + "endColumn": 31 + }, + { + "start": 1397, + "end": 1400, + "replacementText": "taskpool", + "line": 23, + "column": 16, + "endLine": 23, + "endColumn": 31 + } + ], + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 33, + "endLine": 23, + "endColumn": 47, "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 921, - "end": 940, - "replacementText": "" + "start": 1001, + "end": 1017, + "replacementText": "", + "line": 23, + "column": 33, + "endLine": 23, + "endColumn": 47 } ], "suggest": "", @@ -118,15 +172,19 @@ }, { "line": 24, - "column": 1, + "column": 8, "endLine": 24, - "endColumn": 47, + "endColumn": 13, "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 1008, - "end": 1054, - "replacementText": "" + "start": 1039, + "end": 1073, + "replacementText": "", + "line": 24, + "column": 8, + "endLine": 24, + "endColumn": 13 } ], "suggest": "", @@ -135,15 +193,58 @@ }, { "line": 25, - "column": 1, + "column": 10, "endLine": 25, - "endColumn": 37, + "endColumn": 23, "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 1055, - "end": 1091, - "replacementText": "" + "start": 1083, + "end": 1098, + "replacementText": "", + "line": 25, + "column": 10, + "endLine": 25, + "endColumn": 23 + }, + { + "start": 1373, + "end": 1375, + "replacementText": "process", + "line": 25, + "column": 10, + "endLine": 25, + "endColumn": 23 + } + ], + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 43, + "problem": "LimitedStdLibNoImportConcurrency", + "autofix": [ + { + "start": 1096, + "end": 1116, + "replacementText": "", + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 43 + }, + { + "start": 1441, + "end": 1444, + "replacementText": "collections", + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 43 } ], "suggest": "", @@ -152,20 +253,156 @@ }, { "line": 26, - "column": 1, + "column": 8, "endLine": 26, - "endColumn": 74, + "endColumn": 15, "problem": "LimitedStdLibNoImportConcurrency", "autofix": [ { - "start": 1092, - "end": 1165, - "replacementText": "" + "start": 1138, + "end": 1174, + "replacementText": "", + "line": 26, + "column": 8, + "endLine": 26, + "endColumn": 15 } ], "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", "severity": "ERROR" + }, + { + "line": 27, + "column": 8, + "endLine": 27, + "endColumn": 11, + "problem": "LimitedStdLibNoImportConcurrency", + "autofix": [ + { + "start": 1175, + "end": 1207, + "replacementText": "", + "line": 27, + "column": 8, + "endLine": 27, + "endColumn": 11 + }, + { + "start": 1278, + "end": 1281, + "replacementText": "taskpool", + "line": 27, + "column": 8, + "endLine": 27, + "endColumn": 11 + } + ], + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 8, + "endLine": 28, + "endColumn": 10, + "problem": "LimitedStdLibNoImportConcurrency", + "autofix": [ + { + "start": 1208, + "end": 1237, + "replacementText": "", + "line": 28, + "column": 8, + "endLine": 28, + "endColumn": 10 + }, + { + "start": 1411, + "end": 1413, + "replacementText": "ArkTSUtils", + "line": 28, + "column": 8, + "endLine": 28, + "endColumn": 10 + } + ], + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 8, + "endLine": 29, + "endColumn": 12, + "problem": "LimitedStdLibNoImportConcurrency", + "autofix": [ + { + "start": 1238, + "end": 1276, + "replacementText": "", + "line": 29, + "column": 8, + "endLine": 29, + "endColumn": 12 + }, + { + "start": 1430, + "end": 1434, + "replacementText": "collections", + "line": 29, + "column": 8, + "endLine": 29, + "endColumn": 12 + } + ], + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 11, + "endLine": 34, + "endColumn": 20, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1337, + "end": 1346, + "replacementText": "aaa: number = 123", + "line": 34, + "column": 11, + "endLine": 34, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 17, + "endLine": 34, + "endColumn": 20, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1343, + "end": 1346, + "replacementText": "123.0", + "line": 34, + "column": 17, + "endLine": 34, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets b/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets index a7dc1cccd1e7d3efc28ac56813a2342e849546cc..ec7742adfb5b2ee082fb7a749ce18649f122ccb5 100644 --- a/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets +++ b/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets @@ -16,10 +16,28 @@ import { foo, util } from '@ohos.taskpool'; import { anyClass } from '@kit.ArkTS'; //legal -import foo2, { fooClass } from '@ohos.taskpool'; //legal -import { roo } from '@kit.ArkTS'; +import { fooClass } from '@ohos.taskpool'; //legal +import defaultImport, { roo } from '@kit.ArkTS'; import koo from '@kit.ArkTS'; -import doo, { too } from '@kit.ArkTS'; -import fooke from '@ohos.process'; //legal +import doo, { fooModule as fooAs, too } from '@kit.ArkTS'; +import bbbb from '@kit.ArkTS'; + + + + + +taskpool.getTaskPoolInfo() + +function concurrency () { + const aaa: number = 123.0; + console.log(aaa); +} + +process.isIsolatedProcess(); +taskpool.cancel(); +ArkTSUtils.locks.AsyncLock +collections.Set() +collections.Set() +fooAs.getFoo(); diff --git a/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json b/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json index 5881b8079dec64adf90ac1344f90305a60f8fd98..d8df6294eb2883ecaf13d4b2087c322b8b6f80f7 100644 --- a/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json +++ b/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json @@ -46,9 +46,9 @@ }, { "line": 17, - "column": 1, + "column": 10, "endLine": 17, - "endColumn": 44, + "endColumn": 24, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", diff --git a/ets2panda/linter/test/main/taskpool_deprecated_usages2.ets.arkts2.json b/ets2panda/linter/test/main/taskpool_deprecated_usages2.ets.arkts2.json index e4183cf1b5bb5b962d919e12ef452964584a4053..e45a67f04297ffc7f8be2973d192e3f7720dec78 100755 --- a/ets2panda/linter/test/main/taskpool_deprecated_usages2.ets.arkts2.json +++ b/ets2panda/linter/test/main/taskpool_deprecated_usages2.ets.arkts2.json @@ -16,9 +16,9 @@ "result": [ { "line": 16, - "column": 1, + "column": 8, "endLine": 16, - "endColumn": 39, + "endColumn": 16, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", diff --git a/ets2panda/linter/test/main/taskpool_deprecated_usages3.ets.arkts2.json b/ets2panda/linter/test/main/taskpool_deprecated_usages3.ets.arkts2.json index 449be5d7945a1a914efc5ff077f0dbbc744de8ff..75c06b28547989681f9a67799700779003f0b2c3 100755 --- a/ets2panda/linter/test/main/taskpool_deprecated_usages3.ets.arkts2.json +++ b/ets2panda/linter/test/main/taskpool_deprecated_usages3.ets.arkts2.json @@ -16,9 +16,9 @@ "result": [ { "line": 15, - "column": 1, + "column": 8, "endLine": 15, - "endColumn": 39, + "endColumn": 16, "problem": "LimitedStdLibNoImportConcurrency", "suggest": "", "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)",