diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index abf6f3c74c0582135f2788e9b62168b25f3a8506..ce701928ad6456cbedfe1129f7f17644a649f72f 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -10387,6 +10387,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } + // If there are only non parametric constructions, do not check. + const value = extendedClassInfo.values().next().value; + if (extendedClassInfo.size === 1 && value && value.length === 0) { + return; + } + this.handleExtendCustomClass(node.parent, extendedClassInfo); } } diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json b/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json index a63a7a849d8ea047a41f71ef2772e7c26c7bb945..918f5f71570124e510a95ace0d6b25d16a53eac3 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json @@ -1054,16 +1054,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 216, - "column": 1, - "endLine": 218, - "endColumn": 2, - "problem": "MissingSuperCall", - "suggest": "", - "rule": "The subclass constructor must call the parent class's parametered constructor (arkts-subclass-must-call-super-constructor-with-args)", - "severity": "ERROR" - }, { "line": 219, "column": 18, diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json b/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json index 432b311d060d6e363d60832bedbeb65972c13771..7ddc6421822251dbb12b8cbcd53386cecdbbd966 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json @@ -1843,16 +1843,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 216, - "column": 1, - "endLine": 218, - "endColumn": 2, - "problem": "MissingSuperCall", - "suggest": "", - "rule": "The subclass constructor must call the parent class's parametered constructor (arkts-subclass-must-call-super-constructor-with-args)", - "severity": "ERROR" - }, { "line": 219, "column": 18, diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json b/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json index 35c8ec6cd00afdabe9b36d4287d09a6d7d268496..3272b27a7137a3dff88dea4df7bae48a01f905d9 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json @@ -284,16 +284,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 272, - "column": 1, - "endLine": 274, - "endColumn": 2, - "problem": "MissingSuperCall", - "suggest": "", - "rule": "The subclass constructor must call the parent class's parametered constructor (arkts-subclass-must-call-super-constructor-with-args)", - "severity": "ERROR" - }, { "line": 284, "column": 1, @@ -324,16 +314,6 @@ "rule": "Object literal properties can only contain name-value pairs (arkts-obj-literal-props)", "severity": "ERROR" }, - { - "line": 301, - "column": 1, - "endLine": 303, - "endColumn": 2, - "problem": "MissingSuperCall", - "suggest": "", - "rule": "The subclass constructor must call the parent class's parametered constructor (arkts-subclass-must-call-super-constructor-with-args)", - "severity": "ERROR" - }, { "line": 342, "column": 16, diff --git a/ets2panda/linter/test/main/subclass_super_call.ets b/ets2panda/linter/test/main/subclass_super_call.ets index 2ed960ed9071cc0141abcf6db8a1abe4ff6985bb..20947157c1a6348aa37089a8069ee2c13b87a991 100644 --- a/ets2panda/linter/test/main/subclass_super_call.ets +++ b/ets2panda/linter/test/main/subclass_super_call.ets @@ -101,3 +101,24 @@ class B extends A { super(EEE.E1) } } + +class A2 { + constructor() { + console.log("Parent constructor") + } +} + +class C2 extends A2 { + // ok 不用报 +} + +class A3 {} + +class C3 extends A3 { + constructor() { + super() + } +} + +class C4 extends A3 { +} \ No newline at end of file