diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 489abd1ae51af..95bfc3b6b481b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12954,6 +12954,82 @@ 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) { + if (member.kind === SyntaxKind.Constructor) { + for (const param of (member as ConstructorDeclaration).parameters) { + if (isParameterPropertyDeclaration(param)) { + addName(instanceNames, param.name, (param.name as Identifier).text, property); + } + } + } + else { + const static = forEach(member.modifiers, m => m.kind === SyntaxKind.StaticKeyword); + const names = static ? staticNames : instanceNames; + + const memberName = member.name && getPropertyNameForPropertyNameNode(member.name); + switch (member.kind) { + 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, getTextOfNode(location)); + } + 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.symbol.valueDeclaration.name, Diagnostics.Duplicate_identifier_0, memberName); + error(member.name, Diagnostics.Duplicate_identifier_0, memberName); + } + else { + names[memberName] = true; + } + } + } + } + function checkTypeForDuplicateIndexSignatures(node: Node) { if (node.kind === SyntaxKind.InterfaceDeclaration) { const nodeSymbol = getSymbolOfNode(node); @@ -13238,6 +13314,7 @@ namespace ts { const type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); checkIndexConstraints(type); checkTypeForDuplicateIndexSignatures(node); + checkObjectTypeForDuplicateDeclarations(node); } } @@ -14430,6 +14507,10 @@ namespace ts { if (node.initializer) { checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } + if (!areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) { + error(symbol.valueDeclaration.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); + } } if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature) { // We know we don't have a binding pattern or computed name here @@ -14444,6 +14525,21 @@ namespace ts { } } + function areDeclarationFlagsIdentical(left: Declaration, right: Declaration) { + if (hasQuestionToken(left) !== hasQuestionToken(right)) { + return false; + } + + const interestingFlags = NodeFlags.Private | + NodeFlags.Protected | + NodeFlags.Async | + NodeFlags.Abstract | + NodeFlags.Readonly | + NodeFlags.Static; + + return (left.flags & interestingFlags) === (right.flags & interestingFlags); + } + function checkVariableDeclaration(node: VariableDeclaration) { checkGrammarVariableDeclaration(node); return checkVariableLikeDeclaration(node); @@ -15237,6 +15333,7 @@ namespace ts { const typeWithThis = getTypeWithThisArgument(type); const staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); + checkClassForDuplicateDeclarations(node); const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -15514,6 +15611,7 @@ namespace ts { checkIndexConstraints(type); } } + checkObjectTypeForDuplicateDeclarations(node); } forEach(getInterfaceBaseTypeNodes(node), heritageElement => { if (!isSupportedExpressionWithTypeArguments(heritageElement)) { @@ -18152,7 +18250,6 @@ namespace ts { name.kind === SyntaxKind.ComputedPropertyName) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); - continue; } if (prop.kind === SyntaxKind.ShorthandPropertyAssignment && !inDestructuring && (prop).objectAssignmentInitializer) { @@ -18198,17 +18295,22 @@ namespace ts { Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!hasProperty(seen, (name).text)) { - seen[(name).text] = currentKind; + const effectiveName = getPropertyNameForPropertyNameNode(name); + if (effectiveName === undefined) { + continue; + } + + if (!hasProperty(seen, effectiveName)) { + seen[effectiveName] = currentKind; } else { - const existingKind = seen[(name).text]; + const existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - continue; + grammarErrorOnNode(name, Diagnostics.Duplicate_identifier_0, getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[(name).text] = currentKind | existingKind; + seen[effectiveName] = currentKind | existingKind; } else { return grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 747192d105b1e..af8dd8ceb6971 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1927,6 +1927,10 @@ "category": "Error", "code": 2686 }, + "All declarations of '{0}' must have identical modifiers.": { + "category": "Error", + "code": 2687 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 563b4fea7b8d6..271285415c966 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2025,7 +2025,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/src/compiler/utilities.ts b/src/compiler/utilities.ts index 193a48109f065..7969389d788ed 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1774,7 +1774,7 @@ namespace ts { } export function getPropertyNameForPropertyNameNode(name: DeclarationName): string { - if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral) { + if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral || name.kind === SyntaxKind.Parameter) { return (name).text; } if (name.kind === SyntaxKind.ComputedPropertyName) { 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 index 48e52faae1e78..a28471a3f9176 100644 --- a/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.errors.txt +++ b/tests/baselines/reference/classAndInterfaceMergeConflictingMembers.errors.txt @@ -1,44 +1,38 @@ -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(10,15): error TS2686: All declarations of 'x' must have identical modifiers. +tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(14,5): error TS2686: All declarations of 'x' must have identical modifiers. +tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(18,13): error TS2686: All declarations of 'x' must have identical modifiers. +tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts(22,5): error TS2686: All declarations of 'x' must have identical modifiers. -==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceMergeConflictingMembers.ts (4 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'. +!!! error TS2686: All declarations of 'x' must have identical modifiers. } interface C2 { x : number; ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2686: All declarations of 'x' must have identical modifiers. } declare class C3 { private x : number; ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2686: All declarations of 'x' must have identical modifiers. } interface C3 { x : number; ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2686: All declarations of 'x' must have identical modifiers. } \ No newline at end of file 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..1bc487189d38b 100644 --- a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt +++ b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt @@ -1,12 +1,8 @@ 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(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(9,25): error TS2686: All declarations of 'x' must have identical modifiers. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(10,24): error TS2686: All declarations of 'x' must have identical modifiers. 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,24 +14,16 @@ 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 (14 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'. } class C2 { @@ -43,10 +31,10 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatur ~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2686: All declarations of 'x' must have identical modifiers. constructor(public x) { } ~ -!!! error TS2300: Duplicate identifier 'x'. +!!! error TS2686: All declarations of 'x' must have identical modifiers. } class C3 { diff --git a/tests/baselines/reference/constructorParameterProperties2.errors.txt b/tests/baselines/reference/constructorParameterProperties2.errors.txt index 42df015bc5beb..409660c313368 100644 --- a/tests/baselines/reference/constructorParameterProperties2.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties2.errors.txt @@ -1,12 +1,13 @@ -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(18,5): error TS2686: All declarations of 'y' must have identical modifiers. 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(19,25): error TS2686: All declarations of 'y' must have identical modifiers. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(26,5): error TS2686: All declarations of 'y' must have identical modifiers. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,27): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,27): error TS2686: All declarations of 'y' must have identical modifiers. -==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (6 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (7 errors) ==== class C { y: number; constructor(y: number) { } // ok @@ -17,8 +18,6 @@ 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'. @@ -30,10 +29,12 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co class E { y: number; ~ -!!! error TS2300: Duplicate identifier 'y'. +!!! error TS2686: All declarations of 'y' must have identical modifiers. constructor(private y: number) { } // error ~ !!! error TS2300: Duplicate identifier 'y'. + ~ +!!! error TS2686: All declarations of 'y' must have identical modifiers. } var e: E; @@ -42,10 +43,12 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co class F { y: number; ~ -!!! error TS2300: Duplicate identifier 'y'. +!!! error TS2686: All declarations of 'y' must have identical modifiers. constructor(protected y: number) { } // error ~ !!! error TS2300: Duplicate identifier 'y'. + ~ +!!! error TS2686: All declarations of 'y' must have identical modifiers. } var f: F; 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/duplicateIdentifierComputedName.errors.txt b/tests/baselines/reference/duplicateIdentifierComputedName.errors.txt new file mode 100644 index 0000000000000..faef1106c4122 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierComputedName.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/duplicateIdentifierComputedName.ts(3,5): error TS2300: Duplicate identifier 'a'. + + +==== tests/cases/compiler/duplicateIdentifierComputedName.ts (1 errors) ==== + class C { + ["a"]: string; + ["a"]: string; + ~~~~~ +!!! error TS2300: Duplicate identifier 'a'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifierComputedName.js b/tests/baselines/reference/duplicateIdentifierComputedName.js new file mode 100644 index 0000000000000..df488d8072406 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierComputedName.js @@ -0,0 +1,13 @@ +//// [duplicateIdentifierComputedName.ts] +class C { + ["a"]: string; + ["a"]: string; +} + + +//// [duplicateIdentifierComputedName.js] +var C = (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/duplicateIdentifierDifferentModifiers.errors.txt b/tests/baselines/reference/duplicateIdentifierDifferentModifiers.errors.txt new file mode 100644 index 0000000000000..c25609bfa4258 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierDifferentModifiers.errors.txt @@ -0,0 +1,37 @@ +tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts(2,15): error TS2686: All declarations of 'x' must have identical modifiers. +tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts(3,15): error TS2686: All declarations of 'x' must have identical modifiers. +tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts(16,11): error TS2686: All declarations of 'y' must have identical modifiers. +tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts(20,3): error TS2686: All declarations of 'y' must have identical modifiers. + + +==== tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts (4 errors) ==== + // Not OK + interface B { x; } + ~ +!!! error TS2686: All declarations of 'x' must have identical modifiers. + interface B { x?; } + ~ +!!! error TS2686: All declarations of 'x' must have identical modifiers. + + // OK + class A { + public y: string; + } + + interface A { + y: string; + } + + // Not OK + class C { + private y: string; + ~ +!!! error TS2686: All declarations of 'y' must have identical modifiers. + } + + interface C { + y: string; + ~ +!!! error TS2686: All declarations of 'y' must have identical modifiers. + } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifierDifferentModifiers.js b/tests/baselines/reference/duplicateIdentifierDifferentModifiers.js new file mode 100644 index 0000000000000..6500380f35883 --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierDifferentModifiers.js @@ -0,0 +1,37 @@ +//// [duplicateIdentifierDifferentModifiers.ts] +// Not OK +interface B { x; } +interface B { x?; } + +// OK +class A { + public y: string; +} + +interface A { + y: string; +} + +// Not OK +class C { + private y: string; +} + +interface C { + y: string; +} + + +//// [duplicateIdentifierDifferentModifiers.js] +// OK +var A = (function () { + function A() { + } + return A; +}()); +// Not OK +var C = (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/duplicateIdentifierDifferentSpelling.errors.txt b/tests/baselines/reference/duplicateIdentifierDifferentSpelling.errors.txt new file mode 100644 index 0000000000000..fda0f4a66d98a --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierDifferentSpelling.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/duplicateIdentifierDifferentSpelling.ts(3,3): error TS2300: Duplicate identifier '3'. +tests/cases/compiler/duplicateIdentifierDifferentSpelling.ts(6,21): error TS2300: Duplicate identifier '3'. + + +==== tests/cases/compiler/duplicateIdentifierDifferentSpelling.ts (2 errors) ==== + class A { + 0b11 = ''; + 3 = ''; + ~ +!!! error TS2300: Duplicate identifier '3'. + } + + var X = { 0b11: '', 3: '' }; + ~ +!!! error TS2300: Duplicate identifier '3'. + \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifierDifferentSpelling.js b/tests/baselines/reference/duplicateIdentifierDifferentSpelling.js new file mode 100644 index 0000000000000..96e5781919deb --- /dev/null +++ b/tests/baselines/reference/duplicateIdentifierDifferentSpelling.js @@ -0,0 +1,18 @@ +//// [duplicateIdentifierDifferentSpelling.ts] +class A { + 0b11 = ''; + 3 = ''; +} + +var X = { 0b11: '', 3: '' }; + + +//// [duplicateIdentifierDifferentSpelling.js] +var A = (function () { + function A() { + this[3] = ''; + this[3] = ''; + } + return A; +}()); +var X = { 3: '', 3: '' }; diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt index 0dd5febe496ec..abc56a6f8fce7 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt @@ -1,8 +1,6 @@ -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(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(14,9): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS2300: Duplicate identifier 'a'. @@ -10,11 +8,9 @@ tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An o 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 ~ @@ -26,8 +22,6 @@ tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Dupl ~ !!! error TS2300: Duplicate identifier 'a'. c: 1, - ~ -!!! error TS2300: Duplicate identifier 'c'. "c": 56, // Duplicate ~~~ !!! 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..f8ed73c570740 100644 --- a/tests/baselines/reference/duplicatePropertyNames.errors.txt +++ b/tests/baselines/reference/duplicatePropertyNames.errors.txt @@ -2,11 +2,9 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(4,5): error TS23 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'. @@ -14,13 +12,11 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(35,5): error TS2 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 (16 errors) ==== // duplicate property names are an error in all types interface Number { @@ -48,8 +44,6 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2 class C { foo: string; - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. foo: string; ~~~ !!! error TS2300: Duplicate identifier 'foo'. @@ -62,8 +56,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'. @@ -96,14 +88,10 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2 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..c9652ef02d5fd 100644 --- a/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt +++ b/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateStringNamedProperty1.ts(2,5): error TS2300: Duplicate identifier '"artist"'. +tests/cases/compiler/duplicateStringNamedProperty1.ts(2,5): error TS2300: Duplicate identifier 'artist'. tests/cases/compiler/duplicateStringNamedProperty1.ts(3,5): error TS2300: Duplicate identifier 'artist'. @@ -6,7 +6,7 @@ tests/cases/compiler/duplicateStringNamedProperty1.ts(3,5): error TS2300: Duplic export interface Album { "artist": string; ~~~~~~~~ -!!! error TS2300: Duplicate identifier '"artist"'. +!!! error TS2300: Duplicate identifier 'artist'. artist: string; ~~~~~~ !!! error TS2300: Duplicate identifier 'artist'. 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..95b3d90ca2cbb 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -2,6 +2,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate iden 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 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(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'. Property 'prototype' is missing in type 'C1'. @@ -10,7 +11,7 @@ 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 (9 errors) ==== interface I1 { item:number; ~~~~ @@ -27,6 +28,8 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i item:number; ~~~~ !!! error TS2300: Duplicate identifier 'item'. + ~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'item' must be of type 'any', but here has type 'number'. } interface I3 { 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..24801f2847ab0 100644 --- a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt +++ b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt @@ -1,27 +1,19 @@ -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(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(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 (7 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'. @@ -33,7 +25,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP !!! error TS2300: Duplicate identifier '2'. 2.: number; ~~ -!!! error TS2300: Duplicate identifier '2.'. +!!! error TS2300: Duplicate identifier '2'. } var a: { @@ -47,11 +39,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP 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..359a45ded51bf 100644 --- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt +++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt @@ -1,30 +1,27 @@ -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(10,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(16,5): error TS2300: Duplicate identifier '1'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1'. +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(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 (7 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"'. +!!! error TS2300: Duplicate identifier '1'. "1.": number; // not a duplicate 1: number; ~ @@ -34,16 +31,16 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString var a: { "1": number; ~~~ -!!! error TS2300: Duplicate identifier '"1"'. +!!! error TS2300: Duplicate identifier '1'. 1.0: string; ~~~ -!!! error TS2300: Duplicate identifier '1.0'. +!!! error TS2300: Duplicate identifier '1'. + ~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' must be of type 'number', but here has type 'string'. } 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..2505748760cab 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(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(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(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(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''. 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"'. var e9 = { 'a': 0, 'a': 0 }; - ~~~ -!!! 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''. var e11 = { 1.0: 0, '1': 0 }; - ~~~ -!!! error TS2300: Duplicate identifier '1.0'. ~~~ !!! 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'. ~~~ !!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier '000'. var e15 = { "100": 0, 1e2: 0 }; - ~~~~~ -!!! error TS2300: Duplicate identifier '"100"'. ~~~ !!! error TS2300: Duplicate identifier '1e2'. var e16 = { 0x20: 0, 3.2e1: 0 }; - ~~~~ -!!! error TS2300: Duplicate identifier '0x20'. ~~~~~ !!! error TS2300: Duplicate identifier '3.2e1'. 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..0565bf884e033 100644 --- a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt +++ b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt @@ -1,38 +1,34 @@ -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(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(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(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(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(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.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 (16 errors) ==== +==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (14 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 { @@ -41,13 +37,13 @@ tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts( !!! 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: { @@ -56,19 +52,17 @@ tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts( !!! 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'. 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..51e49e048d550 100644 --- a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt +++ b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt @@ -5,7 +5,9 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(12,5): error TS1131: Property o 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(24,5): error TS2686: All declarations of 'prop' must have identical modifiers. tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2300: Duplicate identifier 'prop'. +tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2686: All declarations of 'prop' must have identical modifiers. tests/cases/compiler/optionalPropertiesSyntax.ts(32,5): error TS2375: Duplicate number index signature. tests/cases/compiler/optionalPropertiesSyntax.ts(32,18): error TS1005: ';' expected. tests/cases/compiler/optionalPropertiesSyntax.ts(32,19): error TS1131: Property or signature expected. @@ -14,7 +16,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 (16 errors) ==== interface fnSigs { //functions signatures can be optional fn(): void; @@ -53,9 +55,13 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate prop: any; ~~~~ !!! error TS2300: Duplicate identifier 'prop'. + ~~~~ +!!! error TS2686: All declarations of 'prop' must have identical modifiers. prop?: any; ~~~~ !!! error TS2300: Duplicate identifier 'prop'. + ~~~~ +!!! error TS2686: All declarations of 'prop' must have identical modifiers. prop2?: any; } diff --git a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt index 5885385a20c4c..a99db2a39ad97 100644 --- a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt +++ b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt @@ -1,10 +1,8 @@ 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 errors) ==== +==== tests/cases/compiler/parameterPropertyInConstructor2.ts (2 errors) ==== module mod { class Customers { constructor(public names: string); @@ -12,11 +10,7 @@ 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/parserComputedPropertyName5.errors.txt b/tests/baselines/reference/parserComputedPropertyName5.errors.txt index 09c38ecbef512..51c718269fb96 100644 --- a/tests/baselines/reference/parserComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName5.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,11): error TS1042: 'public' modifier cannot be used here. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (3 errors) ==== var v = { public get [e]() { } }; + ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. ~~~ !!! error TS2378: A 'get' accessor must return a value. ~ 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/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..f6ae46d9b280b 100644 --- a/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt +++ b/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt @@ -1,57 +1,45 @@ -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(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(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 (7 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"'. +!!! 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"'. +!!! 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 index 6fe3299ab905e..69102da1db387 100644 --- a/tests/baselines/reference/symbolProperty36.errors.txt +++ b/tests/baselines/reference/symbolProperty36.errors.txt @@ -1,12 +1,9 @@ -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) ==== +==== tests/cases/conformance/es6/Symbols/symbolProperty36.ts (1 errors) ==== var x = { [Symbol.isConcatSpreadable]: 0, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. [Symbol.isConcatSpreadable]: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. 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 +} diff --git a/tests/baselines/reference/symbolProperty44.errors.txt b/tests/baselines/reference/symbolProperty44.errors.txt index 2cef480e73664..984a20e99749e 100644 --- a/tests/baselines/reference/symbolProperty44.errors.txt +++ b/tests/baselines/reference/symbolProperty44.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/es6/Symbols/symbolProperty44.ts(2,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Duplicate identifier '__@hasInstance'. -==== tests/cases/conformance/es6/Symbols/symbolProperty44.ts (2 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolProperty44.ts (3 errors) ==== class C { get [Symbol.hasInstance]() { ~~~~~~~~~~~~~~~~~~~~ @@ -12,6 +13,8 @@ tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Dupl get [Symbol.hasInstance]() { ~~~~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '__@hasInstance'. return ""; } } \ No newline at end of file diff --git a/tests/cases/compiler/duplicateIdentifierComputedName.ts b/tests/cases/compiler/duplicateIdentifierComputedName.ts new file mode 100644 index 0000000000000..8547f85006f49 --- /dev/null +++ b/tests/cases/compiler/duplicateIdentifierComputedName.ts @@ -0,0 +1,4 @@ +class C { + ["a"]: string; + ["a"]: string; +} diff --git a/tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts b/tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts new file mode 100644 index 0000000000000..67ec8e1a19fb9 --- /dev/null +++ b/tests/cases/compiler/duplicateIdentifierDifferentModifiers.ts @@ -0,0 +1,21 @@ +// Not OK +interface B { x; } +interface B { x?; } + +// OK +class A { + public y: string; +} + +interface A { + y: string; +} + +// Not OK +class C { + private y: string; +} + +interface C { + y: string; +} diff --git a/tests/cases/compiler/duplicateIdentifierDifferentSpelling.ts b/tests/cases/compiler/duplicateIdentifierDifferentSpelling.ts new file mode 100644 index 0000000000000..bf2b4c123fef7 --- /dev/null +++ b/tests/cases/compiler/duplicateIdentifierDifferentSpelling.ts @@ -0,0 +1,6 @@ +class A { + 0b11 = ''; + 3 = ''; +} + +var X = { 0b11: '', 3: '' };