diff --git a/ets2panda/linter/rule-config.json b/ets2panda/linter/rule-config.json index dc1ab4b18ff833330e09c4c6d8617fdeb143d3b5..e2bf187f7622f58703b9a379f52bcf27756fd9ba 100644 --- a/ets2panda/linter/rule-config.json +++ b/ets2panda/linter/rule-config.json @@ -14,7 +14,6 @@ "arkts-no-function-return-this", "arkts-limited-stdlib", "arkts-no-class-add-super-prop-with-readonly", - "arkts-var-assignment-before-use", "arkts-concurrent-deprecated-apis", "arkts-no-classes-as-obj", "arkts-obj-literal-props", @@ -23,6 +22,7 @@ "arkts-optional-methods", "arkts-use-long-for-large-numeric-literal", "arkts-numeric-semantic", + "arkts-limited-tuple-index-type", "arkts-incompatible-function-types", "arkts-limited-void-type", "arkts-distinct-infinity-bitwise-inversion", @@ -61,6 +61,7 @@ "arkts-limited-stdlib-no-setTransferList", "arkts-builtin-object-getOwnPropertyNames", "arkts-no-class-omit-interface-optional-prop", + "arkts-distinct-abstract-method-default-return-type", "arkts-class-no-signature-distinct-with-object-public-api", "arkts-no-sparse-array", "arkts-no-enum-prop-as-type", diff --git a/ets2panda/linter/src/cli/LinterCLI.ts b/ets2panda/linter/src/cli/LinterCLI.ts index 447a2358d12e80890328e3fad0331113b17bb781..b0851047c3eadefc9979b370d2ba43bb22941f7b 100644 --- a/ets2panda/linter/src/cli/LinterCLI.ts +++ b/ets2panda/linter/src/cli/LinterCLI.ts @@ -128,6 +128,12 @@ async function executeHomeCheckTask(scanTaskRelatedInfo: ScanTaskRelatedInfo): P migrationTool = null; scanTaskRelatedInfo.homeCheckResult = transferIssues2ProblemInfo(result); for (const [filePath, problems] of scanTaskRelatedInfo.homeCheckResult) { + if ( + !scanTaskRelatedInfo.cmdOptions.scanWholeProjectInHomecheck && + !scanTaskRelatedInfo.cmdOptions.inputFiles.includes(filePath) + ) { + continue; + } if (!scanTaskRelatedInfo.mergedProblems.has(filePath)) { scanTaskRelatedInfo.mergedProblems.set(filePath, []); } diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index 4d5245cdc2f123c5db1c9c52c19bff2eaee7e1a9..eaeedd2ab284a5cb24da950e4bf78e5c6ee9d16a 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -90,7 +90,7 @@ cookBookTag[59] = '"delete" operator is not supported (arkts-no-delete)'; cookBookTag[60] = '"typeof" operator is allowed only in expression contexts (arkts-no-type-query)'; cookBookTag[61] = 'The bitwise inversion gives different result for "Infinity" (arkts-distinct-infinity-bitwise-inversion)'; -cookBookTag[62] = ''; +cookBookTag[62] = 'Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)'; cookBookTag[63] = ''; cookBookTag[64] = ''; cookBookTag[65] = '"instanceof" operator is partially supported (arkts-instanceof-ref-types)'; @@ -240,6 +240,8 @@ cookBookTag[185] = 'syntax for import type is disabled (arkts-import-types)'; cookBookTag[186] = '"new" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)'; cookBookTag[187] = 'function "Math.pow()" behavior for ArkTS differs from Typescript version (arkts-math-pow-standard-diff)'; +cookBookTag[188] = + 'In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)'; cookBookTag[189] = 'Numeric semantics is different for integer values (arkts-numeric-semantic)'; cookBookTag[190] = 'Stricter assignments into variables of function type (arkts-incompatible-function-types)'; cookBookTag[191] = 'ASON is not supported. (arkts-no-need-stdlib-ason)'; @@ -298,8 +300,6 @@ cookBookTag[268] = 'Direct usage of interop JS objects is not supported (arkts-i cookBookTag[269] = 'Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)'; cookBookTag[270] = 'ArkTS1.2 cannot catch a non Error instance thrown from JS code (arkts-interop-js2s-js-exception)'; -cookBookTag[271] = - 'After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)'; cookBookTag[272] = 'This API of process is obsolete in ArkTS 1.1. It\'s no longer supported in ArkTS 1.2 (arkts-concurrent-deprecated-apis)'; cookBookTag[273] = diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index d52e47f4756d9fdfe24a71db39b9d9170a58f06e..8a6fe17151ba2697323a744587e0c8528e7700ca 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -60,6 +60,7 @@ faultsAttrs[FaultID.UnaryArithmNotNumber] = new FaultAttributes(55); faultsAttrs[FaultID.DeleteOperator] = new FaultAttributes(59); faultsAttrs[FaultID.TypeQuery] = new FaultAttributes(60); faultsAttrs[FaultID.PrefixUnaryInfinity] = new FaultAttributes(61); +faultsAttrs[FaultID.TupleIndex] = new FaultAttributes(62); faultsAttrs[FaultID.InstanceofUnsupported] = new FaultAttributes(65); faultsAttrs[FaultID.InOperator] = new FaultAttributes(66); faultsAttrs[FaultID.DestructuringAssignment] = new FaultAttributes(69); @@ -153,6 +154,7 @@ faultsAttrs[FaultID.OptionalMethod] = new FaultAttributes(184); faultsAttrs[FaultID.ImportType] = new FaultAttributes(185); faultsAttrs[FaultID.DynamicCtorCall] = new FaultAttributes(186); faultsAttrs[FaultID.MathPow] = new FaultAttributes(187); +faultsAttrs[FaultID.InvalidAbstractOverrideReturnType] = new FaultAttributes(188); faultsAttrs[FaultID.NumericSemantics] = new FaultAttributes(189); faultsAttrs[FaultID.IncompationbleFunctionType] = new FaultAttributes(190); faultsAttrs[FaultID.LimitedStdLibNoASON] = new FaultAttributes(191); @@ -204,7 +206,6 @@ faultsAttrs[FaultID.InteropJsObjectCallStaticFunc] = new FaultAttributes(267, Pr faultsAttrs[FaultID.InteropJsObjectConditionJudgment] = new FaultAttributes(268); faultsAttrs[FaultID.InteropJsObjectExpandStaticInstance] = new FaultAttributes(269); faultsAttrs[FaultID.InteropJSFunctionInvoke] = new FaultAttributes(270); -faultsAttrs[FaultID.VariableMissingInitializer] = new FaultAttributes(271); faultsAttrs[FaultID.DeprecatedProcessApi] = new FaultAttributes(272); faultsAttrs[FaultID.NumericUnsignedShiftBehaviorChange] = new FaultAttributes(273); faultsAttrs[FaultID.MissingSuperCall] = new FaultAttributes(274); diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index d2753c7fb5bb2837f6f6bcdb24b593be1c7bb459..66ca12b4baa37f2fcfff618ab5cf7d1edcb97728 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -91,6 +91,7 @@ faultDesc[FaultID.TemplateStringType] = 'Template string type'; faultDesc[FaultID.ShorthandAmbientModuleDecl] = 'Shorthand ambient module declaration'; faultDesc[FaultID.LongNumeric] = 'Use long for big numbers'; faultDesc[FaultID.WildcardsInModuleName] = 'Wildcards in module name'; +faultDesc[FaultID.TupleIndex] = 'Non-negative integer index for tuples'; faultDesc[FaultID.UMDModuleDefinition] = 'UMD module definition'; faultDesc[FaultID.NewTarget] = '"new.target" meta-property'; faultDesc[FaultID.DefiniteAssignment] = faultDesc[FaultID.DefiniteAssignmentError] = 'Definite assignment assertion'; @@ -147,6 +148,7 @@ faultDesc[FaultID.OptionalMethod] = 'Optional method'; faultDesc[FaultID.ImportType] = 'Import type syntax'; faultDesc[FaultID.DynamicCtorCall] = 'Dynamic constructor call'; faultDesc[FaultID.MathPow] = 'Exponent call'; +faultDesc[FaultID.InvalidAbstractOverrideReturnType] = 'Missing return type on abstract method'; faultDesc[FaultID.IncompationbleFunctionType] = 'Incompationble function type'; faultDesc[FaultID.VoidOperator] = 'Void operator'; faultDesc[FaultID.ExponentOp] = 'Exponent operation'; @@ -173,7 +175,6 @@ faultDesc[FaultID.MethodOverridingField] = '"Method overriding field" to keep st faultDesc[FaultID.InteropJsObjectConditionJudgment] = 'Interop JS Object usage in a condition'; faultDesc[FaultID.InteropJsObjectExpandStaticInstance] = 'Interop JS function usage'; faultDesc[FaultID.InteropJSFunctionInvoke] = 'Interop JS function invoke'; -faultDesc[FaultID.VariableMissingInitializer] = 'Value must be assigned to variable'; faultDesc[FaultID.NotSupportTupleGenericValidation] = 'No Tuple type in Generic'; faultDesc[FaultID.DeprecatedProcessApi] = 'This process Api no longer supported in ArkTS 1.2'; faultDesc[FaultID.ExplicitFunctionType] = 'Not explicit function type'; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index d607d731b137835c97f5cc8fd29fe9796cd46104..0c2e3338051df3e0eafc13bd6390cd43fc06db24 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -145,6 +145,7 @@ export enum FaultID { ImportType, DynamicCtorCall, MathPow, + InvalidAbstractOverrideReturnType, VoidOperator, ExponentOp, RegularExpressionLiteral, @@ -163,6 +164,7 @@ export enum FaultID { ArrayIndexExprType, AvoidUnionTypes, NoTuplesArrays, + TupleIndex, DoubleExclaBindingNotSupported, DoubleDollarBindingNotSupported, DollarBindingNotSupported, @@ -193,7 +195,6 @@ export enum FaultID { InteropDirectAccessToTSTypes, InteropTSFunctionInvoke, InteropJSFunctionInvoke, - VariableMissingInitializer, DeprecatedProcessApi, LimitedVoidTypeFromSdk, EntryAnnotation, diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 2658cb6a0d25c67bc325d128ec695ae4c4794efe..3b7a5a6a4e2315ee296a9fa5d53c907eb0ca2421 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -2754,45 +2754,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handlePropertyDescriptorInScenarios(tsVarDecl); this.handleSdkGlobalApi(tsVarDecl); this.handleNoDeprecatedApi(tsVarDecl); - this.handleMissingInitializer(tsVarDecl); this.checkNumericSemanticsForVariable(tsVarDecl); } - /** - * Reports an error if a `let`/`const` declaration lacks an initializer. - */ - private handleMissingInitializer(decl: ts.VariableDeclaration): void { - if (!this.options.arkts2) { - return; - } - - const list = decl.parent as ts.VariableDeclarationList; - if (!(list.flags & (ts.NodeFlags.Let | ts.NodeFlags.Const))) { - return; - } - - // Skip for‐of/for‐in loop bindings - const parentStmt = list.parent; - if (ts.isForOfStatement(parentStmt) || ts.isForInStatement(parentStmt)) { - return; - } - - // Skip explicit function‐type declarations (they are more like methods) - if (decl.type && ts.isFunctionTypeNode(decl.type)) { - return; - } - - // Skip variables declared as void—voids are handled by a different rule - if (decl.type && decl.type.kind === ts.SyntaxKind.VoidKeyword) { - return; - } - - // If no initializer, report - if (!decl.initializer) { - this.incrementCounters(decl.name, FaultID.VariableMissingInitializer); - } - } - private checkNumericSemanticsForBinaryExpression(node: ts.BinaryExpression): void { if (!this.options.arkts2) { return; @@ -3924,6 +3888,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleLimitedVoidFunction(tsMethodDecl); this.checkVoidLifecycleReturn(tsMethodDecl); this.handleNoDeprecatedApi(tsMethodDecl); + this.checkAbstractOverrideReturnType(tsMethodDecl); } private checkObjectPublicApiMethods(node: ts.ClassDeclaration | ts.InterfaceDeclaration): void { @@ -4997,6 +4962,10 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { ); const tsElemAccessArgType = this.tsTypeChecker.getTypeAtLocation(tsElementAccessExpr.argumentExpression); + if (this.options.arkts2 && this.tsUtils.isOrDerivedFrom(tsElemAccessBaseExprType, TsUtils.isTuple)) { + this.handleTupleIndex(tsElementAccessExpr); + } + if (this.tsUtils.hasEsObjectType(tsElementAccessExpr.expression)) { const faultId = this.options.arkts2 ? FaultID.EsValueTypeError : FaultID.EsValueType; this.incrementCounters(node, faultId); @@ -5013,6 +4982,80 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleNoDeprecatedApi(tsElementAccessExpr); } + private handleTupleIndex(expr: ts.ElementAccessExpression): void { + const value = expr.argumentExpression; + + if (this.isArgumentConstDotZero(value)) { + this.incrementCounters(expr as ts.Node, FaultID.TupleIndex); + return; + } + + if (ts.isNumericLiteral(value)) { + const indexText = value.getText(); + const indexValue = Number(indexText); + const isValid = Number.isInteger(indexValue) && indexValue >= 0; + + if (!isValid) { + this.incrementCounters(expr as ts.Node, FaultID.TupleIndex); + } + return; + } + + if (ts.isPrefixUnaryExpression(value)) { + const { operator, operand } = value; + const resolved = this.evaluateValueFromDeclaration(operand); + + if (typeof resolved === 'number') { + const final = operator === ts.SyntaxKind.MinusToken ? -resolved : resolved; + const isValid = Number.isInteger(final) && final >= 0; + if (!isValid) { + this.incrementCounters(expr as ts.Node, FaultID.TupleIndex); + } + return; + } + this.incrementCounters(expr as ts.Node, FaultID.TupleIndex); + return; + } + + const resolved = this.evaluateValueFromDeclaration(value); + if (typeof resolved === 'number') { + const isValid = Number.isInteger(resolved) && resolved >= 0; + if (!isValid) { + this.incrementCounters(expr as ts.Node, FaultID.TupleIndex); + } + return; + } + + this.incrementCounters(expr as ts.Node, FaultID.TupleIndex); + } + + private isArgumentConstDotZero(expr: ts.Expression): boolean { + if (ts.isNumericLiteral(expr)) { + return expr.getText().endsWith('.0'); + } + + if (ts.isPrefixUnaryExpression(expr) && ts.isNumericLiteral(expr.operand)) { + return expr.operand.getText().endsWith('.0'); + } + + if (ts.isIdentifier(expr)) { + const declaration = this.tsUtils.getDeclarationNode(expr); + if (declaration && ts.isVariableDeclaration(declaration) && declaration.initializer) { + const init = declaration.initializer; + + if (ts.isNumericLiteral(init)) { + return init.getText().endsWith('.0'); + } + + if (ts.isPrefixUnaryExpression(init) && ts.isNumericLiteral(init.operand)) { + return init.operand.getText().endsWith('.0'); + } + } + } + + return false; + } + private checkPropertyAccessByIndex( tsElementAccessExpr: ts.ElementAccessExpression, tsElemAccessBaseExprType: ts.Type, @@ -5199,14 +5242,17 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!initializer) { return null; } - - if (!ts.isNumericLiteral(initializer)) { - return null; - } - - const numericValue = Number(initializer.text); - if (!Number.isInteger(numericValue)) { - return null; + let numericValue: number | null = null; + if (ts.isNumericLiteral(initializer)) { + numericValue = Number(initializer.text); + } else if (ts.isPrefixUnaryExpression(initializer) && ts.isNumericLiteral(initializer.operand)) { + const rawValue = Number(initializer.operand.text); + numericValue = + initializer.operator === ts.SyntaxKind.MinusToken ? + -rawValue : + initializer.operator === ts.SyntaxKind.PlusToken ? + rawValue : + null; } return numericValue; @@ -10607,6 +10653,110 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return undefined; } + /** + * If a class method overrides a base-class abstract method that had no explicit return type, + * then any explicit return type other than `void` is an error. + * Also flags async overrides with no explicit annotation. + */ + private checkAbstractOverrideReturnType(method: ts.MethodDeclaration): void { + if (!this.options.arkts2) { + return; + } + + const baseClass = this.getDirectBaseClassOfGivenMethodDecl(method); + if (!baseClass) { + return; + } + + // Locate the abstract method in the inheritance chain + const methodName = method.name.getText(); + const baseMethod = this.findAbstractMethodInBaseChain(baseClass, methodName); + if (!baseMethod) { + return; + } + + // Only if base had no explicit return type + if (baseMethod.type) { + return; + } + + // If override declares a return type, and it isn't void → error + if (method.type && method.type.kind !== ts.SyntaxKind.VoidKeyword) { + const target = ts.isIdentifier(method.name) ? method.name : method; + this.incrementCounters(target, FaultID.InvalidAbstractOverrideReturnType); + + // Also catch async overrides with no explicit annotation (defaulting to Promise) + } else if (TsUtils.hasModifier(method.modifiers, ts.SyntaxKind.AsyncKeyword)) { + const target = ts.isIdentifier(method.name) ? method.name : method; + this.incrementCounters(target, FaultID.InvalidAbstractOverrideReturnType); + } + } + + /** + * Finds the direct superclass declaration for the given method's containing class. + * Returns undefined if the class has no extends clause or cannot resolve the base class. + */ + private getDirectBaseClassOfGivenMethodDecl(method: ts.MethodDeclaration): ts.ClassDeclaration | undefined { + // Must live in a class with an extends clause + const classDecl = method.parent; + if (!ts.isClassDeclaration(classDecl) || !classDecl.heritageClauses) { + return undefined; + } + + return this.getBaseClassDeclFromHeritageClause(classDecl.heritageClauses); + } + + /** + * Walks up the inheritance chain starting from `startClass` to find an abstract method + * named `methodName`. Returns the MethodDeclaration if found, otherwise `undefined`. + */ + private findAbstractMethodInBaseChain( + startClass: ts.ClassDeclaration, + methodName: string + ): ts.MethodDeclaration | undefined { + // Prevent infinite loops from circular extends + const visited = new Set(); + let current: ts.ClassDeclaration | undefined = startClass; + while (current && !visited.has(current)) { + visited.add(current); + const found = current.members.find((m) => { + return ( + ts.isMethodDeclaration(m) && + ts.isIdentifier(m.name) && + m.name.text === methodName && + TsUtils.hasModifier(m.modifiers, ts.SyntaxKind.AbstractKeyword) + ); + }) as ts.MethodDeclaration | undefined; + if (found) { + return found; + } + current = this.getBaseClassDeclFromHeritageClause(current.heritageClauses); + } + return undefined; + } + + getBaseClassDeclFromHeritageClause(clauses?: ts.NodeArray): ts.ClassDeclaration | undefined { + if (!clauses) { + return undefined; + } + + const ext = clauses.find((h) => { + return h.token === ts.SyntaxKind.ExtendsKeyword; + }); + if (!ext || ext.types.length === 0) { + return undefined; + } + + // Resolve the base-class declaration + const expr = ext.types[0].expression; + if (!ts.isIdentifier(expr)) { + return undefined; + } + + const sym = this.tsUtils.trueSymbolAtLocation(expr); + return sym?.declarations?.find(ts.isClassDeclaration); + } + /** * 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 3ef2aba012eaa6e092826910b187dc0c631ba5fe..c321277ede6d057cefdb8d548a49814a3926a8d6 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -4739,7 +4739,7 @@ export class Autofixer { return undefined; } - const typeArgs = Autofixer.getTypeArgumentsFromType(contextualType); + const typeArgs = this.getTypeArgumentsFromType(contextualType); if (typeArgs.length === 0) { return undefined; } @@ -5044,8 +5044,8 @@ export class Autofixer { return [{ start: identifier.getEnd(), end: identifier.getEnd(), replacementText: typeArgsText }]; } - static getTypeArgumentsFromType(type: ts.Type): ts.Type[] { - const typeReference = type as ts.TypeReference; + private getTypeArgumentsFromType(type: ts.Type): ts.Type[] { + const typeReference = this.utils.getNonNullableType(type) as ts.TypeReference; if (typeReference.typeArguments) { return [...typeReference.typeArguments]; } diff --git a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.arkts2.json b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.arkts2.json index 1f7540062cbf194992405ac4c285d5e47f3349b0..ca88f857e960b437dcf767c0ac40be998c8f1236 100755 --- a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.arkts2.json +++ b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.arkts2.json @@ -13,36 +13,5 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 7, - "endLine": 24, - "endColumn": 9, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 7, - "endLine": 28, - "endColumn": 9, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - } - ] -} + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.autofix.json b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.autofix.json index 1f7540062cbf194992405ac4c285d5e47f3349b0..ca88f857e960b437dcf767c0ac40be998c8f1236 100755 --- a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.autofix.json +++ b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.autofix.json @@ -13,36 +13,5 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 7, - "endLine": 24, - "endColumn": 9, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 7, - "endLine": 28, - "endColumn": 9, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - } - ] -} + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.migrate.json b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.migrate.json index d0fa8937d5cf3976f7ea45bf092500e0acfde2b2..ca88f857e960b437dcf767c0ac40be998c8f1236 100755 --- a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.migrate.json +++ b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer1_arkts2.ets.migrate.json @@ -1,48 +1,17 @@ -{ - "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": 20, - "column": 5, - "endLine": 20, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 7, - "endLine": 24, - "endColumn": 9, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 7, - "endLine": 28, - "endColumn": 9, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - } - ] -} +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.arkts2.json b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.arkts2.json index e702358e511ed151d2a4c891a356a9313f10cc7f..afa0bcaf5dcf732ce78a8ef1918853c6df697cf4 100644 --- a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.arkts2.json +++ b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.arkts2.json @@ -14,16 +14,6 @@ "limitations under the License." ], "result": [ - { - "line": 16, - "column": 5, - "endLine": 16, - "endColumn": 13, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 16, "column": 15, @@ -64,16 +54,6 @@ "rule": "SharedArrayBuffer is not supported (arkts-no-need-stdlib-sharedArrayBuffer)", "severity": "ERROR" }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 22, "column": 28, diff --git a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.autofix.json b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.autofix.json index 07ba20c5cc5c6abbfed8c81cf5d16ff33709284f..5665081830ea79823ca1c1d8541da0634a98a623 100644 --- a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.autofix.json +++ b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.autofix.json @@ -14,16 +14,6 @@ "limitations under the License." ], "result": [ - { - "line": 16, - "column": 5, - "endLine": 16, - "endColumn": 13, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 16, "column": 15, @@ -108,16 +98,6 @@ "rule": "SharedArrayBuffer is not supported (arkts-no-need-stdlib-sharedArrayBuffer)", "severity": "ERROR" }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 22, "column": 28, diff --git a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.migrate.json b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.migrate.json index 1b71547ad7a096f21a63f5afa3255c679e904fe5..ca88f857e960b437dcf767c0ac40be998c8f1236 100644 --- a/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.migrate.json +++ b/ets2panda/linter/test/concurrent/concurrent_sharedarraybuffer_arkts2.ets.migrate.json @@ -1,38 +1,17 @@ { - "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": 16, - "column": 5, - "endLine": 16, - "endColumn": 13, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - } - ] -} + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/object_literal_constructor.ets.arkts2.json b/ets2panda/linter/test/interop/object_literal_constructor.ets.arkts2.json index b9f57ab5c027d33514863ebe58edfd7608508b03..a9680f6f23acabb1287f0678008c8eb614b548d7 100644 --- a/ets2panda/linter/test/interop/object_literal_constructor.ets.arkts2.json +++ b/ets2panda/linter/test/interop/object_literal_constructor.ets.arkts2.json @@ -124,16 +124,6 @@ "rule": "Object literal cannot be directly assigned to class with a constructor. (arkts-interop-d2s-object-literal-no-args-constructor)", "severity": "ERROR" }, - { - "line": 67, - "column": 5, - "endLine": 67, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 69, "column": 5, @@ -165,4 +155,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json index 92f20acbdfede9eb7b2fec3e4d7127952c2938c4..88d820858d0642c2bd65fe561d5f034e00ed226f 100644 --- a/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json +++ b/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json @@ -594,16 +594,6 @@ "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, - { - "line": 195, - "column": 9, - "endLine": 195, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 195, "column": 13, @@ -644,16 +634,6 @@ "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, - { - "line": 201, - "column": 9, - "endLine": 201, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 201, "column": 12, @@ -715,4 +695,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json b/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json index fa2a742d07d636adf0b33170b72d67de017d0548..b8110abb5b187d0453892f65181a889b8a8a881b 100644 --- a/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json @@ -24,16 +24,6 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, - { - "line": 22, - "column": 5, - "endLine": 22, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 23, "column": 1, diff --git a/ets2panda/linter/test/main/var_assignment_before_use.ets b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets similarity index 33% rename from ets2panda/linter/test/main/var_assignment_before_use.ets rename to ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets index 35554385ce240145b93bebf7ac0c1a41ef0a99e7..2b73f47073145dd72e9e8ca5fe83105805aad13b 100644 --- a/ets2panda/linter/test/main/var_assignment_before_use.ets +++ b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets @@ -13,46 +13,19 @@ * limitations under the License. */ -// Positive (should be flagged) -let a: A; // ❌ VariableMissingInitializer -let b: number[]; // ❌ VariableMissingInitializer -let c: A; // ❌ VariableMissingInitializer -const x: X; // ❌ VariableMissingInitializer +let tuple: [number, number] = [1.0,2.0]; +tuple[-1]; +tuple[1]; +tuple[1.0]; +tuple[0.0]; +tuple[0]; +const a = 1; +tuple[a]; +tuple[-a]; +const b = -1; +tuple[b]; +tuple[-b]; +const c = 1.0; +tuple[c]; +tuple[-c]; -// Negative (should NOT be flagged) -// 1) Initialized declarations -let d: D = new D(); // ✅ OK -const y1: string = "hello"; // ✅ OK - -// 2) Function‐typed declarations are skipped -let add: (a: number, b: number) => number; // ✅ OK -let handler: (e: Event) => void; // ✅ OK - -// 3) Explicit void‐typed declarations are skipped -let v: void; // ✅ OK -const v2: void; // ✅ OK - -// 4) For…of and For…in loop bindings -for (let item of items) { // ✅ OK - console.log(item); -} - -for (let key in record) { // ✅ OK - console.log(key); -} - -// 5) Function declarations / expressions -function foo() { // ✅ OK - return 42; -} - -let bar = function() { // ✅ OK - return "hi"; -}; - -let baz = () => { // ✅ OK - return true; -}; - -// 6) Destructuring with initializer -let { x, y } = point; // ✅ OK diff --git a/ets2panda/linter/test/main/var_assignment_before_use.ets.json b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.args.json similarity index 33% rename from ets2panda/linter/test/main/var_assignment_before_use.ets.json rename to ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.args.json index 687dd6fe1903d7f360bcaa247ec3c6210db5f411..66fb88f85945924e8be0e83d90123507033f4c5d 100644 --- a/ets2panda/linter/test/main/var_assignment_before_use.ets.json +++ b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.args.json @@ -13,56 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 19, - "column": 10, - "endLine": 19, - "endColumn": 17, - "problem": "EsValueType", - "suggest": "", - "rule": "Usage of 'ESValue' type is restricted (arkts-limited-esobj)", - "severity": "WARNING" - }, - { - "line": 36, - "column": 10, - "endLine": 36, - "endColumn": 14, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 40, - "column": 14, - "endLine": 40, - "endColumn": 16, - "problem": "ForInStatement", - "suggest": "", - "rule": "\"for .. in\" is not supported (arkts-no-for-in)", - "severity": "ERROR" - }, - { - "line": 49, - "column": 11, - "endLine": 51, - "endColumn": 2, - "problem": "FunctionExpression", - "suggest": "", - "rule": "Use arrow functions instead of function expressions (arkts-no-func-expressions)", - "severity": "ERROR" - }, - { - "line": 58, - "column": 5, - "endLine": 58, - "endColumn": 21, - "problem": "DestructuringDeclaration", - "suggest": "", - "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", - "severity": "ERROR" - } - ] + "mode": { + "arkts2": "" + } } diff --git a/ets2panda/linter/test/main/var_assignment_before_use.ets.arkts2.json b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.arkts2.json similarity index 30% rename from ets2panda/linter/test/main/var_assignment_before_use.ets.arkts2.json rename to ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.arkts2.json index f827da9ffb08b67aae99f45de2ed8eaafe9b84c2..4c0e20620142affb03d661500c5306a9e40b77b9 100644 --- a/ets2panda/linter/test/main/var_assignment_before_use.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.arkts2.json @@ -16,133 +16,73 @@ "result": [ { "line": 17, - "column": 5, + "column": 1, "endLine": 17, - "endColumn": 6, - "problem": "VariableMissingInitializer", + "endColumn": 10, + "problem": "TupleIndex", "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" }, { "line": 19, - "column": 5, + "column": 1, "endLine": 19, - "endColumn": 6, - "problem": "VariableMissingInitializer", + "endColumn": 11, + "problem": "TupleIndex", "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 10, - "endLine": 19, - "endColumn": 17, - "problem": "EsValueTypeError", - "suggest": "", - "rule": "Usage of 'ESValue' type is restricted (arkts-limited-esobj)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" }, { "line": 20, - "column": 7, + "column": 1, "endLine": 20, - "endColumn": 8, - "problem": "VariableMissingInitializer", + "endColumn": 11, + "problem": "TupleIndex", "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" }, { "line": 24, - "column": 16, + "column": 1, "endLine": 24, - "endColumn": 17, - "problem": "DynamicCtorCall", - "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", - "severity": "ERROR" - }, - { - "line": 32, - "column": 8, - "endLine": 32, - "endColumn": 12, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 11, - "endLine": 33, - "endColumn": 15, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 36, - "column": 10, - "endLine": 36, - "endColumn": 14, - "problem": "AnyType", + "endColumn": 10, + "problem": "TupleIndex", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" }, { - "line": 40, - "column": 14, - "endLine": 40, - "endColumn": 16, - "problem": "ForInStatement", + "line": 26, + "column": 1, + "endLine": 26, + "endColumn": 9, + "problem": "TupleIndex", "suggest": "", - "rule": "\"for .. in\" is not supported (arkts-no-for-in)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" }, { - "line": 49, - "column": 11, - "endLine": 51, - "endColumn": 2, - "problem": "FunctionExpression", - "suggest": "", - "rule": "Use arrow functions instead of function expressions (arkts-no-func-expressions)", - "severity": "ERROR" - }, - { - "line": 58, - "column": 5, - "endLine": 58, - "endColumn": 21, - "problem": "DestructuringDeclaration", + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 9, + "problem": "TupleIndex", "suggest": "", - "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" }, { - "line": 29, - "column": 18, - "endLine": 29, - "endColumn": 23, - "problem": "UIInterfaceImport", + "line": 30, + "column": 1, + "endLine": 30, + "endColumn": 10, + "problem": "TupleIndex", "suggest": "", - "rule": "The ArkUI interface \"Event\" should be imported before it is used (arkui-modular-interface)", + "rule": "Index of tuple must be non-negative integer (arkts-limited-tuple-index-type)", "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.json b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/main/arkts-limited-tuple-index-type.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/main/arkts-no-template-string-type.ets.arkts2.json b/ets2panda/linter/test/main/arkts-no-template-string-type.ets.arkts2.json index 761207d7879c5a7964ae8d771d7e98b7458e631c..a09f343947433ef57db208477664b956b155c856 100644 --- a/ets2panda/linter/test/main/arkts-no-template-string-type.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-no-template-string-type.ets.arkts2.json @@ -44,16 +44,6 @@ "rule": "Template string type is not supported (arkts-no-template-string-type)", "severity": "ERROR" }, - { - "line": 25, - "column": 5, - "endLine": 25, - "endColumn": 13, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 25, "column": 15, diff --git a/ets2panda/linter/test/main/class_as_object.ets.arkts2.json b/ets2panda/linter/test/main/class_as_object.ets.arkts2.json index ae6c793e86ab40f862ccb0bb13f800af0fcf1628..46d9c9c83497fb9e0a50a3a125bd02613aac0552 100644 --- a/ets2panda/linter/test/main/class_as_object.ets.arkts2.json +++ b/ets2panda/linter/test/main/class_as_object.ets.arkts2.json @@ -214,16 +214,6 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, - { - "line": 98, - "column": 5, - "endLine": 98, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 98, "column": 8, @@ -735,4 +725,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/collections_module.ets.arkts2.json b/ets2panda/linter/test/main/collections_module.ets.arkts2.json index 2c8d9f836573b366620263f322666423700e6f5e..e3169afb9917508130f19c1aeb3a142fd76c060a 100644 --- a/ets2panda/linter/test/main/collections_module.ets.arkts2.json +++ b/ets2panda/linter/test/main/collections_module.ets.arkts2.json @@ -94,16 +94,6 @@ "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" }, - { - "line": 32, - "column": 7, - "endLine": 32, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 32, "column": 21, @@ -134,16 +124,6 @@ "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" }, - { - "line": 36, - "column": 7, - "endLine": 36, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 40, "column": 22, diff --git a/ets2panda/linter/test/main/collections_module.ets.autofix.json b/ets2panda/linter/test/main/collections_module.ets.autofix.json index 9afdf943bad223a455585a40bfc446b1c4d2e187..717aaa4ab4898b8e68b5d54c1849f827775e990e 100644 --- a/ets2panda/linter/test/main/collections_module.ets.autofix.json +++ b/ets2panda/linter/test/main/collections_module.ets.autofix.json @@ -227,16 +227,6 @@ "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" }, - { - "line": 32, - "column": 7, - "endLine": 32, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 32, "column": 21, @@ -300,16 +290,6 @@ "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" }, - { - "line": 36, - "column": 7, - "endLine": 36, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 40, "column": 22, diff --git a/ets2panda/linter/test/main/collections_module.ets.migrate.json b/ets2panda/linter/test/main/collections_module.ets.migrate.json index 5a14ab57e1f22b27528a2071c35d9a880e9a13c7..9b9298a1b69d5e1a8171402c5ea35d320f5a39e0 100644 --- a/ets2panda/linter/test/main/collections_module.ets.migrate.json +++ b/ets2panda/linter/test/main/collections_module.ets.migrate.json @@ -14,26 +14,6 @@ "limitations under the License." ], "result": [ - { - "line": 32, - "column": 7, - "endLine": 32, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 36, - "column": 7, - "endLine": 36, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 41, "column": 11, diff --git a/ets2panda/linter/test/main/definite_assignment.ets.arkts2.json b/ets2panda/linter/test/main/definite_assignment.ets.arkts2.json index 5a0520e0f2cdea5c1e618f551692b7b5a230c5fe..cd7c54679e12d6b274062c1e19e84b41ca2baa32 100644 --- a/ets2panda/linter/test/main/definite_assignment.ets.arkts2.json +++ b/ets2panda/linter/test/main/definite_assignment.ets.arkts2.json @@ -24,26 +24,6 @@ "rule": "Definite assignment assertions are not supported (arkts-no-definite-assignment)", "severity": "ERROR" }, - { - "line": 16, - "column": 5, - "endLine": 16, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 5, - "endLine": 24, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 33, "column": 3, diff --git a/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets new file mode 100644 index 0000000000000000000000000000000000000000..95dd7d9c2873cde34ff08d8ac8a99a463e822fcb --- /dev/null +++ b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets @@ -0,0 +1,96 @@ +/* + * 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. + */ + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 1: Simple override, no explicit type, non-async → OK +// Base has abstract foo() (no annotation), override without annotation defaults to void +abstract class A1 { + abstract foo(); +} +class B1 extends A1 { + foo() { // ✅ no error + // … + } +} + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 2: Explicit void override → OK +abstract class A2 { + abstract foo(); +} +class B2 extends A2 { + foo(): void { // ✅ no error + // … + } +} + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 3: Non-void override → ERROR +abstract class A3 { + abstract foo(); +} +class B3 extends A3 { + foo(): number { // ❌ should flag AbstractOverrideReturnTypeNotVoid + return 42; + } +} + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 4: Async override without annotation → ERROR +// async methods default to Promise, and base foo() had no type +abstract class A4 { + abstract foo(); +} +class B4 extends A4 { + async foo() { // ❌ should flag AbstractOverrideReturnTypeNotVoid + await Promise.resolve(); + } +} + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 5: Indirect inheritance through an intermediate class +abstract class A5 { + abstract foo(); +} +class B5 extends A5 { /* no override here */ } +class C5 extends B5 { + foo(): number { // ❌ should flag — walks up to A5 + return 1; + } +} + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 6: Base declares a return type +abstract class A6 { + abstract bar(): string; // explicit annotation +} +class B6 extends A6 { + bar() { // ✅ no error (base had annotation) + return "ok"; + } +} +class C6 extends A6 { + bar(): number { // ✅ no InvalidAbstractOverrideReturnType error (this rule only applies when base had no type and derived method's type is different from void) + return 123; + } +} + +// ─────────────────────────────────────────────────────────────────────────── +// CASE 7: Class with its own non-override method — no error +class OwnClass { + fooOwn() { // ✅ no error + return 'own'; + } +} diff --git a/ets2panda/linter/test/main/var_assignment_before_use.ets.args.json b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.args.json similarity index 100% rename from ets2panda/linter/test/main/var_assignment_before_use.ets.args.json rename to ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.args.json diff --git a/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.arkts2.json b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..82d3a8851c2eef3a7883e03f507415a517348a4d --- /dev/null +++ b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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": 23, + "column": 3, + "endLine": 23, + "endColumn": 6, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 10, + "endLine": 34, + "endColumn": 14, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 3, + "endLine": 45, + "endColumn": 6, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 9, + "endLine": 57, + "endColumn": 12, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 9, + "endLine": 57, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 3, + "endLine": 69, + "endColumn": 6, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 10, + "endLine": 85, + "endColumn": 16, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.json b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/main/distinct_abstract_method_default_return_type.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/es_object.ets.arkts2.json b/ets2panda/linter/test/main/es_object.ets.arkts2.json index 0fc6f0e05a18eb1908691bfb76688cfebd35f3b1..7463fcb51f18c08a7bff2481cc3428ce7794e867 100644 --- a/ets2panda/linter/test/main/es_object.ets.arkts2.json +++ b/ets2panda/linter/test/main/es_object.ets.arkts2.json @@ -34,26 +34,6 @@ "rule": "Usage of 'ESValue' type is restricted (arkts-limited-esobj)", "severity": "ERROR" }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 5, - "endLine": 21, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 21, "column": 9, @@ -64,16 +44,6 @@ "rule": "Usage of 'ESValue' type is restricted (arkts-limited-esobj)", "severity": "ERROR" }, - { - "line": 22, - "column": 5, - "endLine": 22, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 22, "column": 11, @@ -784,16 +754,6 @@ "rule": "Usage of 'ESValue' type is restricted (arkts-limited-esobj)", "severity": "ERROR" }, - { - "line": 148, - "column": 5, - "endLine": 148, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 149, "column": 1, diff --git a/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json b/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json index 7b672d3e613fb2c39809e78a70d7e7a1b3161a68..125bd65b784762936c75e6f07909e7f61b6fbbdd 100755 --- a/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json +++ b/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json @@ -74,16 +74,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 56, - "column": 5, - "endLine": 56, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 56, "column": 8, @@ -224,16 +214,6 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, - { - "line": 72, - "column": 7, - "endLine": 72, - "endColumn": 8, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 72, "column": 10, @@ -725,4 +705,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets b/ets2panda/linter/test/main/func_inferred_type_args_2.ets index 43830e5da0bb5ebcc71a2d22a9aa1c7dbb308730..173fc2a7abbf7e6d13c3bfc3b1f825505d807bde 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets @@ -121,4 +121,20 @@ let subWeakSet = new SubWeakSet(); class C {} class D {} -let a: D<[C]> = new D(); \ No newline at end of file +let a: D<[C]> = new D(); + +function fun(a?:Map){ + let c:Map|undefined + if(a === undefined){ + a = new Map() + } + if(a){ + a = new Map() + } + if(c){ + c = new Map() + } + if(c === undefined){ + c = new Map() + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json index 788aaf8aaa07a8e20c9a9642e9ba0d7d01b0b6f0..255cfcd961dc430e9255fe71cc88e6956059ebe9 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json @@ -534,6 +534,46 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 129, + "column": 9, + "endLine": 129, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 132, + "column": 9, + "endLine": 132, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 135, + "column": 9, + "endLine": 135, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 138, + "column": 9, + "endLine": 138, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, { "line": 84, "column": 2, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json index 6d8c8403ac0826036252dd6b0bec721f33a4fc57..990925b779d66ed5f56e140f934d40fdd4d5e1e2 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json @@ -787,6 +787,90 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 129, + "column": 9, + "endLine": 129, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 3430, + "end": 3430, + "replacementText": "", + "line": 129, + "column": 9, + "endLine": 129, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 132, + "column": 9, + "endLine": 132, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 3461, + "end": 3461, + "replacementText": "", + "line": 132, + "column": 9, + "endLine": 132, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 135, + "column": 9, + "endLine": 135, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 3492, + "end": 3492, + "replacementText": "", + "line": 135, + "column": 9, + "endLine": 135, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 138, + "column": 9, + "endLine": 138, + "endColumn": 18, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 3537, + "end": 3537, + "replacementText": "", + "line": 138, + "column": 9, + "endLine": 138, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, { "line": 84, "column": 2, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets index 3cfe89eaab8d03105a0c493fbe8b206f07520dff..68520df9e2244e5b6b2ca1c43a3e946ad820ccbd 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets @@ -128,4 +128,20 @@ let subWeakSet = new SubWeakSet(); class C {} class D {} -let a: D<[C]> = new D<[C]>(); \ No newline at end of file +let a: D<[C]> = new D<[C]>(); + +function fun(a?:Map){ + let c:Map|undefined + if(a === undefined){ + a = new Map() + } + if(a){ + a = new Map() + } + if(c){ + c = new Map() + } + if(c === undefined){ + c = new Map() + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json b/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json index 9a3582fd08d139b5a5d589b0d38698ea15b57938..1041e601a3396c117f143ef890f32646efd22f85 100644 --- a/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json +++ b/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json @@ -714,16 +714,6 @@ "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", "severity": "ERROR" }, - { - "line": 210, - "column": 9, - "endLine": 210, - "endColumn": 15, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 214, "column": 13, diff --git a/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json b/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json index 8466667c747191e74f37030705c68bc24c960af0..b388ce8814826366e38dc3fbd8809e7fff4a3cb6 100644 --- a/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json @@ -994,16 +994,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 169, - "column": 5, - "endLine": 169, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 169, "column": 12, @@ -1014,16 +1004,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 172, - "column": 5, - "endLine": 172, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 174, "column": 22, @@ -1064,16 +1044,6 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, - { - "line": 200, - "column": 5, - "endLine": 200, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 201, "column": 19, @@ -1655,4 +1625,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/limit_void_type.ets.autofix.json b/ets2panda/linter/test/main/limit_void_type.ets.autofix.json index b558bfd5f181a936ab2dafe6ce82fefcac0863eb..eed9dfb9db122e6f4e185bf2bf75b7870d67fd31 100644 --- a/ets2panda/linter/test/main/limit_void_type.ets.autofix.json +++ b/ets2panda/linter/test/main/limit_void_type.ets.autofix.json @@ -1087,16 +1087,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 169, - "column": 5, - "endLine": 169, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 169, "column": 12, @@ -1107,16 +1097,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 172, - "column": 5, - "endLine": 172, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 174, "column": 22, @@ -1157,16 +1137,6 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, - { - "line": 200, - "column": 5, - "endLine": 200, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 201, "column": 19, @@ -2142,4 +2112,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/limit_void_type.ets.migrate.json b/ets2panda/linter/test/main/limit_void_type.ets.migrate.json index 996008ade7e950e4a45e3687a744e28420e0c3ef..4af5f71eaec7136041ef702e3b4d62c8849ad757 100644 --- a/ets2panda/linter/test/main/limit_void_type.ets.migrate.json +++ b/ets2panda/linter/test/main/limit_void_type.ets.migrate.json @@ -914,16 +914,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 177, - "column": 5, - "endLine": 177, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 177, "column": 12, @@ -934,16 +924,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 180, - "column": 5, - "endLine": 180, - "endColumn": 10, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 182, "column": 22, @@ -984,16 +964,6 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, - { - "line": 208, - "column": 5, - "endLine": 208, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 209, "column": 19, @@ -1235,4 +1205,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/limited_literal_type.ets.arkts2.json b/ets2panda/linter/test/main/limited_literal_type.ets.arkts2.json index 4137773b300901106be365ebf45414c78c086953..3570308268ac8d18a3c979c8d8e808d82ba03faf 100644 --- a/ets2panda/linter/test/main/limited_literal_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/limited_literal_type.ets.arkts2.json @@ -44,26 +44,6 @@ "rule": "Literal types are restricted(arkts-limited-literal-types)", "severity": "ERROR" }, - { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 5, - "endLine": 22, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 30, "column": 7, @@ -74,26 +54,6 @@ "rule": "Literal types are restricted(arkts-limited-literal-types)", "severity": "ERROR" }, - { - "line": 35, - "column": 5, - "endLine": 35, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 36, - "column": 5, - "endLine": 36, - "endColumn": 12, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 39, "column": 22, @@ -124,16 +84,6 @@ "rule": "Literal types are restricted(arkts-limited-literal-types)", "severity": "ERROR" }, - { - "line": 44, - "column": 5, - "endLine": 44, - "endColumn": 8, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 44, "column": 10, diff --git a/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json b/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json index 54216cf950e4b8b95c35c27f168c22a3f0131ae7..0e4ea28d2f4befa184a513e8d03cf8222d9a8ce2 100644 --- a/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json +++ b/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json @@ -244,6 +244,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 266, + "column": 9, + "endLine": 266, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 271, "column": 9, @@ -254,6 +264,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 271, + "column": 9, + "endLine": 271, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 277, "column": 15, @@ -264,6 +284,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 277, + "column": 9, + "endLine": 277, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 282, "column": 15, @@ -274,6 +304,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 282, + "column": 9, + "endLine": 282, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 287, "column": 15, @@ -284,6 +324,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 287, + "column": 9, + "endLine": 287, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 292, "column": 15, @@ -294,6 +344,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 292, + "column": 9, + "endLine": 292, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 298, "column": 10, @@ -304,6 +364,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 303, + "column": 3, + "endLine": 303, + "endColumn": 6, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 309, "column": 3, @@ -334,16 +404,6 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, - { - "line": 319, - "column": 9, - "endLine": 319, - "endColumn": 11, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 324, "column": 3, @@ -354,16 +414,6 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, - { - "line": 325, - "column": 9, - "endLine": 325, - "endColumn": 11, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 330, "column": 3, @@ -374,16 +424,6 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, - { - "line": 331, - "column": 9, - "endLine": 331, - "endColumn": 11, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 336, "column": 16, @@ -445,4 +485,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/method_inheritance2.ets.arkts2.json b/ets2panda/linter/test/main/method_inheritance2.ets.arkts2.json index 4e6f89111af0dc233834d35bbdbb22355714ab36..618278e62c48397bcc8ac144a3abe2989f6a4477 100755 --- a/ets2panda/linter/test/main/method_inheritance2.ets.arkts2.json +++ b/ets2panda/linter/test/main/method_inheritance2.ets.arkts2.json @@ -1,4 +1,18 @@ { + "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": 46, @@ -240,6 +254,26 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 255, + "column": 9, + "endLine": 255, + "endColumn": 12, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, + { + "line": 258, + "column": 3, + "endLine": 258, + "endColumn": 7, + "problem": "InvalidAbstractOverrideReturnType", + "suggest": "", + "rule": "In 1.1, the default type obtained for the abstract method without the annotation type is any. In 1.2, the default type for the abstract method without the annotation type is void. (arkts-distinct-abstract-method-default-return-type)", + "severity": "ERROR" + }, { "line": 268, "column": 10, diff --git a/ets2panda/linter/test/main/no_import_namespace_star_as_var.ets.arkts2.json b/ets2panda/linter/test/main/no_import_namespace_star_as_var.ets.arkts2.json index 6e0b7d9828c7d6793c4f9a9347c473b160783797..1266c69bfca5190fe69b7b4b806747aa9610c8d6 100644 --- a/ets2panda/linter/test/main/no_import_namespace_star_as_var.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_import_namespace_star_as_var.ets.arkts2.json @@ -124,16 +124,6 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, - { - "line": 34, - "column": 5, - "endLine": 34, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 35, "column": 5, diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json b/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json index f7d3a8c29cdebb57512afa7766c69fbf38b777e3..a41ae5fb222cd1370afac09ef595c1b1d2eef0c3 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json @@ -24,16 +24,6 @@ "rule": "Definite assignment assertions are not supported (arkts-no-definite-assignment)", "severity": "ERROR" }, - { - "line": 57, - "column": 5, - "endLine": 57, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 92, "column": 19, @@ -505,4 +495,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json b/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json index da7ce528c0d4732b9dada9fa4a6560cc55b5acf8..ea95d2fc5c9b219fb3e8d2a1ed92a261b1f9c271 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json @@ -24,16 +24,6 @@ "rule": "Definite assignment assertions are not supported (arkts-no-definite-assignment)", "severity": "ERROR" }, - { - "line": 57, - "column": 5, - "endLine": 57, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 92, "column": 19, @@ -868,4 +858,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json index 713d6b80a9f80a4a28d04d8144c139d62d844946..dc507ae5a9722caed4736e6f7c0fb9536c2535e2 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json @@ -24,16 +24,6 @@ "rule": "Definite assignment assertions are not supported (arkts-no-definite-assignment)", "severity": "ERROR" }, - { - "line": 67, - "column": 5, - "endLine": 67, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 102, "column": 19, @@ -255,4 +245,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/structural_identity.ets.arkts2.json b/ets2panda/linter/test/main/structural_identity.ets.arkts2.json index 5bbd4876a8e631012c6d3f598fbd0a6e997576b9..bdec10723036e327d2e12f01af571ba3e6291c45 100644 --- a/ets2panda/linter/test/main/structural_identity.ets.arkts2.json +++ b/ets2panda/linter/test/main/structural_identity.ets.arkts2.json @@ -674,16 +674,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 507, - "column": 5, - "endLine": 507, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 511, "column": 1, @@ -1285,4 +1275,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json b/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json index 4d493d1feddb9497f7fe883b4fd194eae390ea94..39ff7c832c6095c9cc71fe2a179dead9ec6a7b89 100644 --- a/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json +++ b/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json @@ -24,26 +24,6 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, - { - "line": 58, - "column": 5, - "endLine": 58, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, - { - "line": 60, - "column": 5, - "endLine": 60, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 73, "column": 1, @@ -85,4 +65,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/worker_module.ets.arkts2.json b/ets2panda/linter/test/main/worker_module.ets.arkts2.json index d01b01f98e49498ef40e0df91bab289d73bf0626..535d022afdc58f18c353c35b8ca2d43213f138e0 100644 --- a/ets2panda/linter/test/main/worker_module.ets.arkts2.json +++ b/ets2panda/linter/test/main/worker_module.ets.arkts2.json @@ -114,16 +114,6 @@ "rule": "Worker are not supported(arkts-no-need-stdlib-worker)", "severity": "ERROR" }, - { - "line": 34, - "column": 7, - "endLine": 34, - "endColumn": 14, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 34, "column": 16, @@ -153,16 +143,6 @@ "suggest": "", "rule": "Worker are not supported(arkts-no-need-stdlib-worker)", "severity": "ERROR" - }, - { - "line": 38, - "column": 7, - "endLine": 38, - "endColumn": 14, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json index f3ac4e12f2f009d6952bcef9e31b98721235e12e..e3df86ce857ea1eca57b777226b0a7c5d10e2321 100755 --- a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json +++ b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json @@ -364,16 +364,6 @@ "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", "severity": "ERROR" }, - { - "line": 54, - "column": 5, - "endLine": 54, - "endColumn": 8, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 54, "column": 9, diff --git a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json index 709ee01e70540366d5ca3a1c8af8f9663e9eb62f..ec1d247f9424278f9584bd66c81c332ae57ef9db 100644 --- a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json @@ -154,16 +154,6 @@ "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", "severity": "ERROR" }, - { - "line": 52, - "column": 5, - "endLine": 52, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" - }, { "line": 53, "column": 18,