diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 6bb631d6bbca3e53cdfd683f5a177847c19462f6..ae2004cddccf000c892a237c8b0610100f404ff8 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -4034,7 +4034,13 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private checkArrayIndexType(exprType: ts.Type, argType: ts.Type, expr: ts.ElementAccessExpression): void { + console.error("SJY expr = " +expr.getText()) + console.error("SJY argType = " + this.tsTypeChecker.typeToString(argType)) + console.error("SJY exprType = " + this.tsTypeChecker.typeToString(exprType)) + console.error("SJY isOrDerivedFrom = " +this.tsUtils.isOrDerivedFrom(exprType, this.tsUtils.isIndexableArray)) + console.error("SJY isIndexableArray = " + this.tsUtils.isIndexableArray(exprType)) if (!this.options.arkts2 || !this.tsUtils.isOrDerivedFrom(exprType, this.tsUtils.isIndexableArray)) { + console.error("SJY return") return; } @@ -4046,7 +4052,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { STRINGLITERAL_CHAR ]; const argTypeString = this.tsTypeChecker.typeToString(argType); - if (this.tsUtils.isNumberLikeType(argType)) { this.handleNumericArgument(expr.argumentExpression, argType); } else if (!validStringLiteralTypes.includes(argTypeString)) { @@ -4068,9 +4073,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.incrementCounters(argExpr, FaultID.ArrayIndexExprType, autofix); } } else if (this.tsTypeChecker.typeToString(argType) === 'number') { - if (this.isArrayIndexValidNumber(argExpr)) { - return; - } + // if (this.isArrayIndexValidNumber(argExpr)) { + // return; + // } const autofix = this.autofixer?.fixArrayIndexExprType(argExpr); this.incrementCounters(argExpr, FaultID.ArrayIndexExprType, autofix); } else {