Skip to content

Commit

Permalink
Fix error message wording
Browse files Browse the repository at this point in the history
  • Loading branch information
JsonFreeman committed Feb 7, 2015
1 parent 2d16474 commit 6a6c03b
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8999,7 +8999,7 @@ module ts {
var typeName1 = typeToString(existing.containingType);
var typeName2 = typeToString(base);

var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2);
var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2);

This comment has been minimized.

Copy link
@yuit

yuit Feb 10, 2015

Contributor

Named_property_0_of_types_1_and_2 is...

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Feb 10, 2015

Author Contributor

Hmm, technically you are correct. But for some reason it sounds like a plural noun phrase. Maybe because it is shorthand for "Types of named property 0 of types 1 and 2". I think by the time the reader gets to the predicate "are not identical", they will have forgotten that the noun phrase was singular, and will think it is plural. Especially if types 1 and 2 are long.

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Feb 10, 2015

Author Contributor

The other issue is that 'identical' pretty much needs to take a plural. Otherwise it has to be 'identical to' + something.

errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);
diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/diagnosticInformationMap.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ module ts {
Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." },
Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." },
Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." },
Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." },
Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." },
Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." },
Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." },
Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." },
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@
"category": "Error",
"code": 2318
},
"Named properties '{0}' of types '{1}' and '{2}' are not identical.": {
"Named property '{0}' of types '{1}' and '{2}' are not identical.": {
"category": "Error",
"code": 2319
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'.
Named properties 'm' of types 'X' and 'Y' are not identical.
Named property 'm' of types 'X' and 'Y' are not identical.


==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ====
Expand All @@ -13,4 +13,4 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interfac
interface Z extends X, Y { }
~
!!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'.
!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical.
!!! error TS2320: Named property 'm' of types 'X' and 'Y' are not identical.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I<number>' and 'I<string>'.
Named properties 'foo' of types 'I<number>' and 'I<string>' are not identical.
Named property 'foo' of types 'I<number>' and 'I<string>' are not identical.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.


Expand All @@ -14,7 +14,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha
interface A extends I<number>, I<string> { }
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'I<number>' and 'I<string>'.
!!! error TS2320: Named properties 'foo' of types 'I<number>' and 'I<string>' are not identical.
!!! error TS2320: Named property 'foo' of types 'I<number>' and 'I<string>' are not identical.

var x: A;
// BUG 822524
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'.
Named properties 'm' of types 'B' and 'D' are not identical.
Named property 'm' of types 'B' and 'D' are not identical.


==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ====
Expand All @@ -17,6 +17,6 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Inte
interface E extends B { } // Error here for extending B and D
~
!!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'.
!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical.
!!! error TS2320: Named property 'm' of types 'B' and 'D' are not identical.
interface E extends D { } // No duplicate error here

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'.
Named properties 'f' of types 'Foo' and 'Bar' are not identical.
Named property 'f' of types 'Foo' and 'Bar' are not identical.


==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ====
Expand All @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2
interface Hello extends Foo, Bar {
~~~~~
!!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical.
!!! error TS2320: Named property 'f' of types 'Foo' and 'Bar' are not identical.
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'.
Named properties 'f' of types 'Bar' and 'Foo' are not identical.
Named property 'f' of types 'Bar' and 'Foo' are not identical.


==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ====
Expand All @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2
interface Hello extends Bar, Foo {
~~~~~
!!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'.
!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical.
!!! error TS2320: Named property 'f' of types 'Bar' and 'Foo' are not identical.
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.


==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ====
Expand All @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,1
interface A extends C, C2 { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.


==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ====
Expand All @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11):
interface A extends C, C2 { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
Named properties 'x' of types 'C' and 'C2' are not identical.
Named property 'x' of types 'C' and 'C2' are not identical.


==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ====
Expand All @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11):
interface A extends C, C2 { // error
~
!!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'.
!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical.
!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical.
y: string;
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/interfaceDeclaration1.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' in
Property 'prototype' is missing in type 'C1'.
tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type.
tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'.
Named properties 'foo' of types 'i10' and 'i11' are not identical.
Named property 'foo' of types 'i10' and 'i11' are not identical.


==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ====
Expand Down Expand Up @@ -80,5 +80,5 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i
interface i12 extends i10, i11 { }
~~~
!!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'.
!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical.
!!! error TS2320: Named property 'foo' of types 'i10' and 'i11' are not identical.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
Named properties 'x' of types 'Foo' and 'Bar' are not identical.
Named property 'x' of types 'Foo' and 'Bar' are not identical.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
Property 'x' is private in type 'Bar' but not in type 'I4'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
Expand All @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending
interface I3 extends Foo, Bar { // error
~~
!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical.
!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical.
}

interface I4 extends Foo, Bar { // error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
Named properties 'x' of types 'Foo' and 'Bar' are not identical.
Named property 'x' of types 'Foo' and 'Bar' are not identical.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'.
Property 'x' is protected but type 'I4' is not a class derived from 'Bar'.
tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'.
Expand All @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending
interface I3 extends Foo, Bar { // error
~~
!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'.
!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical.
!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical.
}

interface I4 extends Foo, Bar { // error
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/interfaceImplementation7.errors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'.
Named properties 'name' of types 'i1' and 'i2' are not identical.
Named property 'name' of types 'i1' and 'i2' are not identical.
tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'.
Types of property 'name' are incompatible.
Type '() => string' is not assignable to type '() => { s: string; n: number; }'.
Expand All @@ -14,7 +14,7 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1'
interface i3 extends i1, i2 { }
~~
!!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'.
!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical.
!!! error TS2320: Named property 'name' of types 'i1' and 'i2' are not identical.
interface i4 extends i1, i2 { name(): { s: string; n: number; }; }

class C1 implements i4 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'.
Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.
tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'.
Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.


==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ====
Expand All @@ -17,7 +17,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I
interface MoverShaker extends Mover, Shaker {
~~~~~~~~~~~
!!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'.
!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.

}

Expand All @@ -36,7 +36,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I
interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error
~~~~~~~~~~~~
!!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'.
!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical.
!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical.

interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker {
getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'.
Named properties 'a' of types 'E' and 'D' are not identical.
Named property 'a' of types 'E' and 'D' are not identical.
tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'.
Named properties 'a' of types 'E2' and 'D2' are not identical.
Named property 'a' of types 'E2' and 'D2' are not identical.


==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ====
Expand All @@ -10,12 +10,12 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: In
interface F extends E, D { } // error
~
!!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'.
!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical.
!!! error TS2320: Named property 'a' of types 'E' and 'D' are not identical.

class D2 { a: number; }
class E2 { a: string; }
interface F2 extends E2, D2 { } // error
~~
!!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'.
!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical.
!!! error TS2320: Named property 'a' of types 'E2' and 'D2' are not identical.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
Types of property 'b' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3<T>' cannot simultaneously extend types 'Base1<number>' and 'Base2<number>'.
Named properties 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
Named property 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4<T>' incorrectly extends interface 'Base1<number>'.
Types of property 'x' are incompatible.
Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'.
Expand Down Expand Up @@ -86,7 +86,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
interface Derived3<T> extends Base1<number>, Base2<number> { } // error
~~~~~~~~
!!! error TS2320: Interface 'Derived3<T>' cannot simultaneously extend types 'Base1<number>' and 'Base2<number>'.
!!! error TS2320: Named properties 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
!!! error TS2320: Named property 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.

interface Derived4<T> extends Base1<number>, Base2<number> { // error
~~~~~~~~
Expand Down
Loading

0 comments on commit 6a6c03b

Please sign in to comment.