Skip to content

Commit c2b2c78

Browse files
committed
Make 'extends' error message uniform.
Refer to "'extends' clause" instead of "Extends clause".
1 parent d1a972f commit c2b2c78

8 files changed

+53
-53
lines changed

src/compiler/declarationEmitter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ namespace ts {
317317
function reportIllegalExtends() {
318318
if (errorNameNode) {
319319
reportedDeclarationError = true;
320-
emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.Extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced,
320+
emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced,
321321
declarationNameToString(errorNameNode)));
322322
}
323323
}
@@ -1107,11 +1107,11 @@ namespace ts {
11071107
// Class or Interface implemented/extended is inaccessible
11081108
diagnosticMessage = isImplementsList ?
11091109
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
1110-
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
1110+
Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
11111111
}
11121112
else {
11131113
// interface is inaccessible
1114-
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
1114+
diagnosticMessage = Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
11151115
}
11161116

11171117
return {

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,11 +2096,11 @@
20962096
"category": "Error",
20972097
"code": 4019
20982098
},
2099-
"Extends clause of exported class '{0}' has or is using private name '{1}'.": {
2099+
"'extends' clause of exported class '{0}' has or is using private name '{1}'.": {
21002100
"category": "Error",
21012101
"code": 4020
21022102
},
2103-
"Extends clause of exported interface '{0}' has or is using private name '{1}'.": {
2103+
"'extends' clause of exported interface '{0}' has or is using private name '{1}'.": {
21042104
"category": "Error",
21052105
"code": 4022
21062106
},
@@ -2352,7 +2352,7 @@
23522352
"category": "Error",
23532353
"code": 4092
23542354
},
2355-
"Extends clause of exported class '{0}' refers to a type whose name cannot be referenced.": {
2355+
"'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced.": {
23562356
"category": "Error",
23572357
"code": 4093
23582358
},
@@ -3169,7 +3169,7 @@
31693169
"category": "Error",
31703170
"code": 8016
31713171
},
3172-
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
3172+
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": {
31733173
"category": "Error",
31743174
"code": 9002
31753175
},

tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/cases/compiler/declarationEmitExpressionInExtends3.ts(29,30): error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'.
2-
tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'.
1+
tests/cases/compiler/declarationEmitExpressionInExtends3.ts(29,30): error TS4020: 'extends' clause of exported class 'MyClass' has or is using private name 'LocalClass'.
2+
tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020: 'extends' clause of exported class 'MyClass3' has or is using private name 'LocalInterface'.
33

44

55
==== tests/cases/compiler/declarationEmitExpressionInExtends3.ts (2 errors) ====
@@ -33,7 +33,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020
3333

3434
export class MyClass extends getLocalClass<LocalInterface>(undefined)<string, number> { // error LocalClass is inaccisible
3535
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36-
!!! error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'.
36+
!!! error TS4020: 'extends' clause of exported class 'MyClass' has or is using private name 'LocalClass'.
3737
}
3838

3939

@@ -43,7 +43,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020
4343

4444
export class MyClass3 extends getExportedClass<LocalInterface>(undefined)<LocalInterface> { // Error LocalInterface is inaccisble
4545
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46-
!!! error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'.
46+
!!! error TS4020: 'extends' clause of exported class 'MyClass3' has or is using private name 'LocalInterface'.
4747
}
4848

4949

tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'.
2-
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: Extends clause of exported class 'C' refers to a type whose name cannot be referenced.
2+
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: 'extends' clause of exported class 'C' refers to a type whose name cannot be referenced.
33
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic.
4-
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced.
4+
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced.
55
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
66
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
7-
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
7+
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: 'extends' clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
88

99

1010
==== tests/cases/compiler/declarationEmitExpressionInExtends4.ts (7 errors) ====
@@ -17,15 +17,15 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020
1717

1818
class C extends getSomething()<number, string> {
1919
~
20-
!!! error TS4093: Extends clause of exported class 'C' refers to a type whose name cannot be referenced.
20+
!!! error TS4093: 'extends' clause of exported class 'C' refers to a type whose name cannot be referenced.
2121
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2222
!!! error TS2315: Type 'D' is not generic.
2323

2424
}
2525

2626
class C2 extends SomeUndefinedFunction()<number, string> {
2727
~~
28-
!!! error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced.
28+
!!! error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced.
2929
~~~~~~~~~~~~~~~~~~~~~
3030
!!! error TS2304: Cannot find name 'SomeUndefinedFunction'.
3131

@@ -36,6 +36,6 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020
3636
~~~~~~~~~~~~~~~~~~~~~
3737
!!! error TS2304: Cannot find name 'SomeUndefinedFunction'.
3838
~~~~~~~~~~~~~~~~~~~~~
39-
!!! error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
39+
!!! error TS4020: 'extends' clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
4040

4141
}

tests/baselines/reference/exportClassExtendingIntersection.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced.
1+
tests/cases/compiler/FinalClass.ts(4,14): error TS4093: 'extends' clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced.
22

