Don't pass prop.name directly for error reporting

This commit is contained in:
Jason Freeman 2015-02-04 19:43:36 -08:00
parent 6a6c03b9b7
commit 92617f5978
2 changed files with 17 additions and 1 deletions

View file

@ -8999,7 +8999,7 @@ module ts {
var typeName1 = typeToString(existing.containingType);
var typeName2 = typeToString(base);
var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_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, symbolToString(prop), typeName1, typeName2);
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);
diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));
}

View file

@ -0,0 +1,16 @@
tests/cases/conformance/es6/Symbols/symbolProperty35.ts(8,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'.
Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical.
==== tests/cases/conformance/es6/Symbols/symbolProperty35.ts (1 errors) ====
interface I1 {
[Symbol.toStringTag](): { x: string }
}
interface I2 {
[Symbol.toStringTag](): { x: number }
}
interface I3 extends I1, I2 { }
~~
!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'.
!!! error TS2320: Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical.