From 3270e71fcf66bc10a4b4f002a00297c5c0b7c470 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 22 Jul 2015 14:36:06 -0700 Subject: [PATCH] Address CR --- src/compiler/checker.ts | 6 ++++-- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- tests/baselines/reference/classExtendsNull.errors.txt | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 634d64516a4..0ccf23164cb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10250,11 +10250,13 @@ namespace ts { // constructors of derived classes must contain at least one super call somewhere in their function body. let containingClassDecl = node.parent; if (getClassExtendsHeritageClauseElement(containingClassDecl)) { - let baseConstructorType = getBaseConstructorTypeOfClass(containingClassDecl); + let symbol = getSymbolOfNode(containingClassDecl); + let type = getDeclaredTypeOfSymbol(symbol); + let baseConstructorType = getBaseConstructorTypeOfClass(type); if (containsSuperCall(node.body)) { if (baseConstructorType === nullType) { - error(node, Diagnostics.A_constructor_can_not_contain_super_call_when_a_class_extends_null); + error(node, Diagnostics.A_constructor_cannot_contain_super_call_when_a_class_extends_null); } // The first statement in the body of a constructor must be a super call if both of the following are true: diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 80698217a4b..44f14ac0995 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -613,6 +613,6 @@ namespace ts { Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: DiagnosticCategory.Error, key: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_can_not_contain_super_call_when_a_class_extends_null: { code: 17005, category: DiagnosticCategory.Error, key: "A constructor can not contain super call when a class extends null" }, + A_constructor_cannot_contain_super_call_when_a_class_extends_null: { code: 17005, category: DiagnosticCategory.Error, key: "A constructor cannot contain 'super' call when a class extends 'null'" }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6f1185eb250..1203c5ef61e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2446,7 +2446,7 @@ "category": "Error", "code": 17004 }, - "A constructor can not contain super call when a class extends null": { + "A constructor cannot contain 'super' call when a class extends 'null'": { "category": "Error", "code": 17005 } diff --git a/tests/baselines/reference/classExtendsNull.errors.txt b/tests/baselines/reference/classExtendsNull.errors.txt index 93ef3b7765e..cc5de5cda83 100644 --- a/tests/baselines/reference/classExtendsNull.errors.txt +++ b/tests/baselines/reference/classExtendsNull.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classExtendsNull.ts(2,5): error TS17005: A constructor can not contain super call when a class extends null +tests/cases/compiler/classExtendsNull.ts(2,5): error TS17005: A constructor cannot contain 'super' call when a class extends 'null' ==== tests/cases/compiler/classExtendsNull.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/classExtendsNull.ts(2,5): error TS17005: A constructor can ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ -!!! error TS17005: A constructor can not contain super call when a class extends null +!!! error TS17005: A constructor cannot contain 'super' call when a class extends 'null' } class D extends null {