33

44
==== tests/cases/compiler/BaseClass.ts (0 errors) ====
@@ -26,7 +26,7 @@ tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of export
2626

2727
export class MyExtendedClass extends MyMixin(MyBaseClass)<string> {
2828
~~~~~~~~~~~~~~~
29-
!!! error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced.
29+
!!! error TS4093: 'extends' clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced.
3030
extendedClassProperty: number;
3131
}
3232
==== tests/cases/compiler/Main.ts (0 errors) ====

tests/baselines/reference/mixinAccessModifiers.errors.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(51,4): error TS2445: Pro
55
tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'.
66
Type 'C1' is not assignable to type 'Private'.
77
Property 'p' has conflicting declarations and is inaccessible in type 'C1'.
8-
tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: Extends clause of exported class 'C1' refers to a type whose name cannot be referenced.
8+
tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: 'extends' clause of exported class 'C1' refers to a type whose name cannot be referenced.
99
tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'.
1010
Type 'C2' is not assignable to type 'Private'.
1111
Property 'p' has conflicting declarations and is inaccessible in type 'C2'.
12-
tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced.
12+
tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced.
1313
tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'.
1414
Type 'C3' is not assignable to type 'Private'.
1515
Property 'p' has conflicting declarations and is inaccessible in type 'C3'.
16-
tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: Extends clause of exported class 'C3' refers to a type whose name cannot be referenced.
17-
tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: Extends clause of exported class 'C4' refers to a type whose name cannot be referenced.
18-
tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: Extends clause of exported class 'C5' refers to a type whose name cannot be referenced.
16+
tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: 'extends' clause of exported class 'C3' refers to a type whose name cannot be referenced.
17+
tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: 'extends' clause of exported class 'C4' refers to a type whose name cannot be referenced.
18+
tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: 'extends' clause of exported class 'C5' refers to a type whose name cannot be referenced.
1919
tests/cases/conformance/classes/mixinAccessModifiers.ts(85,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses.
2020
tests/cases/conformance/classes/mixinAccessModifiers.ts(90,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses.
21-
tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: Extends clause of exported class 'C6' refers to a type whose name cannot be referenced.
21+
tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: 'extends' clause of exported class 'C6' refers to a type whose name cannot be referenced.
2222
tests/cases/conformance/classes/mixinAccessModifiers.ts(98,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses.
2323
tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses.
2424

@@ -103,25 +103,25 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr
103103
!!! error TS2415: Type 'C1' is not assignable to type 'Private'.
104104
!!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C1'.
105105
~~
106-
!!! error TS4093: Extends clause of exported class 'C1' refers to a type whose name cannot be referenced.
106+
!!! error TS4093: 'extends' clause of exported class 'C1' refers to a type whose name cannot be referenced.
107107
class C2 extends Mix(Private, Protected) {}
108108
~~
109109
!!! error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'.
110110
!!! error TS2415: Type 'C2' is not assignable to type 'Private'.
111111
!!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C2'.
112112
~~
113-
!!! error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced.
113+
!!! error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced.
114114
class C3 extends Mix(Private, Public) {}
115115
~~
116116
!!! error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'.
117117
!!! error TS2415: Type 'C3' is not assignable to type 'Private'.
118118
!!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C3'.
119119
~~
120-
!!! error TS4093: Extends clause of exported class 'C3' refers to a type whose name cannot be referenced.
120+
!!! error TS4093: 'extends' clause of exported class 'C3' refers to a type whose name cannot be referenced.
121121

122122
class C4 extends Mix(Protected, Protected2) {
123123
~~
124-
!!! error TS4093: Extends clause of exported class 'C4' refers to a type whose name cannot be referenced.
124+
!!! error TS4093: 'extends' clause of exported class 'C4' refers to a type whose name cannot be referenced.
125125
f(c4: C4, c5: C5, c6: C6) {
126126
c4.p;
127127
c5.p;
@@ -136,7 +136,7 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr
136136

137137
class C5 extends Mix(Protected, Public) {
138138
~~
139-
!!! error TS4093: Extends clause of exported class 'C5' refers to a type whose name cannot be referenced.
139+
!!! error TS4093: 'extends' clause of exported class 'C5' refers to a type whose name cannot be referenced.
140140
f(c4: C4, c5: C5, c6: C6) {
141141
c4.p; // Error, not in class deriving from Protected2
142142
~
@@ -155,7 +155,7 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr
155155

156156
class C6 extends Mix(Public, Public2) {
157157
~~
158-
!!! error TS4093: Extends clause of exported class 'C6' refers to a type whose name cannot be referenced.
158+
!!! error TS4093: 'extends' clause of exported class 'C6' refers to a type whose name cannot be referenced.
159159
f(c4: C4, c5: C5, c6: C6) {
160160
c4.p; // Error, not in class deriving from Protected2
161161
~

0 commit comments

Comments
 (0)