From 115317e0a52054e5f70b8dcc313a6d25ebbcd8ae Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 19 May 2016 11:42:30 -0700 Subject: [PATCH] Fixes #8675 by allowing duplicate identifiers across declarations. Duplicate identifiers *within the same block* are still disallowed. --- src/compiler/checker.ts | 89 +++++++++++++++++- src/compiler/types.ts | 2 +- .../binaryIntegerLiteralError.errors.txt | 11 +-- ...turesWithParameterInitializers2.errors.txt | 8 +- ...nterfaceMergeConflictingMembers.errors.txt | 44 --------- ...ndInterfaceMergeConflictingMembers.symbols | 42 +++++++++ ...sAndInterfaceMergeConflictingMembers.types | 42 +++++++++ .../classAndInterfaceWithSameName.errors.txt | 27 ------ .../classAndInterfaceWithSameName.symbols | 26 ++++++ .../classAndInterfaceWithSameName.types | 26 ++++++ ...ssibilityModifiersOnParameters2.errors.txt | 23 ++--- ...constructorParameterProperties2.errors.txt | 23 ++--- ...faceIncompatibleWithBaseIndexer.errors.txt | 8 +- .../duplicateClassElements.errors.txt | 14 +-- .../duplicateInterfaceMembers1.errors.txt | 7 +- .../duplicateObjectLiteralProperty.errors.txt | 16 +--- ...duplicatePropertiesInStrictMode.errors.txt | 5 +- .../duplicatePropertyNames.errors.txt | 39 ++------ .../duplicateStringNamedProperty1.errors.txt | 7 +- .../gettersAndSettersErrors.errors.txt | 11 +-- .../interfaceDeclaration1.errors.txt | 13 +-- ...ationBindMultipleDefaultExports.errors.txt | 8 +- ...CompilationBindStrictModeErrors.errors.txt | 8 +- .../lastPropertyInLiteralWins.errors.txt | 8 +- .../reference/memberOverride.errors.txt | 5 +- ...cesWithConflictingPropertyNames.errors.txt | 23 ++--- ...esWithConflictingPropertyNames2.errors.txt | 62 ------------- ...facesWithConflictingPropertyNames2.symbols | 88 ++++++++++++++++++ ...erfacesWithConflictingPropertyNames2.types | 88 ++++++++++++++++++ .../multipleDefaultExports01.errors.txt | 9 +- .../reference/numericClassMembers1.errors.txt | 16 +--- .../numericNamedPropertyDuplicates.errors.txt | 32 ++----- ...cStringNamedPropertyEquivalence.errors.txt | 27 ++---- .../reference/objectLiteralErrors.errors.txt | 92 ++++--------------- ...tiesErrorFromNotUsingIdentifier.errors.txt | 11 +-- ...ypeWithDuplicateNumericProperty.errors.txt | 74 +++++++-------- .../octalIntegerLiteralError.errors.txt | 11 +-- .../optionalPropertiesSyntax.errors.txt | 7 +- ...parameterPropertyInConstructor2.errors.txt | 9 +- .../reference/parser0_004152.errors.txt | 8 +- .../propertyNamedPrototype.errors.txt | 10 -- .../reference/propertyNamedPrototype.symbols | 11 +++ .../reference/propertyNamedPrototype.types | 11 +++ .../reference/propertySignatures.errors.txt | 7 +- .../reference/reassignStaticProp.errors.txt | 6 +- .../staticPrototypeProperty.errors.txt | 5 +- ...ypesInImplementationSignatures2.errors.txt | 5 +- .../stringNamedPropertyDuplicates.errors.txt | 40 +++----- .../reference/symbolProperty36.errors.txt | 13 --- .../reference/symbolProperty36.symbols | 14 +++ .../reference/symbolProperty36.types | 17 ++++ .../reference/symbolProperty37.errors.txt | 13 --- .../reference/symbolProperty37.symbols | 14 +++ .../reference/symbolProperty37.types | 14 +++ .../reference/symbolProperty38.errors.txt | 15 --- .../reference/symbolProperty38.symbols | 17 ++++ .../reference/symbolProperty38.types | 17 ++++ 57 files changed, 676 insertions(+), 622 deletions(-) delete mode 100644 tests/baselines/reference/classAndInterfaceMergeConflictingMembers.errors.txt create mode 100644 tests/baselines/reference/classAndInterfaceMergeConflictingMembers.symbols create mode 100644 tests/baselines/reference/classAndInterfaceMergeConflictingMembers.types delete mode 100644 tests/baselines/reference/classAndInterfaceWithSameName.errors.txt create mode 100644 tests/baselines/reference/classAndInterfaceWithSameName.symbols create mode 100644 tests/baselines/reference/classAndInterfaceWithSameName.types delete mode 100644 tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt create mode 100644 tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.symbols create mode 100644 tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.types delete mode 100644 tests/baselines/reference/propertyNamedPrototype.errors.txt create mode 100644 tests/baselines/reference/propertyNamedPrototype.symbols create mode 100644 tests/baselines/reference/propertyNamedPrototype.types delete mode 100644 tests/baselines/reference/symbolProperty36.errors.txt create mode 100644 tests/baselines/reference/symbolProperty36.symbols create mode 100644 tests/baselines/reference/symbolProperty36.types delete mode 100644 tests/baselines/reference/symbolProperty37.errors.txt create mode 100644 tests/baselines/reference/symbolProperty37.symbols create mode 100644 tests/baselines/reference/symbolProperty37.types delete mode 100644 tests/baselines/reference/symbolProperty38.errors.txt create mode 100644 tests/baselines/reference/symbolProperty38.symbols create mode 100644 tests/baselines/reference/symbolProperty38.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 83dfdab423aa4..845a2366e6685 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12893,6 +12893,90 @@ namespace ts { } } + function checkClassForDuplicateDeclarations(node: ClassLikeDeclaration) { + const getter = 1, setter = 2, property = getter | setter; + + const instanceNames: Map = {}; + const staticNames: Map = {}; + for (const member of node.members) { + let memberName: string; + if (member.name) { + switch (member.name.kind) { + case SyntaxKind.StringLiteral: + case SyntaxKind.NumericLiteral: + case SyntaxKind.Identifier: + memberName = (member.name as LiteralExpression|Identifier).text; + break; + default: + continue; + } + } + + const static = forEach(member.modifiers, m => m.kind === SyntaxKind.StaticKeyword); + const names = static ? staticNames : instanceNames; + switch (member.kind) { + case SyntaxKind.Constructor: + for (const param of (member as ConstructorDeclaration).parameters) { + if (isParameterPropertyDeclaration(param)) { + addName(names, param, (param.name as Identifier).text, property); + } + } + break; + + case SyntaxKind.GetAccessor: + addName(names, member.name, memberName, getter); + break; + + case SyntaxKind.SetAccessor: + addName(names, member.name, memberName, setter); + break; + + case SyntaxKind.PropertyDeclaration: + addName(names, member.name, memberName, property); + break; + } + } + + function addName(names: Map, location: Node, name: string, meaning: number) { + if (hasProperty(names, name)) { + const prev = names[name]; + if (prev & meaning) { + error(location, Diagnostics.Duplicate_identifier_0, name); + } else { + names[name] = prev | meaning; + } + } + else { + names[name] = meaning; + } + } + } + + function checkObjectTypeForDuplicateDeclarations(node: TypeLiteralNode | InterfaceDeclaration) { + const names: Map = {}; + for (const member of node.members) { + if (member.kind == SyntaxKind.PropertySignature) { + let memberName: string; + switch (member.name.kind) { + case SyntaxKind.StringLiteral: + case SyntaxKind.NumericLiteral: + case SyntaxKind.Identifier: + memberName = (member.name as LiteralExpression|Identifier).text; + break; + default: + continue; + } + + if (hasProperty(names, memberName)) { + error(member, Diagnostics.Duplicate_identifier_0, memberName); + } + else { + names[memberName] = true; + } + } + } + } + function checkTypeForDuplicateIndexSignatures(node: Node) { if (node.kind === SyntaxKind.InterfaceDeclaration) { const nodeSymbol = getSymbolOfNode(node); @@ -13177,6 +13261,7 @@ namespace ts { const type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); checkIndexConstraints(type); checkTypeForDuplicateIndexSignatures(node); + checkObjectTypeForDuplicateDeclarations(node); } } @@ -15176,6 +15261,7 @@ namespace ts { const typeWithThis = getTypeWithThisArgument(type); const staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); + checkClassForDuplicateDeclarations(node); const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -15453,6 +15539,7 @@ namespace ts { checkIndexConstraints(type); } } + checkObjectTypeForDuplicateDeclarations(node); } forEach(getInterfaceBaseTypeNodes(node), heritageElement => { if (!isSupportedExpressionWithTypeArguments(heritageElement)) { @@ -18146,7 +18233,7 @@ namespace ts { else { const existingKind = seen[(name).text]; if (currentKind === Property && existingKind === Property) { - continue; + grammarErrorOnNode(name, Diagnostics.Duplicate_identifier_0, (name).text); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 15fd2bd4fcff1..86fdadee7eea0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2027,7 +2027,7 @@ namespace ts { BlockScopedVariableExcludes = Value, ParameterExcludes = Value, - PropertyExcludes = Value, + PropertyExcludes = None, EnumMemberExcludes = Value, FunctionExcludes = Value & ~(Function | ValueModule), ClassExcludes = (Value | Type) & ~(ValueModule | Interface), // class-interface mergability done in checker.ts diff --git a/tests/baselines/reference/binaryIntegerLiteralError.errors.txt b/tests/baselines/reference/binaryIntegerLiteralError.errors.txt index 20358a8406dfd..df4eafbddc375 100644 --- a/tests/baselines/reference/binaryIntegerLiteralError.errors.txt +++ b/tests/baselines/reference/binaryIntegerLiteralError.errors.txt @@ -1,11 +1,8 @@ tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts(2,17): error TS1005: ',' expected. tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts(3,17): error TS1005: ',' expected. -tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts(6,5): error TS2300: Duplicate identifier '0b11010'. -tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts(7,5): error TS2300: Duplicate identifier '26'. -tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts(8,5): error TS2300: Duplicate identifier '"26"'. -==== tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts (5 errors) ==== +==== tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralError.ts (2 errors) ==== // error var bin1 = 0B1102110; ~~~~ @@ -16,13 +13,7 @@ tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteralErr var obj1 = { 0b11010: "hi", - ~~~~~~~ -!!! error TS2300: Duplicate identifier '0b11010'. 26: "Hello", - ~~ -!!! error TS2300: Duplicate identifier '26'. "26": "world", - ~~~~ -!!! error TS2300: Duplicate identifier '"26"'. }; \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt index 22f8a563e710f..6329b0c5403c8 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(4,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(11,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(21,5): error TS2300: Duplicate identifier 'foo'. -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (6 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (4 errors) ==== // Optional parameters allow initializers only in implementation signatures // All the below declarations are errors @@ -31,15 +29,11 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWit var b = { foo(x = 1), // error - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. ~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. ~ !!! error TS1005: '{' expected. foo(x = 1) { }, // error - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. } b.foo(); diff --git a/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.errors.txt b/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.errors.txt deleted file mode 100644 index 48e52faae1e78..0000000000000 --- a/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.errors.txt +++ /dev/null @@ -1,44 +0,0 @@ -tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(2,12): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(6,5): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(10,15): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(14,5): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(18,13): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(22,5): error TS2300: Duplicate identifier 'x'. - - -==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts (6 errors) ==== - declare class C1 { - public x : number; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - interface C1 { - x : number; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - declare class C2 { - protected x : number; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - interface C2 { - x : number; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - declare class C3 { - private x : number; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - interface C3 { - x : number; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } \ No newline at end of file diff --git a/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.symbols b/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.symbols new file mode 100644 index 0000000000000..e16885d7f7519 --- /dev/null +++ b/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.symbols @@ -0,0 +1,42 @@ +=== tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts === +declare class C1 { +>C1 : Symbol(C1, Decl(classAndInterfaceMergeConflictingMembers.ts, 0, 0), Decl(classAndInterfaceMergeConflictingMembers.ts, 2, 1)) + + public x : number; +>x : Symbol(C1.x, Decl(classAndInterfaceMergeConflictingMembers.ts, 0, 18), Decl(classAndInterfaceMergeConflictingMembers.ts, 4, 14)) +} + +interface C1 { +>C1 : Symbol(C1, Decl(classAndInterfaceMergeConflictingMembers.ts, 0, 0), Decl(classAndInterfaceMergeConflictingMembers.ts, 2, 1)) + + x : number; +>x : Symbol(C1.x, Decl(classAndInterfaceMergeConflictingMembers.ts, 0, 18), Decl(classAndInterfaceMergeConflictingMembers.ts, 4, 14)) +} + +declare class C2 { +>C2 : Symbol(C2, Decl(classAndInterfaceMergeConflictingMembers.ts, 6, 1), Decl(classAndInterfaceMergeConflictingMembers.ts, 10, 1)) + + protected x : number; +>x : Symbol(C2.x, Decl(classAndInterfaceMergeConflictingMembers.ts, 8, 18), Decl(classAndInterfaceMergeConflictingMembers.ts, 12, 14)) +} + +interface C2 { +>C2 : Symbol(C2, Decl(classAndInterfaceMergeConflictingMembers.ts, 6, 1), Decl(classAndInterfaceMergeConflictingMembers.ts, 10, 1)) + + x : number; +>x : Symbol(C2.x, Decl(classAndInterfaceMergeConflictingMembers.ts, 8, 18), Decl(classAndInterfaceMergeConflictingMembers.ts, 12, 14)) +} + +declare class C3 { +>C3 : Symbol(C3, Decl(classAndInterfaceMergeConflictingMembers.ts, 14, 1), Decl(classAndInterfaceMergeConflictingMembers.ts, 18, 1)) + + private x : number; +>x : Symbol(C3.x, Decl(classAndInterfaceMergeConflictingMembers.ts, 16, 18), Decl(classAndInterfaceMergeConflictingMembers.ts, 20, 14)) +} + +interface C3 { +>C3 : Symbol(C3, Decl(classAndInterfaceMergeConflictingMembers.ts, 14, 1), Decl(classAndInterfaceMergeConflictingMembers.ts, 18, 1)) + + x : number; +>x : Symbol(C3.x, Decl(classAndInterfaceMergeConflictingMembers.ts, 16, 18), Decl(classAndInterfaceMergeConflictingMembers.ts, 20, 14)) +} diff --git a/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.types b/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.types new file mode 100644 index 0000000000000..622cc47db05a5 --- /dev/null +++ b/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts === +declare class C1 { +>C1 : C1 + + public x : number; +>x : number +} + +interface C1 { +>C1 : C1 + + x : number; +>x : number +} + +declare class C2 { +>C2 : C2 + + protected x : number; +>x : number +} + +interface C2 { +>C2 : C2 + + x : number; +>x : number +} + +declare class C3 { +>C3 : C3 + + private x : number; +>x : number +} + +interface C3 { +>C3 : C3 + + x : number; +>x : number +} diff --git a/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt b/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt deleted file mode 100644 index f1f26f50f3e91..0000000000000 --- a/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,11): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,15): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(6,9): error TS2300: Duplicate identifier 'bar'. -tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(10,9): error TS2300: Duplicate identifier 'bar'. - - -==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (4 errors) ==== - class C { foo: string; } - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. - interface C { foo: string; } - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. - - module M { - class D { - bar: string; - ~~~ -!!! error TS2300: Duplicate identifier 'bar'. - } - - interface D { - bar: string; - ~~~ -!!! error TS2300: Duplicate identifier 'bar'. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/classAndInterfaceWithSameName.symbols b/tests/baselines/reference/classAndInterfaceWithSameName.symbols new file mode 100644 index 0000000000000..cb9eba3cd6f54 --- /dev/null +++ b/tests/baselines/reference/classAndInterfaceWithSameName.symbols @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts === +class C { foo: string; } +>C : Symbol(C, Decl(classAndInterfaceWithSameName.ts, 0, 0), Decl(classAndInterfaceWithSameName.ts, 0, 24)) +>foo : Symbol(C.foo, Decl(classAndInterfaceWithSameName.ts, 0, 9), Decl(classAndInterfaceWithSameName.ts, 1, 13)) + +interface C { foo: string; } +>C : Symbol(C, Decl(classAndInterfaceWithSameName.ts, 0, 0), Decl(classAndInterfaceWithSameName.ts, 0, 24)) +>foo : Symbol(C.foo, Decl(classAndInterfaceWithSameName.ts, 0, 9), Decl(classAndInterfaceWithSameName.ts, 1, 13)) + +module M { +>M : Symbol(M, Decl(classAndInterfaceWithSameName.ts, 1, 28)) + + class D { +>D : Symbol(D, Decl(classAndInterfaceWithSameName.ts, 3, 10), Decl(classAndInterfaceWithSameName.ts, 6, 5)) + + bar: string; +>bar : Symbol(D.bar, Decl(classAndInterfaceWithSameName.ts, 4, 13), Decl(classAndInterfaceWithSameName.ts, 8, 17)) + } + + interface D { +>D : Symbol(D, Decl(classAndInterfaceWithSameName.ts, 3, 10), Decl(classAndInterfaceWithSameName.ts, 6, 5)) + + bar: string; +>bar : Symbol(D.bar, Decl(classAndInterfaceWithSameName.ts, 4, 13), Decl(classAndInterfaceWithSameName.ts, 8, 17)) + } +} diff --git a/tests/baselines/reference/classAndInterfaceWithSameName.types b/tests/baselines/reference/classAndInterfaceWithSameName.types new file mode 100644 index 0000000000000..274c4eb5c6aef --- /dev/null +++ b/tests/baselines/reference/classAndInterfaceWithSameName.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts === +class C { foo: string; } +>C : C +>foo : string + +interface C { foo: string; } +>C : C +>foo : string + +module M { +>M : typeof M + + class D { +>D : D + + bar: string; +>bar : string + } + + interface D { +>D : D + + bar: string; +>bar : string + } +} diff --git a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt index e12f3a59ca111..cc2c172ea6e99 100644 --- a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt +++ b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt @@ -1,12 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,17): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,24): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,27): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(4,35): error TS2300: Duplicate identifier 'y'. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(5,24): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(5,35): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(5,17): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(5,27): error TS2300: Duplicate identifier 'y'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(9,17): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(9,25): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(10,24): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(10,17): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(14,17): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(19,10): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(20,10): error TS2369: A parameter property is only allowed in a constructor implementation. @@ -18,23 +15,19 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatur tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(35,10): error TS2369: A parameter property is only allowed in a constructor implementation. -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (18 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (15 errors) ==== // Parameter properties are not valid in overloads of constructors class C { constructor(public x, private y); ~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. - ~ -!!! error TS2300: Duplicate identifier 'x'. ~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. - ~ -!!! error TS2300: Duplicate identifier 'y'. constructor(public x, private y) { } - ~ + ~~~~~~~~ !!! error TS2300: Duplicate identifier 'x'. - ~ + ~~~~~~~~~ !!! error TS2300: Duplicate identifier 'y'. } @@ -42,10 +35,8 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatur constructor(private x); ~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. - ~ -!!! error TS2300: Duplicate identifier 'x'. constructor(public x) { } - ~ + ~~~~~~~~ !!! error TS2300: Duplicate identifier 'x'. } diff --git a/tests/baselines/reference/constructorParameterProperties2.errors.txt b/tests/baselines/reference/constructorParameterProperties2.errors.txt index 42df015bc5beb..6faaa24600f3a 100644 --- a/tests/baselines/reference/constructorParameterProperties2.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties2.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(10,5): error TS2300: Duplicate identifier 'y'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(11,24): error TS2300: Duplicate identifier 'y'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(18,5): error TS2300: Duplicate identifier 'y'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(19,25): error TS2300: Duplicate identifier 'y'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(26,5): error TS2300: Duplicate identifier 'y'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,27): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(11,17): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(19,17): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,17): error TS2300: Duplicate identifier 'y'. -==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (6 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (3 errors) ==== class C { y: number; constructor(y: number) { } // ok @@ -17,10 +14,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co class D { y: number; - ~ -!!! error TS2300: Duplicate identifier 'y'. constructor(public y: number) { } // error - ~ + ~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'y'. } @@ -29,10 +24,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co class E { y: number; - ~ -!!! error TS2300: Duplicate identifier 'y'. constructor(private y: number) { } // error - ~ + ~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'y'. } @@ -41,10 +34,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co class F { y: number; - ~ -!!! error TS2300: Duplicate identifier 'y'. constructor(protected y: number) { } // error - ~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'y'. } diff --git a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt index 7212121e106e0..e23384268b113 100644 --- a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt +++ b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt @@ -4,12 +4,10 @@ tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompa tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(11,5): error TS2412: Property ''1'' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(15,5): error TS2411: Property 'foo' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(19,5): error TS2411: Property 'foo' of type '() => { x: number; }' is not assignable to string index type '{ x: number; }'. -tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(24,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(24,5): error TS2412: Property '1' of type '{ x: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. -tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts(28,5): error TS2300: Duplicate identifier ''1''. -==== tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts (9 errors) ==== +==== tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts (7 errors) ==== interface Base { [x: number]: { x: number; y: number; }; [x: string]: { x: number; } @@ -46,14 +44,10 @@ tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompa // satisifies string indexer but not numeric indexer interface Derived5 extends Base { 1: { x: number } // error - ~ -!!! error TS2300: Duplicate identifier '1'. ~~~~~~~~~~~~~~~~ !!! error TS2412: Property '1' of type '{ x: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } interface Derived5 extends Base { '1': { x: number } // error - ~~~ -!!! error TS2300: Duplicate identifier ''1''. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index 9dfec7a2908ea..7579190db7194 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/duplicateClassElements.ts(2,12): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateClassElements.ts(3,12): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateClassElements.ts(4,12): error TS2393: Duplicate function implementation. tests/cases/compiler/duplicateClassElements.ts(6,12): error TS2393: Duplicate function implementation. @@ -15,10 +14,9 @@ tests/cases/compiler/duplicateClassElements.ts(23,9): error TS2300: Duplicate id tests/cases/compiler/duplicateClassElements.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate identifier 'z'. tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(29,9): error TS2300: Duplicate identifier 'x2'. tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(32,9): error TS2300: Duplicate identifier 'x2'. tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' must be of type 'number', but here has type 'any'. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'. tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -26,11 +24,9 @@ tests/cases/compiler/duplicateClassElements.ts(39,9): error TS2300: Duplicate id tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate identifier 'z2'. -==== tests/cases/compiler/duplicateClassElements.ts (26 errors) ==== +==== tests/cases/compiler/duplicateClassElements.ts (24 errors) ==== class a { public a; - ~ -!!! error TS2300: Duplicate identifier 'a'. public a; ~ !!! error TS2300: Duplicate identifier 'a'. @@ -90,19 +86,17 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i get x2() { ~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~ -!!! error TS2300: Duplicate identifier 'x2'. return 10; } set x2(_x: number) { ~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~ -!!! error TS2300: Duplicate identifier 'x2'. } public x2; ~~ !!! error TS2300: Duplicate identifier 'x2'. + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' must be of type 'number', but here has type 'any'. get z2() { ~~ diff --git a/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt b/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt index 674d4f601e679..04c3fa11dbc9a 100644 --- a/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt +++ b/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt @@ -1,14 +1,11 @@ -tests/cases/compiler/duplicateInterfaceMembers1.ts(2,4): error TS2300: Duplicate identifier 'x'. tests/cases/compiler/duplicateInterfaceMembers1.ts(3,4): error TS2300: Duplicate identifier 'x'. -==== tests/cases/compiler/duplicateInterfaceMembers1.ts (2 errors) ==== +==== tests/cases/compiler/duplicateInterfaceMembers1.ts (1 errors) ==== interface Bar { x: number; - ~ -!!! error TS2300: Duplicate identifier 'x'. x: number; - ~ + ~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt index 0dd5febe496ec..9c2df45985e7a 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt @@ -1,36 +1,30 @@ -tests/cases/compiler/duplicateObjectLiteralProperty.ts(2,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(4,5): error TS2300: Duplicate identifier 'a'. -tests/cases/compiler/duplicateObjectLiteralProperty.ts(5,5): error TS2300: Duplicate identifier '\u0061'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(5,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(6,5): error TS2300: Duplicate identifier 'a'. -tests/cases/compiler/duplicateObjectLiteralProperty.ts(7,9): error TS2300: Duplicate identifier 'c'. -tests/cases/compiler/duplicateObjectLiteralProperty.ts(8,9): error TS2300: Duplicate identifier '"c"'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(8,9): error TS2300: Duplicate identifier 'c'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(14,9): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Duplicate identifier 'a'. -==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (10 errors) ==== +==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (8 errors) ==== var x = { a: 1, - ~ -!!! error TS2300: Duplicate identifier 'a'. b: true, // OK a: 56, // Duplicate ~ !!! error TS2300: Duplicate identifier 'a'. \u0061: "ss", // Duplicate ~~~~~~ -!!! error TS2300: Duplicate identifier '\u0061'. +!!! error TS2300: Duplicate identifier 'a'. a: { ~ !!! error TS2300: Duplicate identifier 'a'. c: 1, - ~ -!!! error TS2300: Duplicate identifier 'c'. "c": 56, // Duplicate ~~~ -!!! error TS2300: Duplicate identifier '"c"'. +!!! error TS2300: Duplicate identifier 'c'. } }; diff --git a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt index b3d868dbe7ed5..17a55a7876b00 100644 --- a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt +++ b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt @@ -1,14 +1,11 @@ -tests/cases/compiler/duplicatePropertiesInStrictMode.ts(3,3): error TS2300: Duplicate identifier 'x'. tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS2300: Duplicate identifier 'x'. -==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (3 errors) ==== +==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (2 errors) ==== "use strict"; var x = { x: 1, - ~ -!!! error TS2300: Duplicate identifier 'x'. x: 2 ~ !!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode. diff --git a/tests/baselines/reference/duplicatePropertyNames.errors.txt b/tests/baselines/reference/duplicatePropertyNames.errors.txt index 108a88d145110..216fd73fcde0b 100644 --- a/tests/baselines/reference/duplicatePropertyNames.errors.txt +++ b/tests/baselines/reference/duplicatePropertyNames.errors.txt @@ -1,34 +1,23 @@ -tests/cases/conformance/types/members/duplicatePropertyNames.ts(4,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(5,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(14,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(15,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(19,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(20,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(22,5): error TS2393: Duplicate function implementation. tests/cases/conformance/types/members/duplicatePropertyNames.ts(23,5): error TS2393: Duplicate function implementation. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(25,5): error TS2300: Duplicate identifier 'baz'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(26,5): error TS2300: Duplicate identifier 'baz'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(30,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(31,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(35,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(36,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(38,5): error TS2300: Duplicate identifier 'bar'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(39,5): error TS2300: Duplicate identifier 'bar'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(43,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(44,5): error TS2300: Duplicate identifier 'foo'. -tests/cases/conformance/types/members/duplicatePropertyNames.ts(45,5): error TS2300: Duplicate identifier 'bar'. tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2300: Duplicate identifier 'bar'. -==== tests/cases/conformance/types/members/duplicatePropertyNames.ts (20 errors) ==== +==== tests/cases/conformance/types/members/duplicatePropertyNames.ts (11 errors) ==== // duplicate property names are an error in all types interface Number { foo: string; - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: string; - ~~~ + ~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'foo'. } @@ -39,17 +28,13 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2 interface Array { foo: T; - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: T; - ~~~ + ~~~~~~~ !!! error TS2300: Duplicate identifier 'foo'. } class C { foo: string; - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: string; ~~~ !!! error TS2300: Duplicate identifier 'foo'. @@ -62,8 +47,6 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2 !!! error TS2393: Duplicate function implementation. baz = () => { } - ~~~ -!!! error TS2300: Duplicate identifier 'baz'. baz = () => { } ~~~ !!! error TS2300: Duplicate identifier 'baz'. @@ -71,39 +54,29 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2 interface I { foo: string; - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: string; - ~~~ + ~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'foo'. } var a: { foo: string; - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: string; - ~~~ + ~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'foo'. bar: () => {}; - ~~~ -!!! error TS2300: Duplicate identifier 'bar'. bar: () => {}; - ~~~ + ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'bar'. } var b = { foo: '', - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: '', ~~~ !!! error TS2300: Duplicate identifier 'foo'. bar: () => { }, - ~~~ -!!! error TS2300: Duplicate identifier 'bar'. bar: () => { } ~~~ !!! error TS2300: Duplicate identifier 'bar'. diff --git a/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt b/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt index 7d6c5d6bafcb4..cea2b2ad85169 100644 --- a/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt +++ b/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt @@ -1,13 +1,10 @@ -tests/cases/compiler/duplicateStringNamedProperty1.ts(2,5): error TS2300: Duplicate identifier '"artist"'. tests/cases/compiler/duplicateStringNamedProperty1.ts(3,5): error TS2300: Duplicate identifier 'artist'. -==== tests/cases/compiler/duplicateStringNamedProperty1.ts (2 errors) ==== +==== tests/cases/compiler/duplicateStringNamedProperty1.ts (1 errors) ==== export interface Album { "artist": string; - ~~~~~~~~ -!!! error TS2300: Duplicate identifier '"artist"'. artist: string; - ~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'artist'. } \ No newline at end of file diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index db2d4c5bc87de..a3be786cb264b 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -1,8 +1,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' must be of type 'string', but here has type 'number'. tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -11,22 +10,20 @@ tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and setter accessors do not agree in visibility. -==== tests/cases/compiler/gettersAndSettersErrors.ts (11 errors) ==== +==== tests/cases/compiler/gettersAndSettersErrors.ts (10 errors) ==== class C { public get Foo() { return "foo";} // ok ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. public set Foo(foo:string) {} // ok ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. public Foo = 0; // error - duplicate identifier Foo - confirmed ~~~ !!! error TS2300: Duplicate identifier 'Foo'. + ~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' must be of type 'string', but here has type 'number'. public get Goo(v:string):string {return null;} // error - getters must not have a parameter ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index b73cfef75dfaa..5d8e490c8bfb2 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -1,6 +1,5 @@ -tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate identifier 'item'. tests/cases/compiler/interfaceDeclaration1.ts(3,5): error TS2300: Duplicate identifier 'item'. -tests/cases/compiler/interfaceDeclaration1.ts(7,5): error TS2300: Duplicate identifier 'item'. +tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'item' must be of type 'any', but here has type 'number'. tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2300: Duplicate identifier 'item'. tests/cases/compiler/interfaceDeclaration1.ts(22,11): error TS2310: Type 'I5' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' incorrectly implements interface 'I3'. @@ -10,22 +9,20 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i Named property 'foo' of types 'i10' and 'i11' are not identical. -==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ==== +==== tests/cases/compiler/interfaceDeclaration1.ts (7 errors) ==== interface I1 { item:number; - ~~~~ -!!! error TS2300: Duplicate identifier 'item'. item:number; - ~~~~ + ~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'item'. } interface I2 { item:any; - ~~~~ -!!! error TS2300: Duplicate identifier 'item'. item:number; ~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'item' must be of type 'any', but here has type 'number'. + ~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'item'. } diff --git a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt index 05fecf03d3069..4c1d237aa4708 100644 --- a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt +++ b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt @@ -1,15 +1,9 @@ -tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports. -tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports. tests/cases/compiler/a.js(3,16): error TS1109: Expression expected. -==== tests/cases/compiler/a.js (3 errors) ==== +==== tests/cases/compiler/a.js (1 errors) ==== export default class a { - ~ -!!! error TS2528: A module cannot have multiple default exports. } export default var a = 10; - ~~~~~~~~~~~~~~ -!!! error TS2528: A module cannot have multiple default exports. ~~~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt index 65dffb5a08e42..3cc2f5f085f55 100644 --- a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt +++ b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt @@ -1,6 +1,4 @@ -tests/cases/compiler/a.js(3,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. -tests/cases/compiler/a.js(5,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode. @@ -14,18 +12,14 @@ tests/cases/compiler/d.js(2,9): error TS1121: Octal literals are not allowed in tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. -==== tests/cases/compiler/a.js (8 errors) ==== +==== tests/cases/compiler/a.js (6 errors) ==== "use strict"; var a = { a: "hello", // error - ~ -!!! error TS2300: Duplicate identifier 'a'. b: 10, a: 10 // error ~ !!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode. - ~ -!!! error TS2300: Duplicate identifier 'a'. }; var let = 10; // error ~~~ diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt index 51fce2d29d4e2..2b4a694975b4c 100644 --- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt +++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt @@ -3,13 +3,11 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(7,6): error TS2345: Argument o Type '(num: number) => void' is not assignable to type '(str: string) => void'. Types of parameters 'num' and 'str' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'. -tests/cases/compiler/lastPropertyInLiteralWins.ts(13,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate identifier 'thunk'. -==== tests/cases/compiler/lastPropertyInLiteralWins.ts (5 errors) ==== +==== tests/cases/compiler/lastPropertyInLiteralWins.ts (3 errors) ==== interface Thing { thunk: (str: string) => void; } @@ -20,8 +18,6 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ thunk: (str: string) => {}, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~ -!!! error TS2300: Duplicate identifier 'thunk'. thunk: (num: number) => {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ @@ -36,8 +32,6 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate test({ // Should be OK. Last 'thunk' is of correct type thunk: (num: number) => {}, - ~~~~~ -!!! error TS2300: Duplicate identifier 'thunk'. thunk: (str: string) => {} ~~~~~ !!! error TS2300: Duplicate identifier 'thunk'. diff --git a/tests/baselines/reference/memberOverride.errors.txt b/tests/baselines/reference/memberOverride.errors.txt index b4974e69e5363..15c4b2ad37bb8 100644 --- a/tests/baselines/reference/memberOverride.errors.txt +++ b/tests/baselines/reference/memberOverride.errors.txt @@ -1,14 +1,11 @@ -tests/cases/compiler/memberOverride.ts(4,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/memberOverride.ts(5,5): error TS2300: Duplicate identifier 'a'. -==== tests/cases/compiler/memberOverride.ts (2 errors) ==== +==== tests/cases/compiler/memberOverride.ts (1 errors) ==== // An object initialiser accepts the first definition for the same property with a different type signature // Should compile, since the second declaration of a overrides the first var x = { a: "", - ~ -!!! error TS2300: Duplicate identifier 'a'. a: 5 ~ !!! error TS2300: Duplicate identifier 'a'. diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt index 0b5984dcc6d6d..437bf2d80f0c7 100644 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt @@ -1,35 +1,28 @@ -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(2,5): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(11,9): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(33,9): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. -==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (6 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (3 errors) ==== interface A { x: string; // error - ~ -!!! error TS2300: Duplicate identifier 'x'. } interface A { x: number; ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. } module M { interface A { x: T; - ~ -!!! error TS2300: Duplicate identifier 'x'. } interface A { x: number; // error ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. } } @@ -48,8 +41,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli module M3 { export interface A { x: T; - ~ -!!! error TS2300: Duplicate identifier 'x'. } } @@ -57,6 +48,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli export interface A { x: number; // error ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. } } \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt deleted file mode 100644 index d0a50f4ae69e9..0000000000000 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt +++ /dev/null @@ -1,62 +0,0 @@ -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(2,5): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(6,5): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(11,9): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(15,9): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(33,9): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts(39,9): error TS2300: Duplicate identifier 'x'. - - -==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts (6 errors) ==== - interface A { - x: string; // error - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - interface A { - x: string; // error - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - module M { - interface A { - x: T; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - - interface A { - x: T; // error - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - } - - module M2 { - interface A { - x: T; - } - } - - module M2 { - interface A { - x: T; // ok, different declaration space than other M2 - } - } - - module M3 { - export interface A { - x: T; - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - } - - module M3 { - export interface A { - x: T; // error - ~ -!!! error TS2300: Duplicate identifier 'x'. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.symbols b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.symbols new file mode 100644 index 0000000000000..70de1ae8c997c --- /dev/null +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.symbols @@ -0,0 +1,88 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts === +interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 0, 0), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 2, 1)) + + x: string; // error +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 0, 13), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 4, 13)) +} + +interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 0, 0), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 2, 1)) + + x: string; // error +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 0, 13), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 4, 13)) +} + +module M { +>M : Symbol(M, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 6, 1)) + + interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 8, 10), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 11, 5)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 9, 16), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 13, 16)) + + x: T; +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 9, 20), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 13, 20)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 9, 16), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 13, 16)) + } + + interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 8, 10), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 11, 5)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 9, 16), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 13, 16)) + + x: T; // error +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 9, 20), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 13, 20)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 9, 16), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 13, 16)) + } +} + +module M2 { +>M2 : Symbol(M2, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 16, 1), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 22, 1)) + + interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 18, 11)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 19, 16)) + + x: T; +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 19, 20)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 19, 16)) + } +} + +module M2 { +>M2 : Symbol(M2, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 16, 1), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 22, 1)) + + interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 24, 11)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 25, 16)) + + x: T; // ok, different declaration space than other M2 +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 25, 20)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 25, 16)) + } +} + +module M3 { +>M3 : Symbol(M3, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 28, 1), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 34, 1)) + + export interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 30, 11), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 36, 11)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 31, 23), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 37, 23)) + + x: T; +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 31, 27), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 37, 27)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 31, 23), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 37, 23)) + } +} + +module M3 { +>M3 : Symbol(M3, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 28, 1), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 34, 1)) + + export interface A { +>A : Symbol(A, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 30, 11), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 36, 11)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 31, 23), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 37, 23)) + + x: T; // error +>x : Symbol(A.x, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 31, 27), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 37, 27)) +>T : Symbol(T, Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 31, 23), Decl(mergedInterfacesWithConflictingPropertyNames2.ts, 37, 23)) + } +} diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.types b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.types new file mode 100644 index 0000000000000..ec7fa633d7b59 --- /dev/null +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.types @@ -0,0 +1,88 @@ +=== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts === +interface A { +>A : A + + x: string; // error +>x : string +} + +interface A { +>A : A + + x: string; // error +>x : string +} + +module M { +>M : any + + interface A { +>A : A +>T : T + + x: T; +>x : T +>T : T + } + + interface A { +>A : A +>T : T + + x: T; // error +>x : T +>T : T + } +} + +module M2 { +>M2 : any + + interface A { +>A : A +>T : T + + x: T; +>x : T +>T : T + } +} + +module M2 { +>M2 : any + + interface A { +>A : A +>T : T + + x: T; // ok, different declaration space than other M2 +>x : T +>T : T + } +} + +module M3 { +>M3 : any + + export interface A { +>A : A +>T : T + + x: T; +>x : T +>T : T + } +} + +module M3 { +>M3 : any + + export interface A { +>A : A +>T : T + + x: T; // error +>x : T +>T : T + } +} diff --git a/tests/baselines/reference/multipleDefaultExports01.errors.txt b/tests/baselines/reference/multipleDefaultExports01.errors.txt index 16aa3b2f7b15b..b3e7d75728983 100644 --- a/tests/baselines/reference/multipleDefaultExports01.errors.txt +++ b/tests/baselines/reference/multipleDefaultExports01.errors.txt @@ -1,13 +1,16 @@ +tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2323: Cannot redeclare exported variable 'default'. tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2528: A module cannot have multiple default exports. tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2528: A module cannot have multiple default exports. -tests/cases/conformance/es6/modules/m1.ts(11,1): error TS2528: A module cannot have multiple default exports. +tests/cases/conformance/es6/modules/m1.ts(11,1): error TS2323: Cannot redeclare exported variable 'default'. tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof foo' is not callable. Did you mean to include 'new'? -==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ==== +==== tests/cases/conformance/es6/modules/m1.ts (4 errors) ==== export default class foo { ~~~ +!!! error TS2323: Cannot redeclare exported variable 'default'. + ~~~ !!! error TS2528: A module cannot have multiple default exports. } @@ -21,7 +24,7 @@ tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typ var x = 10; export default x; ~~~~~~~~~~~~~~~~~ -!!! error TS2528: A module cannot have multiple default exports. +!!! error TS2323: Cannot redeclare exported variable 'default'. ==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ==== import Entity from "./m1" diff --git a/tests/baselines/reference/numericClassMembers1.errors.txt b/tests/baselines/reference/numericClassMembers1.errors.txt index eb99f26bb4c99..7c99932e937a9 100644 --- a/tests/baselines/reference/numericClassMembers1.errors.txt +++ b/tests/baselines/reference/numericClassMembers1.errors.txt @@ -1,26 +1,20 @@ -tests/cases/compiler/numericClassMembers1.ts(2,3): error TS2300: Duplicate identifier '0'. -tests/cases/compiler/numericClassMembers1.ts(3,3): error TS2300: Duplicate identifier '0.0'. -tests/cases/compiler/numericClassMembers1.ts(7,3): error TS2300: Duplicate identifier '0.0'. -tests/cases/compiler/numericClassMembers1.ts(8,2): error TS2300: Duplicate identifier ''0''. +tests/cases/compiler/numericClassMembers1.ts(3,3): error TS2300: Duplicate identifier '0'. +tests/cases/compiler/numericClassMembers1.ts(8,2): error TS2300: Duplicate identifier '0'. -==== tests/cases/compiler/numericClassMembers1.ts (4 errors) ==== +==== tests/cases/compiler/numericClassMembers1.ts (2 errors) ==== class C234 { 0 = 1; - ~ -!!! error TS2300: Duplicate identifier '0'. 0.0 = 2; ~~~ -!!! error TS2300: Duplicate identifier '0.0'. +!!! error TS2300: Duplicate identifier '0'. } class C235 { 0.0 = 1; - ~~~ -!!! error TS2300: Duplicate identifier '0.0'. '0' = 2; ~~~ -!!! error TS2300: Duplicate identifier ''0''. +!!! error TS2300: Duplicate identifier '0'. } class C236 { diff --git a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt index 1c5eeb36b272d..e5901a397d9e3 100644 --- a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt +++ b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt @@ -1,27 +1,17 @@ -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(2,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(3,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(4,12): error TS2300: Duplicate identifier '2'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(3,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(5,12): error TS2300: Duplicate identifier '2'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(9,5): error TS2300: Duplicate identifier '2'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(10,5): error TS2300: Duplicate identifier '2.'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(14,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(10,5): error TS2300: Duplicate identifier '2'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(15,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(19,5): error TS2300: Duplicate identifier '2'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS2300: Duplicate identifier '2'. -==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts (11 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts (5 errors) ==== class C { 1: number; - ~ -!!! error TS2300: Duplicate identifier '1'. 1.0: number; ~~~ -!!! error TS2300: Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1'. static 2: number; - ~ -!!! error TS2300: Duplicate identifier '2'. static 2: number; ~ !!! error TS2300: Duplicate identifier '2'. @@ -29,29 +19,21 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP interface I { 2: number; - ~ -!!! error TS2300: Duplicate identifier '2'. 2.: number; - ~~ -!!! error TS2300: Duplicate identifier '2.'. + ~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '2'. } var a: { 1: number; - ~ -!!! error TS2300: Duplicate identifier '1'. 1: number; - ~ + ~~~~~~~~~~ !!! error TS2300: Duplicate identifier '1'. } var b = { 2: 1 - ~ -!!! error TS2300: Duplicate identifier '2'. 2: 1 ~ !!! error TS1005: ',' expected. - ~ -!!! error TS2300: Duplicate identifier '2'. } \ No newline at end of file diff --git a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt index 4ebef99bd07a5..06061f99ff0b8 100644 --- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt +++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt @@ -1,49 +1,40 @@ -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(4,5): error TS2300: Duplicate identifier '"1"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(6,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(10,5): error TS2300: Duplicate identifier '"1"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(6,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(12,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(16,5): error TS2300: Duplicate identifier '"1"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(21,5): error TS2300: Duplicate identifier '"0"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' must be of type 'number', but here has type 'string'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(22,5): error TS2300: Duplicate identifier '0'. -==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (8 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (5 errors) ==== // Each of these types has an error in it. // String named and numeric named properties conflict if they would be equivalent after ToNumber on the property name. class C { "1": number; - ~~~ -!!! error TS2300: Duplicate identifier '"1"'. "1.0": number; // not a duplicate 1.0: number; ~~~ -!!! error TS2300: Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1'. } interface I { "1": number; - ~~~ -!!! error TS2300: Duplicate identifier '"1"'. "1.": number; // not a duplicate 1: number; - ~ + ~~~~~~~~~~ !!! error TS2300: Duplicate identifier '1'. } var a: { "1": number; - ~~~ -!!! error TS2300: Duplicate identifier '"1"'. 1.0: string; ~~~ -!!! error TS2300: Duplicate identifier '1.0'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' must be of type 'number', but here has type 'string'. + ~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '1'. } var b = { "0": '', - ~~~ -!!! error TS2300: Duplicate identifier '"0"'. 0: '' ~ !!! error TS2300: Duplicate identifier '0'. diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 134b79a443eef..a4d8b96c088df 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -1,39 +1,21 @@ -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,18): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,19): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,18): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,21): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,19): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,12): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,18): error TS2300: Duplicate identifier ''a''. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,18): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,20): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,12): error TS2300: Duplicate identifier ''a''. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,20): error TS2300: Duplicate identifier '"a"'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,12): error TS2300: Duplicate identifier ''a''. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,20): error TS2300: Duplicate identifier ''a''. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,13): error TS2300: Duplicate identifier '"a"'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,21): error TS2300: Duplicate identifier ''a''. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,13): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21): error TS2300: Duplicate identifier ''1''. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,20): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,20): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,21): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21): error TS2300: Duplicate identifier '1'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,13): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,13): error TS2300: Duplicate identifier '0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,13): error TS2300: Duplicate identifier '"100"'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,13): error TS2300: Duplicate identifier '0x20'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '3.2e1'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,13): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '100'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '32'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,25): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS1119: An object literal cannot have property and accessor with the same name. @@ -96,99 +78,63 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,16) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55): error TS2380: 'get' and 'set' accessor must have the same type. -==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (96 errors) ==== +==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (78 errors) ==== // Multiple properties with the same name var e1 = { a: 0, a: 0 }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var e2 = { a: '', a: '' }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var e3 = { a: 0, a: '' }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var e4 = { a: true, a: false }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var e5 = { a: {}, a: {} }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. var e6 = { a: 0, 'a': 0 }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~~~ -!!! error TS2300: Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier 'a'. var e7 = { 'a': 0, a: 0 }; - ~~~ -!!! error TS2300: Duplicate identifier ''a''. ~ !!! error TS2300: Duplicate identifier 'a'. var e8 = { 'a': 0, "a": 0 }; - ~~~ -!!! error TS2300: Duplicate identifier ''a''. ~~~ -!!! error TS2300: Duplicate identifier '"a"'. +!!! error TS2300: Duplicate identifier 'a'. var e9 = { 'a': 0, 'a': 0 }; - ~~~ -!!! error TS2300: Duplicate identifier ''a''. ~~~ -!!! error TS2300: Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier 'a'. var e10 = { "a": 0, 'a': 0 }; - ~~~ -!!! error TS2300: Duplicate identifier '"a"'. ~~~ -!!! error TS2300: Duplicate identifier ''a''. +!!! error TS2300: Duplicate identifier 'a'. var e11 = { 1.0: 0, '1': 0 }; - ~~~ -!!! error TS2300: Duplicate identifier '1.0'. ~~~ -!!! error TS2300: Duplicate identifier ''1''. +!!! error TS2300: Duplicate identifier '1'. var e12 = { 0: 0, 0: 0 }; - ~ -!!! error TS2300: Duplicate identifier '0'. ~ !!! error TS2300: Duplicate identifier '0'. var e13 = { 0: 0, 0: 0 }; - ~ -!!! error TS2300: Duplicate identifier '0'. ~ !!! error TS2300: Duplicate identifier '0'. var e14 = { 0: 0, 0x0: 0 }; - ~ -!!! error TS2300: Duplicate identifier '0'. ~~~ -!!! error TS2300: Duplicate identifier '0x0'. - var e14 = { 0: 0, 000: 0 }; - ~ !!! error TS2300: Duplicate identifier '0'. + var e14 = { 0: 0, 000: 0 }; ~~~ !!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2300: Duplicate identifier '000'. +!!! error TS2300: Duplicate identifier '0'. var e15 = { "100": 0, 1e2: 0 }; - ~~~~~ -!!! error TS2300: Duplicate identifier '"100"'. ~~~ -!!! error TS2300: Duplicate identifier '1e2'. +!!! error TS2300: Duplicate identifier '100'. var e16 = { 0x20: 0, 3.2e1: 0 }; - ~~~~ -!!! error TS2300: Duplicate identifier '0x20'. ~~~~~ -!!! error TS2300: Duplicate identifier '3.2e1'. +!!! error TS2300: Duplicate identifier '32'. var e17 = { a: 0, b: 1, a: 0 }; - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2300: Duplicate identifier 'a'. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt index 80bfb49883b59..5fa8a12e87559 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt @@ -7,16 +7,13 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(9,8): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(10,10): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(12,1): error TS1005: ':' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,5): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,6): error TS1005: ':' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,5): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,6): error TS1005: ':' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,5): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,6): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(20,17): error TS1005: ':' expected. -==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (16 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (13 errors) ==== // errors var y = { "stringLiteral", @@ -50,18 +47,12 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var x = { a.b, - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS1005: ':' expected. a["ss"], - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS1005: ':' expected. a[1], - ~ -!!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS1005: ':' expected. }; diff --git a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt index c89cd04d1eeee..25efe98787302 100644 --- a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt +++ b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt @@ -1,83 +1,71 @@ -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(5,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(6,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(7,5): error TS2300: Duplicate identifier '1.'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(8,5): error TS2300: Duplicate identifier '1.00'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(12,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(13,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(14,5): error TS2300: Duplicate identifier '1.'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(15,5): error TS2300: Duplicate identifier '1.00'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(19,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(20,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(21,5): error TS2300: Duplicate identifier '1.'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(22,5): error TS2300: Duplicate identifier '1.00'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(26,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(27,5): error TS2300: Duplicate identifier '1.0'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(28,5): error TS2300: Duplicate identifier '1.'. -tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(29,5): error TS2300: Duplicate identifier '1.00'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(6,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(7,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(8,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(13,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(14,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(15,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(20,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(21,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(22,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(27,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(28,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(29,5): error TS2300: Duplicate identifier '1'. -==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (16 errors) ==== +==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (12 errors) ==== // numeric properties must be distinct after a ToNumber operation // so the below are all errors class C { 1; - ~ -!!! error TS2300: Duplicate identifier '1'. 1.0; ~~~ -!!! error TS2300: Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1'. 1.; ~~ -!!! error TS2300: Duplicate identifier '1.'. +!!! error TS2300: Duplicate identifier '1'. 1.00; ~~~~ -!!! error TS2300: Duplicate identifier '1.00'. +!!! error TS2300: Duplicate identifier '1'. } interface I { 1; - ~ -!!! error TS2300: Duplicate identifier '1'. 1.0; - ~~~ -!!! error TS2300: Duplicate identifier '1.0'. + ~~~~ +!!! error TS2300: Duplicate identifier '1'. 1.; - ~~ -!!! error TS2300: Duplicate identifier '1.'. + ~~~ +!!! error TS2300: Duplicate identifier '1'. 1.00; - ~~~~ -!!! error TS2300: Duplicate identifier '1.00'. + ~~~~~ +!!! error TS2300: Duplicate identifier '1'. } var a: { 1; - ~ -!!! error TS2300: Duplicate identifier '1'. 1.0; - ~~~ -!!! error TS2300: Duplicate identifier '1.0'. + ~~~~ +!!! error TS2300: Duplicate identifier '1'. 1.; - ~~ -!!! error TS2300: Duplicate identifier '1.'. + ~~~ +!!! error TS2300: Duplicate identifier '1'. 1.00; - ~~~~ -!!! error TS2300: Duplicate identifier '1.00'. + ~~~~~ +!!! error TS2300: Duplicate identifier '1'. } var b = { 1: 1, - ~ -!!! error TS2300: Duplicate identifier '1'. 1.0: 1, ~~~ -!!! error TS2300: Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1'. 1.: 1, ~~ -!!! error TS2300: Duplicate identifier '1.'. +!!! error TS2300: Duplicate identifier '1'. 1.00: 1 ~~~~ -!!! error TS2300: Duplicate identifier '1.00'. +!!! error TS2300: Duplicate identifier '1'. } \ No newline at end of file diff --git a/tests/baselines/reference/octalIntegerLiteralError.errors.txt b/tests/baselines/reference/octalIntegerLiteralError.errors.txt index f1386f75b87fe..dd1211983585f 100644 --- a/tests/baselines/reference/octalIntegerLiteralError.errors.txt +++ b/tests/baselines/reference/octalIntegerLiteralError.errors.txt @@ -1,11 +1,8 @@ tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts(2,19): error TS1005: ',' expected. tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts(3,18): error TS1005: ',' expected. -tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts(6,5): error TS2300: Duplicate identifier '0O45436'. -tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts(7,5): error TS2300: Duplicate identifier '19230'. -tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts(8,5): error TS2300: Duplicate identifier '"19230"'. -==== tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts (5 errors) ==== +==== tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralError.ts (2 errors) ==== // error var oct1 = 0O13334823; ~~~ @@ -16,13 +13,7 @@ tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/octalIntegerLiteralErro var obj1 = { 0O45436: "hi", - ~~~~~~~ -!!! error TS2300: Duplicate identifier '0O45436'. 19230: "Hello", - ~~~~~ -!!! error TS2300: Duplicate identifier '19230'. "19230": "world", - ~~~~~~~ -!!! error TS2300: Duplicate identifier '"19230"'. }; \ No newline at end of file diff --git a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt index f0a9995ba6fa0..125edd20f44b7 100644 --- a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt +++ b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt @@ -4,7 +4,6 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(11,8): error TS1131: Property o tests/cases/compiler/optionalPropertiesSyntax.ts(12,5): error TS1131: Property or signature expected. tests/cases/compiler/optionalPropertiesSyntax.ts(18,11): error TS1005: ';' expected. tests/cases/compiler/optionalPropertiesSyntax.ts(18,12): error TS1131: Property or signature expected. -tests/cases/compiler/optionalPropertiesSyntax.ts(24,5): error TS2300: Duplicate identifier 'prop'. tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2300: Duplicate identifier 'prop'. tests/cases/compiler/optionalPropertiesSyntax.ts(32,5): error TS2375: Duplicate number index signature. tests/cases/compiler/optionalPropertiesSyntax.ts(32,18): error TS1005: ';' expected. @@ -14,7 +13,7 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(33,7): error TS2375: Duplicate tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate number index signature. -==== tests/cases/compiler/optionalPropertiesSyntax.ts (14 errors) ==== +==== tests/cases/compiler/optionalPropertiesSyntax.ts (13 errors) ==== interface fnSigs { //functions signatures can be optional fn(): void; @@ -51,10 +50,8 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate interface propertySig { //Property signatures can be optional prop: any; - ~~~~ -!!! error TS2300: Duplicate identifier 'prop'. prop?: any; - ~~~~ + ~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'prop'. prop2?: any; } diff --git a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt index 5885385a20c4c..ed295755f1d57 100644 --- a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt +++ b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt @@ -1,10 +1,9 @@ tests/cases/compiler/parameterPropertyInConstructor2.ts(3,5): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/parameterPropertyInConstructor2.ts(3,17): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/compiler/parameterPropertyInConstructor2.ts(3,24): error TS2300: Duplicate identifier 'names'. -tests/cases/compiler/parameterPropertyInConstructor2.ts(4,24): error TS2300: Duplicate identifier 'names'. +tests/cases/compiler/parameterPropertyInConstructor2.ts(4,17): error TS2300: Duplicate identifier 'names'. -==== tests/cases/compiler/parameterPropertyInConstructor2.ts (4 errors) ==== +==== tests/cases/compiler/parameterPropertyInConstructor2.ts (3 errors) ==== module mod { class Customers { constructor(public names: string); @@ -12,10 +11,8 @@ tests/cases/compiler/parameterPropertyInConstructor2.ts(4,24): error TS2300: Dup !!! error TS2394: Overload signature is not compatible with function implementation. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. - ~~~~~ -!!! error TS2300: Duplicate identifier 'names'. constructor(public names: string, public ages: number) { - ~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'names'. } } diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index dfff2ea1a0968..93ac55f4c409f 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,28): error TS2304: Cannot find name 'DisplayPosition'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,45): error TS1137: Expression or comma expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,48): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,49): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,51): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,52): error TS1005: ';' expected. @@ -11,7 +10,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,57): error T tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,58): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,60): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,61): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,63): error TS2300: Duplicate identifier '0'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,64): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,66): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,67): error TS1005: ';' expected. @@ -34,7 +32,7 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error T tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'. -==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (34 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (32 errors) ==== export class Game { private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); ~~~~~~~~~~~~~~~ @@ -43,8 +41,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T !!! error TS1137: Expression or comma expected. ~ !!! error TS1005: ';' expected. - ~ -!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. ~ @@ -63,8 +59,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T !!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. - ~ -!!! error TS2300: Duplicate identifier '0'. ~ !!! error TS1005: ';' expected. ~ diff --git a/tests/baselines/reference/propertyNamedPrototype.errors.txt b/tests/baselines/reference/propertyNamedPrototype.errors.txt deleted file mode 100644 index 6ce4054fb43c9..0000000000000 --- a/tests/baselines/reference/propertyNamedPrototype.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/propertyNamedPrototype.ts(3,12): error TS2300: Duplicate identifier 'prototype'. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/propertyNamedPrototype.ts (1 errors) ==== - class C { - prototype: number; // ok - static prototype: C; // error - ~~~~~~~~~ -!!! error TS2300: Duplicate identifier 'prototype'. - } \ No newline at end of file diff --git a/tests/baselines/reference/propertyNamedPrototype.symbols b/tests/baselines/reference/propertyNamedPrototype.symbols new file mode 100644 index 0000000000000..6bbd0f49e333b --- /dev/null +++ b/tests/baselines/reference/propertyNamedPrototype.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/propertyNamedPrototype.ts === +class C { +>C : Symbol(C, Decl(propertyNamedPrototype.ts, 0, 0)) + + prototype: number; // ok +>prototype : Symbol(C.prototype, Decl(propertyNamedPrototype.ts, 0, 9)) + + static prototype: C; // error +>prototype : Symbol(C.prototype, Decl(propertyNamedPrototype.ts, 1, 22)) +>C : Symbol(C, Decl(propertyNamedPrototype.ts, 0, 0)) +} diff --git a/tests/baselines/reference/propertyNamedPrototype.types b/tests/baselines/reference/propertyNamedPrototype.types new file mode 100644 index 0000000000000..70a45d0bd495d --- /dev/null +++ b/tests/baselines/reference/propertyNamedPrototype.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/propertyNamedPrototype.ts === +class C { +>C : C + + prototype: number; // ok +>prototype : number + + static prototype: C; // error +>prototype : C +>C : C +} diff --git a/tests/baselines/reference/propertySignatures.errors.txt b/tests/baselines/reference/propertySignatures.errors.txt index fd415334e74a9..c60d29191a917 100644 --- a/tests/baselines/reference/propertySignatures.errors.txt +++ b/tests/baselines/reference/propertySignatures.errors.txt @@ -1,14 +1,11 @@ -tests/cases/compiler/propertySignatures.ts(2,13): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/propertySignatures.ts(2,23): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/propertySignatures.ts(14,12): error TS2304: Cannot find name 'foo'. -==== tests/cases/compiler/propertySignatures.ts (3 errors) ==== +==== tests/cases/compiler/propertySignatures.ts (2 errors) ==== // Should be error - duplicate identifiers var foo1: { a:string; a: string; }; - ~ -!!! error TS2300: Duplicate identifier 'a'. - ~ + ~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'a'. // Should be OK diff --git a/tests/baselines/reference/reassignStaticProp.errors.txt b/tests/baselines/reference/reassignStaticProp.errors.txt index bbcfe8267870a..7f67a6e7fc316 100644 --- a/tests/baselines/reference/reassignStaticProp.errors.txt +++ b/tests/baselines/reference/reassignStaticProp.errors.txt @@ -1,17 +1,17 @@ -tests/cases/compiler/reassignStaticProp.ts(3,12): error TS2300: Duplicate identifier 'bar'. tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2300: Duplicate identifier 'bar'. +tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' must be of type 'number', but here has type 'string'. ==== tests/cases/compiler/reassignStaticProp.ts (2 errors) ==== class foo { static bar = 1; - ~~~ -!!! error TS2300: Duplicate identifier 'bar'. static bar:string; // errror - duplicate id ~~~ !!! error TS2300: Duplicate identifier 'bar'. + ~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' must be of type 'number', but here has type 'string'. } diff --git a/tests/baselines/reference/staticPrototypeProperty.errors.txt b/tests/baselines/reference/staticPrototypeProperty.errors.txt index 19b3f3ffb20d1..c3f5cb99c96b1 100644 --- a/tests/baselines/reference/staticPrototypeProperty.errors.txt +++ b/tests/baselines/reference/staticPrototypeProperty.errors.txt @@ -1,8 +1,7 @@ tests/cases/compiler/staticPrototypeProperty.ts(2,11): error TS2300: Duplicate identifier 'prototype'. -tests/cases/compiler/staticPrototypeProperty.ts(6,11): error TS2300: Duplicate identifier 'prototype'. -==== tests/cases/compiler/staticPrototypeProperty.ts (2 errors) ==== +==== tests/cases/compiler/staticPrototypeProperty.ts (1 errors) ==== class C { static prototype() { } ~~~~~~~~~ @@ -11,6 +10,4 @@ tests/cases/compiler/staticPrototypeProperty.ts(6,11): error TS2300: Duplicate i class C2 { static prototype; - ~~~~~~~~~ -!!! error TS2300: Duplicate identifier 'prototype'. } \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt index b0ab5010ea5e8..d7f6c1825035c 100644 --- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2300: Duplicate identifier 'foo'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2300: Duplicate identifier 'foo'. -==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (2 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (1 errors) ==== // String literal types are only valid in overload signatures function foo(x: any); @@ -29,8 +28,6 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType var b = { foo(x: 'hi') { }, - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo(x: 'a') { }, ~~~ !!! error TS2300: Duplicate identifier 'foo'. diff --git a/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt b/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt index d24ece0d12679..ef395c59328ac 100644 --- a/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt +++ b/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt @@ -1,57 +1,39 @@ -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(2,5): error TS2300: Duplicate identifier '"a b"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(3,5): error TS2300: Duplicate identifier '"a b"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(4,12): error TS2300: Duplicate identifier '"c d"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(5,12): error TS2300: Duplicate identifier '"c d"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(9,5): error TS2300: Duplicate identifier '"a b"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(10,5): error TS2300: Duplicate identifier '"a b"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(14,5): error TS2300: Duplicate identifier '"a b"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(15,5): error TS2300: Duplicate identifier '"a b"'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(19,5): error TS2300: Duplicate identifier '"a b"'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(3,5): error TS2300: Duplicate identifier 'a b'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(5,12): error TS2300: Duplicate identifier 'c d'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(10,5): error TS2300: Duplicate identifier 'a b'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(15,5): error TS2300: Duplicate identifier 'a b'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(20,5): error TS2300: Duplicate identifier '"a b"'. -==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts (11 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts (5 errors) ==== class C { "a b": number; - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. "a b": number; ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. +!!! error TS2300: Duplicate identifier 'a b'. static "c d": number; - ~~~~~ -!!! error TS2300: Duplicate identifier '"c d"'. static "c d": number; ~~~~~ -!!! error TS2300: Duplicate identifier '"c d"'. +!!! error TS2300: Duplicate identifier 'c d'. } interface I { "a b": number; - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. "a b": number; - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'a b'. } var a: { "a b": number; - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. "a b": number; - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'a b'. } var b = { "a b": 1 - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. "a b": 1 ~~~~~ !!! error TS1005: ',' expected. - ~~~~~ -!!! error TS2300: Duplicate identifier '"a b"'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty36.errors.txt b/tests/baselines/reference/symbolProperty36.errors.txt deleted file mode 100644 index 6fe3299ab905e..0000000000000 --- a/tests/baselines/reference/symbolProperty36.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/es6/Symbols/symbolProperty36.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. -tests/cases/conformance/es6/Symbols/symbolProperty36.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - - -==== tests/cases/conformance/es6/Symbols/symbolProperty36.ts (2 errors) ==== - var x = { - [Symbol.isConcatSpreadable]: 0, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - [Symbol.isConcatSpreadable]: 1 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty36.symbols b/tests/baselines/reference/symbolProperty36.symbols new file mode 100644 index 0000000000000..9636c1c30f8f6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.symbols @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty36.ts === +var x = { +>x : Symbol(x, Decl(symbolProperty36.ts, 0, 3)) + + [Symbol.isConcatSpreadable]: 0, +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + + [Symbol.isConcatSpreadable]: 1 +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +} diff --git a/tests/baselines/reference/symbolProperty36.types b/tests/baselines/reference/symbolProperty36.types new file mode 100644 index 0000000000000..0f77ba4c2252e --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty36.ts === +var x = { +>x : { [Symbol.isConcatSpreadable]: number; } +>{ [Symbol.isConcatSpreadable]: 0, [Symbol.isConcatSpreadable]: 1} : { [Symbol.isConcatSpreadable]: number; } + + [Symbol.isConcatSpreadable]: 0, +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>0 : number + + [Symbol.isConcatSpreadable]: 1 +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>1 : number +} diff --git a/tests/baselines/reference/symbolProperty37.errors.txt b/tests/baselines/reference/symbolProperty37.errors.txt deleted file mode 100644 index 96e10e7f2a4e2..0000000000000 --- a/tests/baselines/reference/symbolProperty37.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/es6/Symbols/symbolProperty37.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. -tests/cases/conformance/es6/Symbols/symbolProperty37.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - - -==== tests/cases/conformance/es6/Symbols/symbolProperty37.ts (2 errors) ==== - interface I { - [Symbol.isConcatSpreadable]: string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - [Symbol.isConcatSpreadable]: string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty37.symbols b/tests/baselines/reference/symbolProperty37.symbols new file mode 100644 index 0000000000000..392bbf52c8cf1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.symbols @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty37.ts === +interface I { +>I : Symbol(I, Decl(symbolProperty37.ts, 0, 0)) + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +} diff --git a/tests/baselines/reference/symbolProperty37.types b/tests/baselines/reference/symbolProperty37.types new file mode 100644 index 0000000000000..4d8482deff5d5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty37.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolProperty38.errors.txt b/tests/baselines/reference/symbolProperty38.errors.txt deleted file mode 100644 index a519f7eb9a3d5..0000000000000 --- a/tests/baselines/reference/symbolProperty38.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/conformance/es6/Symbols/symbolProperty38.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. -tests/cases/conformance/es6/Symbols/symbolProperty38.ts(5,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - - -==== tests/cases/conformance/es6/Symbols/symbolProperty38.ts (2 errors) ==== - interface I { - [Symbol.isConcatSpreadable]: string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - } - interface I { - [Symbol.isConcatSpreadable]: string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. - } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty38.symbols b/tests/baselines/reference/symbolProperty38.symbols new file mode 100644 index 0000000000000..9bd7b40d9d0fe --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty38.ts === +interface I { +>I : Symbol(I, Decl(symbolProperty38.ts, 0, 0), Decl(symbolProperty38.ts, 2, 1)) + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +} +interface I { +>I : Symbol(I, Decl(symbolProperty38.ts, 0, 0), Decl(symbolProperty38.ts, 2, 1)) + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +} diff --git a/tests/baselines/reference/symbolProperty38.types b/tests/baselines/reference/symbolProperty38.types new file mode 100644 index 0000000000000..5c3faed61f47c --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty38.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +}