From 92617f5978a9ef2da4b39f578e6b1d376108b593 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Feb 2015 19:43:36 -0800 Subject: [PATCH] Don't pass prop.name directly for error reporting --- src/compiler/checker.ts | 2 +- .../reference/symbolProperty35.errors.txt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/symbolProperty35.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index af36448cbfe4e..2e900f3b6ce51 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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)); } diff --git a/tests/baselines/reference/symbolProperty35.errors.txt b/tests/baselines/reference/symbolProperty35.errors.txt new file mode 100644 index 0000000000000..1558f5a3409bc --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.errors.txt @@ -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. \ No newline at end of file