From eacc092f87bd3ffefeb16de7e952aa94d18ed436 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 19 Feb 2016 11:33:32 -0800 Subject: [PATCH 1/5] Add cases and baselines from #6211 and #6210 --- .../nonIdenticalTypeConstraints.errors.txt | 50 +++++++++++++ .../reference/nonIdenticalTypeConstraints.js | 71 +++++++++++++++++++ .../compiler/nonIdenticalTypeConstraints.ts | 38 ++++++++++ 3 files changed, 159 insertions(+) create mode 100644 tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt create mode 100644 tests/baselines/reference/nonIdenticalTypeConstraints.js create mode 100644 tests/cases/compiler/nonIdenticalTypeConstraints.ts diff --git a/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt new file mode 100644 index 00000000000..a8b54bf44dd --- /dev/null +++ b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt @@ -0,0 +1,50 @@ +tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations must have identical type parameters. + + +==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (3 errors) ==== + class Different { + a: number; + b: string; + c: boolean; + } + + class Foo { + n: T; + } + interface Foo { + ~~~ +!!! error TS2428: All declarations must have identical type parameters. + y: T; + } + interface Qux { + y: T; + } + class Qux { + ~~~ +!!! error TS2428: All declarations must have identical type parameters. + n: T; + } + + class Bar { + n: T; + } + interface Bar { + y: T; + } + interface Baz { + y: T; + } + class Baz { + n: T; + } + + class Quux { + n: T; + } + interface Quux { + ~~~~ +!!! error TS2428: All declarations must have identical type parameters. + m: U; + } \ No newline at end of file diff --git a/tests/baselines/reference/nonIdenticalTypeConstraints.js b/tests/baselines/reference/nonIdenticalTypeConstraints.js new file mode 100644 index 00000000000..73748f63885 --- /dev/null +++ b/tests/baselines/reference/nonIdenticalTypeConstraints.js @@ -0,0 +1,71 @@ +//// [nonIdenticalTypeConstraints.ts] +class Different { + a: number; + b: string; + c: boolean; +} + +class Foo { + n: T; +} +interface Foo { + y: T; +} +interface Qux { + y: T; +} +class Qux { + n: T; +} + +class Bar { + n: T; +} +interface Bar { + y: T; +} +interface Baz { + y: T; +} +class Baz { + n: T; +} + +class Quux { + n: T; +} +interface Quux { + m: U; +} + +//// [nonIdenticalTypeConstraints.js] +var Different = (function () { + function Different() { + } + return Different; +}()); +var Foo = (function () { + function Foo() { + } + return Foo; +}()); +var Qux = (function () { + function Qux() { + } + return Qux; +}()); +var Bar = (function () { + function Bar() { + } + return Bar; +}()); +var Baz = (function () { + function Baz() { + } + return Baz; +}()); +var Quux = (function () { + function Quux() { + } + return Quux; +}()); diff --git a/tests/cases/compiler/nonIdenticalTypeConstraints.ts b/tests/cases/compiler/nonIdenticalTypeConstraints.ts new file mode 100644 index 00000000000..c0271edc91a --- /dev/null +++ b/tests/cases/compiler/nonIdenticalTypeConstraints.ts @@ -0,0 +1,38 @@ +class Different { + a: number; + b: string; + c: boolean; +} + +class Foo { + n: T; +} +interface Foo { + y: T; +} +interface Qux { + y: T; +} +class Qux { + n: T; +} + +class Bar { + n: T; +} +interface Bar { + y: T; +} +interface Baz { + y: T; +} +class Baz { + n: T; +} + +class Quux { + n: T; +} +interface Quux { + m: U; +} \ No newline at end of file From bb2eb635d60c7b63da580e130beacea386b28507 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 19 Feb 2016 11:36:35 -0800 Subject: [PATCH 2/5] Merged classes and interfaces must have identical type constraints Previously, only interfaces needed to check this, but now that classes and interfaces can merge, the check needs to happen in more places. --- src/compiler/checker.ts | 28 +++++++++++++++++++++------- src/compiler/diagnosticMessages.json | 4 ++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index eddddb5cb2b..b9a8ab6cd2c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14013,7 +14013,7 @@ namespace ts { } } - // Check each type parameter and check that list has no duplicate type parameter declarations + /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) { @@ -14031,6 +14031,23 @@ namespace ts { } } + /** Check that type parameter lists are identical across multiple declarations */ + function checkTypeParameterListsIdentical(node: ClassLikeDeclaration | InterfaceDeclaration, symbol: Symbol) { + let firstDecl: ClassLikeDeclaration | InterfaceDeclaration; + if (symbol.declarations.length > 1) { + for (const declaration of symbol.declarations) { + if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, Diagnostics.All_declarations_must_have_identical_type_parameters); + } + } + } + } + } + function checkClassExpression(node: ClassExpression): Type { checkClassLikeDeclaration(node); checkNodeDeferred(node); @@ -14064,6 +14081,7 @@ namespace ts { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); const staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(node, symbol); const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -14326,14 +14344,10 @@ namespace ts { checkExportsOnMergedDeclarations(node); const symbol = getSymbolOfNode(node); - const firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); - if (symbol.declarations.length > 1) { - if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { - error(node.name, Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); - } - } + checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once + const firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); if (node === firstInterfaceDecl) { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 16cf1911642..92396d005b7 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1311,7 +1311,7 @@ "category": "Error", "code": 2427 }, - "All declarations of an interface must have identical type parameters.": { + "All declarations must have identical type parameters.": { "category": "Error", "code": 2428 }, @@ -2801,4 +2801,4 @@ "category": "Error", "code": 17009 } -} +} From 0d3f6473cf36127777aeb75bd3676ca5fb14ad96 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 19 Feb 2016 11:46:47 -0800 Subject: [PATCH 3/5] Rebaseline messages in existing tests --- ...nstructSignaturesWithOverloads2.errors.txt | 4 +- ...acesWithDuplicateTypeParameters.errors.txt | 4 +- ...GenericInterfaceWithTheSameName.errors.txt | 12 ++--- ...terfaceWithMultipleDeclarations.errors.txt | 44 +++++++++---------- .../multipleNumericIndexers.errors.txt | 4 +- ...cesDifferingByTypeParameterName.errors.txt | 20 ++++----- ...esDifferingByTypeParameterName2.errors.txt | 12 ++--- ...erfacesWithDifferentConstraints.errors.txt | 12 ++--- ...ithTheSameNameButDifferentArity.errors.txt | 12 ++--- 9 files changed, 62 insertions(+), 62 deletions(-) diff --git a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt index ceb828dd061..4f0a5944659 100644 --- a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt +++ b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations must have identical type parameters. ==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (1 errors) ==== @@ -35,7 +35,7 @@ tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSig interface I { ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. new (x: T, y?: number): C2; new (x: T, y: number): C2; } diff --git a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt index 7d7fea1b2c6..ebe2cd05aec 100644 --- a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt +++ b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(1,42): error TS2300: Duplicate identifier 'A'. -tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations must have identical type parameters. tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): error TS2300: Duplicate identifier 'C'. @@ -16,7 +16,7 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): err interface InterfaceWithSomeTypars { // should error ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. ~ !!! error TS2300: Duplicate identifier 'C'. bar2(): void; diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt index 4c3245b11f7..ae02c434d25 100644 --- a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. bar: T; } @@ -23,7 +23,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. foo: string; } } @@ -49,7 +49,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf module M3 { export interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. bar: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt index e4b37db8a7a..5cd4f2f7d96 100644 --- a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations must have identical type parameters. ==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (11 errors) ==== @@ -16,53 +16,53 @@ tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: } interface I1 { // Name mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I1 { // constraint present ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I2 { } interface I2 string> { // constraint mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I2 { // constraint absent ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I2 { // name mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } interface I3 { } interface I3 { // length mismatch ~~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. } class Foo { diff --git a/tests/baselines/reference/multipleNumericIndexers.errors.txt b/tests/baselines/reference/multipleNumericIndexers.errors.txt index 856fdbe47ff..11fb81ba5b3 100644 --- a/tests/baselines/reference/multipleNumericIndexers.errors.txt +++ b/tests/baselines/reference/multipleNumericIndexers.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(25,5): error TS2375: Duplicate number index signature. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations must have identical type parameters. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(29,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature. @@ -48,7 +48,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI interface I { ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ !!! error TS2375: Duplicate number index signature. diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt index adf9583095d..6b56f5dfef6 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts (5 errors) ==== @@ -14,7 +14,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: U; } @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: V; } @@ -35,7 +35,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: U; } @@ -45,7 +45,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: V; } } @@ -71,7 +71,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: V; } } diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt index dd1483b9e1d..7caec272386 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(8,8): error TS2304: Cannot find name 'V'. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts (4 errors) ==== @@ -13,7 +13,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: V; ~ !!! error TS2304: Cannot find name 'V'. @@ -26,7 +26,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } } @@ -52,7 +52,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } } diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt index 665a26f47f4..39e684ec3dd 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi interface B> { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } } @@ -47,7 +47,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi module M3 { export interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt index be0608c0cd6..e31a8d5c433 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations of an interface must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations of an interface must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } } @@ -47,7 +47,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh module M3 { export interface A { // error ~ -!!! error TS2428: All declarations of an interface must have identical type parameters. +!!! error TS2428: All declarations must have identical type parameters. y: T; } } \ No newline at end of file From 14a457e51857c8a668560b430d5d923c0b25eb2d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 19 Feb 2016 13:05:19 -0800 Subject: [PATCH 4/5] Address review comments 1. Give class name in error message. 2. Reduce nesting via an early exit. --- src/compiler/checker.ts | 19 ++++++++++--------- src/compiler/diagnosticMessages.json | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b9a8ab6cd2c..dbce5f41ef4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14033,16 +14033,17 @@ namespace ts { /** Check that type parameter lists are identical across multiple declarations */ function checkTypeParameterListsIdentical(node: ClassLikeDeclaration | InterfaceDeclaration, symbol: Symbol) { + if (symbol.declarations.length === 1) { + return; + } let firstDecl: ClassLikeDeclaration | InterfaceDeclaration; - if (symbol.declarations.length > 1) { - for (const declaration of symbol.declarations) { - if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { - if (!firstDecl) { - firstDecl = declaration; - } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, Diagnostics.All_declarations_must_have_identical_type_parameters); - } + for (const declaration of symbol.declarations) { + if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { + if (!firstDecl) { + firstDecl = declaration; + } + else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 92396d005b7..70c6d8ff167 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1311,7 +1311,7 @@ "category": "Error", "code": 2427 }, - "All declarations must have identical type parameters.": { + "All declarations of '{0}' must have identical type parameters.": { "category": "Error", "code": 2428 }, From 09ac720382c29dd8c051975ef9c4ed4c22821f4c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 19 Feb 2016 13:22:57 -0800 Subject: [PATCH 5/5] Rebaseline tests with improved error message --- ...nstructSignaturesWithOverloads2.errors.txt | 4 +- ...acesWithDuplicateTypeParameters.errors.txt | 4 +- ...GenericInterfaceWithTheSameName.errors.txt | 12 ++--- ...terfaceWithMultipleDeclarations.errors.txt | 44 +++++++++---------- .../multipleNumericIndexers.errors.txt | 4 +- .../nonIdenticalTypeConstraints.errors.txt | 12 ++--- ...cesDifferingByTypeParameterName.errors.txt | 20 ++++----- ...esDifferingByTypeParameterName2.errors.txt | 12 ++--- ...erfacesWithDifferentConstraints.errors.txt | 12 ++--- ...ithTheSameNameButDifferentArity.errors.txt | 12 ++--- 10 files changed, 68 insertions(+), 68 deletions(-) diff --git a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt index 4f0a5944659..617f7b1502f 100644 --- a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt +++ b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of 'I' must have identical type parameters. ==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (1 errors) ==== @@ -35,7 +35,7 @@ tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSig interface I { ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I' must have identical type parameters. new (x: T, y?: number): C2; new (x: T, y: number): C2; } diff --git a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt index ebe2cd05aec..7b47fee05af 100644 --- a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt +++ b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(1,42): error TS2300: Duplicate identifier 'A'. -tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): error TS2300: Duplicate identifier 'C'. @@ -16,7 +16,7 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): err interface InterfaceWithSomeTypars { // should error ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. ~ !!! error TS2300: Duplicate identifier 'C'. bar2(): void; diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt index ae02c434d25..8d9ebb8d276 100644 --- a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of 'A' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. bar: T; } @@ -23,7 +23,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. foo: string; } } @@ -49,7 +49,7 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf module M3 { export interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. bar: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt index 5cd4f2f7d96..79d8b4a509a 100644 --- a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of 'I3' must have identical type parameters. ==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (11 errors) ==== @@ -16,53 +16,53 @@ tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: } interface I1 { // Name mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // constraint present ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Length mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I2 { } interface I2 string> { // constraint mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // constraint absent ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // name mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 { // length mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I3 { } interface I3 { // length mismatch ~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I3' must have identical type parameters. } class Foo { diff --git a/tests/baselines/reference/multipleNumericIndexers.errors.txt b/tests/baselines/reference/multipleNumericIndexers.errors.txt index 11fb81ba5b3..82fc444ac65 100644 --- a/tests/baselines/reference/multipleNumericIndexers.errors.txt +++ b/tests/baselines/reference/multipleNumericIndexers.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(25,5): error TS2375: Duplicate number index signature. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(28,11): error TS2428: All declarations of 'I' must have identical type parameters. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(29,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature. @@ -48,7 +48,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI interface I { ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'I' must have identical type parameters. [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ !!! error TS2375: Duplicate number index signature. diff --git a/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt index a8b54bf44dd..627b38579a2 100644 --- a/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt +++ b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations must have identical type parameters. -tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations of 'Foo' must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations of 'Qux' must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations of 'Quux' must have identical type parameters. ==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (3 errors) ==== @@ -15,7 +15,7 @@ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All de } interface Foo { ~~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'Foo' must have identical type parameters. y: T; } interface Qux { @@ -23,7 +23,7 @@ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All de } class Qux { ~~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'Qux' must have identical type parameters. n: T; } @@ -45,6 +45,6 @@ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All de } interface Quux { ~~~~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'Quux' must have identical type parameters. m: U; } \ No newline at end of file diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt index 6b56f5dfef6..6c0f562ac64 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations of 'B' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts (5 errors) ==== @@ -14,7 +14,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: U; } @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; } @@ -35,7 +35,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: U; } @@ -45,7 +45,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; } } @@ -71,7 +71,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; } } diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt index 7caec272386..f2a0063c230 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(8,8): error TS2304: Cannot find name 'V'. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations of 'B' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts (4 errors) ==== @@ -13,7 +13,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: V; ~ !!! error TS2304: Cannot find name 'V'. @@ -26,7 +26,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer interface B { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: T; } } @@ -52,7 +52,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: T; } } diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt index 39e684ec3dd..4b2455773f5 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi interface B> { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'B' must have identical type parameters. y: T; } } @@ -47,7 +47,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi module M3 { export interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } } \ No newline at end of file diff --git a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt index e31a8d5c433..de4c4d8e1c3 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations must have identical type parameters. -tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. ==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } } @@ -47,7 +47,7 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh module M3 { export interface A { // error ~ -!!! error TS2428: All declarations must have identical type parameters. +!!! error TS2428: All declarations of 'A' must have identical type parameters. y: T; } } \ No newline at end of file