diff --git a/Jakefile b/Jakefile
index db8d670b0bf..da91239d7a5 100644
--- a/Jakefile
+++ b/Jakefile
@@ -57,7 +57,9 @@ var servicesSources = [
"services.ts",
"shims.ts",
"signatureHelp.ts",
- "utilities.ts"
+ "utilities.ts",
+ "navigationBar.ts",
+ "outliningElementsCollector.ts"
].map(function (f) {
return path.join(servicesDirectory, f);
}));
@@ -126,6 +128,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
}
var useDebugMode = false;
+var generateDeclarations = false;
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
var compilerFilename = "tsc.js";
/* Compiles a file from a list of sources
@@ -140,6 +143,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
file(outFile, prereqs, function() {
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
var options = "-removeComments --module commonjs -noImplicitAny "; //" -propagateEnumConstants "
+ if (generateDeclarations) {
+ options += "--declaration ";
+ }
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
if (useDebugMode) {
@@ -248,7 +254,7 @@ task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]);
// Local target to build the compiler and services
desc("Emit debug mode files with sourcemaps");
task("debug", function() {
- useDebugMode = true;
+ useDebugMode = true;
});
@@ -262,6 +268,12 @@ task("clean", function() {
jake.rmRf(builtDirectory);
});
+// generate declarations for compiler and services
+desc("Generate declarations for compiler and services");
+task("declaration", function() {
+ generateDeclarations = true;
+});
+
// Generate Markdown spec
var word2mdJs = path.join(scriptsDirectory, "word2md.js");
var word2mdTs = path.join(scriptsDirectory, "word2md.ts");
@@ -281,12 +293,12 @@ compileFile(word2mdJs,
// The generated spec.md; built for the 'generate-spec' task
file(specMd, [word2mdJs, specWord], function () {
jake.cpR(headerMd, specMd, {silent: true});
- var specWordFullPath = path.resolve(specWord);
+ var specWordFullPath = path.resolve(specWord);
var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" >>' + specMd;
- console.log(cmd);
- child_process.exec(cmd, function () {
- complete();
- });
+ console.log(cmd);
+ child_process.exec(cmd, function () {
+ complete();
+ });
}, {async: true})
diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx
index 740dd2c6034..381ac186a4b 100644
Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ
diff --git a/doc/TypeScript Language Specification.pdf b/doc/TypeScript Language Specification.pdf
index 4263dd72dc1..049f7e06fb3 100644
Binary files a/doc/TypeScript Language Specification.pdf and b/doc/TypeScript Language Specification.pdf differ
diff --git a/doc/spec.md b/doc/spec.md
index e49132c61fc..5635c100a40 100644
--- a/doc/spec.md
+++ b/doc/spec.md
@@ -581,10 +581,10 @@ For this switch statement, the compiler will generate the following code.
```TypeScript
switch (op) {
- case 0 /* Operator.ADD */ :
+ case 0 /* Operator.ADD */:
// execute add
break;
- case 1 /* Operator.DIV */ :
+ case 1 /* Operator.DIV */:
// execute div
break;
// ...
@@ -738,7 +738,7 @@ var M;
return s;
}
M.f = f;
-})(M||(M={}));
+})(M || (M = {}));
```
In this case, the compiler assumes that the module object resides in global variable ‘M’, which may or may not have been initialized to the desired module object.
@@ -1068,7 +1068,7 @@ Type references (section [3.6.2](#3.6.2)) to class and interface types are class
### 3.3.2 Array Types
-***Array types*** represent JavaScript arrays with a common element type. Array types are named type references created from the generic interface type ‘Array’ in the global module with the array element type as a type argument. Array type literals (section [Error! Reference source not found.](#Error! Reference source not found.)) provide a shorthand notation for creating such references.
+***Array types*** represent JavaScript arrays with a common element type. Array types are named type references created from the generic interface type ‘Array’ in the global module with the array element type as a type argument. Array type literals (section [3.6.4](#3.6.4)) provide a shorthand notation for creating such references.
The declaration of the ‘Array’ interface includes a property ‘length’ and a numeric index signature for the element type, along with other members:
diff --git a/package.json b/package.json
index 6b1d991cca6..00752302254 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
- "version": "1.1.0",
+ "version": "1.3.0",
"licenses": [
{
"type": "Apache License 2.0",
diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts
index 3959335542c..c9f9d6bf6e3 100644
--- a/src/compiler/binder.ts
+++ b/src/compiler/binder.ts
@@ -84,8 +84,13 @@ module ts {
if (node.name) {
node.name.parent = node;
}
- file.semanticErrors.push(createDiagnosticForNode(node.name ? node.name : node,
- Diagnostics.Duplicate_identifier_0, getDisplayName(node)));
+ // Report errors every position with duplicate declaration
+ // Report errors on previous encountered declarations
+ forEach(symbol.declarations, (declaration) => {
+ file.semanticErrors.push(createDiagnosticForNode(declaration.name, Diagnostics.Duplicate_identifier_0, getDisplayName(declaration)));
+ });
+ file.semanticErrors.push(createDiagnosticForNode(node.name, Diagnostics.Duplicate_identifier_0, getDisplayName(node)));
+
symbol = createSymbol(0, name);
}
}
@@ -332,7 +337,7 @@ module ts {
break;
case SyntaxKind.SourceFile:
if (isExternalModule(node)) {
- bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + getModuleNameFromFilename((node).filename) + '"');
+ bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).filename) + '"');
break;
}
default:
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 1d710c9315c..180d6ceb6fe 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -92,7 +92,9 @@ module ts {
getContextualType: getContextualType,
getFullyQualifiedName: getFullyQualifiedName,
getResolvedSignature: getResolvedSignature,
- getEnumMemberValue: getEnumMemberValue
+ getEnumMemberValue: getEnumMemberValue,
+ isValidPropertyAccess: isValidPropertyAccess,
+ getAliasedSymbol: resolveImport
};
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
@@ -2753,7 +2755,7 @@ module ts {
function getStringLiteralType(node: StringLiteralTypeNode): StringLiteralType {
if (hasProperty(stringLiteralTypes, node.text)) return stringLiteralTypes[node.text];
var type = stringLiteralTypes[node.text] = createType(TypeFlags.StringLiteral);
- type.text = getSourceTextOfNode(node);
+ type.text = getTextOfNode(node);
return type;
}
@@ -4709,6 +4711,25 @@ module ts {
return anyType;
}
+ function isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean {
+ var type = checkExpression(node.left);
+ if (type !== unknownType && type !== anyType) {
+ var apparentType = getApparentType(getWidenedType(type));
+ var prop = getPropertyOfApparentType(apparentType, propertyName);
+ if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) {
+ if (node.left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) {
+ return false;
+ }
+ else {
+ var diagnosticsCount = diagnostics.length;
+ checkClassPropertyAccess(node, type, prop);
+ return diagnostics.length === diagnosticsCount
+ }
+ }
+ }
+ return true;
+ }
+
function checkIndexedAccess(node: IndexedAccess): Type {
var objectType = checkExpression(node.object);
var indexType = checkExpression(node.index);
@@ -4781,25 +4802,32 @@ module ts {
}
function signatureHasCorrectArity(node: CallExpression, signature: Signature): boolean {
- var args = node.arguments || emptyArray;
- var isCorrect = args.length >= signature.minArgumentCount &&
- (signature.hasRestParameter || args.length <= signature.parameters.length) &&
- (!node.typeArguments || signature.typeParameters && node.typeArguments.length === signature.typeParameters.length);
-
- // For error recovery, since we have parsed OmittedExpressions for any extra commas
- // in the argument list, if we see any OmittedExpressions, just return true.
- // The reason this is ok is because omitted expressions here are syntactically
- // illegal, and will cause a parse error.
- // Note: It may be worth keeping the upper bound check on arity, but removing
- // the lower bound check if there are omitted expressions.
- if (!isCorrect) {
- // Technically this type assertion is not safe because args could be initialized to emptyArray
- // above.
- if ((>args).hasTrailingComma || forEach(args, arg => arg.kind === SyntaxKind.OmittedExpression)) {
- return true;
- }
+ if (!node.arguments) {
+ // This only happens when we have something of the form:
+ // new C
+ //
+ return signature.minArgumentCount === 0;
}
- return isCorrect;
+
+ // For IDE scenarios, since we may have an incomplete call, we make two modifications
+ // to arity checking.
+ // 1. A trailing comma is tantamount to adding another argument
+ // 2. If the call is incomplete (no closing paren) allow fewer arguments than expected
+ var args = node.arguments;
+ var numberOfArgs = args.hasTrailingComma ? args.length + 1 : args.length;
+ var hasTooManyArguments = !signature.hasRestParameter && numberOfArgs > signature.parameters.length;
+ var hasRightNumberOfTypeArguments = !node.typeArguments ||
+ (signature.typeParameters && node.typeArguments.length === signature.typeParameters.length);
+
+ if (hasTooManyArguments || !hasRightNumberOfTypeArguments) {
+ return false;
+ }
+
+ // If we are missing the close paren, the call is incomplete, and we should skip
+ // the lower bound check.
+ var callIsIncomplete = args.end === node.end;
+ var hasEnoughArguments = numberOfArgs >= signature.minArgumentCount;
+ return callIsIncomplete || hasEnoughArguments;
}
// If type has a single call signature and no other members, return that signature. Otherwise, return undefined.
@@ -5501,10 +5529,21 @@ module ts {
if (leftType.flags & (TypeFlags.Undefined | TypeFlags.Null)) leftType = rightType;
if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType;
- var leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
- var rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
- if (leftOk && rightOk) {
- checkAssignmentOperator(numberType);
+ var suggestedOperator: SyntaxKind;
+ // if a user tries to apply a bitwise operator to 2 boolean operands
+ // try and return them a helpful suggestion
+ if ((leftType.flags & TypeFlags.Boolean) &&
+ (rightType.flags & TypeFlags.Boolean) &&
+ (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) {
+ error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operator), tokenToString(suggestedOperator));
+ }
+ else {
+ // otherwise just check each operand separately and report errors as normal
+ var leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
+ var rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
+ if (leftOk && rightOk) {
+ checkAssignmentOperator(numberType);
+ }
}
return numberType;
@@ -5569,6 +5608,22 @@ module ts {
case SyntaxKind.CommaToken:
return rightType;
}
+
+ function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind {
+ switch (operator) {
+ case SyntaxKind.BarToken:
+ case SyntaxKind.BarEqualsToken:
+ return SyntaxKind.BarBarToken;
+ case SyntaxKind.CaretToken:
+ case SyntaxKind.CaretEqualsToken:
+ return SyntaxKind.ExclamationEqualsEqualsToken;
+ case SyntaxKind.AmpersandToken:
+ case SyntaxKind.AmpersandEqualsToken:
+ return SyntaxKind.AmpersandAmpersandToken;
+ default:
+ return undefined;
+ }
+ }
function checkAssignmentOperator(valueType: Type): void {
if (fullTypeCheck && operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) {
@@ -6104,6 +6159,10 @@ module ts {
var isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0;
function reportImplementationExpectedError(node: FunctionDeclaration): void {
+ if (node.name && node.name.kind === SyntaxKind.Missing) {
+ return;
+ }
+
var seen = false;
var subsequentNode = forEachChild(node.parent, c => {
if (seen) {
@@ -6142,6 +6201,8 @@ module ts {
// when checking exported function declarations across modules check only duplicate implementations
// names and consistency of modifiers are verified when we check local symbol
var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module;
+ var duplicateFunctionDeclaration = false;
+ var multipleConstructorImplementation = false;
for (var i = 0; i < declarations.length; i++) {
var node = declarations[i];
var inAmbientContext = isInAmbientContext(node);
@@ -6164,10 +6225,10 @@ module ts {
if (node.body && bodyDeclaration) {
if (isConstructor) {
- error(node, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
+ multipleConstructorImplementation = true;
}
else {
- error(node, Diagnostics.Duplicate_function_implementation);
+ duplicateFunctionDeclaration = true;
}
}
else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) {
@@ -6191,6 +6252,18 @@ module ts {
}
}
+ if (multipleConstructorImplementation) {
+ forEach(declarations, declaration => {
+ error(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed);
+ });
+ }
+
+ if (duplicateFunctionDeclaration) {
+ forEach( declarations, declaration => {
+ error(declaration.name, Diagnostics.Duplicate_function_implementation);
+ });
+ }
+
if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) {
reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
}
@@ -7533,23 +7606,6 @@ module ts {
return mapToArray(symbols);
}
- // True if the given identifier is the name of a type declaration node (class, interface, enum, type parameter, etc)
- function isTypeDeclarationName(name: Node): boolean {
- return name.kind == SyntaxKind.Identifier &&
- isTypeDeclaration(name.parent) &&
- (name.parent).name === name;
- }
-
- function isTypeDeclaration(node: Node): boolean {
- switch (node.kind) {
- case SyntaxKind.TypeParameter:
- case SyntaxKind.ClassDeclaration:
- case SyntaxKind.InterfaceDeclaration:
- case SyntaxKind.EnumDeclaration:
- return true;
- }
- }
-
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(entityName: EntityName): boolean {
var node: Node = entityName;
@@ -7628,75 +7684,6 @@ module ts {
return false;
}
- function isTypeNode(node: Node): boolean {
- if (node.kind >= SyntaxKind.FirstTypeNode && node.kind <= SyntaxKind.LastTypeNode) {
- return true;
- }
-
- switch (node.kind) {
- case SyntaxKind.AnyKeyword:
- case SyntaxKind.NumberKeyword:
- case SyntaxKind.StringKeyword:
- case SyntaxKind.BooleanKeyword:
- return true;
- case SyntaxKind.VoidKeyword:
- return node.parent.kind !== SyntaxKind.PrefixOperator;
- case SyntaxKind.StringLiteral:
- // Specialized signatures can have string literals as their parameters' type names
- return node.parent.kind === SyntaxKind.Parameter;
- // Identifiers and qualified names may be type nodes, depending on their context. Climb
- // above them to find the lowest container
- case SyntaxKind.Identifier:
- // If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === SyntaxKind.QualifiedName) {
- node = node.parent;
- }
- // Fall through
- case SyntaxKind.QualifiedName:
- // At this point, node is either a qualified name or an identifier
- var parent = node.parent;
- if (parent.kind === SyntaxKind.TypeQuery) {
- return false;
- }
- // Do not recursively call isTypeNode on the parent. In the example:
- //
- // var a: A.B.C;
- //
- // Calling isTypeNode would consider the qualified name A.B a type node. Only C or
- // A.B.C is a type node.
- if (parent.kind >= SyntaxKind.FirstTypeNode && parent.kind <= SyntaxKind.LastTypeNode) {
- return true;
- }
- switch (parent.kind) {
- case SyntaxKind.TypeParameter:
- return node === (parent).constraint;
- case SyntaxKind.Property:
- case SyntaxKind.Parameter:
- case SyntaxKind.VariableDeclaration:
- return node === (parent).type;
- case SyntaxKind.FunctionDeclaration:
- case SyntaxKind.FunctionExpression:
- case SyntaxKind.ArrowFunction:
- case SyntaxKind.Constructor:
- case SyntaxKind.Method:
- case SyntaxKind.GetAccessor:
- case SyntaxKind.SetAccessor:
- return node === (parent).type;
- case SyntaxKind.CallSignature:
- case SyntaxKind.ConstructSignature:
- case SyntaxKind.IndexSignature:
- return node === (parent).type;
- case SyntaxKind.TypeAssertion:
- return node === (parent).type;
- case SyntaxKind.CallExpression:
- case SyntaxKind.NewExpression:
- return (parent).typeArguments.indexOf(node) >= 0;
- }
- }
-
- return false;
- }
-
function isInRightSideOfImportOrExportAssignment(node: EntityName) {
while (node.parent.kind === SyntaxKind.QualifiedName) {
node = node.parent;
@@ -7950,7 +7937,7 @@ module ts {
while (!isUniqueLocalName(escapeIdentifier(prefix + name), container)) {
prefix += "_";
}
- links.localModuleName = prefix + getSourceTextOfNode(container.name);
+ links.localModuleName = prefix + getTextOfNode(container.name);
}
return links.localModuleName;
}
diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index 8d8ea66d86b..ee7f4701d19 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -209,11 +209,9 @@ module ts {
export var localizedDiagnosticMessages: Map = undefined;
export function getLocaleSpecificMessage(message: string) {
- if (ts.localizedDiagnosticMessages) {
- message = localizedDiagnosticMessages[message];
- }
-
- return message;
+ return localizedDiagnosticMessages && localizedDiagnosticMessages[message]
+ ? localizedDiagnosticMessages[message]
+ : message;
}
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
@@ -478,7 +476,7 @@ module ts {
}
}
- export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, isAbsolutePathAnUrl: boolean) {
+ export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean) {
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
@@ -489,7 +487,7 @@ module ts {
// Find the component that differs
for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
- if (directoryComponents[joinStartIndex] !== pathComponents[joinStartIndex]) {
+ if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {
break;
}
}
@@ -535,6 +533,43 @@ module ts {
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
}
+ var supportedExtensions = [".d.ts", ".ts", ".js"];
+
+ export function removeFileExtension(path: string): string {
+ for (var i = 0; i < supportedExtensions.length; i++) {
+ var ext = supportedExtensions[i];
+
+ if (fileExtensionIs(path, ext)) {
+ return path.substr(0, path.length - ext.length);
+ }
+ }
+
+ return path;
+ }
+
+ var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\\\u2028\u2029\u0085]/g;
+ var escapedCharsMap: Map = {
+ "\t": "\\t",
+ "\v": "\\v",
+ "\f": "\\f",
+ "\b": "\\b",
+ "\0": "\\0",
+ "\r": "\\r",
+ "\n": "\\n",
+ "\"": "\\\"",
+ "\u2028": "\\u2028", // lineSeparator
+ "\u2029": "\\u2029", // paragraphSeparator
+ "\u0085": "\\u0085" // nextLine
+ };
+
+ /** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names
+ * or string literals. If the information encoded in the map changes, this needs to be revisited. */
+ export function escapeString(s: string): string {
+ return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, c => {
+ return escapedCharsMap[c] || c;
+ }) : s;
+ }
+
export interface ObjectAllocator {
getNodeConstructor(kind: SyntaxKind): new () => Node;
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts
index 266d0a14c4b..8d477e4682c 100644
--- a/src/compiler/diagnosticInformationMap.generated.ts
+++ b/src/compiler/diagnosticInformationMap.generated.ts
@@ -5,6 +5,7 @@ module ts {
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." },
_0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." },
+ A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." },
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." },
Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." },
@@ -258,6 +259,7 @@ module ts {
Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." },
Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." },
Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." },
+ The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index cc2a752fce7..05e35b4312b 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -10,6 +10,10 @@
"'{0}' expected.": {
"category": "Error",
"code": 1005
+ },
+ "A file cannot have a reference to itself.": {
+ "category": "Error",
+ "code": 1006
},
"Trailing comma not allowed.": {
"category": "Error",
@@ -1024,6 +1028,10 @@
"category": "Error",
"code": 2446
},
+ "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.": {
+ "category": "Error",
+ "code": 2447
+ },
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -1347,6 +1355,7 @@
"category": "Error",
"code": 5001
},
+
"Cannot find the common subdirectory path for the input files.": {
"category": "Error",
"code": 5009
diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index 4052350cf8c..1e1c57f5700 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -56,10 +56,10 @@ module ts {
function getOwnEmitOutputFilePath(sourceFile: SourceFile, extension: string) {
if (compilerOptions.outDir) {
- var emitOutputFilePathWithoutExtension = getModuleNameFromFilename(getSourceFilePathInNewDir(compilerOptions.outDir, sourceFile));
+ var emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(compilerOptions.outDir, sourceFile));
}
else {
- var emitOutputFilePathWithoutExtension = getModuleNameFromFilename(sourceFile.filename);
+ var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.filename);
}
return emitOutputFilePathWithoutExtension + extension;
@@ -527,7 +527,8 @@ module ts {
sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath,
node.filename,
compilerHost.getCurrentDirectory(),
- /*isAbsolutePathAnUrl*/ true));
+ compilerHost.getCanonicalFileName,
+ /*isAbsolutePathAnUrl*/ true));
sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1;
// The one that can be used from program to get the actual source file
@@ -591,21 +592,6 @@ module ts {
recordSourceMapSpan(comment.end);
}
- var escapedCharsRegExp = /[\t\v\f\b\0\r\n\"\u2028\u2029\u0085]/g;
- var escapedCharsMap: Map = {
- "\t": "\\t",
- "\v": "\\v",
- "\f": "\\f",
- "\b": "\\b",
- "\0": "\\0",
- "\r": "\\r",
- "\n": "\\n",
- "\"": "\\\"",
- "\u2028": "\\u2028", // lineSeparator
- "\u2029": "\\u2029", // paragraphSeparator
- "\u0085": "\\u0085" // nextLine
- };
-
function serializeSourceMapContents(version: number, file: string, sourceRoot: string, sources: string[], names: string[], mappings: string) {
if (typeof JSON !== "undefined") {
return JSON.stringify({
@@ -620,14 +606,6 @@ module ts {
return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}";
- /** This does not support the full escape characters, it only supports the subset that can be used in file names
- * or string literals. If the information encoded in the map changes, this needs to be revisited. */
- function escapeString(s: string): string {
- return escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, c => {
- return escapedCharsMap[c] || c;
- }) : s;
- }
-
function serializeStringArray(list: string[]): string {
var output = "";
for (var i = 0, n = list.length; i < n; i++) {
@@ -692,7 +670,8 @@ module ts {
getDirectoryPath(normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath
combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap
compilerHost.getCurrentDirectory(),
- /*isAbsolutePathAnUrl*/ true);
+ compilerHost.getCanonicalFileName,
+ /*isAbsolutePathAnUrl*/ true);
}
else {
sourceMapData.jsSourceMappingURL = combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL);
@@ -3150,7 +3129,7 @@ module ts {
}
}
- function resolveScriptReference(sourceFile: SourceFile, reference: FileReference) {
+ function tryResolveScriptReference(sourceFile: SourceFile, reference: FileReference) {
var referenceFileName = normalizePath(combinePaths(getDirectoryPath(sourceFile.filename), reference.filename));
return program.getSourceFile(referenceFileName);
}
@@ -3164,13 +3143,14 @@ module ts {
? referencedFile.filename // Declaration file, use declaration file name
: shouldEmitToOwnFile(referencedFile, compilerOptions)
? getOwnEmitOutputFilePath(referencedFile, ".d.ts") // Own output file so get the .d.ts file
- : getModuleNameFromFilename(compilerOptions.out) + ".d.ts";// Global out file
+ : removeFileExtension(compilerOptions.out) + ".d.ts";// Global out file
declFileName = getRelativePathToDirectoryOrUrl(
getDirectoryPath(normalizeSlashes(jsFilePath)),
declFileName,
compilerHost.getCurrentDirectory(),
- /*isAbsolutePathAnUrl*/ false);
+ compilerHost.getCanonicalFileName,
+ /*isAbsolutePathAnUrl*/ false);
referencePathsOutput += "/// " + newLine;
}
@@ -3180,12 +3160,12 @@ module ts {
if (!compilerOptions.noResolve) {
var addedGlobalFileReference = false;
forEach(root.referencedFiles, fileReference => {
- var referencedFile = resolveScriptReference(root, fileReference);
+ var referencedFile = tryResolveScriptReference(root, fileReference);
// All the references that are not going to be part of same file
- if ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference
+ if (referencedFile && ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference
shouldEmitToOwnFile(referencedFile, compilerOptions) || // This is referenced file is emitting its own js file
- !addedGlobalFileReference) { // Or the global out file corresponding to this reference was not added
+ !addedGlobalFileReference)) { // Or the global out file corresponding to this reference was not added
writeReferencePath(referencedFile);
if (!isExternalModuleOrDeclarationFile(referencedFile)) {
@@ -3205,11 +3185,11 @@ module ts {
// Check what references need to be added
if (!compilerOptions.noResolve) {
forEach(sourceFile.referencedFiles, fileReference => {
- var referencedFile = resolveScriptReference(sourceFile, fileReference);
+ var referencedFile = tryResolveScriptReference(sourceFile, fileReference);
// If the reference file is a declaration file or an external module, emit that reference
- if (isExternalModuleOrDeclarationFile(referencedFile) &&
- !contains(emittedReferencedFiles, referencedFile)) { // If the file reference was not already emitted
+ if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) &&
+ !contains(emittedReferencedFiles, referencedFile))) { // If the file reference was not already emitted
writeReferencePath(referencedFile);
emittedReferencedFiles.push(referencedFile);
@@ -3237,7 +3217,7 @@ module ts {
}
});
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);
- writeFile(getModuleNameFromFilename(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM);
+ writeFile(removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM);
}
}
@@ -3251,21 +3231,27 @@ module ts {
}
if (targetSourceFile === undefined) {
+ // No targetSourceFile is specified (e.g. calling emitter from batch compiler)
forEach(program.getSourceFiles(), sourceFile => {
if (shouldEmitToOwnFile(sourceFile, compilerOptions)) {
var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js");
emitFile(jsFilePath, sourceFile);
}
});
- }
- else {
- // Emit only one file specified in targetFilename. This is mainly used in compilerOnSave feature
- var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, ".js");
- emitFile(jsFilePath, targetSourceFile);
- }
- if (compilerOptions.out) {
- emitFile(compilerOptions.out);
+ if (compilerOptions.out) {
+ emitFile(compilerOptions.out);
+ }
+ } else {
+ // targetSourceFile is specified (e.g calling emitter from language service)
+ if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) {
+ // If shouldEmitToOwnFile is true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file
+ var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, ".js");
+ emitFile(jsFilePath, targetSourceFile);
+ } else {
+ // If shouldEmitToOwnFile is false, then emit all, non-external-module file, into one single output file
+ emitFile(compilerOptions.out);
+ }
}
// Sort and make the unique list of diagnostics
diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index cb6c9a37cd9..ce90650524e 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -17,22 +17,11 @@ module ts {
return node;
}
- var moduleExtensions = [".d.ts", ".ts", ".js"];
-
interface ReferenceComments {
referencedFiles: FileReference[];
amdDependencies: string[];
}
- export function getModuleNameFromFilename(filename: string) {
- for (var i = 0; i < moduleExtensions.length; i++) {
- var ext = moduleExtensions[i];
- var len = filename.length - ext.length;
- if (len > 0 && filename.substr(len) === ext) return filename.substr(0, len);
- }
- return filename;
- }
-
export function getSourceFileOfNode(node: Node): SourceFile {
while (node && node.kind !== SyntaxKind.SourceFile) node = node.parent;
return node;
@@ -54,11 +43,11 @@ module ts {
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
- export function getSourceTextOfNodeFromSourceText(sourceText: string, node: Node): string {
+ export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string {
return sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
}
- export function getSourceTextOfNode(node: Node): string {
+ export function getTextOfNode(node: Node): string {
var text = getSourceFileOfNode(node).text;
return text.substring(skipTrivia(text, node.pos), node.end);
}
@@ -75,7 +64,7 @@ module ts {
// Return display name of an identifier
export function identifierToString(identifier: Identifier) {
- return identifier.kind === SyntaxKind.Missing ? "(Missing)" : getSourceTextOfNode(identifier);
+ return identifier.kind === SyntaxKind.Missing ? "(Missing)" : getTextOfNode(identifier);
}
export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic {
@@ -404,6 +393,100 @@ module ts {
return false;
}
+ /**
+ * Note: this function only works when given a node with valid parent pointers.
+ */
+ export function isTypeNode(node: Node): boolean {
+ if (node.kind >= SyntaxKind.FirstTypeNode && node.kind <= SyntaxKind.LastTypeNode) {
+ return true;
+ }
+
+ switch (node.kind) {
+ case SyntaxKind.AnyKeyword:
+ case SyntaxKind.NumberKeyword:
+ case SyntaxKind.StringKeyword:
+ case SyntaxKind.BooleanKeyword:
+ return true;
+ case SyntaxKind.VoidKeyword:
+ return node.parent.kind !== SyntaxKind.PrefixOperator;
+ case SyntaxKind.StringLiteral:
+ // Specialized signatures can have string literals as their parameters' type names
+ return node.parent.kind === SyntaxKind.Parameter;
+ // Identifiers and qualified names may be type nodes, depending on their context. Climb
+ // above them to find the lowest container
+ case SyntaxKind.Identifier:
+ // If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
+ if (node.parent.kind === SyntaxKind.QualifiedName) {
+ node = node.parent;
+ }
+ // Fall through
+ case SyntaxKind.QualifiedName:
+ // At this point, node is either a qualified name or an identifier
+ var parent = node.parent;
+ if (parent.kind === SyntaxKind.TypeQuery) {
+ return false;
+ }
+ // Do not recursively call isTypeNode on the parent. In the example:
+ //
+ // var a: A.B.C;
+ //
+ // Calling isTypeNode would consider the qualified name A.B a type node. Only C or
+ // A.B.C is a type node.
+ if (parent.kind >= SyntaxKind.FirstTypeNode && parent.kind <= SyntaxKind.LastTypeNode) {
+ return true;
+ }
+ switch (parent.kind) {
+ case SyntaxKind.TypeParameter:
+ return node === (parent).constraint;
+ case SyntaxKind.Property:
+ case SyntaxKind.Parameter:
+ case SyntaxKind.VariableDeclaration:
+ return node === (parent).type;
+ case SyntaxKind.FunctionDeclaration:
+ case SyntaxKind.FunctionExpression:
+ case SyntaxKind.ArrowFunction:
+ case SyntaxKind.Constructor:
+ case SyntaxKind.Method:
+ case SyntaxKind.GetAccessor:
+ case SyntaxKind.SetAccessor:
+ return node === (parent).type;
+ case SyntaxKind.CallSignature:
+ case SyntaxKind.ConstructSignature:
+ case SyntaxKind.IndexSignature:
+ return node === (parent).type;
+ case SyntaxKind.TypeAssertion:
+ return node === (parent).type;
+ case SyntaxKind.CallExpression:
+ case SyntaxKind.NewExpression:
+ return (parent).typeArguments && (parent).typeArguments.indexOf(node) >= 0;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Note: this function only works when given a node with valid parent pointers.
+ *
+ * returns true if the given identifier is the name of a type declaration node (class, interface, enum, type parameter, etc)
+ */
+ export function isTypeDeclarationName(name: Node): boolean {
+ return name.kind == SyntaxKind.Identifier &&
+ isTypeDeclaration(name.parent) &&
+ (name.parent).name === name;
+ }
+
+
+ export function isTypeDeclaration(node: Node): boolean {
+ switch (node.kind) {
+ case SyntaxKind.TypeParameter:
+ case SyntaxKind.ClassDeclaration:
+ case SyntaxKind.InterfaceDeclaration:
+ case SyntaxKind.EnumDeclaration:
+ return true;
+ }
+ }
+
export function getContainingFunction(node: Node): SignatureDeclaration {
while (true) {
node = node.parent;
@@ -1015,7 +1098,10 @@ module ts {
return finishNode(node);
}
error(Diagnostics.Identifier_expected);
- return createMissingNode();
+
+ var node = createMissingNode();
+ node.text = "";
+ return node;
}
function parseIdentifier(): Identifier {
@@ -1075,7 +1161,7 @@ module ts {
case ParsingContext.TypeParameters:
return isIdentifier();
case ParsingContext.ArgumentExpressions:
- return isExpression();
+ return token === SyntaxKind.CommaToken || isExpression();
case ParsingContext.ArrayLiteralMembers:
return token === SyntaxKind.CommaToken || isExpression();
case ParsingContext.Parameters:
@@ -1228,18 +1314,6 @@ module ts {
error(Diagnostics._0_expected, ",");
}
else if (isListTerminator(kind)) {
- // Check if the last token was a comma.
- if (commaStart >= 0) {
- if (!allowTrailingComma) {
- if (file.syntacticErrors.length === errorCountBeforeParsingList) {
- // Report a grammar error so we don't affect lookahead
- grammarErrorAtPos(commaStart, scanner.getStartPos() - commaStart, Diagnostics.Trailing_comma_not_allowed);
- }
- }
- // Always preserve a trailing comma by marking it on the NodeArray
- result.hasTrailingComma = true;
- }
-
break;
}
else {
@@ -1250,6 +1324,23 @@ module ts {
nextToken();
}
}
+
+ // Recording the trailing comma is deliberately done after the previous
+ // loop, and not just if we see a list terminator. This is because the list
+ // may have ended incorrectly, but it is still important to know if there
+ // was a trailing comma.
+ // Check if the last token was a comma.
+ if (commaStart >= 0) {
+ if (!allowTrailingComma) {
+ if (file.syntacticErrors.length === errorCountBeforeParsingList) {
+ // Report a grammar error so we don't affect lookahead
+ grammarErrorAtPos(commaStart, scanner.getStartPos() - commaStart, Diagnostics.Trailing_comma_not_allowed);
+ }
+ }
+ // Always preserve a trailing comma by marking it on the NodeArray
+ result.hasTrailingComma = true;
+ }
+
result.end = getNodeEnd();
parsingContext = saveParsingContext;
return result;
@@ -2324,9 +2415,6 @@ module ts {
else {
parseExpected(SyntaxKind.OpenParenToken);
}
- // It is an error to have a trailing comma in an argument list. However, the checker
- // needs evidence of a trailing comma in order to give good results for signature help.
- // That is why we do not allow a trailing comma, but we "preserve" a trailing comma.
callExpr.arguments = parseDelimitedList(ParsingContext.ArgumentExpressions,
parseArgumentExpression, /*allowTrailingComma*/ false);
parseExpected(SyntaxKind.CloseParenToken);
@@ -2554,9 +2642,6 @@ module ts {
parseExpected(SyntaxKind.NewKeyword);
node.func = parseCallAndAccess(parsePrimaryExpression(), /* inNewExpression */ true);
if (parseOptional(SyntaxKind.OpenParenToken) || token === SyntaxKind.LessThanToken && (node.typeArguments = tryParse(parseTypeArgumentsAndOpenParen))) {
- // It is an error to have a trailing comma in an argument list. However, the checker
- // needs evidence of a trailing comma in order to give good results for signature help.
- // That is why we do not allow a trailing comma, but we "preserve" a trailing comma.
node.arguments = parseDelimitedList(ParsingContext.ArgumentExpressions,
parseArgumentExpression, /*allowTrailingComma*/ false);
parseExpected(SyntaxKind.CloseParenToken);
@@ -2964,7 +3049,7 @@ module ts {
parseExpected(SyntaxKind.ColonToken);
if (labelledStatementInfo.nodeIsNestedInLabel(node.label, /*requireIterationStatement*/ false, /*stopAtFunctionBoundary*/ true)) {
- grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getSourceTextOfNodeFromSourceText(sourceText, node.label));
+ grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceText, node.label));
}
labelledStatementInfo.addLabel(node.label);
@@ -3566,7 +3651,7 @@ module ts {
}
return finishNode(node);
}
-
+
function parseAndCheckEnumDeclaration(pos: number, flags: NodeFlags): EnumDeclaration {
function isIntegerLiteral(expression: Expression): boolean {
function isInteger(literalExpression: LiteralExpression): boolean {
@@ -3844,15 +3929,17 @@ module ts {
}
else {
var matchResult = fullTripleSlashReferencePathRegEx.exec(comment);
+ var start = range.pos;
+ var end = range.end;
+ var length = end - start;
+
if (!matchResult) {
- var start = range.pos;
- var length = range.end - start;
errorAtPos(start, length, Diagnostics.Invalid_reference_directive_syntax);
}
else {
referencedFiles.push({
- pos: range.pos,
- end: range.end,
+ pos: start,
+ end: end,
filename: matchResult[3]
});
}
@@ -3969,6 +4056,9 @@ module ts {
else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = Diagnostics.File_0_not_found;
}
+ else if (refFile && host.getCanonicalFileName(filename) === host.getCanonicalFileName(refFile.filename)) {
+ diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself;
+ }
}
else {
if (!(findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) || findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd))) {
@@ -4027,7 +4117,8 @@ module ts {
function processReferencedFiles(file: SourceFile, basePath: string) {
forEach(file.referencedFiles, ref => {
- processSourceFile(normalizePath(combinePaths(basePath, ref.filename)), /* isDefaultLib */ false, file, ref.pos, ref.end);
+ var referencedFilename = isRootedDiskPath(ref.filename) ? ref.filename : combinePaths(basePath, ref.filename);
+ processSourceFile(normalizePath(referencedFilename), /* isDefaultLib */ false, file, ref.pos, ref.end);
});
}
diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts
index 2a148407631..c8cccd2da1c 100644
--- a/src/compiler/tsc.ts
+++ b/src/compiler/tsc.ts
@@ -9,7 +9,7 @@
///
module ts {
- var version = "1.1.0.0";
+ var version = "1.3.0.0";
/**
* Checks to see if the locale is in the appropriate format,
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index 29f77e77f65..f8d1b684d61 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -660,6 +660,9 @@ module ts {
// Returns the constant value of this enum member, or 'undefined' if the enum member has a
// computed value.
getEnumMemberValue(node: EnumMember): number;
+
+ isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean;
+ getAliasedSymbol(symbol: Symbol): Symbol;
}
export interface TextWriter {
diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts
index a97319ff332..84177cf6698 100644
--- a/src/harness/fourslash.ts
+++ b/src/harness/fourslash.ts
@@ -412,6 +412,15 @@ module FourSlash {
}
}
+ private raiseError(message: string) {
+ message = this.messageAtLastKnownMarker(message);
+ throw new Error(message);
+ }
+
+ private messageAtLastKnownMarker(message: string) {
+ return "Marker: " + currentTestState.lastKnownMarker + "\n" + message;
+ }
+
private getDiagnostics(fileName: string): ts.Diagnostic[] {
var syntacticErrors = this.languageService.getSyntacticDiagnostics(fileName);
var semanticErrors = this.languageService.getSemanticDiagnostics(fileName);
@@ -500,7 +509,7 @@ module FourSlash {
this.printErrorLog(false, errors);
var errorMsg = "Actual number of errors (" + actual + ") does not match expected number (" + expected + ")";
Harness.IO.log(errorMsg);
- throw new Error(errorMsg);
+ this.raiseError(errorMsg);
}
}
@@ -514,7 +523,7 @@ module FourSlash {
var evaluation = new Function(emit.outputFiles[0].text + ';\r\nreturn (' + expr + ');')();
if (evaluation !== value) {
- throw new Error('Expected evaluation of expression "' + expr + '" to equal "' + value + '", but got "' + evaluation + '"');
+ this.raiseError('Expected evaluation of expression "' + expr + '" to equal "' + value + '", but got "' + evaluation + '"');
}
}
@@ -531,7 +540,7 @@ module FourSlash {
this.assertItemInCompletionList(members.entries, symbol, type, docComment, fullSymbolName, kind);
}
else {
- throw new Error("Expected a member list, but none was provided");
+ this.raiseError("Expected a member list, but none was provided");
}
}
@@ -554,11 +563,11 @@ module FourSlash {
var match = members.entries.length === expectedCount;
if ((!match && !negative) || (match && negative)) {
- throw new Error("Member list count was " + members.entries.length + ". Expected " + expectedCount);
+ this.raiseError("Member list count was " + members.entries.length + ". Expected " + expectedCount);
}
}
else if (expectedCount) {
- throw new Error("Member list count was 0. Expected " + expectedCount);
+ this.raiseError("Member list count was 0. Expected " + expectedCount);
}
}
@@ -568,7 +577,7 @@ module FourSlash {
var members = this.getMemberListAtCaret();
if (members.entries.filter(e => e.name === symbol).length !== 0) {
- throw new Error('Member list did contain ' + symbol);
+ this.raiseError('Member list did contain ' + symbol);
}
}
@@ -579,7 +588,7 @@ module FourSlash {
var itemsCount = completions.entries.length;
if (itemsCount <= count) {
- throw new Error('Expected completion list items count to be greater than ' + count + ', but is actually ' + itemsCount);
+ this.raiseError('Expected completion list items count to be greater than ' + count + ', but is actually ' + itemsCount);
}
}
@@ -592,7 +601,7 @@ module FourSlash {
var members = this.getMemberListAtCaret();
if ((!members || members.entries.length === 0) && negative) {
- throw new Error("Member list is empty at Caret");
+ this.raiseError("Member list is empty at Caret");
} else if ((members && members.entries.length !== 0) && !negative) {
var errorMsg = "\n" + "Member List contains: [" + members.entries[0].name;
@@ -602,7 +611,7 @@ module FourSlash {
errorMsg += "]\n";
Harness.IO.log(errorMsg);
- throw new Error("Member list is not empty at Caret");
+ this.raiseError("Member list is not empty at Caret");
}
}
@@ -612,7 +621,7 @@ module FourSlash {
var completions = this.getCompletionListAtCaret();
if ((!completions || completions.entries.length === 0) && negative) {
- throw new Error("Completion list is empty at Caret");
+ this.raiseError("Completion list is empty at Caret");
} else if ((completions && completions.entries.length !== 0) && !negative) {
var errorMsg = "\n" + "Completion List contains: [" + completions.entries[0].name;
@@ -622,7 +631,7 @@ module FourSlash {
errorMsg += "]\n";
Harness.IO.log(errorMsg);
- throw new Error("Completion list is not empty at Caret");
+ this.raiseError("Completion list is not empty at Caret");
}
}
@@ -638,7 +647,7 @@ module FourSlash {
var completions = this.getCompletionListAtCaret();
if (completions && completions.entries && completions.entries.filter(e => e.name === symbol).length !== 0) {
- throw new Error('Completion list did contain ' + symbol);
+ this.raiseError('Completion list did contain ' + symbol);
}
}
@@ -668,21 +677,21 @@ module FourSlash {
var references = this.getReferencesAtCaret();
if (!references || references.length === 0) {
- throw new Error('verifyReferencesAtPositionListContains failed - found 0 references, expected at least one.');
+ this.raiseError('verifyReferencesAtPositionListContains failed - found 0 references, expected at least one.');
}
for (var i = 0; i < references.length; i++) {
var reference = references[i];
if (reference && reference.fileName === fileName && reference.textSpan.start() === start && reference.textSpan.end() === end) {
if (typeof isWriteAccess !== "undefined" && reference.isWriteAccess !== isWriteAccess) {
- throw new Error('verifyReferencesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + reference.isWriteAccess + ', expected: ' + isWriteAccess + '.');
+ this.raiseError('verifyReferencesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + reference.isWriteAccess + ', expected: ' + isWriteAccess + '.');
}
return;
}
}
var missingItem = { fileName: fileName, start: start, end: end, isWriteAccess: isWriteAccess };
- throw new Error('verifyReferencesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(references) + ')');
+ this.raiseError('verifyReferencesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(references) + ')');
}
public verifyReferencesCountIs(count: number, localFilesOnly: boolean = true) {
@@ -706,7 +715,7 @@ module FourSlash {
if (referencesCount !== count) {
var condition = localFilesOnly ? "excluding libs" : "including libs";
- throw new Error("Expected references count (" + condition + ") to be " + count + ", but is actually " + referencesCount);
+ this.raiseError("Expected references count (" + condition + ") to be " + count + ", but is actually " + referencesCount);
}
}
@@ -729,7 +738,7 @@ module FourSlash {
if (implementorsCount !== count) {
var condition = localFilesOnly ? "excluding libs" : "including libs";
- throw new Error("Expected implementors count (" + condition + ") to be " + count + ", but is actually " + implementors.length);
+ this.raiseError("Expected implementors count (" + condition + ") to be " + count + ", but is actually " + implementors.length);
}
}
@@ -753,6 +762,10 @@ module FourSlash {
return this.languageService.getImplementorsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
}
+ private assertionMessage(name: string, actualValue: any, expectedValue: any) {
+ return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
+ }
+
public verifyQuickInfo(negative: boolean, expectedTypeName?: string, docComment?: string, symbolName?: string, kind?: string) {
[expectedTypeName, docComment, symbolName, kind].forEach(str => {
if (str) {
@@ -767,51 +780,79 @@ module FourSlash {
var actualQuickInfoSymbolName = actualQuickInfo ? actualQuickInfo.fullSymbolName : "";
var actualQuickInfoKind = actualQuickInfo ? actualQuickInfo.kind : "";
- function assertionMessage(name: string, actualValue: string, expectedValue: string) {
- return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
- }
-
if (negative) {
if (expectedTypeName !== undefined) {
- assert.notEqual(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member name", actualQuickInfoMemberName, expectedTypeName));
+ assert.notEqual(actualQuickInfoMemberName, expectedTypeName, this.messageAtLastKnownMarker("quick info member name"));
}
if (docComment != undefined) {
- assert.notEqual(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc comment", actualQuickInfoDocComment, docComment));
+ assert.notEqual(actualQuickInfoDocComment, docComment, this.messageAtLastKnownMarker("quick info doc comment"));
}
if (symbolName !== undefined) {
- assert.notEqual(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name", actualQuickInfoSymbolName, symbolName));
+ assert.notEqual(actualQuickInfoSymbolName, symbolName, this.messageAtLastKnownMarker("quick info symbol name"));
}
if (kind !== undefined) {
- assert.notEqual(actualQuickInfoKind, kind, assertionMessage("quick info kind", actualQuickInfoKind, kind));
+ assert.notEqual(actualQuickInfoKind, kind, this.messageAtLastKnownMarker("quick info kind"));
}
} else {
if (expectedTypeName !== undefined) {
- assert.equal(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member", actualQuickInfoMemberName, expectedTypeName));
+ assert.equal(actualQuickInfoMemberName, expectedTypeName, this.messageAtLastKnownMarker("quick info member"));
}
if (docComment != undefined) {
- assert.equal(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc", actualQuickInfoDocComment, docComment));
+ assert.equal(actualQuickInfoDocComment, docComment, this.messageAtLastKnownMarker("quick info doc"));
}
if (symbolName !== undefined) {
- assert.equal(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name", actualQuickInfoSymbolName, symbolName));
+ assert.equal(actualQuickInfoSymbolName, symbolName, this.messageAtLastKnownMarker("quick info symbol name"));
}
if (kind !== undefined) {
- assert.equal(actualQuickInfoKind, kind, assertionMessage("quick info kind", actualQuickInfoKind, kind));
+ assert.equal(actualQuickInfoKind, kind, this.messageAtLastKnownMarker("quick info kind"));
}
}
}
- public verifyQuickInfoExists(negative: number) {
+ public verifyRenameLocations(findInStrings: boolean, findInComments: boolean) {
+ var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
+ if (renameInfo.canRename) {
+ var references = this.languageService.findRenameLocations(
+ this.activeFile.fileName, this.currentCaretPosition, findInStrings, findInComments);
+
+ var ranges = this.getRanges();
+ if (ranges.length !== references.length) {
+ this.raiseError(this.assertionMessage("Rename locations", references.length, ranges.length));
+ }
+
+ ranges = ranges.sort((r1, r2) => r1.start - r2.start);
+ references = references.sort((r1, r2) => r1.textSpan.start() - r2.textSpan.start());
+
+ for (var i = 0, n = ranges.length; i < n; i++) {
+ var reference = references[i];
+ var range = ranges[i];
+
+ if (reference.textSpan.start() !== range.start ||
+ reference.textSpan.end() !== range.end) {
+
+ this.raiseError(this.assertionMessage("Rename location",
+ "[" + reference.textSpan.start() + "," + reference.textSpan.end() + ")",
+ "[" + range.start + "," + range.end + ")"));
+ }
+ }
+ }
+ else {
+ this.raiseError("Expected rename to succeed, but it actually failed.");
+ }
+ }
+
+ public verifyQuickInfoExists(negative: boolean) {
this.taoInvalidReason = 'verifyQuickInfoExists NYI';
var actualQuickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition);
if (negative) {
if (actualQuickInfo) {
- throw new Error('verifyQuickInfoExists failed. Expected quick info NOT to exist');
+ this.raiseError('verifyQuickInfoExists failed. Expected quick info NOT to exist');
}
}
else {
if (!actualQuickInfo) {
- throw new Error('verifyQuickInfoExists failed. Expected quick info to exist');
+ this.raiseError('verifyQuickInfoExists failed. Expected quick info to exist');
}
}
}
@@ -886,31 +927,38 @@ module FourSlash {
assert.equal(actual, expected);
}
+ public verifySignatureHelpArgumentCount(expected: number) {
+ this.taoInvalidReason = 'verifySignatureHelpArgumentCount NYI';
+ var signatureHelpItems = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
+ var actual = signatureHelpItems.argumentCount;
+ assert.equal(actual, expected);
+ }
+
public verifySignatureHelpPresent(shouldBePresent = true) {
this.taoInvalidReason = 'verifySignatureHelpPresent NYI';
var actual = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
if (shouldBePresent) {
if (!actual) {
- throw new Error("Expected signature help to be present, but it wasn't");
+ this.raiseError("Expected signature help to be present, but it wasn't");
}
} else {
if (actual) {
- throw new Error("Expected no signature help, but got '" + JSON.stringify(actual) + "'");
+ this.raiseError("Expected no signature help, but got '" + JSON.stringify(actual) + "'");
}
}
}
private validate(name: string, expected: string, actual: string) {
if (expected && expected !== actual) {
- throw new Error("Expected " + name + " '" + expected + "'. Got '" + actual + "' instead.");
+ this.raiseError("Expected " + name + " '" + expected + "'. Got '" + actual + "' instead.");
}
}
public verifyRenameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string) {
var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
if (!renameInfo.canRename) {
- throw new Error("Rename did not succeed");
+ this.raiseError("Rename did not succeed");
}
this.validate("displayName", displayName, renameInfo.displayName);
@@ -919,13 +967,13 @@ module FourSlash {
this.validate("kindModifiers", kindModifiers, renameInfo.kindModifiers);
if (this.getRanges().length !== 1) {
- throw new Error("Expected a single range to be selected in the test file.");
+ this.raiseError("Expected a single range to be selected in the test file.");
}
var expectedRange = this.getRanges()[0];
if (renameInfo.triggerSpan.start() !== expectedRange.start ||
renameInfo.triggerSpan.end() !== expectedRange.end) {
- throw new Error("Expected triggerSpan [" + expectedRange.start + "," + expectedRange.end + "). Got [" +
+ this.raiseError("Expected triggerSpan [" + expectedRange.start + "," + expectedRange.end + "). Got [" +
renameInfo.triggerSpan.start() + "," + renameInfo.triggerSpan.end() + ") instead.");
}
}
@@ -933,35 +981,22 @@ module FourSlash {
public verifyRenameInfoFailed(message?: string) {
var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
if (renameInfo.canRename) {
- throw new Error("Rename was expected to fail");
+ this.raiseError("Rename was expected to fail");
}
this.validate("error", message, renameInfo.localizedErrorMessage);
}
- //private getFormalParameter() {
- // var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
- // return help.formal;
- //}
-
private getActiveSignatureHelpItem() {
var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
-
- // If the signature hasn't been narrowed down yet (e.g. no parameters have yet been entered),
- // 'activeFormal' will be -1 (even if there is only 1 signature). Signature help will show the
- // first signature in the signature group, so go with that
- var index = help.selectedItemIndex < 0 ? 0 : help.selectedItemIndex;
-
+ var index = help.selectedItemIndex;
return help.items[index];
}
private getActiveParameter(): ts.SignatureHelpParameter {
var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
-
var item = help.items[help.selectedItemIndex];
-
- // Same logic as in getActiveSignatureHelp - this value might be -1 until a parameter value actually gets typed
- var currentParam = help.argumentIndex < 0 ? 0 : help.argumentIndex;
+ var currentParam = help.argumentIndex;
return item.parameters[currentParam];
}
@@ -1009,7 +1044,7 @@ module FourSlash {
// If there is not emiThisFile flag specified in the test file, throw an error
if (emitFiles.length === 0) {
- throw new Error("No emitThisFile is specified in the test file");
+ this.raiseError("No emitThisFile is specified in the test file");
}
Harness.Baseline.runBaseline(
@@ -1309,7 +1344,7 @@ module FourSlash {
//var fullSyntaxErrs = JSON.stringify(refSyntaxTree.diagnostics());
//if (incrSyntaxErrs !== fullSyntaxErrs) {
- // throw new Error('Mismatched incremental/full syntactic errors for file ' + this.activeFile.fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs);
+ // this.raiseError('Mismatched incremental/full syntactic errors for file ' + this.activeFile.fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs);
//}
// if (this.editValidation !== IncrementalEditValidation.SyntacticOnly) {
@@ -1326,7 +1361,7 @@ module FourSlash {
// var incrSemanticErrs = JSON.stringify(this.languageService.getSemanticDiagnostics(this.testData.files[i].fileName));
// if (incrSemanticErrs !== refSemanticErrs) {
- // throw new Error('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs);
+ // this.raiseError('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs);
// }
// }
// }
@@ -1365,7 +1400,7 @@ module FourSlash {
var newContent = snapshot.getText(0, snapshot.getLength());
if (newContent.replace(/\s/g, '') !== oldContent.replace(/\s/g, '')) {
- throw new Error('Formatting operation destroyed non-whitespace content');
+ this.raiseError('Formatting operation destroyed non-whitespace content');
}
}
return runningOffset;
@@ -1422,11 +1457,11 @@ module FourSlash {
var definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
if (!definitions || !definitions.length) {
- throw new Error('goToDefinition failed - expected to at least one definition location but got 0');
+ this.raiseError('goToDefinition failed - expected to at least one definition location but got 0');
}
if (definitionIndex >= definitions.length) {
- throw new Error('goToDefinition failed - definitionIndex value (' + definitionIndex + ') exceeds definition list size (' + definitions.length + ')');
+ this.raiseError('goToDefinition failed - definitionIndex value (' + definitionIndex + ') exceeds definition list size (' + definitions.length + ')');
}
var definition = definitions[definitionIndex];
@@ -1442,10 +1477,25 @@ module FourSlash {
var foundDefinitions = definitions && definitions.length;
if (foundDefinitions && negative) {
- throw new Error('goToDefinition - expected to 0 definition locations but got ' + definitions.length);
+ this.raiseError('goToDefinition - expected to 0 definition locations but got ' + definitions.length);
}
else if (!foundDefinitions && !negative) {
- throw new Error('goToDefinition - expected to at least one definition location but got 0');
+ this.raiseError('goToDefinition - expected to at least one definition location but got 0');
+ }
+ }
+
+ public verifyDefinitionsName(negative: boolean, expectedName: string, expectedContainerName: string) {
+ this.taoInvalidReason = 'verifyDefinititionsInfo NYI';
+
+ var definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
+ var actualDefinitionName = definitions && definitions.length ? definitions[0].name : "";
+ var actualDefinitionContainerName = definitions && definitions.length ? definitions[0].containerName : "";
+ if (negative) {
+ assert.notEqual(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
+ assert.notEqual(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Container Name"));
+ } else {
+ assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
+ assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Container Name"));
}
}
@@ -1480,7 +1530,7 @@ module FourSlash {
var actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition);
if (actual != numberOfSpaces) {
- throw new Error('verifyIndentationAtCurrentPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual);
+ this.raiseError('verifyIndentationAtCurrentPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual);
}
}
@@ -1489,7 +1539,7 @@ module FourSlash {
var actual = this.getIndentation(fileName, position);
if (actual !== numberOfSpaces) {
- throw new Error('verifyIndentationAtPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual);
+ this.raiseError('verifyIndentationAtPosition failed - expected: ' + numberOfSpaces + ', actual: ' + actual);
}
}
@@ -1532,14 +1582,14 @@ module FourSlash {
var span = this.languageService.getNameOrDottedNameSpan(this.activeFile.fileName, this.currentCaretPosition, this.currentCaretPosition);
if (span === null) {
- throw new Error('verifyCurrentNameOrDottedNameSpanText\n' +
+ this.raiseError('verifyCurrentNameOrDottedNameSpanText\n' +
'\tExpected: "' + text + '"\n' +
'\t Actual: null');
}
var actual = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName).getText(span.start(), span.end());
if (actual !== text) {
- throw new Error('verifyCurrentNameOrDottedNameSpanText\n' +
+ this.raiseError('verifyCurrentNameOrDottedNameSpanText\n' +
'\tExpected: "' + text + '"\n' +
'\t Actual: "' + actual + '"');
}
@@ -1577,7 +1627,7 @@ module FourSlash {
private verifyClassifications(expected: { classificationType: string; text: string }[], actual: ts.ClassifiedSpan[]) {
if (actual.length !== expected.length) {
- throw new Error('verifySyntacticClassification failed - expected total classifications to be ' + expected.length + ', but was ' + actual.length);
+ this.raiseError('verifyClassifications failed - expected total classifications to be ' + expected.length + ', but was ' + actual.length);
}
for (var i = 0; i < expected.length; i++) {
@@ -1586,7 +1636,7 @@ module FourSlash {
var expectedType: string = (ts.ClassificationTypeNames)[expectedClassification.classificationType];
if (expectedType !== actualClassification.classificationType) {
- throw new Error('verifySyntacticClassification failed - expected classifications type to be ' +
+ this.raiseError('verifyClassifications failed - expected classifications type to be ' +
expectedType + ', but was ' +
actualClassification.classificationType);
}
@@ -1594,7 +1644,7 @@ module FourSlash {
var actualSpan = actualClassification.textSpan;
var actualText = this.activeFile.content.substr(actualSpan.start(), actualSpan.length());
if (expectedClassification.text !== actualText) {
- throw new Error('verifySyntacticClassification failed - expected classificatied text to be ' +
+ this.raiseError('verifyClassifications failed - expected classificatied text to be ' +
expectedClassification.text + ', but was ' +
actualText);
}
@@ -1621,14 +1671,14 @@ module FourSlash {
var actual = this.languageService.getOutliningSpans(this.activeFile.fileName);
if (actual.length !== spans.length) {
- throw new Error('verifyOutliningSpans failed - expected total spans to be ' + spans.length + ', but was ' + actual.length);
+ this.raiseError('verifyOutliningSpans failed - expected total spans to be ' + spans.length + ', but was ' + actual.length);
}
for (var i = 0; i < spans.length; i++) {
var expectedSpan = spans[i];
var actualSpan = actual[i];
if (expectedSpan.start !== actualSpan.textSpan.start() || expectedSpan.end !== actualSpan.textSpan.end()) {
- throw new Error('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualSpan.textSpan.start() + ',' + actualSpan.textSpan.end() + ')');
+ this.raiseError('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualSpan.textSpan.start() + ',' + actualSpan.textSpan.end() + ')');
}
}
}
@@ -1638,7 +1688,7 @@ module FourSlash {
descriptors.map(d => { return { text: d, priority: 0 }; }));
if (actual.length !== spans.length) {
- throw new Error('verifyTodoComments failed - expected total spans to be ' + spans.length + ', but was ' + actual.length);
+ this.raiseError('verifyTodoComments failed - expected total spans to be ' + spans.length + ', but was ' + actual.length);
}
for (var i = 0; i < spans.length; i++) {
@@ -1647,7 +1697,7 @@ module FourSlash {
var actualCommentSpan = new TypeScript.TextSpan(actualComment.position, actualComment.message.length);
if (expectedSpan.start !== actualCommentSpan.start() || expectedSpan.end !== actualCommentSpan.end()) {
- throw new Error('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualCommentSpan.start() + ',' + actualCommentSpan.end() + ')');
+ this.raiseError('verifyOutliningSpans failed - span ' + (i + 1) + ' expected: (' + expectedSpan.start + ',' + expectedSpan.end + '), actual: (' + actualCommentSpan.start() + ',' + actualCommentSpan.end() + ')');
}
}
}
@@ -1658,7 +1708,7 @@ module FourSlash {
var actual = this.languageService.getBraceMatchingAtPosition(this.activeFile.fileName, bracePosition);
if (actual.length !== 2) {
- throw new Error('verifyMatchingBracePosition failed - expected result to contain 2 spans, but it had ' + actual.length);
+ this.raiseError('verifyMatchingBracePosition failed - expected result to contain 2 spans, but it had ' + actual.length);
}
var actualMatchPosition = -1;
@@ -1667,11 +1717,11 @@ module FourSlash {
} else if (bracePosition === actual[1].start()) {
actualMatchPosition = actual[0].start();
} else {
- throw new Error('verifyMatchingBracePosition failed - could not find the brace position: ' + bracePosition + ' in the returned list: (' + actual[0].start() + ',' + actual[0].end() + ') and (' + actual[1].start() + ',' + actual[1].end() + ')');
+ this.raiseError('verifyMatchingBracePosition failed - could not find the brace position: ' + bracePosition + ' in the returned list: (' + actual[0].start() + ',' + actual[0].end() + ') and (' + actual[1].start() + ',' + actual[1].end() + ')');
}
if (actualMatchPosition !== expectedMatchPosition) {
- throw new Error('verifyMatchingBracePosition failed - expected: ' + actualMatchPosition + ', actual: ' + expectedMatchPosition);
+ this.raiseError('verifyMatchingBracePosition failed - expected: ' + actualMatchPosition + ', actual: ' + expectedMatchPosition);
}
}
@@ -1681,7 +1731,7 @@ module FourSlash {
var actual = this.languageService.getBraceMatchingAtPosition(this.activeFile.fileName, bracePosition);
if (actual.length !== 0) {
- throw new Error('verifyNoMatchingBracePosition failed - expected: 0 spans, actual: ' + actual.length);
+ this.raiseError('verifyNoMatchingBracePosition failed - expected: 0 spans, actual: ' + actual.length);
}
}
@@ -1768,7 +1818,7 @@ module FourSlash {
}
if (expected != actual) {
- throw new Error('verifyNavigationItemsCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.');
+ this.raiseError('verifyNavigationItemsCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.');
}
}
@@ -1788,7 +1838,7 @@ module FourSlash {
var items = this.languageService.getNavigateToItems(searchValue);
if (!items || items.length === 0) {
- throw new Error('verifyNavigationItemsListContains failed - found 0 navigation items, expected at least one.');
+ this.raiseError('verifyNavigationItemsListContains failed - found 0 navigation items, expected at least one.');
}
for (var i = 0; i < items.length; i++) {
@@ -1804,7 +1854,7 @@ module FourSlash {
// if there was an explicit match kind specified, then it should be validated.
if (matchKind !== undefined) {
var missingItem = { name: name, kind: kind, searchValue: searchValue, matchKind: matchKind, fileName: fileName, parentName: parentName };
- throw new Error('verifyNavigationItemsListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')');
+ this.raiseError('verifyNavigationItemsListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')');
}
}
@@ -1815,7 +1865,7 @@ module FourSlash {
var actual = this.getNavigationBarItemsCount(items);
if (expected != actual) {
- throw new Error('verifyGetScriptLexicalStructureListCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.');
+ this.raiseError('verifyGetScriptLexicalStructureListCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.');
}
}
@@ -1840,7 +1890,7 @@ module FourSlash {
var items = this.languageService.getNavigationBarItems(this.activeFile.fileName);
if (!items || items.length === 0) {
- throw new Error('verifyGetScriptLexicalStructureListContains failed - found 0 navigation items, expected at least one.');
+ this.raiseError('verifyGetScriptLexicalStructureListContains failed - found 0 navigation items, expected at least one.');
}
if (this.navigationBarItemsContains(items, name, kind)) {
@@ -1848,7 +1898,7 @@ module FourSlash {
}
var missingItem = { name: name, kind: kind };
- throw new Error('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')');
+ this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')');
}
private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) {
@@ -1902,21 +1952,21 @@ module FourSlash {
var occurances = this.getOccurancesAtCurrentPosition();
if (!occurances || occurances.length === 0) {
- throw new Error('verifyOccurancesAtPositionListContains failed - found 0 references, expected at least one.');
+ this.raiseError('verifyOccurancesAtPositionListContains failed - found 0 references, expected at least one.');
}
for (var i = 0; i < occurances.length; i++) {
var occurance = occurances[i];
if (occurance && occurance.fileName === fileName && occurance.textSpan.start() === start && occurance.textSpan.end() === end) {
if (typeof isWriteAccess !== "undefined" && occurance.isWriteAccess !== isWriteAccess) {
- throw new Error('verifyOccurancesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + occurance.isWriteAccess + ', expected: ' + isWriteAccess + '.');
+ this.raiseError('verifyOccurancesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + occurance.isWriteAccess + ', expected: ' + isWriteAccess + '.');
}
return;
}
}
var missingItem = { fileName: fileName, start: start, end: end, isWriteAccess: isWriteAccess };
- throw new Error('verifyOccurancesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(occurances) + ')');
+ this.raiseError('verifyOccurancesAtPositionListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(occurances) + ')');
}
public verifyOccurrencesAtPositionListCount(expectedCount: number) {
@@ -1925,7 +1975,7 @@ module FourSlash {
var occurances = this.getOccurancesAtCurrentPosition();
var actualCount = occurances ? occurances.length : 0;
if (expectedCount !== actualCount) {
- throw new Error('verifyOccurrencesAtPositionListCount failed - actual: ' + actualCount + ', expected:' + expectedCount);
+ this.raiseError('verifyOccurrencesAtPositionListCount failed - actual: ' + actualCount + ', expected:' + expectedCount);
}
}
@@ -2010,7 +2060,7 @@ module FourSlash {
var itemsString = items.map((item) => JSON.stringify({ name: item.name, kind: item.kind })).join(",\n");
- throw new Error("Marker: " + currentTestState.lastKnownMarker + "\n" + 'Expected "' + JSON.stringify({ name: name, type: type, docComment: docComment, fullSymbolName: fullSymbolName, kind: kind }) + '" to be in list [' + itemsString + ']');
+ this.raiseError('Expected "' + JSON.stringify({ name: name, type: type, docComment: docComment, fullSymbolName: fullSymbolName, kind: kind }) + '" to be in list [' + itemsString + ']');
}
private findFile(indexOrName: any) {
@@ -2097,9 +2147,6 @@ module FourSlash {
xmlData.push(xml);
}
- // Cache these between executions so we don't have to re-parse them for every test
- var fourslashSourceFile: ts.SourceFile = undefined;
-
export function runFourSlashTestContent(content: string, fileName: string): TestXmlData {
// Parse out the files and their metadata
var testData = parseTestData(content, fileName);
@@ -2107,21 +2154,16 @@ module FourSlash {
currentTestState = new TestState(testData);
var result = '';
- var fourslashFilename = 'fourslash.ts';
- var tsFn = 'tests/cases/fourslash/' + fourslashFilename;
- fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), ts.ScriptTarget.ES5, /*version*/ "0", /*isOpen*/ false);
-
- var files: { [filename: string]: ts.SourceFile; } = {};
- files[Harness.Compiler.getCanonicalFileName(fourslashFilename)] = fourslashSourceFile;
- files[Harness.Compiler.getCanonicalFileName(fileName)] = ts.createSourceFile(fileName, content, ts.ScriptTarget.ES5, /*version*/ "0", /*isOpen*/ false);
- files[Harness.Compiler.getCanonicalFileName(Harness.Compiler.defaultLibFileName)] = Harness.Compiler.defaultLibSourceFile;
-
- var host = Harness.Compiler.createCompilerHost(files, (fn, contents) => result = contents);
- var program = ts.createProgram([fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host);
+ var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFilename, content: undefined },
+ { unitName: fileName, content: content }],
+ (fn, contents) => result = contents,
+ ts.ScriptTarget.ES5,
+ sys.useCaseSensitiveFileNames);
+ var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host);
var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true);
checker.checkProgram();
- var errs = checker.getDiagnostics(files[fileName]);
+ var errs = checker.getDiagnostics(program.getSourceFile(fileName));
if (errs.length > 0) {
throw new Error('Error compiling ' + fileName + ': ' + errs.map(e => e.messageText).join('\r\n'));
}
diff --git a/src/harness/harness.ts b/src/harness/harness.ts
index 268d2125c2c..e35fe83f9b2 100644
--- a/src/harness/harness.ts
+++ b/src/harness/harness.ts
@@ -534,18 +534,47 @@ module Harness {
export var defaultLibFileName = 'lib.d.ts';
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.ES5, /*version:*/ "0");
+ // Cache these between executions so we don't have to re-parse them for every test
+ export var fourslashFilename = 'fourslash.ts';
+ export var fourslashSourceFile: ts.SourceFile;
+
export function getCanonicalFileName(fileName: string): string {
return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
}
- export function createCompilerHost(filemap: { [filename: string]: ts.SourceFile; }, writeFile: (fn: string, contents: string, writeByteOrderMark:boolean) => void): ts.CompilerHost {
+ export function createCompilerHost(inputFiles: { unitName: string; content: string; }[],
+ writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
+ scriptTarget: ts.ScriptTarget,
+ useCaseSensitiveFileNames: boolean): ts.CompilerHost {
+
+ // Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames
+ function getCanonicalFileName(fileName: string): string {
+ return useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
+ }
+
+ var filemap: { [filename: string]: ts.SourceFile; } = {};
+ // Register input files
+ function register(file: { unitName: string; content: string; }) {
+ if (file.content !== undefined) {
+ var filename = Path.switchToForwardSlashes(file.unitName);
+ filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, scriptTarget, /*version:*/ "0");
+ }
+ };
+ inputFiles.forEach(register);
+
return {
getCurrentDirectory: sys.getCurrentDirectory,
getCancellationToken: (): any => undefined,
getSourceFile: (fn, languageVersion) => {
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
return filemap[getCanonicalFileName(fn)];
- } else {
+ }
+ else if (fn === fourslashFilename) {
+ var tsFn = 'tests/cases/fourslash/' + fourslashFilename;
+ fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), scriptTarget, /*version*/ "0", /*isOpen*/ false);
+ return fourslashSourceFile;
+ }
+ else {
var lib = defaultLibFileName;
if (fn === defaultLibFileName) {
return defaultLibSourceFile;
@@ -557,7 +586,7 @@ module Harness {
getDefaultLibFilename: () => defaultLibFileName,
writeFile: writeFile,
getCanonicalFileName: getCanonicalFileName,
- useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
+ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
getNewLine: ()=> sys.newLine
};
}
@@ -614,7 +643,7 @@ module Harness {
}
public compileFiles(inputFiles: { unitName: string; content: string }[],
- otherFiles: { unitName: string; content?: string }[],
+ otherFiles: { unitName: string; content: string }[],
onComplete: (result: CompilerResult, checker: ts.TypeChecker) => void,
settingsCallback?: (settings: ts.CompilerOptions) => void,
options?: ts.CompilerOptions) {
@@ -628,9 +657,10 @@ module Harness {
settingsCallback(null);
}
+ var useCaseSensitiveFileNames = sys.useCaseSensitiveFileNames;
this.settings.forEach(setting => {
switch (setting.flag.toLowerCase()) {
- // "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve"
+ // "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
case "module":
case "modulegentarget":
if (typeof setting.value === 'string') {
@@ -706,10 +736,13 @@ module Harness {
options.removeComments = setting.value === 'false';
break;
+ case 'usecasesensitivefilenames':
+ useCaseSensitiveFileNames = setting.value === 'true';
+ break;
+
case 'mapsourcefiles':
case 'maproot':
case 'generatedeclarationfiles':
- case 'usecasesensitivefileresolution':
case 'gatherDiagnostics':
case 'codepage':
case 'createFileLog':
@@ -748,7 +781,10 @@ module Harness {
var fileOutputs: GeneratedFile[] = [];
var programFiles = inputFiles.map(file => file.unitName);
- var program = ts.createProgram(programFiles, options, createCompilerHost(filemap, (fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark })));
+ var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(otherFiles),
+ (fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
+ options.target,
+ useCaseSensitiveFileNames));
var hadParseErrors = program.getDiagnostics().length > 0;
@@ -1034,7 +1070,7 @@ module Harness {
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
// List of allowed metadata names
- var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation"];
+ var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames"];
function extractCompilerSettings(content: string): CompilerSetting[] {
diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts
index c294f5b1be4..2886c43f091 100644
--- a/src/harness/projectsRunner.ts
+++ b/src/harness/projectsRunner.ts
@@ -226,7 +226,8 @@ class ProjectRunner extends RunnerBase {
? filename
: ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename);
- var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName, getCurrentDirectory(), false);
+ var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName,
+ getCurrentDirectory(), Harness.Compiler.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
if (ts.isRootedDiskPath(diskRelativeName) || diskRelativeName.substr(0, 3) === "../") {
// If the generated output file resides in the parent folder or is rooted path,
// we need to instead create files that can live in the project reference folder
diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts
index 3b5d8cd3fff..8169531c27e 100644
--- a/src/harness/typeWriter.ts
+++ b/src/harness/typeWriter.ts
@@ -76,7 +76,7 @@ class TypeWriterWalker {
private log(node: ts.Node, type: ts.Type): void {
var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos);
var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos);
- var sourceText = ts.getSourceTextOfNodeFromSourceText(this.currentSourceFile.text, node);
+ var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node);
// If we got an unknown type, we temporarily want to fall back to just pretending the name
// (source text) of the node is the type. This is to align with the old typeWriter to make
diff --git a/src/services/core/diagnosticCore.ts b/src/services/core/diagnosticCore.ts
index b4d95a1c60b..369b8114eac 100644
--- a/src/services/core/diagnosticCore.ts
+++ b/src/services/core/diagnosticCore.ts
@@ -1,8 +1,6 @@
///
module TypeScript {
- export var LocalizedDiagnosticMessages: ts.Map = null;
-
export class Location {
private _fileName: string;
private _lineMap: LineMap;
diff --git a/src/services/getScriptLexicalStructureWalker.ts b/src/services/getScriptLexicalStructureWalker.ts
deleted file mode 100644
index 94ed8a6de87..00000000000
--- a/src/services/getScriptLexicalStructureWalker.ts
+++ /dev/null
@@ -1,363 +0,0 @@
-
-module TypeScript.Services {
- export class NavigationBarItemGetter {
- private hasGlobalNode = false;
-
- private getIndent(node: ISyntaxNode): number {
- var indent = this.hasGlobalNode ? 1 : 0;
-
- var current = node.parent;
- while (current != null) {
- if (current.kind() == SyntaxKind.ModuleDeclaration || current.kind() === SyntaxKind.FunctionDeclaration) {
- indent++;
- }
-
- current = current.parent;
- }
-
- return indent;
- }
-
- private getKindModifiers(modifiers: TypeScript.ISyntaxToken[]): string {
- var result: string[] = [];
-
- for (var i = 0, n = modifiers.length; i < n; i++) {
- result.push(modifiers[i].text());
- }
-
- return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none;
- }
-
- public getItems(node: TypeScript.SourceUnitSyntax): ts.NavigationBarItem[] {
- return this.getItemsWorker(() => this.getTopLevelNodes(node), n => this.createTopLevelItem(n));
- }
-
- private getChildNodes(nodes: IModuleElementSyntax[]): ISyntaxNode[] {
- var childNodes: ISyntaxNode[] = [];
-
- for (var i = 0, n = nodes.length; i < n; i++) {
- var node = nodes[i];
-
- if (node.kind() === SyntaxKind.FunctionDeclaration) {
- childNodes.push(node);
- }
- else if (node.kind() === SyntaxKind.VariableStatement) {
- var variableDeclaration = (node).variableDeclaration;
- childNodes.push.apply(childNodes, variableDeclaration.variableDeclarators);
- }
- }
-
- return childNodes;
- }
-
- private getTopLevelNodes(node: SourceUnitSyntax): ISyntaxNode[] {
- var topLevelNodes: ISyntaxNode[] = [];
- topLevelNodes.push(node);
-
- this.addTopLevelNodes(node.moduleElements, topLevelNodes);
-
- return topLevelNodes;
- }
-
- private addTopLevelNodes(nodes: IModuleElementSyntax[], topLevelNodes: ISyntaxNode[]): void {
- for (var i = 0, n = nodes.length; i < n; i++) {
- var node = nodes[i];
- switch (node.kind()) {
- case SyntaxKind.ClassDeclaration:
- case SyntaxKind.EnumDeclaration:
- case SyntaxKind.InterfaceDeclaration:
- topLevelNodes.push(node);
- break;
-
- case SyntaxKind.ModuleDeclaration:
- var moduleDeclaration = node;
- topLevelNodes.push(node);
- this.addTopLevelNodes(moduleDeclaration.moduleElements, topLevelNodes);
- break;
-
- case SyntaxKind.FunctionDeclaration:
- var functionDeclaration = node;
- if (this.isTopLevelFunctionDeclaration(functionDeclaration)) {
- topLevelNodes.push(node);
- this.addTopLevelNodes(functionDeclaration.block.statements, topLevelNodes);
- }
- break;
- }
- }
- }
-
- public isTopLevelFunctionDeclaration(functionDeclaration: FunctionDeclarationSyntax) {
- // A function declaration is 'top level' if it contains any function declarations
- // within it.
- return functionDeclaration.block && ArrayUtilities.any(functionDeclaration.block.statements, s => s.kind() === SyntaxKind.FunctionDeclaration);
- }
-
- private getItemsWorker(getNodes: () => ISyntaxNode[], createItem: (n: ISyntaxNode) => ts.NavigationBarItem): ts.NavigationBarItem[] {
- var items: ts.NavigationBarItem[] = [];
-
- var keyToItem = createIntrinsicsObject();
-
- var nodes = getNodes();
- for (var i = 0, n = nodes.length; i < n; i++) {
- var child = nodes[i];
- var item = createItem(child);
- if (item != null) {
- if (item.text.length > 0) {
- var key = item.text + "-" + item.kind;
-
- var itemWithSameName = keyToItem[key];
- if (itemWithSameName) {
- // We had an item with the same name. Merge these items together.
- this.merge(itemWithSameName, item);
- }
- else {
- keyToItem[key] = item;
- items.push(item);
- }
- }
- }
- }
-
- return items;
- }
-
- private merge(target: ts.NavigationBarItem, source: ts.NavigationBarItem) {
- // First, add any spans in the source to the target.
- target.spans.push.apply(target.spans, source.spans);
-
- if (source.childItems) {
- if (!target.childItems) {
- target.childItems = [];
- }
-
- // Next, recursively merge or add any children in the source as appropriate.
- outer:
- for (var i = 0, n = source.childItems.length; i < n; i++) {
- var sourceChild = source.childItems[i];
-
- for (var j = 0, m = target.childItems.length; j < m; j++) {
- var targetChild = target.childItems[j];
-
- if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) {
- // Found a match. merge them.
- this.merge(targetChild, sourceChild);
- continue outer;
- }
- }
-
- // Didn't find a match, just add this child to the list.
- target.childItems.push(sourceChild);
- }
- }
- }
-
- private getNavigationBarItem(text: string, kind: string, kindModifiers: string, spans: TypeScript.TextSpan[], childItems: ts.NavigationBarItem[]= [], indent: number = 0): ts.NavigationBarItem {
- return {
- text: text,
- kind: kind,
- kindModifiers: kindModifiers,
- spans: spans,
- childItems: childItems,
- indent: indent,
- bolded: false,
- grayed: false
- };
- }
-
- private createChildItem(node: ISyntaxNode): ts.NavigationBarItem {
- switch (node.kind()) {
- case SyntaxKind.Parameter:
- var parameter = node;
- if (parameter.modifiers.length === 0) {
- return null;
- }
- return this.getNavigationBarItem(parameter.identifier.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(parameter.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.MemberFunctionDeclaration:
- var memberFunction = node;
- return this.getNavigationBarItem(memberFunction.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, this.getKindModifiers(memberFunction.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.GetAccessor:
- var getAccessor = node;
- return this.getNavigationBarItem(getAccessor.propertyName.text(), ts.ScriptElementKind.memberGetAccessorElement, this.getKindModifiers(getAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.SetAccessor:
- var setAccessor = node;
- return this.getNavigationBarItem(setAccessor.propertyName.text(), ts.ScriptElementKind.memberSetAccessorElement, this.getKindModifiers(setAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.IndexSignature:
- var indexSignature = node;
- return this.getNavigationBarItem("[]", ts.ScriptElementKind.indexSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.EnumElement:
- var enumElement = node;
- return this.getNavigationBarItem(enumElement.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.CallSignature:
- var callSignature = node;
- return this.getNavigationBarItem("()", ts.ScriptElementKind.callSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.ConstructSignature:
- var constructSignature = node;
- return this.getNavigationBarItem("new()", ts.ScriptElementKind.constructSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.MethodSignature:
- var methodSignature = node;
- return this.getNavigationBarItem(methodSignature.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.PropertySignature:
- var propertySignature = node;
- return this.getNavigationBarItem(propertySignature.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
-
- case SyntaxKind.FunctionDeclaration:
- var functionDeclaration = node;
- if (!this.isTopLevelFunctionDeclaration(functionDeclaration)) {
- return this.getNavigationBarItem(functionDeclaration.identifier.text(), ts.ScriptElementKind.functionElement, this.getKindModifiers(functionDeclaration.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
- }
- break;
-
- case SyntaxKind.MemberVariableDeclaration:
- var memberVariableDeclaration = node;
- return this.getNavigationBarItem(memberVariableDeclaration.variableDeclarator.propertyName.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(memberVariableDeclaration.modifiers), [TextSpan.fromBounds(start(memberVariableDeclaration.variableDeclarator), end(memberVariableDeclaration.variableDeclarator))]);
-
- case SyntaxKind.VariableDeclarator:
- var variableDeclarator = node;
- return this.getNavigationBarItem(variableDeclarator.propertyName.text(), ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(variableDeclarator), end(variableDeclarator))]);
-
- case SyntaxKind.ConstructorDeclaration:
- var constructorDeclaration = node;
- return this.getNavigationBarItem("constructor", ts.ScriptElementKind.constructorImplementationElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
- }
-
- return null;
- }
-
- private createTopLevelItem(node: ISyntaxNode): ts.NavigationBarItem {
- switch (node.kind()) {
- case SyntaxKind.SourceUnit:
- return this.createSourceUnitItem(node);
-
- case SyntaxKind.ClassDeclaration:
- return this.createClassItem(node);
-
- case SyntaxKind.EnumDeclaration:
- return this.createEnumItem(node);
-
- case SyntaxKind.InterfaceDeclaration:
- return this.createIterfaceItem(node);
-
- case SyntaxKind.ModuleDeclaration:
- return this.createModuleItem(node);
-
- case SyntaxKind.FunctionDeclaration:
- return this.createFunctionItem(node);
- }
-
- return null;
- }
-
- private getModuleNames(node: TypeScript.ModuleDeclarationSyntax): string[] {
- var result: string[] = [];
-
- if (node.stringLiteral) {
- result.push(node.stringLiteral.text());
- }
- else {
- this.getModuleNamesHelper(node.name, result);
- }
-
- return result;
- }
-
- private getModuleNamesHelper(name: TypeScript.INameSyntax, result: string[]): void {
- if (name.kind() === TypeScript.SyntaxKind.QualifiedName) {
- var qualifiedName = name;
- this.getModuleNamesHelper(qualifiedName.left, result);
- result.push(qualifiedName.right.text());
- }
- else {
- result.push((name).text());
- }
- }
-
- private createModuleItem(node: ModuleDeclarationSyntax): ts.NavigationBarItem {
- var moduleNames = this.getModuleNames(node);
-
- var childItems = this.getItemsWorker(() => this.getChildNodes(node.moduleElements), n => this.createChildItem(n));
-
- return this.getNavigationBarItem(moduleNames.join("."),
- ts.ScriptElementKind.moduleElement,
- this.getKindModifiers(node.modifiers),
- [TextSpan.fromBounds(start(node), end(node))],
- childItems,
- this.getIndent(node));
- }
-
- private createFunctionItem(node: FunctionDeclarationSyntax) {
- var childItems = this.getItemsWorker(() => node.block.statements, n => this.createChildItem(n));
-
- return this.getNavigationBarItem(node.identifier.text(),
- ts.ScriptElementKind.functionElement,
- this.getKindModifiers(node.modifiers),
- [TextSpan.fromBounds(start(node), end(node))],
- childItems,
- this.getIndent(node));
- }
-
- private createSourceUnitItem(node: SourceUnitSyntax): ts.NavigationBarItem {
- var childItems = this.getItemsWorker(() => this.getChildNodes(node.moduleElements), n => this.createChildItem(n));
-
- if (childItems === null || childItems.length === 0) {
- return null;
- }
-
- this.hasGlobalNode = true;
- return this.getNavigationBarItem("",
- ts.ScriptElementKind.moduleElement,
- ts.ScriptElementKindModifier.none,
- [TextSpan.fromBounds(start(node), end(node))],
- childItems);
- }
-
- private createClassItem(node: ClassDeclarationSyntax): ts.NavigationBarItem {
- var constructor = ArrayUtilities.firstOrDefault(
- node.classElements, n => n.kind() === SyntaxKind.ConstructorDeclaration);
-
- // Add the constructor parameters in as children of hte class (for property parameters).
- var nodes: ISyntaxNode[] = constructor
- ? (constructor.callSignature.parameterList.parameters).concat(node.classElements)
- : node.classElements;
-
- var childItems = this.getItemsWorker(() => nodes, n => this.createChildItem(n));
- return this.getNavigationBarItem(
- node.identifier.text(),
- ts.ScriptElementKind.classElement,
- this.getKindModifiers(node.modifiers),
- [TextSpan.fromBounds(start(node), end(node))],
- childItems,
- this.getIndent(node));
- }
-
- private createEnumItem(node: TypeScript.EnumDeclarationSyntax): ts.NavigationBarItem {
- var childItems = this.getItemsWorker(() => node.enumElements, n => this.createChildItem(n));
- return this.getNavigationBarItem(
- node.identifier.text(),
- ts.ScriptElementKind.enumElement,
- this.getKindModifiers(node.modifiers),
- [TextSpan.fromBounds(start(node), end(node))],
- childItems,
- this.getIndent(node));
- }
-
- private createIterfaceItem(node: TypeScript.InterfaceDeclarationSyntax): ts.NavigationBarItem {
- var childItems = this.getItemsWorker(() => node.body.typeMembers, n => this.createChildItem(n));
- return this.getNavigationBarItem(
- node.identifier.text(),
- ts.ScriptElementKind.interfaceElement,
- this.getKindModifiers(node.modifiers),
- [TextSpan.fromBounds(start(node), end(node))],
- childItems,
- this.getIndent(node));
- }
- }
-}
\ No newline at end of file
diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts
new file mode 100644
index 00000000000..9f16fa57741
--- /dev/null
+++ b/src/services/navigationBar.ts
@@ -0,0 +1,426 @@
+///
+///
+
+module ts.NavigationBar {
+ export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] {
+ // If the source file has any child items, then it included in the tree
+ // and takes lexical ownership of all other top-level items.
+ var hasGlobalNode = false;
+
+ return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem);
+
+ function getIndent(node: Node): number {
+ // If we have a global node in the tree,
+ // then it adds an extra layer of depth to all subnodes.
+ var indent = hasGlobalNode ? 1 : 0;
+
+ var current = node.parent;
+ while (current) {
+ switch (current.kind) {
+ case SyntaxKind.ModuleDeclaration:
+ // If we have a module declared as A.B.C, it is more "intuitive"
+ // to say it only has a single layer of depth
+ do {
+ current = current.parent;
+ }
+ while (current.kind === SyntaxKind.ModuleDeclaration);
+
+ // fall through
+ case SyntaxKind.ClassDeclaration:
+ case SyntaxKind.EnumDeclaration:
+ case SyntaxKind.InterfaceDeclaration:
+ case SyntaxKind.FunctionDeclaration:
+ indent++;
+ }
+
+ current = current.parent;
+ }
+
+ return indent;
+ }
+
+ function getChildNodes(nodes: Node[]): Node[] {
+ var childNodes: Node[] = [];
+
+ for (var i = 0, n = nodes.length; i < n; i++) {
+ var node = nodes[i];
+
+ if (node.kind === SyntaxKind.ClassDeclaration ||
+ node.kind === SyntaxKind.EnumDeclaration ||
+ node.kind === SyntaxKind.InterfaceDeclaration ||
+ node.kind === SyntaxKind.ModuleDeclaration ||
+ node.kind === SyntaxKind.FunctionDeclaration) {
+
+ childNodes.push(node);
+ }
+ else if (node.kind === SyntaxKind.VariableStatement) {
+ childNodes.push.apply(childNodes, (node).declarations);
+ }
+ }
+
+ return sortNodes(childNodes);
+ }
+
+ function getTopLevelNodes(node: SourceFile): Node[] {
+ var topLevelNodes: Node[] = [];
+ topLevelNodes.push(node);
+
+ addTopLevelNodes(node.statements, topLevelNodes);
+
+ return topLevelNodes;
+ }
+
+ function sortNodes(nodes: Node[]): Node[] {
+ return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => {
+ if (n1.name && n2.name) {
+ return n1.name.text.localeCompare(n2.name.text);
+ }
+ else if (n1.name) {
+ return 1;
+ }
+ else if (n2.name) {
+ -1;
+ }
+ else {
+ return n1.kind - n2.kind;
+ }
+ });
+ }
+
+ function addTopLevelNodes(nodes: Node[], topLevelNodes: Node[]): void {
+ nodes = sortNodes(nodes);
+
+ for (var i = 0, n = nodes.length; i < n; i++) {
+ var node = nodes[i];
+ switch (node.kind) {
+ case SyntaxKind.ClassDeclaration:
+ case SyntaxKind.EnumDeclaration:
+ case SyntaxKind.InterfaceDeclaration:
+ topLevelNodes.push(node);
+ break;
+
+ case SyntaxKind.ModuleDeclaration:
+ var moduleDeclaration = node;
+ topLevelNodes.push(node);
+ addTopLevelNodes((getInnermostModule(moduleDeclaration).body).statements, topLevelNodes);
+ break;
+
+ case SyntaxKind.FunctionDeclaration:
+ var functionDeclaration = node;
+ if (isTopLevelFunctionDeclaration(functionDeclaration)) {
+ topLevelNodes.push(node);
+ addTopLevelNodes((functionDeclaration.body).statements, topLevelNodes);
+ }
+ break;
+ }
+ }
+ }
+
+ function isTopLevelFunctionDeclaration(functionDeclaration: FunctionDeclaration) {
+ if (functionDeclaration.kind === SyntaxKind.FunctionDeclaration) {
+ // A function declaration is 'top level' if it contains any function declarations
+ // within it.
+ if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.FunctionBlock) {
+ if (forEach((functionDeclaration.body).statements,
+ s => s.kind === SyntaxKind.FunctionDeclaration && !isEmpty((s).name.text))) {
+
+ return true;
+ }
+
+ // Or if it is not parented by another function. i.e all functions
+ // at module scope are 'top level'.
+ if (functionDeclaration.parent.kind !== SyntaxKind.FunctionBlock) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ function getItemsWorker(nodes: Node[], createItem: (n: Node) => ts.NavigationBarItem): ts.NavigationBarItem[] {
+ var items: ts.NavigationBarItem[] = [];
+
+ var keyToItem: Map = {};
+
+ for (var i = 0, n = nodes.length; i < n; i++) {
+ var child = nodes[i];
+ var item = createItem(child);
+ if (item !== undefined) {
+ if (item.text.length > 0) {
+ var key = item.text + "-" + item.kind + "-" + item.indent;
+
+ var itemWithSameName = keyToItem[key];
+ if (itemWithSameName) {
+ // We had an item with the same name. Merge these items together.
+ merge(itemWithSameName, item);
+ }
+ else {
+ keyToItem[key] = item;
+ items.push(item);
+ }
+ }
+ }
+ }
+
+ return items;
+ }
+
+ function merge(target: ts.NavigationBarItem, source: ts.NavigationBarItem) {
+ // First, add any spans in the source to the target.
+ target.spans.push.apply(target.spans, source.spans);
+
+ if (source.childItems) {
+ if (!target.childItems) {
+ target.childItems = [];
+ }
+
+ // Next, recursively merge or add any children in the source as appropriate.
+ outer:
+ for (var i = 0, n = source.childItems.length; i < n; i++) {
+ var sourceChild = source.childItems[i];
+
+ for (var j = 0, m = target.childItems.length; j < m; j++) {
+ var targetChild = target.childItems[j];
+
+ if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) {
+ // Found a match. merge them.
+ merge(targetChild, sourceChild);
+ continue outer;
+ }
+ }
+
+ // Didn't find a match, just add this child to the list.
+ target.childItems.push(sourceChild);
+ }
+ }
+ }
+
+ function createChildItem(node: Node): ts.NavigationBarItem {
+ switch (node.kind) {
+ case SyntaxKind.Parameter:
+ if ((node.flags & NodeFlags.Modifier) === 0) {
+ return undefined;
+ }
+
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberVariableElement);
+
+ case SyntaxKind.Method:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberFunctionElement);
+
+ case SyntaxKind.GetAccessor:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberGetAccessorElement);
+
+ case SyntaxKind.SetAccessor:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberSetAccessorElement);
+
+ case SyntaxKind.IndexSignature:
+ return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement);
+
+ case SyntaxKind.EnumMember:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberVariableElement);
+
+ case SyntaxKind.CallSignature:
+ return createItem(node, "()", ts.ScriptElementKind.callSignatureElement);
+
+ case SyntaxKind.ConstructSignature:
+ return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement);
+
+ case SyntaxKind.Property:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.memberVariableElement);
+
+ case SyntaxKind.FunctionDeclaration:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.functionElement);
+
+ case SyntaxKind.VariableDeclaration:
+ return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.variableElement);
+
+ case SyntaxKind.Constructor:
+ return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement);
+ }
+
+ return undefined;
+
+ function createItem(node: Node, name: string, scriptElementKind: string): NavigationBarItem {
+ return getNavigationBarItem(name, scriptElementKind, getNodeModifiers(node), [getNodeSpan(node)]);
+ }
+ }
+
+ function isEmpty(text: string) {
+ return !text || text.trim() === "";
+ }
+
+ function getNavigationBarItem(text: string, kind: string, kindModifiers: string, spans: TypeScript.TextSpan[], childItems: ts.NavigationBarItem[] = [], indent: number = 0): ts.NavigationBarItem {
+ if (isEmpty(text)) {
+ return undefined;
+ }
+
+ return {
+ text: text,
+ kind: kind,
+ kindModifiers: kindModifiers,
+ spans: spans,
+ childItems: childItems,
+ indent: indent,
+ bolded: false,
+ grayed: false
+ };
+ }
+
+ function createTopLevelItem(node: Node): ts.NavigationBarItem {
+ switch (node.kind) {
+ case SyntaxKind.SourceFile:
+ return createSourceFileItem(node);
+
+ case SyntaxKind.ClassDeclaration:
+ return createClassItem(node);
+
+ case SyntaxKind.EnumDeclaration:
+ return createEnumItem(node);
+
+ case SyntaxKind.InterfaceDeclaration:
+ return createIterfaceItem(node);
+
+ case SyntaxKind.ModuleDeclaration:
+ return createModuleItem(node);
+
+ case SyntaxKind.FunctionDeclaration:
+ return createFunctionItem(node);
+ }
+
+ return undefined;
+
+ function getModuleName(moduleDeclaration: ModuleDeclaration): string {
+ // We want to maintain quotation marks.
+ if (moduleDeclaration.name.kind === SyntaxKind.StringLiteral) {
+ return getTextOfNode(moduleDeclaration.name);
+ }
+
+ // Otherwise, we need to aggregate each identifier to build up the qualified name.
+ var result: string[] = [];
+
+ result.push(moduleDeclaration.name.text);
+
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) {
+ moduleDeclaration = moduleDeclaration.body;
+
+ result.push(moduleDeclaration.name.text);
+ }
+
+ return result.join(".");
+ }
+
+ function createModuleItem(node: ModuleDeclaration): NavigationBarItem {
+ var moduleName = getModuleName(node);
+
+ var childItems = getItemsWorker(getChildNodes((getInnermostModule(node).body).statements), createChildItem);
+
+ return getNavigationBarItem(moduleName,
+ ts.ScriptElementKind.moduleElement,
+ getNodeModifiers(node),
+ [getNodeSpan(node)],
+ childItems,
+ getIndent(node));
+ }
+
+ function createFunctionItem(node: FunctionDeclaration) {
+ if (node.name && node.body && node.body.kind === SyntaxKind.FunctionBlock) {
+ var childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem);
+
+ return getNavigationBarItem(node.name.text,
+ ts.ScriptElementKind.functionElement,
+ getNodeModifiers(node),
+ [getNodeSpan(node)],
+ childItems,
+ getIndent(node));
+ }
+
+ return undefined;
+ }
+
+ function createSourceFileItem(node: SourceFile): ts.NavigationBarItem {
+ var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem);
+
+ if (childItems === undefined || childItems.length === 0) {
+ return undefined;
+ }
+
+ hasGlobalNode = true;
+ var rootName = isExternalModule(node) ?
+ "\"" + escapeString(getBaseFilename(removeFileExtension(normalizePath(node.filename)))) + "\"" :
+ ""
+
+ return getNavigationBarItem(rootName,
+ ts.ScriptElementKind.moduleElement,
+ ts.ScriptElementKindModifier.none,
+ [getNodeSpan(node)],
+ childItems);
+ }
+
+ function createClassItem(node: ClassDeclaration): ts.NavigationBarItem {
+ var childItems: NavigationBarItem[];
+
+ if (node.members) {
+ var constructor = forEach(node.members, member => {
+ return member.kind === SyntaxKind.Constructor && member;
+ });
+
+ // Add the constructor parameters in as children of the class (for property parameters).
+ var nodes: Node[] = constructor
+ ? constructor.parameters.concat(node.members)
+ : node.members;
+
+ var childItems = getItemsWorker(sortNodes(nodes), createChildItem);
+ }
+
+ return getNavigationBarItem(
+ node.name.text,
+ ts.ScriptElementKind.classElement,
+ getNodeModifiers(node),
+ [getNodeSpan(node)],
+ childItems,
+ getIndent(node));
+ }
+
+ function createEnumItem(node: EnumDeclaration): ts.NavigationBarItem {
+ var childItems = getItemsWorker(sortNodes(node.members), createChildItem);
+ return getNavigationBarItem(
+ node.name.text,
+ ts.ScriptElementKind.enumElement,
+ getNodeModifiers(node),
+ [getNodeSpan(node)],
+ childItems,
+ getIndent(node));
+ }
+
+ function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem {
+ var childItems = getItemsWorker(sortNodes(node.members), createChildItem);
+ return getNavigationBarItem(
+ node.name.text,
+ ts.ScriptElementKind.interfaceElement,
+ getNodeModifiers(node),
+ [getNodeSpan(node)],
+ childItems,
+ getIndent(node));
+ }
+ }
+
+ function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration {
+ while (node.body.kind === SyntaxKind.ModuleDeclaration) {
+ node = node.body;
+ }
+
+ return node;
+ }
+
+ function getNodeSpan(node: Node) {
+ return node.kind === SyntaxKind.SourceFile
+ ? TypeScript.TextSpan.fromBounds(node.getFullStart(), node.getEnd())
+ : TypeScript.TextSpan.fromBounds(node.getStart(), node.getEnd());
+ }
+
+ function getTextOfNode(node: Node): string {
+ return getTextOfNodeFromSourceText(sourceFile.text, node);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts
index 134508bc067..aaaedb735ea 100644
--- a/src/services/outliningElementsCollector.ts
+++ b/src/services/outliningElementsCollector.ts
@@ -33,19 +33,32 @@ module ts {
export module OutliningElementsCollector {
export function collectElements(sourceFile: SourceFile): OutliningSpan[] {
var elements: OutliningSpan[] = [];
+ var collapseText = "...";
- function addOutlineRange(hintSpanNode: Node, startElement: Node, endElement: Node) {
+ function addOutliningSpan(hintSpanNode: Node, startElement: Node, endElement: Node, autoCollapse: boolean) {
if (hintSpanNode && startElement && endElement) {
var span: OutliningSpan = {
textSpan: TypeScript.TextSpan.fromBounds(startElement.pos, endElement.end),
hintSpan: TypeScript.TextSpan.fromBounds(hintSpanNode.getStart(), hintSpanNode.end),
- bannerText: "...",
- autoCollapse: false
+ bannerText: collapseText,
+ autoCollapse: autoCollapse
};
elements.push(span);
}
}
+ function autoCollapse(node: Node) {
+ switch (node.kind) {
+ case SyntaxKind.ModuleBlock:
+ case SyntaxKind.ClassDeclaration:
+ case SyntaxKind.InterfaceDeclaration:
+ case SyntaxKind.EnumDeclaration:
+ return false;
+ }
+
+ return true;
+ }
+
var depth = 0;
var maxDepth = 20;
function walk(n: Node): void {
@@ -54,15 +67,44 @@ module ts {
}
switch (n.kind) {
case SyntaxKind.Block:
+ var parent = n.parent;
+ var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
+ var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
+
+ // Check if the block is standalone, or 'attached' to some parent statement.
+ // If the latter, we want to collaps the block, but consider its hint span
+ // to be the entire span of the parent.
+ if (parent.kind === SyntaxKind.DoStatement ||
+ parent.kind === SyntaxKind.ForInStatement ||
+ parent.kind === SyntaxKind.ForStatement ||
+ parent.kind === SyntaxKind.IfStatement ||
+ parent.kind === SyntaxKind.WhileStatement ||
+ parent.kind === SyntaxKind.WithStatement) {
+
+ addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
+ }
+ else {
+ // Block was a standalone block. In this case we want to only collapse
+ // the span of the block, independent of any parent span.
+ var span = TypeScript.TextSpan.fromBounds(n.getStart(), n.end);
+ elements.push({
+ textSpan: span,
+ hintSpan: span,
+ bannerText: collapseText,
+ autoCollapse: autoCollapse(n)
+ });
+ }
+ break;
+
+
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.TryBlock:
- case SyntaxKind.TryBlock:
case SyntaxKind.CatchBlock:
case SyntaxKind.FinallyBlock:
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
- addOutlineRange(n.parent, openBrace, closeBrace);
+ addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n));
break;
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
@@ -71,12 +113,12 @@ module ts {
case SyntaxKind.SwitchStatement:
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
- addOutlineRange(n, openBrace, closeBrace);
+ addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
break;
case SyntaxKind.ArrayLiteral:
var openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile);
var closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
- addOutlineRange(n, openBracket, closeBracket);
+ addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
break;
}
depth++;
diff --git a/src/services/services.ts b/src/services/services.ts
index 3e222450aa7..703a05c62cb 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -6,7 +6,7 @@
///
///
-///
+///
///
///
///
@@ -256,7 +256,7 @@ module ts {
var declarations = this.getDeclarations();
if (declarations) {
for (var i = 0, n = declarations.length; i < n; i++) {
- this.processDocumentationCommentDeclaration(lines, declarations[0]);
+ this.processDocumentationCommentDeclaration(lines, declarations[i]);
}
}
@@ -274,7 +274,7 @@ module ts {
for (var i = 0, n = commentRanges.length; i < n; i++) {
this.processDocumentationCommentRange(
- lines, sourceFile, commentRanges[0]);
+ lines, sourceFile, commentRanges[i]);
}
}
}
@@ -504,27 +504,47 @@ module ts {
if (!this.namedDeclarations) {
var sourceFile = this;
var namedDeclarations: Declaration[] = [];
- var isExternalModule = ts.isExternalModule(sourceFile);
- forEachChild(sourceFile, function visit(node: Node): boolean {
+ forEachChild(sourceFile, function visit(node: Node): void {
switch (node.kind) {
+ case SyntaxKind.FunctionDeclaration:
+ case SyntaxKind.Method:
+ var functionDeclaration = node;
+
+ if (functionDeclaration.name && functionDeclaration.name.kind !== SyntaxKind.Missing) {
+ var lastDeclaration = namedDeclarations.length > 0 ?
+ namedDeclarations[namedDeclarations.length - 1] :
+ undefined;
+
+ // Check whether this declaration belongs to an "overload group".
+ if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) {
+ // Overwrite the last declaration if it was an overload
+ // and this one is an implementation.
+ if (functionDeclaration.body && !(lastDeclaration).body) {
+ namedDeclarations[namedDeclarations.length - 1] = functionDeclaration;
+ }
+ }
+ else {
+ namedDeclarations.push(node);
+ }
+
+ forEachChild(node, visit);
+ }
+ break;
+
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
- case SyntaxKind.Method:
- case SyntaxKind.FunctionDeclaration:
- case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.TypeLiteral:
if ((node).name) {
namedDeclarations.push(node);
}
- forEachChild(node, visit);
- break;
-
+ // fall through
+ case SyntaxKind.Constructor:
case SyntaxKind.VariableStatement:
case SyntaxKind.ModuleBlock:
case SyntaxKind.FunctionBlock:
@@ -532,19 +552,17 @@ module ts {
break;
case SyntaxKind.Parameter:
+ // Only consider properties defined as constructor parameters
if (!(node.flags & NodeFlags.AccessibilityModifier)) {
- // Only consider properties defined as constructor parameters
break;
}
+ // fall through
case SyntaxKind.VariableDeclaration:
case SyntaxKind.EnumMember:
case SyntaxKind.Property:
namedDeclarations.push(node);
break;
}
-
- // do not go any deeper
- return undefined;
});
this.namedDeclarations = namedDeclarations;
@@ -666,6 +684,8 @@ module ts {
getSignatureAtPosition(fileName: string, position: number): SignatureInfo;
getRenameInfo(fileName: string, position: number): RenameInfo;
+ findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
+
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
@@ -757,6 +777,11 @@ module ts {
newText: string;
}
+ export interface RenameLocation {
+ textSpan: TypeScript.TextSpan;
+ fileName: string;
+ }
+
export interface ReferenceEntry {
textSpan: TypeScript.TextSpan;
fileName: string;
@@ -1025,6 +1050,8 @@ module ts {
static primitiveType = "primitive type";
static label = "label";
+
+ static alias = "alias"
}
export class ScriptElementKindModifier {
@@ -1510,6 +1537,20 @@ module ts {
}
/// Helpers
+ export function getNodeModifiers(node: Node): string {
+ var flags = node.flags;
+ var result: string[] = [];
+
+ if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier);
+ if (flags & NodeFlags.Protected) result.push(ScriptElementKindModifier.protectedMemberModifier);
+ if (flags & NodeFlags.Public) result.push(ScriptElementKindModifier.publicMemberModifier);
+ if (flags & NodeFlags.Static) result.push(ScriptElementKindModifier.staticModifier);
+ if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier);
+ if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier);
+
+ return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none;
+ }
+
function getTargetLabel(referenceNode: Node, labelName: string): Identifier {
while (referenceNode) {
if (referenceNode.kind === SyntaxKind.LabeledStatement && (referenceNode).label.text === labelName) {
@@ -1648,8 +1689,8 @@ module ts {
var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined;
// Check if the localized messages json is set, otherwise query the host for it
- if (!TypeScript.LocalizedDiagnosticMessages) {
- TypeScript.LocalizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
+ if (!localizedDiagnosticMessages) {
+ localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
}
function getSourceFile(filename: string): SourceFile {
@@ -2038,15 +2079,6 @@ module ts {
return (SyntaxKind.FirstPunctuation <= kind && kind <= SyntaxKind.LastPunctuation);
}
- function isVisibleWithinClassDeclaration(symbol: Symbol, containingClass: Declaration): boolean {
- var declaration = symbol.declarations && symbol.declarations[0];
- if (declaration && (declaration.flags & NodeFlags.Private)) {
- var declarationClass = getAncestor(declaration, SyntaxKind.ClassDeclaration);
- return containingClass === declarationClass;
- }
- return true;
- }
-
function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
if (!existingMembers || existingMembers.length === 0) {
return contextualMemberSymbols;
@@ -2130,7 +2162,7 @@ module ts {
}
// TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct node
- var mappedNode = getNodeAtPosition(sourceFile, TypeScript.end(node) - 1);
+ var mappedNode = getTouchingToken(sourceFile, TypeScript.end(node) - 1);
if (isPunctuation(mappedNode.kind)) {
mappedNode = mappedNode.parent;
}
@@ -2150,15 +2182,20 @@ module ts {
// Right of dot member completion list
if (isRightOfDot) {
var symbols: Symbol[] = [];
- var containingClass = getAncestor(mappedNode, SyntaxKind.ClassDeclaration);
isMemberCompletion = true;
if (mappedNode.kind === SyntaxKind.Identifier || mappedNode.kind === SyntaxKind.QualifiedName || mappedNode.kind === SyntaxKind.PropertyAccess) {
var symbol = typeInfoResolver.getSymbolInfo(mappedNode);
+
+ // This is an alias, follow what it aliases
+ if (symbol && symbol.flags & SymbolFlags.Import) {
+ symbol = typeInfoResolver.getAliasedSymbol(symbol);
+ }
+
if (symbol && symbol.flags & SymbolFlags.HasExports) {
// Extract module or enum members
forEachValue(symbol.exports, symbol => {
- if (isVisibleWithinClassDeclaration(symbol, containingClass)) {
+ if (typeInfoResolver.isValidPropertyAccess((mappedNode.parent), symbol.name)) {
symbols.push(symbol);
}
});
@@ -2170,7 +2207,7 @@ module ts {
if (apparentType) {
// Filter private properties
forEach(apparentType.getApparentProperties(), symbol => {
- if (isVisibleWithinClassDeclaration(symbol, containingClass)) {
+ if (typeInfoResolver.isValidPropertyAccess((mappedNode.parent), symbol.name)) {
symbols.push(symbol);
}
});
@@ -2205,7 +2242,7 @@ module ts {
else {
isMemberCompletion = false;
/// TODO filter meaning based on the current context
- var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace;
+ var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Import;
var symbols = typeInfoResolver.getSymbolsInScope(mappedNode, symbolMeanings);
getCompletionEntriesFromSymbols(symbols, activeCompletionSession);
@@ -2303,6 +2340,7 @@ module ts {
if (flags & SymbolFlags.Constructor) return ScriptElementKind.constructorImplementationElement;
if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement;
if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement;
+ if (flags & SymbolFlags.Import) return ScriptElementKind.alias;
return ScriptElementKind.unknown;
}
@@ -2349,26 +2387,12 @@ module ts {
: ScriptElementKindModifier.none;
}
- function getNodeModifiers(node: Node): string {
- var flags = node.flags;
- var result: string[] = [];
-
- if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier);
- if (flags & NodeFlags.Protected) result.push(ScriptElementKindModifier.protectedMemberModifier);
- if (flags & NodeFlags.Public) result.push(ScriptElementKindModifier.publicMemberModifier);
- if (flags & NodeFlags.Static) result.push(ScriptElementKindModifier.staticModifier);
- if (flags & NodeFlags.Export) result.push(ScriptElementKindModifier.exportedModifier);
- if (isInAmbientContext(node)) result.push(ScriptElementKindModifier.ambientModifier);
-
- return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none;
- }
-
function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
synchronizeHostData();
fileName = TypeScript.switchToForwardSlashes(fileName);
var sourceFile = getSourceFile(fileName);
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingPropertyName(sourceFile, position);
if (!node) {
return undefined;
}
@@ -2476,7 +2500,7 @@ module ts {
fileName = TypeScript.switchToForwardSlashes(fileName);
var sourceFile = getSourceFile(fileName);
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingWord(sourceFile, position);
if (!node) {
return undefined;
}
@@ -2559,7 +2583,7 @@ module ts {
filename = TypeScript.switchToForwardSlashes(filename);
var sourceFile = getSourceFile(filename);
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingPropertyName(sourceFile, position);
if (!node) {
return undefined;
}
@@ -2574,7 +2598,8 @@ module ts {
/// Triple slash reference comments
var comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined);
if (comment) {
- var targetFilename = normalizePath(combinePaths(getDirectoryPath(filename), comment.filename));
+ var targetFilename = isRootedDiskPath(comment.filename) ? comment.filename : combinePaths(getDirectoryPath(filename), comment.filename);
+ targetFilename = normalizePath(targetFilename);
if (program.getSourceFile(targetFilename)) {
return [{
fileName: targetFilename,
@@ -2599,7 +2624,7 @@ module ts {
var result: DefinitionInfo[] = [];
var declarations = symbol.getDeclarations();
- var symbolName = typeInfoResolver.symbolToString(symbol, node);
+ var symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
var symbolKind = getSymbolKind(symbol);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : "";
@@ -2623,14 +2648,14 @@ module ts {
filename = TypeScript.switchToForwardSlashes(filename);
var sourceFile = getSourceFile(filename);
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingWord(sourceFile, position);
if (!node) {
return undefined;
}
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.SuperKeyword ||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) {
- return getReferencesForNode(node, [sourceFile]);
+ return getReferencesForNode(node, [sourceFile], /*findInStrings:*/ false, /*findInComments:*/ false);
}
switch (node.kind) {
@@ -2645,6 +2670,11 @@ module ts {
return getReturnOccurrences(node.parent);
}
break;
+ case SyntaxKind.ThrowKeyword:
+ if (hasKind(node.parent, SyntaxKind.ThrowStatement)) {
+ return getThrowOccurrences(node.parent);
+ }
+ break;
case SyntaxKind.TryKeyword:
case SyntaxKind.CatchKeyword:
case SyntaxKind.FinallyKeyword:
@@ -2685,6 +2715,11 @@ module ts {
return getConstructorOccurrences(node.parent);
}
break;
+ case SyntaxKind.GetKeyword:
+ case SyntaxKind.SetKeyword:
+ if (hasKind(node.parent, SyntaxKind.GetAccessor) || hasKind(node.parent, SyntaxKind.SetAccessor)) {
+ return getGetAndSetOccurrences(node.parent);
+ }
}
return undefined;
@@ -2762,12 +2797,108 @@ module ts {
}
var keywords: Node[] = []
- forEachReturnStatement((func).body, returnStatement => {
+ forEachReturnStatement(func.body, returnStatement => {
pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword);
});
+ // Include 'throw' statements that do not occur within a try block.
+ forEach(aggregateOwnedThrowStatements(func.body), throwStatement => {
+ pushKeywordIf(keywords, throwStatement.getFirstToken(), SyntaxKind.ThrowKeyword);
+ });
+
return map(keywords, getReferenceEntryFromNode);
}
+
+ function getThrowOccurrences(throwStatement: ThrowStatement) {
+ var owner = getThrowStatementOwner(throwStatement);
+
+ if (!owner) {
+ return undefined;
+ }
+
+ var keywords: Node[] = [];
+
+ forEach(aggregateOwnedThrowStatements(owner), throwStatement => {
+ pushKeywordIf(keywords, throwStatement.getFirstToken(), SyntaxKind.ThrowKeyword);
+ });
+
+ // If the "owner" is a function, then we equate 'return' and 'throw' statements in their
+ // ability to "jump out" of the function, and include occurrences for both.
+ if (owner.kind === SyntaxKind.FunctionBlock) {
+ forEachReturnStatement(owner, returnStatement => {
+ pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword);
+ });
+ }
+
+ return map(keywords, getReferenceEntryFromNode);
+ }
+
+ /**
+ * Aggregates all throw-statements within this node *without* crossing
+ * into function boundaries and try-blocks with catch-clauses.
+ */
+ function aggregateOwnedThrowStatements(node: Node): ThrowStatement[] {
+ var statementAccumulator: ThrowStatement[] = []
+ aggregate(node);
+ return statementAccumulator;
+
+ function aggregate(node: Node): void {
+ if (node.kind === SyntaxKind.ThrowStatement) {
+ statementAccumulator.push(node);
+ }
+ else if (node.kind === SyntaxKind.TryStatement) {
+ var tryStatement = node;
+
+ if (tryStatement.catchBlock) {
+ aggregate(tryStatement.catchBlock);
+ }
+ else {
+ // Exceptions thrown within a try block lacking a catch clause
+ // are "owned" in the current context.
+ aggregate(tryStatement.tryBlock);
+ }
+
+ if (tryStatement.finallyBlock) {
+ aggregate(tryStatement.finallyBlock);
+ }
+ }
+ // Do not cross function boundaries.
+ else if (!isAnyFunction(node)) {
+ forEachChild(node, aggregate);
+ }
+ };
+ }
+
+ /**
+ * For lack of a better name, this function takes a throw statement and returns the
+ * nearest ancestor that is a try-block (whose try statement has a catch clause),
+ * function-block, or source file.
+ */
+ function getThrowStatementOwner(throwStatement: ThrowStatement): Node {
+ var child: Node = throwStatement;
+
+ while (child.parent) {
+ var parent = child.parent;
+
+ if (parent.kind === SyntaxKind.FunctionBlock || parent.kind === SyntaxKind.SourceFile) {
+ return parent;
+ }
+
+ // A throw-statement is only owned by a try-statement if the try-statement has
+ // a catch clause, and if the throw-statement occurs within the try block.
+ if (parent.kind === SyntaxKind.TryStatement) {
+ var tryStatement = parent;
+
+ if (tryStatement.tryBlock === child && tryStatement.catchBlock) {
+ return child;
+ }
+ }
+
+ child = parent;
+ }
+
+ return undefined;
+ }
function getTryCatchFinallyOccurrences(tryStatement: TryStatement): ReferenceEntry[] {
var keywords: Node[] = [];
@@ -2919,6 +3050,23 @@ module ts {
return map(keywords, getReferenceEntryFromNode);
}
+ function getGetAndSetOccurrences(accessorDeclaration: AccessorDeclaration): ReferenceEntry[] {
+ var keywords: Node[] = [];
+
+ tryPushAccessorKeyword(accessorDeclaration.symbol, SyntaxKind.GetAccessor);
+ tryPushAccessorKeyword(accessorDeclaration.symbol, SyntaxKind.SetAccessor);
+
+ return map(keywords, getReferenceEntryFromNode);
+
+ function tryPushAccessorKeyword(accessorSymbol: Symbol, accessorKind: SyntaxKind): void {
+ var accessor = getDeclarationOfKind(accessorSymbol, accessorKind);
+
+ if (accessor) {
+ forEach(accessor.getChildren(), child => pushKeywordIf(keywords, child, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword));
+ }
+ }
+ }
+
// returns true if 'node' is defined and has a matching 'kind'.
function hasKind(node: Node, kind: SyntaxKind) {
return node !== undefined && node.kind === kind;
@@ -2939,13 +3087,21 @@ module ts {
}
}
- function getReferencesAtPosition(filename: string, position: number): ReferenceEntry[] {
+ function findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] {
+ return findReferences(fileName, position, findInStrings, findInComments);
+ }
+
+ function getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
+ return findReferences(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false);
+ }
+
+ function findReferences(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
synchronizeHostData();
- filename = TypeScript.switchToForwardSlashes(filename);
- var sourceFile = getSourceFile(filename);
+ fileName = TypeScript.switchToForwardSlashes(fileName);
+ var sourceFile = getSourceFile(fileName);
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingPropertyName(sourceFile, position);
if (!node) {
return undefined;
}
@@ -2959,10 +3115,11 @@ module ts {
return undefined;
}
- return getReferencesForNode(node, program.getSourceFiles());
+ Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.NumericLiteral || node.kind === SyntaxKind.StringLiteral);
+ return getReferencesForNode(node, program.getSourceFiles(), findInStrings, findInComments);
}
- function getReferencesForNode(node: Node, sourceFiles: SourceFile[]): ReferenceEntry[] {
+ function getReferencesForNode(node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
// Labels
if (isLabelName(node)) {
if (isJumpStatementTarget(node)) {
@@ -3012,7 +3169,7 @@ module ts {
if (scope) {
result = [];
- getReferencesInNode(scope, symbol, symbolName, node, searchMeaning, result);
+ getReferencesInNode(scope, symbol, symbolName, node, searchMeaning, findInStrings, findInComments, result);
}
else {
forEach(sourceFiles, sourceFile => {
@@ -3020,7 +3177,7 @@ module ts {
if (lookUp(sourceFile.identifiers, symbolName)) {
result = result || [];
- getReferencesInNode(sourceFile, symbol, symbolName, node, searchMeaning, result);
+ getReferencesInNode(sourceFile, symbol, symbolName, node, searchMeaning, findInStrings, findInComments, result);
}
});
}
@@ -3128,7 +3285,7 @@ module ts {
forEach(possiblePositions, position => {
cancellationToken.throwIfCancellationRequested();
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingWord(sourceFile, position);
if (!node || node.getWidth() !== labelName.length) {
return;
}
@@ -3172,8 +3329,16 @@ module ts {
* tuple of(searchSymbol, searchText, searchLocation, and searchMeaning).
* searchLocation: a node where the search value
*/
- function getReferencesInNode(container: Node, searchSymbol: Symbol, searchText: string, searchLocation: Node, searchMeaning: SearchMeaning, result: ReferenceEntry[]): void {
+ function getReferencesInNode(container: Node,
+ searchSymbol: Symbol,
+ searchText: string,
+ searchLocation: Node,
+ searchMeaning: SearchMeaning,
+ findInStrings: boolean,
+ findInComments: boolean,
+ result: ReferenceEntry[]): void {
var sourceFile = container.getSourceFile();
+ var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, container.getStart(), container.getEnd());
@@ -3184,8 +3349,19 @@ module ts {
forEach(possiblePositions, position => {
cancellationToken.throwIfCancellationRequested();
- var referenceLocation = getNodeAtPosition(sourceFile, position);
+ var referenceLocation = getTouchingPropertyName(sourceFile, position);
if (!isValidReferencePosition(referenceLocation, searchText)) {
+ // This wasn't the start of a token. Check to see if it might be a
+ // match in a comment or string if that's what the caller is asking
+ // for.
+ if ((findInStrings && isInString(position)) ||
+ (findInComments && isInComment(position))) {
+ result.push({
+ fileName: sourceFile.filename,
+ textSpan: new TypeScript.TextSpan(position, searchText.length),
+ isWriteAccess: false
+ });
+ }
return;
}
@@ -3206,6 +3382,32 @@ module ts {
}
});
}
+
+ function isInString(position: number) {
+ var token = getTokenAtPosition(sourceFile, position);
+ return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
+ }
+
+ function isInComment(position: number) {
+ var token = getTokenAtPosition(sourceFile, position);
+ if (token && position < token.getStart()) {
+ // First, we have to see if this position actually landed in a comment.
+ var commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
+
+ // Then we want to make sure that it wasn't in a "///<" directive comment
+ // We don't want to unintentionally update a file name.
+ return forEach(commentRanges, c => {
+ if (c.pos < position && position < c.end) {
+ var commentText = sourceFile.text.substring(c.pos, c.end);
+ if (!tripleSlashDirectivePrefixRegex.test(commentText)) {
+ return true;
+ }
+ }
+ });
+ }
+
+ return false;
+ }
}
function getReferencesForSuperKeyword(superKeyword: Node): ReferenceEntry[]{
@@ -3236,7 +3438,7 @@ module ts {
forEach(possiblePositions, position => {
cancellationToken.throwIfCancellationRequested();
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingWord(sourceFile, position);
if (!node || node.kind !== SyntaxKind.SuperKeyword) {
return;
@@ -3302,7 +3504,7 @@ module ts {
forEach(possiblePositions, position => {
cancellationToken.throwIfCancellationRequested();
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingWord(sourceFile, position);
if (!node || node.kind !== SyntaxKind.ThisKeyword) {
return;
}
@@ -3360,7 +3562,7 @@ module ts {
}
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[]): void {
- if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
+ if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
forEach(symbol.getDeclarations(), declaration => {
if (declaration.kind === SyntaxKind.ClassDeclaration) {
getPropertySymbolFromTypeReference((declaration).baseType);
@@ -3375,14 +3577,15 @@ module ts {
function getPropertySymbolFromTypeReference(typeReference: TypeReferenceNode) {
if (typeReference) {
- // TODO: move to getTypeOfNode instead
- var typeReferenceSymbol = typeInfoResolver.getSymbolInfo(typeReference.typeName);
- if (typeReferenceSymbol) {
- var propertySymbol = typeReferenceSymbol.members[propertyName];
- if (propertySymbol) result.push(typeReferenceSymbol.members[propertyName]);
+ var type = typeInfoResolver.getTypeOfNode(typeReference);
+ if (type) {
+ var propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName);
+ if (propertySymbol) {
+ result.push(propertySymbol);
+ }
// Visit the typeReference as well to see if it directly or indirectly use that property
- getPropertySymbolsFromBaseTypes(typeReferenceSymbol, propertyName, result);
+ getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result);
}
}
}
@@ -3697,7 +3900,8 @@ module ts {
filename = TypeScript.switchToForwardSlashes(filename);
var compilerOptions = program.getCompilerOptions();
var targetSourceFile = program.getSourceFile(filename); // Current selected file to be output
- var emitToSingleFile = ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions);
+ // If --out flag is not specified, shouldEmitToOwnFile is true. Otherwise shouldEmitToOwnFile is false.
+ var shouldEmitToOwnFile = ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions);
var emitDeclaration = compilerOptions.declaration;
var emitOutput: EmitOutput = {
outputFiles: [],
@@ -3718,7 +3922,7 @@ module ts {
var syntacticDiagnostics: Diagnostic[] = [];
var containSyntacticErrors = false;
- if (emitToSingleFile) {
+ if (shouldEmitToOwnFile) {
// Check only the file we want to emit
containSyntacticErrors = containErrors(program.getDiagnostics(targetSourceFile));
} else {
@@ -3745,7 +3949,7 @@ module ts {
// Perform semantic and force a type check before emit to ensure that all symbols are updated
// EmitFiles will report if there is an error from TypeChecker and Emitter
// Depend whether we will have to emit into a single file or not either emit only selected file in the project, emit all files into a single file
- var emitFilesResult = emitToSingleFile ? getFullTypeCheckChecker().emitFiles(targetSourceFile) : getFullTypeCheckChecker().emitFiles();
+ var emitFilesResult = getFullTypeCheckChecker().emitFiles(targetSourceFile);
emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus;
// Reset writer back to undefined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in getEmitOutput
@@ -3904,10 +4108,10 @@ module ts {
return TypeScript.Services.Breakpoints.getBreakpointLocation(syntaxtree, position);
}
- function getNavigationBarItems(filename: string) {
+ function getNavigationBarItems(filename: string): NavigationBarItem[] {
filename = TypeScript.switchToForwardSlashes(filename);
- var syntaxTree = getSyntaxTree(filename);
- return new TypeScript.Services.NavigationBarItemGetter().getItems(syntaxTree.sourceUnit());
+
+ return NavigationBar.getNavigationBarItems(getCurrentSourceFile(filename));
}
function getSemanticClassifications(fileName: string, span: TypeScript.TextSpan): ClassifiedSpan[] {
@@ -3921,7 +4125,7 @@ module ts {
return result;
- function classifySymbol(symbol: Symbol) {
+ function classifySymbol(symbol: Symbol, isInTypePosition: boolean) {
var flags = symbol.getFlags();
if (flags & SymbolFlags.Class) {
@@ -3930,14 +4134,16 @@ module ts {
else if (flags & SymbolFlags.Enum) {
return ClassificationTypeNames.enumName;
}
- else if (flags & SymbolFlags.Interface) {
- return ClassificationTypeNames.interfaceName;
- }
else if (flags & SymbolFlags.Module) {
return ClassificationTypeNames.moduleName;
}
- else if (flags & SymbolFlags.TypeParameter) {
- return ClassificationTypeNames.typeParameterName;
+ else if (isInTypePosition) {
+ if (flags & SymbolFlags.Interface) {
+ return ClassificationTypeNames.interfaceName;
+ }
+ else if (flags & SymbolFlags.TypeParameter) {
+ return ClassificationTypeNames.typeParameterName;
+ }
}
}
@@ -3947,7 +4153,7 @@ module ts {
if (node.kind === SyntaxKind.Identifier && node.getWidth() > 0) {
var symbol = typeInfoResolver.getSymbolInfo(node);
if (symbol) {
- var type = classifySymbol(symbol);
+ var type = classifySymbol(symbol, isTypeNode(node) || isTypeDeclarationName(node));
if (type) {
result.push({
textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()),
@@ -4116,7 +4322,7 @@ module ts {
var sourceFile = getCurrentSourceFile(filename);
var result: TypeScript.TextSpan[] = [];
- var token = getTokenAtPosition(sourceFile, position);
+ var token = getTouchingToken(sourceFile, position);
if (token.getStart(sourceFile) === position) {
var matchKind = getMatchingTokenKind(token);
@@ -4400,7 +4606,7 @@ module ts {
fileName = TypeScript.switchToForwardSlashes(fileName);
var sourceFile = getSourceFile(fileName);
- var node = getNodeAtPosition(sourceFile, position);
+ var node = getTouchingWord(sourceFile, position);
// Can only rename an identifier.
if (node && node.kind === SyntaxKind.Identifier) {
@@ -4465,6 +4671,7 @@ module ts {
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
getNavigateToItems: getNavigateToItems,
getRenameInfo: getRenameInfo,
+ findRenameLocations: findRenameLocations,
getNavigationBarItems: getNavigationBarItems,
getOutliningSpans: getOutliningSpans,
getTodoComments: getTodoComments,
@@ -4486,26 +4693,58 @@ module ts {
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
- var noRegexTable: boolean[];
- if (!noRegexTable) {
- noRegexTable = [];
- noRegexTable[SyntaxKind.Identifier] = true;
- noRegexTable[SyntaxKind.StringLiteral] = true;
- noRegexTable[SyntaxKind.NumericLiteral] = true;
- noRegexTable[SyntaxKind.RegularExpressionLiteral] = true;
- noRegexTable[SyntaxKind.ThisKeyword] = true;
- noRegexTable[SyntaxKind.PlusPlusToken] = true;
- noRegexTable[SyntaxKind.MinusMinusToken] = true;
- noRegexTable[SyntaxKind.CloseParenToken] = true;
- noRegexTable[SyntaxKind.CloseBracketToken] = true;
- noRegexTable[SyntaxKind.CloseBraceToken] = true;
- noRegexTable[SyntaxKind.TrueKeyword] = true;
- noRegexTable[SyntaxKind.FalseKeyword] = true;
+ var noRegexTable: boolean[] = [];
+ noRegexTable[SyntaxKind.Identifier] = true;
+ noRegexTable[SyntaxKind.StringLiteral] = true;
+ noRegexTable[SyntaxKind.NumericLiteral] = true;
+ noRegexTable[SyntaxKind.RegularExpressionLiteral] = true;
+ noRegexTable[SyntaxKind.ThisKeyword] = true;
+ noRegexTable[SyntaxKind.PlusPlusToken] = true;
+ noRegexTable[SyntaxKind.MinusMinusToken] = true;
+ noRegexTable[SyntaxKind.CloseParenToken] = true;
+ noRegexTable[SyntaxKind.CloseBracketToken] = true;
+ noRegexTable[SyntaxKind.CloseBraceToken] = true;
+ noRegexTable[SyntaxKind.TrueKeyword] = true;
+ noRegexTable[SyntaxKind.FalseKeyword] = true;
+
+ function isAccessibilityModifier(kind: SyntaxKind) {
+ switch (kind) {
+ case SyntaxKind.PublicKeyword:
+ case SyntaxKind.PrivateKeyword:
+ case SyntaxKind.ProtectedKeyword:
+ return true;
+ }
+
+ return false;
+ }
+
+ /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */
+ function canFollow(keyword1: SyntaxKind, keyword2: SyntaxKind) {
+ if (isAccessibilityModifier(keyword1)) {
+ if (keyword2 === SyntaxKind.GetKeyword ||
+ keyword2 === SyntaxKind.SetKeyword ||
+ keyword2 === SyntaxKind.ConstructorKeyword ||
+ keyword2 === SyntaxKind.StaticKeyword) {
+
+ // Allow things like "public get", "public constructor" and "public static".
+ // These are all legal.
+ return true;
+ }
+
+ // Any other keyword following "public" is actually an identifier an not a real
+ // keyword.
+ return false;
+ }
+
+ // Assume any other keyword combination is legal. This can be refined in the future
+ // if there are more cases we want the classifier to be better at.
+ return true;
}
function getClassificationsForLine(text: string, lexState: EndOfLineState): ClassificationResult {
var offset = 0;
var lastTokenOrCommentEnd = 0;
+ var token = SyntaxKind.Unknown;
var lastNonTriviaToken = SyntaxKind.Unknown;
// If we're in a string literal, then prepend: "\
@@ -4535,8 +4774,27 @@ module ts {
entries: []
};
-
- var token = SyntaxKind.Unknown;
+ // We can run into an unfortunate interaction between the lexical and syntactic classifier
+ // when the user is typing something generic. Consider the case where the user types:
+ //
+ // Foo tokens. It's a weak heuristic, but should
+ // work well enough in practice.
+ var angleBracketStack = 0;
+
do {
token = scanner.scan();
@@ -4549,6 +4807,35 @@ module ts {
else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) {
token = SyntaxKind.Identifier;
}
+ else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
+ // We have two keywords in a row. Only treat the second as a keyword if
+ // it's a sequence that could legally occur in the language. Otherwise
+ // treat it as an identifier. This way, if someone writes "private var"
+ // we recognize that 'var' is actually an identifier here.
+ token = SyntaxKind.Identifier;
+ }
+ else if (lastNonTriviaToken === SyntaxKind.Identifier &&
+ token === SyntaxKind.LessThanToken) {
+ // Could be the start of something generic. Keep track of that by bumping
+ // up the current count of generic contexts we may be in.
+ angleBracketStack++;
+ }
+ else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) {
+ // If we think we're currently in something generic, then mark that that
+ // generic entity is complete.
+ angleBracketStack--;
+ }
+ else if (token === SyntaxKind.AnyKeyword ||
+ token === SyntaxKind.StringKeyword ||
+ token === SyntaxKind.NumberKeyword ||
+ token === SyntaxKind.BooleanKeyword) {
+ if (angleBracketStack > 0) {
+ // If it looks like we're could be in something generic, don't classify this
+ // as a keyword. We may just get overwritten by the syntactic classifier,
+ // causing a noisy experience for the user.
+ token = SyntaxKind.Identifier;
+ }
+ }
lastNonTriviaToken = token;
}
diff --git a/src/services/shims.ts b/src/services/shims.ts
index 45ac958935e..bab9b98a983 100644
--- a/src/services/shims.ts
+++ b/src/services/shims.ts
@@ -102,6 +102,12 @@ module ts {
*/
getRenameInfo(fileName: string, position: number): string;
+ /**
+ * Returns a JSON-encoded value of the type:
+ * { fileName: string, textSpan: { start: number, length: number } }[]
+ */
+ findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string;
+
/**
* Returns a JSON-encoded value of the type:
* { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string }
@@ -168,7 +174,7 @@ module ts {
}
/// TODO: delete this, it is only needed until the VS interface is updated
- enum LanguageVersion {
+ export enum LanguageVersion {
EcmaScript3 = 0,
EcmaScript5 = 1,
}
@@ -344,12 +350,6 @@ module ts {
}
var options = compilationSettingsToCompilerOptions(JSON.parse(settingsJson));
- /// TODO: this should be pushed into VS.
- /// We can not ask the LS instance to resolve, as this will lead to asking the host about files it does not know about,
- /// something it is not designed to handle. for now make sure we never get a "noresolve == false".
- /// This value should not matter, as the host runs resolution logic independently
- options.noResolve = true;
-
return options;
}
@@ -375,6 +375,7 @@ module ts {
if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
return null;
}
+
try {
return JSON.parse(diagnosticMessagesJson);
}
@@ -501,7 +502,8 @@ module ts {
start: diagnostic.start,
length: diagnostic.length,
/// TODO: no need for the tolowerCase call
- category: DiagnosticCategory[diagnostic.category].toLowerCase()
+ category: DiagnosticCategory[diagnostic.category].toLowerCase(),
+ code: diagnostic.code
};
}
@@ -655,6 +657,14 @@ module ts {
});
}
+ public findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string {
+ return this.forwardJSONCall(
+ "findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")",
+ () => {
+ return this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments);
+ });
+ }
+
/// GET BRACE MATCHING
public getBraceMatchingAtPosition(fileName: string, position: number): string {
return this.forwardJSONCall(
diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts
index 796472c030e..189d8d2e727 100644
--- a/src/services/signatureHelp.ts
+++ b/src/services/signatureHelp.ts
@@ -172,15 +172,15 @@ module ts.SignatureHelp {
return undefined;
}
- var argumentList = getContainingArgumentList(startingToken);
+ var argumentInfo = getContainingArgumentInfo(startingToken);
cancellationToken.throwIfCancellationRequested();
// Semantic filtering of signature help
- if (!argumentList) {
+ if (!argumentInfo) {
return undefined;
}
- var call = argumentList.parent;
+ var call = argumentInfo.list.parent;
var candidates = [];
var resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates);
cancellationToken.throwIfCancellationRequested();
@@ -189,13 +189,13 @@ module ts.SignatureHelp {
return undefined;
}
- return createSignatureHelpItems(candidates, resolvedSignature, argumentList);
+ return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo);
/**
* If node is an argument, returns its index in the argument list.
* If not, returns -1.
*/
- function getImmediatelyContainingArgumentList(node: Node): Node {
+ function getImmediatelyContainingArgumentInfo(node: Node): ListItemInfo {
if (node.parent.kind !== SyntaxKind.CallExpression && node.parent.kind !== SyntaxKind.NewExpression) {
return undefined;
}
@@ -216,10 +216,14 @@ module ts.SignatureHelp {
var parent = node.parent;
// Find out if 'node' is an argument, a type argument, or neither
if (node.kind === SyntaxKind.LessThanToken || node.kind === SyntaxKind.OpenParenToken) {
- // Find the list that starts right *after* the < or ( token
+ // Find the list that starts right *after* the < or ( token.
+ // If the user has just opened a list, consider this item 0.
var list = getChildListThatStartsWithOpenerToken(parent, node, sourceFile);
Debug.assert(list);
- return list;
+ return {
+ list: list,
+ listItemIndex: 0
+ };
}
if (node.kind === SyntaxKind.GreaterThanToken
@@ -228,18 +232,24 @@ module ts.SignatureHelp {
return undefined;
}
- return findContainingList(node);
+ return findListItemInfo(node);
}
- function getContainingArgumentList(node: Node): Node {
+ function getContainingArgumentInfo(node: Node): ListItemInfo {
for (var n = node; n.kind !== SyntaxKind.SourceFile; n = n.parent) {
if (n.kind === SyntaxKind.FunctionBlock) {
return undefined;
}
- var argumentList = getImmediatelyContainingArgumentList(n);
- if (argumentList) {
- return argumentList;
+ // If the node is not a subspan of its parent, this is a big problem.
+ // There have been crashes that might be caused by this violation.
+ if (n.pos < n.parent.pos || n.end > n.parent.end) {
+ Debug.fail("Node of kind " + SyntaxKind[n.kind] + " is not a subspan of its parent of kind " + SyntaxKind[n.parent.kind]);
+ }
+
+ var argumentInfo = getImmediatelyContainingArgumentInfo(n);
+ if (argumentInfo) {
+ return argumentInfo;
}
@@ -248,7 +258,35 @@ module ts.SignatureHelp {
return undefined;
}
- function createSignatureHelpItems(candidates: Signature[], bestSignature: Signature, argumentListOrTypeArgumentList: Node): SignatureHelpItems {
+ /**
+ * The selectedItemIndex could be negative for several reasons.
+ * 1. There are too many arguments for all of the overloads
+ * 2. None of the overloads were type compatible
+ * The solution here is to try to pick the best overload by picking
+ * either the first one that has an appropriate number of parameters,
+ * or the one with the most parameters.
+ */
+ function selectBestInvalidOverloadIndex(candidates: Signature[], argumentCount: number): number {
+ var maxParamsSignatureIndex = -1;
+ var maxParams = -1;
+ for (var i = 0; i < candidates.length; i++) {
+ var candidate = candidates[i];
+
+ if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) {
+ return i;
+ }
+
+ if (candidate.parameters.length > maxParams) {
+ maxParams = candidate.parameters.length;
+ maxParamsSignatureIndex = i;
+ }
+ }
+
+ return maxParamsSignatureIndex;
+ }
+
+ function createSignatureHelpItems(candidates: Signature[], bestSignature: Signature, argumentInfoOrTypeArgumentInfo: ListItemInfo): SignatureHelpItems {
+ var argumentListOrTypeArgumentList = argumentInfoOrTypeArgumentInfo.list;
var items: SignatureHelpItem[] = map(candidates, candidateSignature => {
var parameters = candidateSignature.parameters;
var parameterHelpItems: SignatureHelpParameter[] = parameters.length === 0 ? emptyArray : map(parameters, p => {
@@ -321,11 +359,6 @@ module ts.SignatureHelp {
};
});
- var selectedItemIndex = candidates.indexOf(bestSignature);
- if (selectedItemIndex < 0) {
- selectedItemIndex = 0;
- }
-
// We use full start and skip trivia on the end because we want to include trivia on
// both sides. For example,
//
@@ -338,63 +371,38 @@ module ts.SignatureHelp {
var applicableSpanEnd = skipTrivia(sourceFile.text, argumentListOrTypeArgumentList.end, /*stopAfterLineBreak*/ false);
var applicableSpan = new TypeScript.TextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
- var state = getSignatureHelpCurrentArgumentState(sourceFile, position, applicableSpanStart);
+ // The listItemIndex we got back includes commas. Our goal is to return the index of the proper
+ // item (not including commas). Here are some examples:
+ // 1. foo(a, b, c $) -> the listItemIndex is 4, we want to return 2
+ // 2. foo(a, b, $ c) -> listItemIndex is 3, we want to return 2
+ // 3. foo($a) -> listItemIndex is 0, we want to return 0
+ //
+ // In general, we want to subtract the number of commas before the current index.
+ // But if we are on a comma, we also want to pretend we are on the argument *following*
+ // the comma. That amounts to taking the ceiling of half the index.
+ var argumentIndex = (argumentInfoOrTypeArgumentInfo.listItemIndex + 1) >> 1;
+
+ // argumentCount is the number of commas plus one, unless the list is completely empty,
+ // in which case there are 0.
+ var argumentCount = argumentListOrTypeArgumentList.getChildCount() === 0
+ ? 0
+ : 1 + countWhere(argumentListOrTypeArgumentList.getChildren(), arg => arg.kind === SyntaxKind.CommaToken);
+
+ var selectedItemIndex = candidates.indexOf(bestSignature);
+ if (selectedItemIndex < 0) {
+ selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount);
+ }
+
return {
items: items,
applicableSpan: applicableSpan,
selectedItemIndex: selectedItemIndex,
- argumentIndex: state.argumentIndex,
- argumentCount: state.argumentCount
+ argumentIndex: argumentIndex,
+ argumentCount: argumentCount
};
}
}
- function getSignatureHelpCurrentArgumentState(sourceFile: SourceFile, position: number, applicableSpanStart: number): { argumentIndex: number; argumentCount: number } {
- var tokenPrecedingSpanStart = findPrecedingToken(applicableSpanStart, sourceFile);
- if (!tokenPrecedingSpanStart) {
- return undefined;
- }
-
- if (tokenPrecedingSpanStart.kind !== SyntaxKind.OpenParenToken && tokenPrecedingSpanStart.kind !== SyntaxKind.LessThanToken) {
- // The span start must have moved backward in the file (for example if the open paren was backspaced)
- return undefined;
- }
-
- var tokenPrecedingCurrentPosition = findPrecedingToken(position, sourceFile);
- var call = tokenPrecedingSpanStart.parent;
- Debug.assert(call.kind === SyntaxKind.CallExpression || call.kind === SyntaxKind.NewExpression, "wrong call kind " + SyntaxKind[call.kind]);
- if (tokenPrecedingCurrentPosition.kind === SyntaxKind.CloseParenToken || tokenPrecedingCurrentPosition.kind === SyntaxKind.GreaterThanToken) {
- if (tokenPrecedingCurrentPosition.parent === call) {
- // This call expression is complete. Stop signature help.
- return undefined;
- }
- }
-
- var argumentListOrTypeArgumentList = getChildListThatStartsWithOpenerToken(call, tokenPrecedingSpanStart, sourceFile);
- // Debug.assert(argumentListOrTypeArgumentList.getChildCount() === 0 || argumentListOrTypeArgumentList.getChildCount() % 2 === 1, "Even number of children");
-
- // The call might be finished, but incorrectly. Check if we are still within the bounds of the call
- if (position > skipTrivia(sourceFile.text, argumentListOrTypeArgumentList.end, /*stopAfterLineBreak*/ false)) {
- return undefined;
- }
-
- var numberOfCommas = countWhere(argumentListOrTypeArgumentList.getChildren(), arg => arg.kind === SyntaxKind.CommaToken);
- var argumentCount = numberOfCommas + 1;
- if (argumentCount <= 1) {
- return { argumentIndex: 0, argumentCount: argumentCount };
- }
-
- var indexOfNodeContainingPosition = findListItemIndexContainingPosition(argumentListOrTypeArgumentList, position);
-
- // indexOfNodeContainingPosition checks that position is between pos and end of each child, so it is
- // possible that we are to the right of all children. Assume that we are still within
- // the applicable span and that we are typing the last argument
- // Alternatively, we could be in range of one of the arguments, in which case we need to divide
- // by 2 to exclude commas. Use bit shifting in order to take the floor of the division.
- var argumentIndex = indexOfNodeContainingPosition < 0 ? argumentCount - 1 : indexOfNodeContainingPosition >> 1;
- return { argumentIndex: argumentIndex, argumentCount: argumentCount };
- }
-
function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node {
var children = parent.getChildren(sourceFile);
var indexOfOpenerToken = children.indexOf(openerToken);
diff --git a/src/services/utilities.ts b/src/services/utilities.ts
index 9e68ef1a7aa..4ceb20fdcee 100644
--- a/src/services/utilities.ts
+++ b/src/services/utilities.ts
@@ -27,11 +27,18 @@ module ts {
// for the position of the relevant node (or comma).
var syntaxList = forEach(node.parent.getChildren(), c => {
// find syntax list that covers the span of the node
- if (c.kind == SyntaxKind.SyntaxList && c.pos <= node.pos && c.end >= node.end) {
+ if (c.kind === SyntaxKind.SyntaxList && c.pos <= node.pos && c.end >= node.end) {
return c;
}
});
+ // syntaxList should not be undefined here. If it is, there is a problem. Find out if
+ // there at least is a child that is a list.
+ if (!syntaxList) {
+ Debug.assert(findChildOfKind(node.parent, SyntaxKind.SyntaxList),
+ "Node of kind " + SyntaxKind[node.parent.kind] + " has no list children");
+ }
+
return syntaxList;
}
@@ -50,34 +57,54 @@ module ts {
return -1;
}
- /** Get a token that contains the position. This is guaranteed to return a token, the position can be in the
- * leading trivia or within the token text.
- */
- export function getTokenAtPosition(sourceFile: SourceFile, position: number) {
- var current: Node = sourceFile;
- outer: while (true) {
- // find the child that has this
- for (var i = 0, n = current.getChildCount(); i < n; i++) {
- var child = current.getChildAt(i);
- if (child.getFullStart() <= position && position < child.getEnd()) {
- current = child;
- continue outer;
- }
- }
- return current;
- }
+ /* Gets the token whose text has range [start, end) and
+ * position >= start and (position < end or (position === end && token is keyword or identifier))
+ */
+ export function getTouchingWord(sourceFile: SourceFile, position: number): Node {
+ return getTouchingToken(sourceFile, position, isWord);
}
- /** Get the token whose text contains the position, or the containing node. */
- export function getNodeAtPosition(sourceFile: SourceFile, position: number) {
+ /* Gets the token whose text has range [start, end) and position >= start
+ * and (position < end or (position === end && token is keyword or identifier or numeric\string litera))
+ */
+ export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node {
+ return getTouchingToken(sourceFile, position, isPropertyName);
+ }
+
+ /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
+ export function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node {
+ return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition);
+ }
+
+ /** Returns a token if position is in [start-of-leading-trivia, end) */
+ export function getTokenAtPosition(sourceFile: SourceFile, position: number): Node {
+ return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined);
+ }
+
+ /** Get the token whose text contains the position */
+ function getTokenAtPositionWorker(sourceFile: SourceFile, position: number, allowPositionInLeadingTrivia: boolean, includeItemAtEndPosition: (n: Node) => boolean): Node {
var current: Node = sourceFile;
outer: while (true) {
- // find the child that has this
- for (var i = 0, n = current.getChildCount(); i < n; i++) {
+ if (isToken(current)) {
+ // exit early
+ return current;
+ }
+
+ // find the child that contains 'position'
+ for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) {
var child = current.getChildAt(i);
- if (child.getStart() <= position && position < child.getEnd()) {
- current = child;
- continue outer;
+ var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile);
+ if (start <= position) {
+ if (position < child.getEnd()) {
+ current = child;
+ continue outer;
+ }
+ else if (includeItemAtEndPosition && child.getEnd() === position) {
+ var previousToken = findPrecedingToken(position, sourceFile, child);
+ if (previousToken && includeItemAtEndPosition(previousToken)) {
+ return previousToken;
+ }
+ }
}
}
return current;
@@ -130,8 +157,8 @@ module ts {
}
}
- export function findPrecedingToken(position: number, sourceFile: SourceFile): Node {
- return find(sourceFile);
+ export function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node {
+ return find(startNode || sourceFile);
function findRightmostToken(n: Node): Node {
if (isToken(n)) {
@@ -167,7 +194,7 @@ module ts {
}
}
- Debug.assert(n.kind === SyntaxKind.SourceFile);
+ Debug.assert(startNode || n.kind === SyntaxKind.SourceFile);
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
@@ -202,7 +229,19 @@ module ts {
return n.kind !== SyntaxKind.SyntaxList || n.getChildCount() !== 0;
}
- function isToken(n: Node): boolean {
+ export function isToken(n: Node): boolean {
return n.kind >= SyntaxKind.FirstToken && n.kind <= SyntaxKind.LastToken;
}
+
+ function isKeyword(n: Node): boolean {
+ return n.kind >= SyntaxKind.FirstKeyword && n.kind <= SyntaxKind.LastKeyword;
+ }
+
+ function isWord(n: Node): boolean {
+ return n.kind === SyntaxKind.Identifier || isKeyword(n);
+ }
+
+ function isPropertyName(n: Node): boolean {
+ return n.kind === SyntaxKind.StringLiteral || n.kind === SyntaxKind.NumericLiteral || isWord(n);
+ }
}
\ No newline at end of file
diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt
index 2ab89730405..d200258fdb1 100644
--- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt
+++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt
@@ -1,12 +1,15 @@
+tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts(5,12): error TS2300: Duplicate identifier 'fn'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'.
-==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts (1 errors) ====
+==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts (2 errors) ====
class clodule {
id: string;
value: T;
static fn(id: U) { }
+ ~~
+!!! error TS2300: Duplicate identifier 'fn'.
}
module clodule {
diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt
index 5db506d1052..474613e283f 100644
--- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt
+++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.errors.txt
@@ -1,12 +1,15 @@
+tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts(5,12): error TS2300: Duplicate identifier 'fn'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'.
-==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts (1 errors) ====
+==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.ts (2 errors) ====
class clodule {
id: string;
value: T;
static fn(id: string) { }
+ ~~
+!!! error TS2300: Duplicate identifier 'fn'.
}
module clodule {
diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt
index 9b62647f40b..a59953e7fb2 100644
--- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt
+++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.errors.txt
@@ -1,12 +1,16 @@
+tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(4,12): error TS2300: Duplicate identifier 'Origin'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(8,21): error TS2300: Duplicate identifier 'Origin'.
+tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(16,16): error TS2300: Duplicate identifier 'Origin'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts(20,25): error TS2300: Duplicate identifier 'Origin'.
-==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts (2 errors) ====
+==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts (4 errors) ====
class Point {
constructor(public x: number, public y: number) { }
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'Origin'.
}
module Point {
@@ -21,6 +25,8 @@ tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMer
constructor(public x: number, public y: number) { }
static Origin(): Point { return { x: 0, y: 0 }; } // unexpected error here bug 840246
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'Origin'.
}
export module Point {
diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt
index b160146f6f7..88ad9f358be 100644
--- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt
+++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.errors.txt
@@ -1,12 +1,16 @@
+tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(4,12): error TS2300: Duplicate identifier 'Origin'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(8,16): error TS2300: Duplicate identifier 'Origin'.
+tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(16,16): error TS2300: Duplicate identifier 'Origin'.
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts(20,20): error TS2300: Duplicate identifier 'Origin'.
-==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts (2 errors) ====
+==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts (4 errors) ====
class Point {
constructor(public x: number, public y: number) { }
static Origin: Point = { x: 0, y: 0 };
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'Origin'.
}
module Point {
@@ -21,6 +25,8 @@ tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMer
constructor(public x: number, public y: number) { }
static Origin: Point = { x: 0, y: 0 };
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'Origin'.
}
export module Point {
diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt
index fd9c4bc0ffe..39e5278041d 100644
--- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt
+++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.errors.txt
@@ -1,10 +1,14 @@
+tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(2,18): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(10,18): error TS2300: Duplicate identifier 'Point'.
+tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(17,18): error TS2300: Duplicate identifier 'Line'.
tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts(26,26): error TS2300: Duplicate identifier 'Line'.
-==== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (2 errors) ====
+==== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts (4 errors) ====
module A {
export class Point {
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
x: number;
y: number;
}
@@ -22,6 +26,8 @@ tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesTha
module X.Y.Z {
export class Line {
+ ~~~~
+!!! error TS2300: Duplicate identifier 'Line'.
length: number;
}
}
diff --git a/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt b/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt
index e7ace55872a..16df32bb2c5 100644
--- a/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt
+++ b/tests/baselines/reference/ambientClassOverloadForFunction.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/ambientClassOverloadForFunction.ts(1,15): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/ambientClassOverloadForFunction.ts(2,10): error TS2300: Duplicate identifier 'foo'.
-==== tests/cases/compiler/ambientClassOverloadForFunction.ts (1 errors) ====
+==== tests/cases/compiler/ambientClassOverloadForFunction.ts (2 errors) ====
declare class foo{};
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
function foo() { return null; }
~~~
!!! error TS2300: Duplicate identifier 'foo'.
diff --git a/tests/baselines/reference/anyDeclare.errors.txt b/tests/baselines/reference/anyDeclare.errors.txt
index c9728323818..8eda3672f24 100644
--- a/tests/baselines/reference/anyDeclare.errors.txt
+++ b/tests/baselines/reference/anyDeclare.errors.txt
@@ -1,10 +1,13 @@
+tests/cases/compiler/anyDeclare.ts(3,9): error TS2300: Duplicate identifier 'myFn'.
tests/cases/compiler/anyDeclare.ts(4,14): error TS2300: Duplicate identifier 'myFn'.
-==== tests/cases/compiler/anyDeclare.ts (1 errors) ====
+==== tests/cases/compiler/anyDeclare.ts (2 errors) ====
declare var x: any;
module myMod {
var myFn;
+ ~~~~
+!!! error TS2300: Duplicate identifier 'myFn'.
function myFn() { }
~~~~
!!! error TS2300: Duplicate identifier 'myFn'.
diff --git a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt
index 668a7bef6a0..0d376912b8d 100644
--- a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt
+++ b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.errors.txt
@@ -395,8 +395,7 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(417,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(418,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(420,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(421,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(421,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(421,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(422,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(423,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(423,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -451,8 +450,7 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(474,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(475,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(477,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(478,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(478,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(478,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(479,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(480,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(480,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -507,8 +505,7 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(531,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(532,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(534,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(535,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(535,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(535,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(536,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(537,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(537,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -560,7 +557,7 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts(581,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts (560 errors) ====
+==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithInvalidOperands.ts (557 errors) ====
// these operators require their operands to be of type Any, the Number primitive type, or
// an enum type
enum E { a, b, c }
@@ -1776,10 +1773,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8b2 = b & b;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8b3 = b & c;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -1945,10 +1940,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9b2 = b ^ b;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9b3 = b ^ c;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -2114,10 +2107,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10b2 = b | b;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10b3 = b | c;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt
index 5ad26655c3c..c043cda8e68 100644
--- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt
+++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt
@@ -166,81 +166,69 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(124,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts (240 errors) ====
+==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts (228 errors) ====
// If one operand is the null or undefined value, it is treated as having the type of the
// other operand.
@@ -705,10 +693,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
// operator &
var r8a1 = null & a;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8a2 = null & b;
~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -721,10 +707,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8b1 = a & null;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8b2 = b & null;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -737,10 +721,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8c1 = null & true;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8c2 = null & '';
~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -753,10 +735,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8d1 = true & null;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8d2 = '' & null;
~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -770,10 +750,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
// operator ^
var r9a1 = null ^ a;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9a2 = null ^ b;
~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -786,10 +764,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9b1 = a ^ null;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9b2 = b ^ null;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -802,10 +778,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9c1 = null ^ true;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9c2 = null ^ '';
~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -818,10 +792,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9d1 = true ^ null;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9d2 = '' ^ null;
~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -835,10 +807,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
// operator |
var r10a1 = null | a;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10a2 = null | b;
~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -851,10 +821,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10b1 = a | null;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10b2 = b | null;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -867,10 +835,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10c1 = null | true;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10c2 = null | '';
~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -883,10 +849,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10d1 = true | null;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10d2 = '' | null;
~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt
index 7bd250ae661..9ee53c2f15c 100644
--- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt
+++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt
@@ -166,81 +166,69 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(124,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts (240 errors) ====
+==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts (228 errors) ====
// If one operand is the undefined or undefined value, it is treated as having the type of the
// other operand.
@@ -705,10 +693,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
// operator &
var r8a1 = undefined & a;
- ~~~~~~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8a2 = undefined & b;
~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -721,10 +707,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8b1 = a & undefined;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8b2 = b & undefined;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -737,10 +721,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8c1 = undefined & true;
- ~~~~~~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8c2 = undefined & '';
~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -753,10 +735,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r8d1 = true & undefined;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead.
var r8d2 = '' & undefined;
~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -770,10 +750,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
// operator ^
var r9a1 = undefined ^ a;
- ~~~~~~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9a2 = undefined ^ b;
~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -786,10 +764,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9b1 = a ^ undefined;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9b2 = b ^ undefined;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -802,10 +778,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9c1 = undefined ^ true;
- ~~~~~~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9c2 = undefined ^ '';
~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -818,10 +792,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r9d1 = true ^ undefined;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
var r9d2 = '' ^ undefined;
~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -835,10 +807,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
// operator |
var r10a1 = undefined | a;
- ~~~~~~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10a2 = undefined | b;
~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -851,10 +821,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10b1 = a | undefined;
- ~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10b2 = b | undefined;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -867,10 +835,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10c1 = undefined | true;
- ~~~~~~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10c2 = undefined | '';
~~~~~~~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -883,10 +849,8 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
var r10d1 = true | undefined;
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead.
var r10d2 = '' | undefined;
~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt
new file mode 100644
index 00000000000..7c0a3a5c8b9
--- /dev/null
+++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt
@@ -0,0 +1,36 @@
+tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]':
+ Types of property 'pop' are incompatible:
+ Type '() => {}' is not assignable to type '() => number':
+ Type '{}' is not assignable to type 'number'.
+tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]':
+ Property '0' is missing in type '{}[]'.
+
+
+==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts (2 errors) ====
+ var numStrTuple: [number, string];
+ var numNumTuple: [number, number];
+ var numEmptyObjTuple: [number, {}];
+ var emptyObjTuple: [{}];
+
+ var numArray: number[];
+ var emptyObjArray: {}[];
+
+ // no error
+ numArray = numNumTuple;
+ emptyObjArray = emptyObjTuple;
+ emptyObjArray = numStrTuple;
+ emptyObjArray = numNumTuple;
+ emptyObjArray = numEmptyObjTuple;
+
+ // error
+ numArray = numStrTuple;
+ ~~~~~~~~
+!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]':
+!!! error TS2322: Types of property 'pop' are incompatible:
+!!! error TS2322: Type '() => {}' is not assignable to type '() => number':
+!!! error TS2322: Type '{}' is not assignable to type 'number'.
+ emptyObjTuple = emptyObjArray;
+ ~~~~~~~~~~~~~
+!!! error TS2322: Type '{}[]' is not assignable to type '[{}]':
+!!! error TS2322: Property '0' is missing in type '{}[]'.
+
\ No newline at end of file
diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js
new file mode 100644
index 00000000000..cbe6b1ff04e
--- /dev/null
+++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js
@@ -0,0 +1,37 @@
+//// [assignmentCompatBetweenTupleAndArray.ts]
+var numStrTuple: [number, string];
+var numNumTuple: [number, number];
+var numEmptyObjTuple: [number, {}];
+var emptyObjTuple: [{}];
+
+var numArray: number[];
+var emptyObjArray: {}[];
+
+// no error
+numArray = numNumTuple;
+emptyObjArray = emptyObjTuple;
+emptyObjArray = numStrTuple;
+emptyObjArray = numNumTuple;
+emptyObjArray = numEmptyObjTuple;
+
+// error
+numArray = numStrTuple;
+emptyObjTuple = emptyObjArray;
+
+
+//// [assignmentCompatBetweenTupleAndArray.js]
+var numStrTuple;
+var numNumTuple;
+var numEmptyObjTuple;
+var emptyObjTuple;
+var numArray;
+var emptyObjArray;
+// no error
+numArray = numNumTuple;
+emptyObjArray = emptyObjTuple;
+emptyObjArray = numStrTuple;
+emptyObjArray = numNumTuple;
+emptyObjArray = numEmptyObjTuple;
+// error
+numArray = numStrTuple;
+emptyObjTuple = emptyObjArray;
diff --git a/tests/baselines/reference/augmentedTypesClass.errors.txt b/tests/baselines/reference/augmentedTypesClass.errors.txt
index 16faa14b4c2..2ff6889e22f 100644
--- a/tests/baselines/reference/augmentedTypesClass.errors.txt
+++ b/tests/baselines/reference/augmentedTypesClass.errors.txt
@@ -1,16 +1,22 @@
+tests/cases/compiler/augmentedTypesClass.ts(2,7): error TS2300: Duplicate identifier 'c1'.
tests/cases/compiler/augmentedTypesClass.ts(3,5): error TS2300: Duplicate identifier 'c1'.
+tests/cases/compiler/augmentedTypesClass.ts(6,7): error TS2300: Duplicate identifier 'c4'.
tests/cases/compiler/augmentedTypesClass.ts(7,6): error TS2300: Duplicate identifier 'c4'.
-==== tests/cases/compiler/augmentedTypesClass.ts (2 errors) ====
+==== tests/cases/compiler/augmentedTypesClass.ts (4 errors) ====
//// class then var
class c1 { public foo() { } }
+ ~~
+!!! error TS2300: Duplicate identifier 'c1'.
var c1 = 1; // error
~~
!!! error TS2300: Duplicate identifier 'c1'.
//// class then enum
class c4 { public foo() { } }
+ ~~
+!!! error TS2300: Duplicate identifier 'c4'.
enum c4 { One } // error
~~
!!! error TS2300: Duplicate identifier 'c4'.
\ No newline at end of file
diff --git a/tests/baselines/reference/augmentedTypesClass2.errors.txt b/tests/baselines/reference/augmentedTypesClass2.errors.txt
index 32104b65ac5..5881e49dae9 100644
--- a/tests/baselines/reference/augmentedTypesClass2.errors.txt
+++ b/tests/baselines/reference/augmentedTypesClass2.errors.txt
@@ -1,12 +1,16 @@
+tests/cases/compiler/augmentedTypesClass2.ts(4,7): error TS2300: Duplicate identifier 'c11'.
tests/cases/compiler/augmentedTypesClass2.ts(10,11): error TS2300: Duplicate identifier 'c11'.
+tests/cases/compiler/augmentedTypesClass2.ts(16,7): error TS2300: Duplicate identifier 'c33'.
tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate identifier 'c33'.
-==== tests/cases/compiler/augmentedTypesClass2.ts (2 errors) ====
+==== tests/cases/compiler/augmentedTypesClass2.ts (4 errors) ====
// Checking class with other things in type space not value space
// class then interface
- class c11 {
+ class c11 { // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'c11'.
foo() {
return 1;
}
@@ -21,6 +25,8 @@ tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate iden
// class then class - covered
// class then enum
class c33 {
+ ~~~
+!!! error TS2300: Duplicate identifier 'c33'.
foo() {
return 1;
}
diff --git a/tests/baselines/reference/augmentedTypesClass2.js b/tests/baselines/reference/augmentedTypesClass2.js
index b4df1672b69..f75c08a5920 100644
--- a/tests/baselines/reference/augmentedTypesClass2.js
+++ b/tests/baselines/reference/augmentedTypesClass2.js
@@ -2,7 +2,7 @@
// Checking class with other things in type space not value space
// class then interface
-class c11 {
+class c11 { // error
foo() {
return 1;
}
diff --git a/tests/baselines/reference/augmentedTypesClass2a.errors.txt b/tests/baselines/reference/augmentedTypesClass2a.errors.txt
index 74dece080a6..b17ab32d408 100644
--- a/tests/baselines/reference/augmentedTypesClass2a.errors.txt
+++ b/tests/baselines/reference/augmentedTypesClass2a.errors.txt
@@ -1,10 +1,13 @@
+tests/cases/compiler/augmentedTypesClass2a.ts(2,7): error TS2300: Duplicate identifier 'c2'.
tests/cases/compiler/augmentedTypesClass2a.ts(3,10): error TS2300: Duplicate identifier 'c2'.
tests/cases/compiler/augmentedTypesClass2a.ts(4,5): error TS2300: Duplicate identifier 'c2'.
-==== tests/cases/compiler/augmentedTypesClass2a.ts (2 errors) ====
+==== tests/cases/compiler/augmentedTypesClass2a.ts (3 errors) ====
//// class then function
- class c2 { public foo() { } }
+ class c2 { public foo() { } } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'c2'.
function c2() { } // error
~~
!!! error TS2300: Duplicate identifier 'c2'.
diff --git a/tests/baselines/reference/augmentedTypesClass2a.js b/tests/baselines/reference/augmentedTypesClass2a.js
index cca45c2c0b3..fe31f0964c2 100644
--- a/tests/baselines/reference/augmentedTypesClass2a.js
+++ b/tests/baselines/reference/augmentedTypesClass2a.js
@@ -1,6 +1,6 @@
//// [augmentedTypesClass2a.ts]
//// class then function
-class c2 { public foo() { } }
+class c2 { public foo() { } } // error
function c2() { } // error
var c2 = () => { }
@@ -12,7 +12,7 @@ var c2 = (function () {
c2.prototype.foo = function () {
};
return c2;
-})();
+})(); // error
function c2() {
} // error
var c2 = function () {
diff --git a/tests/baselines/reference/augmentedTypesClass4.errors.txt b/tests/baselines/reference/augmentedTypesClass4.errors.txt
index 2df0a95ccd2..6df027ca511 100644
--- a/tests/baselines/reference/augmentedTypesClass4.errors.txt
+++ b/tests/baselines/reference/augmentedTypesClass4.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/augmentedTypesClass4.ts(2,7): error TS2300: Duplicate identifier 'c3'.
tests/cases/compiler/augmentedTypesClass4.ts(3,7): error TS2300: Duplicate identifier 'c3'.
-==== tests/cases/compiler/augmentedTypesClass4.ts (1 errors) ====
+==== tests/cases/compiler/augmentedTypesClass4.ts (2 errors) ====
//// class then class
- class c3 { public foo() { } }
+ class c3 { public foo() { } } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'c3'.
class c3 { public bar() { } } // error
~~
!!! error TS2300: Duplicate identifier 'c3'.
diff --git a/tests/baselines/reference/augmentedTypesClass4.js b/tests/baselines/reference/augmentedTypesClass4.js
index c4e104e714b..71fc61d6659 100644
--- a/tests/baselines/reference/augmentedTypesClass4.js
+++ b/tests/baselines/reference/augmentedTypesClass4.js
@@ -1,6 +1,6 @@
//// [augmentedTypesClass4.ts]
//// class then class
-class c3 { public foo() { } }
+class c3 { public foo() { } } // error
class c3 { public bar() { } } // error
@@ -12,7 +12,7 @@ var c3 = (function () {
c3.prototype.foo = function () {
};
return c3;
-})();
+})(); // error
var c3 = (function () {
function c3() {
}
diff --git a/tests/baselines/reference/augmentedTypesEnum.errors.txt b/tests/baselines/reference/augmentedTypesEnum.errors.txt
index 374ca14093b..3102f9d4786 100644
--- a/tests/baselines/reference/augmentedTypesEnum.errors.txt
+++ b/tests/baselines/reference/augmentedTypesEnum.errors.txt
@@ -1,43 +1,58 @@
+tests/cases/compiler/augmentedTypesEnum.ts(2,6): error TS2300: Duplicate identifier 'e1111'.
tests/cases/compiler/augmentedTypesEnum.ts(3,5): error TS2300: Duplicate identifier 'e1111'.
+tests/cases/compiler/augmentedTypesEnum.ts(6,6): error TS2300: Duplicate identifier 'e2'.
tests/cases/compiler/augmentedTypesEnum.ts(7,10): error TS2300: Duplicate identifier 'e2'.
+tests/cases/compiler/augmentedTypesEnum.ts(9,6): error TS2300: Duplicate identifier 'e3'.
tests/cases/compiler/augmentedTypesEnum.ts(10,5): error TS2300: Duplicate identifier 'e3'.
+tests/cases/compiler/augmentedTypesEnum.ts(13,6): error TS2300: Duplicate identifier 'e4'.
tests/cases/compiler/augmentedTypesEnum.ts(14,7): error TS2300: Duplicate identifier 'e4'.
tests/cases/compiler/augmentedTypesEnum.ts(18,11): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.
+tests/cases/compiler/augmentedTypesEnum.ts(20,12): error TS2300: Duplicate identifier 'One'.
tests/cases/compiler/augmentedTypesEnum.ts(21,12): error TS2300: Duplicate identifier 'One'.
tests/cases/compiler/augmentedTypesEnum.ts(21,12): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.
-==== tests/cases/compiler/augmentedTypesEnum.ts (7 errors) ====
+==== tests/cases/compiler/augmentedTypesEnum.ts (12 errors) ====
// enum then var
- enum e1111 { One }
+ enum e1111 { One } // error
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'e1111'.
var e1111 = 1; // error
~~~~~
!!! error TS2300: Duplicate identifier 'e1111'.
// enum then function
- enum e2 { One }
+ enum e2 { One } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'e2'.
function e2() { } // error
~~
!!! error TS2300: Duplicate identifier 'e2'.
- enum e3 { One }
+ enum e3 { One } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'e3'.
var e3 = () => { } // error
~~
!!! error TS2300: Duplicate identifier 'e3'.
// enum then class
- enum e4 { One }
+ enum e4 { One } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'e4'.
class e4 { public foo() { } } // error
~~
!!! error TS2300: Duplicate identifier 'e4'.
// enum then enum
enum e5 { One }
- enum e5 { Two }
+ enum e5 { Two } // error
~~~
!!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.
- enum e5a { One }
+ enum e5a { One } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'One'.
enum e5a { One } // error
~~~
!!! error TS2300: Duplicate identifier 'One'.
diff --git a/tests/baselines/reference/augmentedTypesEnum.js b/tests/baselines/reference/augmentedTypesEnum.js
index 8422b99798b..f7a83018cfd 100644
--- a/tests/baselines/reference/augmentedTypesEnum.js
+++ b/tests/baselines/reference/augmentedTypesEnum.js
@@ -1,24 +1,24 @@
//// [augmentedTypesEnum.ts]
// enum then var
-enum e1111 { One }
+enum e1111 { One } // error
var e1111 = 1; // error
// enum then function
-enum e2 { One }
+enum e2 { One } // error
function e2() { } // error
-enum e3 { One }
+enum e3 { One } // error
var e3 = () => { } // error
// enum then class
-enum e4 { One }
+enum e4 { One } // error
class e4 { public foo() { } } // error
// enum then enum
enum e5 { One }
-enum e5 { Two }
+enum e5 { Two } // error
-enum e5a { One }
+enum e5a { One } // error
enum e5a { One } // error
// enum then internal module
@@ -40,26 +40,26 @@ module e6b { export var y = 2; } // should be error
var e1111;
(function (e1111) {
e1111[e1111["One"] = 0] = "One";
-})(e1111 || (e1111 = {}));
+})(e1111 || (e1111 = {})); // error
var e1111 = 1; // error
// enum then function
var e2;
(function (e2) {
e2[e2["One"] = 0] = "One";
-})(e2 || (e2 = {}));
+})(e2 || (e2 = {})); // error
function e2() {
} // error
var e3;
(function (e3) {
e3[e3["One"] = 0] = "One";
-})(e3 || (e3 = {}));
+})(e3 || (e3 = {})); // error
var e3 = function () {
}; // error
// enum then class
var e4;
(function (e4) {
e4[e4["One"] = 0] = "One";
-})(e4 || (e4 = {}));
+})(e4 || (e4 = {})); // error
var e4 = (function () {
function e4() {
}
@@ -75,11 +75,11 @@ var e5;
var e5;
(function (e5) {
e5[e5["Two"] = 0] = "Two";
-})(e5 || (e5 = {}));
+})(e5 || (e5 = {})); // error
var e5a;
(function (e5a) {
e5a[e5a["One"] = 0] = "One";
-})(e5a || (e5a = {}));
+})(e5a || (e5a = {})); // error
var e5a;
(function (e5a) {
e5a[e5a["One"] = 0] = "One";
diff --git a/tests/baselines/reference/augmentedTypesEnum2.errors.txt b/tests/baselines/reference/augmentedTypesEnum2.errors.txt
index 86e155f8772..8c6c7382f85 100644
--- a/tests/baselines/reference/augmentedTypesEnum2.errors.txt
+++ b/tests/baselines/reference/augmentedTypesEnum2.errors.txt
@@ -1,12 +1,16 @@
+tests/cases/compiler/augmentedTypesEnum2.ts(2,6): error TS2300: Duplicate identifier 'e1'.
tests/cases/compiler/augmentedTypesEnum2.ts(4,11): error TS2300: Duplicate identifier 'e1'.
+tests/cases/compiler/augmentedTypesEnum2.ts(11,6): error TS2300: Duplicate identifier 'e2'.
tests/cases/compiler/augmentedTypesEnum2.ts(12,7): error TS2300: Duplicate identifier 'e2'.
-==== tests/cases/compiler/augmentedTypesEnum2.ts (2 errors) ====
+==== tests/cases/compiler/augmentedTypesEnum2.ts (4 errors) ====
// enum then interface
- enum e1 { One }
+ enum e1 { One } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'e1'.
- interface e1 {
+ interface e1 { // error
~~
!!! error TS2300: Duplicate identifier 'e1'.
foo(): void;
@@ -15,7 +19,9 @@ tests/cases/compiler/augmentedTypesEnum2.ts(12,7): error TS2300: Duplicate ident
// interface then enum works
// enum then class
- enum e2 { One };
+ enum e2 { One }; // error
+ ~~
+!!! error TS2300: Duplicate identifier 'e2'.
class e2 { // error
~~
!!! error TS2300: Duplicate identifier 'e2'.
diff --git a/tests/baselines/reference/augmentedTypesEnum2.js b/tests/baselines/reference/augmentedTypesEnum2.js
index 13656b33411..8ab98a7cb7b 100644
--- a/tests/baselines/reference/augmentedTypesEnum2.js
+++ b/tests/baselines/reference/augmentedTypesEnum2.js
@@ -1,15 +1,15 @@
//// [augmentedTypesEnum2.ts]
// enum then interface
-enum e1 { One }
+enum e1 { One } // error
-interface e1 {
+interface e1 { // error
foo(): void;
}
// interface then enum works
// enum then class
-enum e2 { One };
+enum e2 { One }; // error
class e2 { // error
foo() {
return 1;
@@ -24,7 +24,7 @@ class e2 { // error
var e1;
(function (e1) {
e1[e1["One"] = 0] = "One";
-})(e1 || (e1 = {}));
+})(e1 || (e1 = {})); // error
// interface then enum works
// enum then class
var e2;
diff --git a/tests/baselines/reference/augmentedTypesFunction.errors.txt b/tests/baselines/reference/augmentedTypesFunction.errors.txt
index ba324349c65..8d1ce671c9e 100644
--- a/tests/baselines/reference/augmentedTypesFunction.errors.txt
+++ b/tests/baselines/reference/augmentedTypesFunction.errors.txt
@@ -1,42 +1,60 @@
+tests/cases/compiler/augmentedTypesFunction.ts(2,10): error TS2300: Duplicate identifier 'y1'.
tests/cases/compiler/augmentedTypesFunction.ts(3,5): error TS2300: Duplicate identifier 'y1'.
-tests/cases/compiler/augmentedTypesFunction.ts(7,1): error TS2393: Duplicate function implementation.
+tests/cases/compiler/augmentedTypesFunction.ts(6,10): error TS2393: Duplicate function implementation.
+tests/cases/compiler/augmentedTypesFunction.ts(7,10): error TS2393: Duplicate function implementation.
+tests/cases/compiler/augmentedTypesFunction.ts(9,10): error TS2300: Duplicate identifier 'y2a'.
tests/cases/compiler/augmentedTypesFunction.ts(10,5): error TS2300: Duplicate identifier 'y2a'.
+tests/cases/compiler/augmentedTypesFunction.ts(13,10): error TS2300: Duplicate identifier 'y3'.
tests/cases/compiler/augmentedTypesFunction.ts(14,7): error TS2300: Duplicate identifier 'y3'.
+tests/cases/compiler/augmentedTypesFunction.ts(16,10): error TS2300: Duplicate identifier 'y3a'.
tests/cases/compiler/augmentedTypesFunction.ts(17,7): error TS2300: Duplicate identifier 'y3a'.
+tests/cases/compiler/augmentedTypesFunction.ts(20,10): error TS2300: Duplicate identifier 'y4'.
tests/cases/compiler/augmentedTypesFunction.ts(21,6): error TS2300: Duplicate identifier 'y4'.
-==== tests/cases/compiler/augmentedTypesFunction.ts (6 errors) ====
+==== tests/cases/compiler/augmentedTypesFunction.ts (12 errors) ====
// function then var
- function y1() { }
+ function y1() { } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'y1'.
var y1 = 1; // error
~~
!!! error TS2300: Duplicate identifier 'y1'.
// function then function
- function y2() { }
function y2() { } // error
- ~~~~~~~~~~~~~~~~~
+ ~~
+!!! error TS2393: Duplicate function implementation.
+ function y2() { } // error
+ ~~
!!! error TS2393: Duplicate function implementation.
- function y2a() { }
+ function y2a() { } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'y2a'.
var y2a = () => { } // error
~~~
!!! error TS2300: Duplicate identifier 'y2a'.
// function then class
- function y3() { }
+ function y3() { } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'y3'.
class y3 { } // error
~~
!!! error TS2300: Duplicate identifier 'y3'.
- function y3a() { }
+ function y3a() { } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'y3a'.
class y3a { public foo() { } } // error
~~~
!!! error TS2300: Duplicate identifier 'y3a'.
// function then enum
- function y4() { }
+ function y4() { } // error
+ ~~
+!!! error TS2300: Duplicate identifier 'y4'.
enum y4 { One } // error
~~
!!! error TS2300: Duplicate identifier 'y4'.
diff --git a/tests/baselines/reference/augmentedTypesFunction.js b/tests/baselines/reference/augmentedTypesFunction.js
index 097482c7c5b..078854e227c 100644
--- a/tests/baselines/reference/augmentedTypesFunction.js
+++ b/tests/baselines/reference/augmentedTypesFunction.js
@@ -1,24 +1,24 @@
//// [augmentedTypesFunction.ts]
// function then var
-function y1() { }
+function y1() { } // error
var y1 = 1; // error
// function then function
-function y2() { }
+function y2() { } // error
function y2() { } // error
-function y2a() { }
+function y2a() { } // error
var y2a = () => { } // error
// function then class
-function y3() { }
+function y3() { } // error
class y3 { } // error
-function y3a() { }
+function y3a() { } // error
class y3a { public foo() { } } // error
// function then enum
-function y4() { }
+function y4() { } // error
enum y4 { One } // error
// function then internal module
@@ -41,27 +41,27 @@ module y5c { export interface I { foo(): void } } // should be an error
//// [augmentedTypesFunction.js]
// function then var
function y1() {
-}
+} // error
var y1 = 1; // error
// function then function
function y2() {
-}
+} // error
function y2() {
} // error
function y2a() {
-}
+} // error
var y2a = function () {
}; // error
// function then class
function y3() {
-}
+} // error
var y3 = (function () {
function y3() {
}
return y3;
})(); // error
function y3a() {
-}
+} // error
var y3a = (function () {
function y3a() {
}
@@ -71,7 +71,7 @@ var y3a = (function () {
})(); // error
// function then enum
function y4() {
-}
+} // error
var y4;
(function (y4) {
y4[y4["One"] = 0] = "One";
diff --git a/tests/baselines/reference/augmentedTypesInterface.errors.txt b/tests/baselines/reference/augmentedTypesInterface.errors.txt
index 77a7fa64eed..a9fc28dd5ae 100644
--- a/tests/baselines/reference/augmentedTypesInterface.errors.txt
+++ b/tests/baselines/reference/augmentedTypesInterface.errors.txt
@@ -1,8 +1,10 @@
+tests/cases/compiler/augmentedTypesInterface.ts(12,11): error TS2300: Duplicate identifier 'i2'.
tests/cases/compiler/augmentedTypesInterface.ts(16,7): error TS2300: Duplicate identifier 'i2'.
+tests/cases/compiler/augmentedTypesInterface.ts(23,11): error TS2300: Duplicate identifier 'i3'.
tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate identifier 'i3'.
-==== tests/cases/compiler/augmentedTypesInterface.ts (2 errors) ====
+==== tests/cases/compiler/augmentedTypesInterface.ts (4 errors) ====
// interface then interface
interface i {
@@ -14,7 +16,9 @@ tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate i
}
// interface then class
- interface i2 {
+ interface i2 { // error
+ ~~
+!!! error TS2300: Duplicate identifier 'i2'.
foo(): void;
}
@@ -27,7 +31,9 @@ tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate i
}
// interface then enum
- interface i3 {
+ interface i3 { // error
+ ~~
+!!! error TS2300: Duplicate identifier 'i3'.
foo(): void;
}
enum i3 { One }; // error
diff --git a/tests/baselines/reference/augmentedTypesInterface.js b/tests/baselines/reference/augmentedTypesInterface.js
index 5c68ba9a744..709b16d615c 100644
--- a/tests/baselines/reference/augmentedTypesInterface.js
+++ b/tests/baselines/reference/augmentedTypesInterface.js
@@ -10,7 +10,7 @@ interface i {
}
// interface then class
-interface i2 {
+interface i2 { // error
foo(): void;
}
@@ -21,7 +21,7 @@ class i2 { // error
}
// interface then enum
-interface i3 {
+interface i3 { // error
foo(): void;
}
enum i3 { One }; // error
diff --git a/tests/baselines/reference/augmentedTypesModules.errors.txt b/tests/baselines/reference/augmentedTypesModules.errors.txt
index 75b1973525d..980837a18ef 100644
--- a/tests/baselines/reference/augmentedTypesModules.errors.txt
+++ b/tests/baselines/reference/augmentedTypesModules.errors.txt
@@ -1,23 +1,30 @@
+tests/cases/compiler/augmentedTypesModules.ts(5,8): error TS2300: Duplicate identifier 'm1a'.
tests/cases/compiler/augmentedTypesModules.ts(6,5): error TS2300: Duplicate identifier 'm1a'.
+tests/cases/compiler/augmentedTypesModules.ts(8,8): error TS2300: Duplicate identifier 'm1b'.
tests/cases/compiler/augmentedTypesModules.ts(9,5): error TS2300: Duplicate identifier 'm1b'.
+tests/cases/compiler/augmentedTypesModules.ts(16,8): error TS2300: Duplicate identifier 'm1d'.
tests/cases/compiler/augmentedTypesModules.ts(19,5): error TS2300: Duplicate identifier 'm1d'.
tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
-==== tests/cases/compiler/augmentedTypesModules.ts (6 errors) ====
+==== tests/cases/compiler/augmentedTypesModules.ts (9 errors) ====
// module then var
module m1 { }
var m1 = 1; // Should be allowed
- module m1a { var y = 2; }
- var m1a = 1;
+ module m1a { var y = 2; } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'm1a'.
+ var m1a = 1; // error
~~~
!!! error TS2300: Duplicate identifier 'm1a'.
- module m1b { export var y = 2; }
- var m1b = 1;
+ module m1b { export var y = 2; } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'm1b'.
+ var m1b = 1; // error
~~~
!!! error TS2300: Duplicate identifier 'm1b'.
@@ -26,7 +33,9 @@ tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A module decl
}
var m1c = 1; // Should be allowed
- module m1d {
+ module m1d { // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'm1d'.
export class I { foo() { } }
}
var m1d = 1; // error
diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js
index 5085b1cbda3..0c7967b2227 100644
--- a/tests/baselines/reference/augmentedTypesModules.js
+++ b/tests/baselines/reference/augmentedTypesModules.js
@@ -3,18 +3,18 @@
module m1 { }
var m1 = 1; // Should be allowed
-module m1a { var y = 2; }
-var m1a = 1;
+module m1a { var y = 2; } // error
+var m1a = 1; // error
-module m1b { export var y = 2; }
-var m1b = 1;
+module m1b { export var y = 2; } // error
+var m1b = 1; // error
module m1c {
export interface I { foo(): void; }
}
var m1c = 1; // Should be allowed
-module m1d {
+module m1d { // error
export class I { foo() { } }
}
var m1d = 1; // error
@@ -102,13 +102,13 @@ var m1 = 1; // Should be allowed
var m1a;
(function (m1a) {
var y = 2;
-})(m1a || (m1a = {}));
-var m1a = 1;
+})(m1a || (m1a = {})); // error
+var m1a = 1; // error
var m1b;
(function (m1b) {
m1b.y = 2;
-})(m1b || (m1b = {}));
-var m1b = 1;
+})(m1b || (m1b = {})); // error
+var m1b = 1; // error
var m1c = 1; // Should be allowed
var m1d;
(function (m1d) {
diff --git a/tests/baselines/reference/augmentedTypesVar.errors.txt b/tests/baselines/reference/augmentedTypesVar.errors.txt
index 9f3980e39bc..24c194d25c3 100644
--- a/tests/baselines/reference/augmentedTypesVar.errors.txt
+++ b/tests/baselines/reference/augmentedTypesVar.errors.txt
@@ -1,41 +1,55 @@
+tests/cases/compiler/augmentedTypesVar.ts(6,5): error TS2300: Duplicate identifier 'x2'.
tests/cases/compiler/augmentedTypesVar.ts(7,10): error TS2300: Duplicate identifier 'x2'.
tests/cases/compiler/augmentedTypesVar.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'.
+tests/cases/compiler/augmentedTypesVar.ts(13,5): error TS2300: Duplicate identifier 'x4'.
tests/cases/compiler/augmentedTypesVar.ts(14,7): error TS2300: Duplicate identifier 'x4'.
+tests/cases/compiler/augmentedTypesVar.ts(16,5): error TS2300: Duplicate identifier 'x4a'.
tests/cases/compiler/augmentedTypesVar.ts(17,7): error TS2300: Duplicate identifier 'x4a'.
+tests/cases/compiler/augmentedTypesVar.ts(20,5): error TS2300: Duplicate identifier 'x5'.
tests/cases/compiler/augmentedTypesVar.ts(21,6): error TS2300: Duplicate identifier 'x5'.
+tests/cases/compiler/augmentedTypesVar.ts(27,5): error TS2300: Duplicate identifier 'x6a'.
tests/cases/compiler/augmentedTypesVar.ts(28,8): error TS2300: Duplicate identifier 'x6a'.
+tests/cases/compiler/augmentedTypesVar.ts(30,5): error TS2300: Duplicate identifier 'x6b'.
tests/cases/compiler/augmentedTypesVar.ts(31,8): error TS2300: Duplicate identifier 'x6b'.
-==== tests/cases/compiler/augmentedTypesVar.ts (7 errors) ====
+==== tests/cases/compiler/augmentedTypesVar.ts (13 errors) ====
// var then var
var x1 = 1;
var x1 = 2;
// var then function
- var x2 = 1;
- function x2() { } // should be an error
+ var x2 = 1; // error
+ ~~
+!!! error TS2300: Duplicate identifier 'x2'.
+ function x2() { } // error
~~
!!! error TS2300: Duplicate identifier 'x2'.
- var x3 = 1;
- var x3 = () => { } // should be an error
+ var x3 = 1;
+ var x3 = () => { } // error
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'.
// var then class
- var x4 = 1;
+ var x4 = 1; // error
+ ~~
+!!! error TS2300: Duplicate identifier 'x4'.
class x4 { } // error
~~
!!! error TS2300: Duplicate identifier 'x4'.
- var x4a = 1;
+ var x4a = 1; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'x4a'.
class x4a { public foo() { } } // error
~~~
!!! error TS2300: Duplicate identifier 'x4a'.
// var then enum
var x5 = 1;
+ ~~
+!!! error TS2300: Duplicate identifier 'x5'.
enum x5 { One } // error
~~
!!! error TS2300: Duplicate identifier 'x5'.
@@ -44,12 +58,16 @@ tests/cases/compiler/augmentedTypesVar.ts(31,8): error TS2300: Duplicate identif
var x6 = 1;
module x6 { } // ok since non-instantiated
- var x6a = 1;
+ var x6a = 1; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'x6a'.
module x6a { var y = 2; } // error since instantiated
~~~
!!! error TS2300: Duplicate identifier 'x6a'.
- var x6b = 1;
+ var x6b = 1; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'x6b'.
module x6b { export var y = 2; } // error
~~~
!!! error TS2300: Duplicate identifier 'x6b'.
diff --git a/tests/baselines/reference/augmentedTypesVar.js b/tests/baselines/reference/augmentedTypesVar.js
index ca50b8ab9a9..4735d647056 100644
--- a/tests/baselines/reference/augmentedTypesVar.js
+++ b/tests/baselines/reference/augmentedTypesVar.js
@@ -4,17 +4,17 @@ var x1 = 1;
var x1 = 2;
// var then function
-var x2 = 1;
-function x2() { } // should be an error
+var x2 = 1; // error
+function x2() { } // error
-var x3 = 1;
-var x3 = () => { } // should be an error
+var x3 = 1;
+var x3 = () => { } // error
// var then class
-var x4 = 1;
+var x4 = 1; // error
class x4 { } // error
-var x4a = 1;
+var x4a = 1; // error
class x4a { public foo() { } } // error
// var then enum
@@ -25,10 +25,10 @@ enum x5 { One } // error
var x6 = 1;
module x6 { } // ok since non-instantiated
-var x6a = 1;
+var x6a = 1; // error
module x6a { var y = 2; } // error since instantiated
-var x6b = 1;
+var x6b = 1; // error
module x6b { export var y = 2; } // error
// var then import, messes with other error reporting
@@ -41,20 +41,20 @@ module x6b { export var y = 2; } // error
var x1 = 1;
var x1 = 2;
// var then function
-var x2 = 1;
+var x2 = 1; // error
function x2() {
-} // should be an error
+} // error
var x3 = 1;
var x3 = function () {
-}; // should be an error
+}; // error
// var then class
-var x4 = 1;
+var x4 = 1; // error
var x4 = (function () {
function x4() {
}
return x4;
})(); // error
-var x4a = 1;
+var x4a = 1; // error
var x4a = (function () {
function x4a() {
}
@@ -70,12 +70,12 @@ var x5;
})(x5 || (x5 = {})); // error
// var then module
var x6 = 1;
-var x6a = 1;
+var x6a = 1; // error
var x6a;
(function (x6a) {
var y = 2;
})(x6a || (x6a = {})); // error since instantiated
-var x6b = 1;
+var x6b = 1; // error
var x6b;
(function (x6b) {
x6b.y = 2;
diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js
new file mode 100644
index 00000000000..a668b9978b0
--- /dev/null
+++ b/tests/baselines/reference/bestCommonTypeOfTuple.js
@@ -0,0 +1,58 @@
+//// [bestCommonTypeOfTuple.ts]
+function f1(x: number): string { return "foo"; }
+
+function f2(x: number): number { return 10; }
+
+function f3(x: number): boolean { return true; }
+
+enum E1 { one }
+
+enum E2 { two }
+
+
+var t1: [(x: number) => string, (x: number) => number];
+var t2: [E1, E2];
+var t3: [number, any];
+var t4: [E1, E2, number];
+
+// no error
+t1 = [f1, f2];
+t2 = [E1.one, E2.two];
+t3 = [5, undefined];
+t4 = [E1.one, E2.two, 20];
+var e1 = t1[2]; // {}
+var e2 = t2[2]; // {}
+var e3 = t3[2]; // any
+var e4 = t4[3]; // number
+
+//// [bestCommonTypeOfTuple.js]
+function f1(x) {
+ return "foo";
+}
+function f2(x) {
+ return 10;
+}
+function f3(x) {
+ return true;
+}
+var E1;
+(function (E1) {
+ E1[E1["one"] = 0] = "one";
+})(E1 || (E1 = {}));
+var E2;
+(function (E2) {
+ E2[E2["two"] = 0] = "two";
+})(E2 || (E2 = {}));
+var t1;
+var t2;
+var t3;
+var t4;
+// no error
+t1 = [f1, f2];
+t2 = [0 /* one */, 0 /* two */];
+t3 = [5, undefined];
+t4 = [0 /* one */, 0 /* two */, 20];
+var e1 = t1[2]; // {}
+var e2 = t2[2]; // {}
+var e3 = t3[2]; // any
+var e4 = t4[3]; // number
diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types
new file mode 100644
index 00000000000..936607769e7
--- /dev/null
+++ b/tests/baselines/reference/bestCommonTypeOfTuple.types
@@ -0,0 +1,96 @@
+=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts ===
+function f1(x: number): string { return "foo"; }
+>f1 : (x: number) => string
+>x : number
+
+function f2(x: number): number { return 10; }
+>f2 : (x: number) => number
+>x : number
+
+function f3(x: number): boolean { return true; }
+>f3 : (x: number) => boolean
+>x : number
+
+enum E1 { one }
+>E1 : E1
+>one : E1
+
+enum E2 { two }
+>E2 : E2
+>two : E2
+
+
+var t1: [(x: number) => string, (x: number) => number];
+>t1 : [(x: number) => string, (x: number) => number]
+>x : number
+>x : number
+
+var t2: [E1, E2];
+>t2 : [E1, E2]
+>E1 : E1
+>E2 : E2
+
+var t3: [number, any];
+>t3 : [number, any]
+
+var t4: [E1, E2, number];
+>t4 : [E1, E2, number]
+>E1 : E1
+>E2 : E2
+
+// no error
+t1 = [f1, f2];
+>t1 = [f1, f2] : [(x: number) => string, (x: number) => number]
+>t1 : [(x: number) => string, (x: number) => number]
+>[f1, f2] : [(x: number) => string, (x: number) => number]
+>f1 : (x: number) => string
+>f2 : (x: number) => number
+
+t2 = [E1.one, E2.two];
+>t2 = [E1.one, E2.two] : [E1, E2]
+>t2 : [E1, E2]
+>[E1.one, E2.two] : [E1, E2]
+>E1.one : E1
+>E1 : typeof E1
+>one : E1
+>E2.two : E2
+>E2 : typeof E2
+>two : E2
+
+t3 = [5, undefined];
+>t3 = [5, undefined] : [number, undefined]
+>t3 : [number, any]
+>[5, undefined] : [number, undefined]
+>undefined : undefined
+
+t4 = [E1.one, E2.two, 20];
+>t4 = [E1.one, E2.two, 20] : [E1, E2, number]
+>t4 : [E1, E2, number]
+>[E1.one, E2.two, 20] : [E1, E2, number]
+>E1.one : E1
+>E1 : typeof E1
+>one : E1
+>E2.two : E2
+>E2 : typeof E2
+>two : E2
+
+var e1 = t1[2]; // {}
+>e1 : {}
+>t1[2] : {}
+>t1 : [(x: number) => string, (x: number) => number]
+
+var e2 = t2[2]; // {}
+>e2 : {}
+>t2[2] : {}
+>t2 : [E1, E2]
+
+var e3 = t3[2]; // any
+>e3 : any
+>t3[2] : any
+>t3 : [number, any]
+
+var e4 = t4[3]; // number
+>e4 : number
+>t4[3] : number
+>t4 : [E1, E2, number]
+
diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js
new file mode 100644
index 00000000000..2f2db308fc9
--- /dev/null
+++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js
@@ -0,0 +1,77 @@
+//// [bestCommonTypeOfTuple2.ts]
+interface base { }
+interface base1 { i }
+class C implements base { c }
+class D implements base { d }
+class E implements base { e }
+class F extends C { f }
+
+class C1 implements base1 { i = "foo"; c }
+class D1 extends C1 { i = "bar"; d }
+
+var t1: [C, base];
+var t2: [C, D];
+var t3: [C1, D1];
+var t4: [base1, C1];
+var t5: [C1, F]
+
+var e11 = t1[4]; // base
+var e21 = t2[4]; // {}
+var e31 = t3[4]; // C1
+var e41 = t4[2]; // base1
+var e51 = t5[2]; // {}
+
+
+//// [bestCommonTypeOfTuple2.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var C = (function () {
+ function C() {
+ }
+ return C;
+})();
+var D = (function () {
+ function D() {
+ }
+ return D;
+})();
+var E = (function () {
+ function E() {
+ }
+ return E;
+})();
+var F = (function (_super) {
+ __extends(F, _super);
+ function F() {
+ _super.apply(this, arguments);
+ }
+ return F;
+})(C);
+var C1 = (function () {
+ function C1() {
+ this.i = "foo";
+ }
+ return C1;
+})();
+var D1 = (function (_super) {
+ __extends(D1, _super);
+ function D1() {
+ _super.apply(this, arguments);
+ this.i = "bar";
+ }
+ return D1;
+})(C1);
+var t1;
+var t2;
+var t3;
+var t4;
+var t5;
+var e11 = t1[4]; // base
+var e21 = t2[4]; // {}
+var e31 = t3[4]; // C1
+var e41 = t4[2]; // base1
+var e51 = t5[2]; // {}
diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types
new file mode 100644
index 00000000000..ec52e6c685f
--- /dev/null
+++ b/tests/baselines/reference/bestCommonTypeOfTuple2.types
@@ -0,0 +1,90 @@
+=== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts ===
+interface base { }
+>base : base
+
+interface base1 { i }
+>base1 : base1
+>i : any
+
+class C implements base { c }
+>C : C
+>base : base
+>c : any
+
+class D implements base { d }
+>D : D
+>base : base
+>d : any
+
+class E implements base { e }
+>E : E
+>base : base
+>e : any
+
+class F extends C { f }
+>F : F
+>C : C
+>f : any
+
+class C1 implements base1 { i = "foo"; c }
+>C1 : C1
+>base1 : base1
+>i : string
+>c : any
+
+class D1 extends C1 { i = "bar"; d }
+>D1 : D1
+>C1 : C1
+>i : string
+>d : any
+
+var t1: [C, base];
+>t1 : [C, base]
+>C : C
+>base : base
+
+var t2: [C, D];
+>t2 : [C, D]
+>C : C
+>D : D
+
+var t3: [C1, D1];
+>t3 : [C1, D1]
+>C1 : C1
+>D1 : D1
+
+var t4: [base1, C1];
+>t4 : [base1, C1]
+>base1 : base1
+>C1 : C1
+
+var t5: [C1, F]
+>t5 : [C1, F]
+>C1 : C1
+>F : F
+
+var e11 = t1[4]; // base
+>e11 : base
+>t1[4] : base
+>t1 : [C, base]
+
+var e21 = t2[4]; // {}
+>e21 : {}
+>t2[4] : {}
+>t2 : [C, D]
+
+var e31 = t3[4]; // C1
+>e31 : C1
+>t3[4] : C1
+>t3 : [C1, D1]
+
+var e41 = t4[2]; // base1
+>e41 : base1
+>t4[2] : base1
+>t4 : [base1, C1]
+
+var e51 = t5[2]; // {}
+>e51 : {}
+>t5[2] : {}
+>t5 : [C1, F]
+
diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt
new file mode 100644
index 00000000000..1cd51984682
--- /dev/null
+++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.errors.txt
@@ -0,0 +1,59 @@
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(3,1): error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(9,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(14,1): error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(20,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(24,1): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
+tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+
+
+==== tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts (8 errors) ====
+ var a = true;
+ var b = 1;
+ a ^= a;
+ ~~~~~~
+!!! error TS2447: The '^=' operator is not allowed for boolean types. Consider using '!==' instead.
+ a = true;
+ b ^= b;
+ b = 1;
+ a ^= b;
+ ~
+!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ a = true;
+ b ^= a;
+ ~
+!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ b = 1;
+
+ var c = false;
+ var d = 2;
+ c &= c;
+ ~~~~~~
+!!! error TS2447: The '&=' operator is not allowed for boolean types. Consider using '&&' instead.
+ c = false;
+ d &= d;
+ d = 2;
+ c &= d;
+ ~
+!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ c = false;
+ d &= c;
+ ~
+!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+
+ var e = true;
+ var f = 0;
+ e |= e;
+ ~~~~~~
+!!! error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
+ e = true;
+ f |= f;
+ f = 0;
+ e |= f;
+ ~
+!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ e = true;
+ f |= f;
+
+
\ No newline at end of file
diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js
new file mode 100644
index 00000000000..e9bfeabb965
--- /dev/null
+++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js
@@ -0,0 +1,63 @@
+//// [bitwiseCompoundAssignmentOperators.ts]
+var a = true;
+var b = 1;
+a ^= a;
+a = true;
+b ^= b;
+b = 1;
+a ^= b;
+a = true;
+b ^= a;
+b = 1;
+
+var c = false;
+var d = 2;
+c &= c;
+c = false;
+d &= d;
+d = 2;
+c &= d;
+c = false;
+d &= c;
+
+var e = true;
+var f = 0;
+e |= e;
+e = true;
+f |= f;
+f = 0;
+e |= f;
+e = true;
+f |= f;
+
+
+
+//// [bitwiseCompoundAssignmentOperators.js]
+var a = true;
+var b = 1;
+a ^= a;
+a = true;
+b ^= b;
+b = 1;
+a ^= b;
+a = true;
+b ^= a;
+b = 1;
+var c = false;
+var d = 2;
+c &= c;
+c = false;
+d &= d;
+d = 2;
+c &= d;
+c = false;
+d &= c;
+var e = true;
+var f = 0;
+e |= e;
+e = true;
+f |= f;
+f = 0;
+e |= f;
+e = true;
+f |= f;
diff --git a/tests/baselines/reference/callOnInstance.errors.txt b/tests/baselines/reference/callOnInstance.errors.txt
index c1861d05377..156bdfd512a 100644
--- a/tests/baselines/reference/callOnInstance.errors.txt
+++ b/tests/baselines/reference/callOnInstance.errors.txt
@@ -1,13 +1,16 @@
+tests/cases/compiler/callOnInstance.ts(1,18): error TS2300: Duplicate identifier 'D'.
tests/cases/compiler/callOnInstance.ts(3,15): error TS2300: Duplicate identifier 'D'.
tests/cases/compiler/callOnInstance.ts(7,19): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/callOnInstance.ts(7,19): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature.
-==== tests/cases/compiler/callOnInstance.ts (4 errors) ====
- declare function D(): string;
+==== tests/cases/compiler/callOnInstance.ts (5 errors) ====
+ declare function D(): string; // error
+ ~
+!!! error TS2300: Duplicate identifier 'D'.
- declare class D { constructor (value: number); } // Duplicate identifier
+ declare class D { constructor (value: number); } // error
~
!!! error TS2300: Duplicate identifier 'D'.
diff --git a/tests/baselines/reference/callOnInstance.js b/tests/baselines/reference/callOnInstance.js
index 477bdca26a7..3b07d0affc8 100644
--- a/tests/baselines/reference/callOnInstance.js
+++ b/tests/baselines/reference/callOnInstance.js
@@ -1,7 +1,7 @@
//// [callOnInstance.ts]
-declare function D(): string;
+declare function D(): string; // error
-declare class D { constructor (value: number); } // Duplicate identifier
+declare class D { constructor (value: number); } // error
var s1: string = D(); // OK
diff --git a/tests/baselines/reference/callOverloads1.errors.txt b/tests/baselines/reference/callOverloads1.errors.txt
index 759c00aa7e4..64927462104 100644
--- a/tests/baselines/reference/callOverloads1.errors.txt
+++ b/tests/baselines/reference/callOverloads1.errors.txt
@@ -1,10 +1,13 @@
+tests/cases/compiler/callOverloads1.ts(1,7): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads1.ts(9,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads1.ts(9,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads1.ts(17,1): error TS2348: Value of type 'typeof Foo' is not callable. Did you mean to include 'new'?
-==== tests/cases/compiler/callOverloads1.ts (3 errors) ====
- class Foo {
+==== tests/cases/compiler/callOverloads1.ts (4 errors) ====
+ class Foo { // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js
index dc76fcba98a..86cb951f853 100644
--- a/tests/baselines/reference/callOverloads1.js
+++ b/tests/baselines/reference/callOverloads1.js
@@ -1,5 +1,5 @@
//// [callOverloads1.ts]
-class Foo {
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
diff --git a/tests/baselines/reference/callOverloads2.errors.txt b/tests/baselines/reference/callOverloads2.errors.txt
index 693b67872eb..6291fa8f3de 100644
--- a/tests/baselines/reference/callOverloads2.errors.txt
+++ b/tests/baselines/reference/callOverloads2.errors.txt
@@ -1,14 +1,18 @@
+tests/cases/compiler/callOverloads2.ts(3,7): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads2.ts(11,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads2.ts(13,10): error TS2389: Function implementation name must be 'Foo'.
-tests/cases/compiler/callOverloads2.ts(14,1): error TS2393: Duplicate function implementation.
+tests/cases/compiler/callOverloads2.ts(13,10): error TS2393: Duplicate function implementation.
+tests/cases/compiler/callOverloads2.ts(14,10): error TS2393: Duplicate function implementation.
tests/cases/compiler/callOverloads2.ts(16,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads2.ts(24,1): error TS2348: Value of type 'typeof Foo' is not callable. Did you mean to include 'new'?
-==== tests/cases/compiler/callOverloads2.ts (5 errors) ====
+==== tests/cases/compiler/callOverloads2.ts (7 errors) ====
- class Foo {
+ class Foo { // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
@@ -16,15 +20,17 @@ tests/cases/compiler/callOverloads2.ts(24,1): error TS2348: Value of type 'typeo
}
}
- function Foo();
+ function Foo(); // error
~~~
!!! error TS2300: Duplicate identifier 'Foo'.
- function F1(s:string) {return s;}
+ function F1(s:string) {return s;} // error
~~
!!! error TS2389: Function implementation name must be 'Foo'.
- function F1(a:any) { return a;} // error - duplicate identifier
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~~
+!!! error TS2393: Duplicate function implementation.
+ function F1(a:any) { return a;} // error
+ ~~
!!! error TS2393: Duplicate function implementation.
function Goo(s:string); // error - no implementation
diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js
index be42753bc3d..e3cbceb177a 100644
--- a/tests/baselines/reference/callOverloads2.js
+++ b/tests/baselines/reference/callOverloads2.js
@@ -1,7 +1,7 @@
//// [callOverloads2.ts]
-class Foo {
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
@@ -9,10 +9,10 @@ class Foo {
}
}
-function Foo();
+function Foo(); // error
-function F1(s:string) {return s;}
-function F1(a:any) { return a;} // error - duplicate identifier
+function F1(s:string) {return s;} // error
+function F1(a:any) { return a;} // error
function Goo(s:string); // error - no implementation
@@ -36,10 +36,10 @@ var Foo = (function () {
})();
function F1(s) {
return s;
-}
+} // error
function F1(a) {
return a;
-} // error - duplicate identifier
+} // error
var f1 = new Foo("hey");
f1.bar1();
Foo();
diff --git a/tests/baselines/reference/callOverloads3.errors.txt b/tests/baselines/reference/callOverloads3.errors.txt
index 986f0478369..ecb889bc1ab 100644
--- a/tests/baselines/reference/callOverloads3.errors.txt
+++ b/tests/baselines/reference/callOverloads3.errors.txt
@@ -1,21 +1,27 @@
+tests/cases/compiler/callOverloads3.ts(2,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads3.ts(2,16): error TS2304: Cannot find name 'Foo'.
+tests/cases/compiler/callOverloads3.ts(3,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads3.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads3.ts(3,24): error TS2304: Cannot find name 'Foo'.
tests/cases/compiler/callOverloads3.ts(4,7): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads3.ts(12,10): error TS2350: Only a void function can be called with the 'new' keyword.
-==== tests/cases/compiler/callOverloads3.ts (5 errors) ====
+==== tests/cases/compiler/callOverloads3.ts (7 errors) ====
- function Foo():Foo;
+ function Foo():Foo; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
~~~
!!! error TS2304: Cannot find name 'Foo'.
- function Foo(s:string):Foo;
+ function Foo(s:string):Foo; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
~~~
!!! error TS2304: Cannot find name 'Foo'.
- class Foo {
+ class Foo { // error
~~~
!!! error TS2300: Duplicate identifier 'Foo'.
bar1() { /*WScript.Echo("bar1");*/ }
diff --git a/tests/baselines/reference/callOverloads3.js b/tests/baselines/reference/callOverloads3.js
index 93176cc1edb..85c16fe85a6 100644
--- a/tests/baselines/reference/callOverloads3.js
+++ b/tests/baselines/reference/callOverloads3.js
@@ -1,8 +1,8 @@
//// [callOverloads3.ts]
-function Foo():Foo;
-function Foo(s:string):Foo;
-class Foo {
+function Foo():Foo; // error
+function Foo(s:string):Foo; // error
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
// WScript.Echo("Constructor function has executed");
diff --git a/tests/baselines/reference/callOverloads4.errors.txt b/tests/baselines/reference/callOverloads4.errors.txt
index cec3a1834ba..3010d7c15d8 100644
--- a/tests/baselines/reference/callOverloads4.errors.txt
+++ b/tests/baselines/reference/callOverloads4.errors.txt
@@ -1,21 +1,27 @@
+tests/cases/compiler/callOverloads4.ts(2,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads4.ts(2,16): error TS2304: Cannot find name 'Foo'.
+tests/cases/compiler/callOverloads4.ts(3,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads4.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads4.ts(3,24): error TS2304: Cannot find name 'Foo'.
tests/cases/compiler/callOverloads4.ts(4,7): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads4.ts(12,10): error TS2350: Only a void function can be called with the 'new' keyword.
-==== tests/cases/compiler/callOverloads4.ts (5 errors) ====
+==== tests/cases/compiler/callOverloads4.ts (7 errors) ====
- function Foo():Foo;
+ function Foo():Foo; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
~~~
!!! error TS2304: Cannot find name 'Foo'.
- function Foo(s:string):Foo;
+ function Foo(s:string):Foo; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
~~~
!!! error TS2304: Cannot find name 'Foo'.
- class Foo {
+ class Foo { // error
~~~
!!! error TS2300: Duplicate identifier 'Foo'.
bar1() { /*WScript.Echo("bar1");*/ }
diff --git a/tests/baselines/reference/callOverloads4.js b/tests/baselines/reference/callOverloads4.js
index 86ec2b91e7e..6aab555b721 100644
--- a/tests/baselines/reference/callOverloads4.js
+++ b/tests/baselines/reference/callOverloads4.js
@@ -1,8 +1,8 @@
//// [callOverloads4.ts]
-function Foo():Foo;
-function Foo(s:string):Foo;
-class Foo {
+function Foo():Foo; // error
+function Foo(s:string):Foo; // error
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(s: string);
constructor(x: any) {
diff --git a/tests/baselines/reference/callOverloads5.errors.txt b/tests/baselines/reference/callOverloads5.errors.txt
index 240e10b9f55..e521a9a9076 100644
--- a/tests/baselines/reference/callOverloads5.errors.txt
+++ b/tests/baselines/reference/callOverloads5.errors.txt
@@ -1,20 +1,26 @@
+tests/cases/compiler/callOverloads5.ts(1,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads5.ts(1,16): error TS2304: Cannot find name 'Foo'.
+tests/cases/compiler/callOverloads5.ts(2,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads5.ts(2,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads5.ts(2,24): error TS2304: Cannot find name 'Foo'.
tests/cases/compiler/callOverloads5.ts(3,7): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads5.ts(13,10): error TS2350: Only a void function can be called with the 'new' keyword.
-==== tests/cases/compiler/callOverloads5.ts (5 errors) ====
- function Foo():Foo;
+==== tests/cases/compiler/callOverloads5.ts (7 errors) ====
+ function Foo():Foo; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
~~~
!!! error TS2304: Cannot find name 'Foo'.
- function Foo(s:string):Foo;
+ function Foo(s:string):Foo; // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
~~~
!!! error TS2304: Cannot find name 'Foo'.
- class Foo {
+ class Foo { // error
~~~
!!! error TS2300: Duplicate identifier 'Foo'.
bar1(s:string);
diff --git a/tests/baselines/reference/callOverloads5.js b/tests/baselines/reference/callOverloads5.js
index 30cc65915ec..2220568e4c2 100644
--- a/tests/baselines/reference/callOverloads5.js
+++ b/tests/baselines/reference/callOverloads5.js
@@ -1,7 +1,7 @@
//// [callOverloads5.ts]
-function Foo():Foo;
-function Foo(s:string):Foo;
-class Foo {
+function Foo():Foo; // error
+function Foo(s:string):Foo; // error
+class Foo { // error
bar1(s:string);
bar1(n:number);
bar1(a:any) { /*WScript.Echo(a);*/ }
diff --git a/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt b/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt
index ff1fd1e66cf..034aa4039cf 100644
--- a/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt
+++ b/tests/baselines/reference/callSignaturesWithDuplicateParameters.errors.txt
@@ -1,107 +1,173 @@
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(3,14): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(3,17): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(4,22): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(4,25): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(5,20): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(5,23): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(6,11): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(6,14): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(7,14): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(7,20): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(9,15): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(9,26): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(10,23): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(10,34): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(11,20): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(11,31): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(12,11): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(12,22): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(16,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(16,12): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(17,10): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(17,21): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(18,13): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(18,19): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(22,6): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(22,9): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(23,6): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(23,17): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(24,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(24,12): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(25,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(25,20): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(26,13): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(26,19): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(30,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(30,12): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(31,10): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(31,21): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(35,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(35,12): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(36,21): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(36,32): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(37,12): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts(37,18): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts (22 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts (44 errors) ====
// Duplicate parameter names are always an error
function foo(x, x) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f = function foo(x, x) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f2 = function (x, x) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f3 = (x, x) => { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f4 = (x: T, x: T) => { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
function foo2(x: string, x: number) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f5 = function foo(x: string, x: number) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f6 = function (x: string, x: number) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f7 = (x: string, x: number) => { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
var f8 = (x: T, y: T) => { }
class C {
foo(x, x) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
foo2(x: number, x: string) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
foo3(x: T, x: T) { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
}
interface I {
(x, x);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
(x: string, x: number);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
foo(x, x);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
foo(x: number, x: string);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
foo3(x: T, x: T);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
}
var a: {
foo(x, x);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
foo2(x: number, x: string);
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
};
var b = {
foo(x, x) { },
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
a: function foo(x: number, x: string) { },
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
b: (x: T, x: T) => { }
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
~
!!! error TS2300: Duplicate identifier 'x'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt
index fcc1eee9169..1801bd42e4d 100644
--- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt
+++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt
@@ -1,10 +1,11 @@
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected.
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(21,5): error TS2300: Duplicate identifier 'foo'.
-==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (4 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (5 errors) ====
// Optional parameters allow initializers only in implementation signatures
// All the below declarations are errors
@@ -28,10 +29,12 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWit
c.foo(1);
var b = {
- foo(x = 1),
+ foo(x = 1), // error
~
!!! error TS1005: '{' expected.
- foo(x = 1) { },
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
+ foo(x = 1) { }, // error
~~~
!!! error TS2300: Duplicate identifier 'foo'.
}
diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt
new file mode 100644
index 00000000000..ee09362f01f
--- /dev/null
+++ b/tests/baselines/reference/castingTuple.errors.txt
@@ -0,0 +1,61 @@
+tests/cases/conformance/types/tuple/castingTuple.ts(24,10): error TS2353: Neither type '[number, string]' nor type '[number, number]' is assignable to the other:
+ Types of property '1' are incompatible:
+ Type 'string' is not assignable to type 'number'.
+tests/cases/conformance/types/tuple/castingTuple.ts(25,10): error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other:
+ Types of property '0' are incompatible:
+ Type 'C' is not assignable to type 'A':
+ Property 'a' is missing in type 'C'.
+tests/cases/conformance/types/tuple/castingTuple.ts(26,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
+tests/cases/conformance/types/tuple/castingTuple.ts(26,14): error TS2353: Neither type '[number, string]' nor type 'number[]' is assignable to the other:
+ Types of property 'pop' are incompatible:
+ Type '() => {}' is not assignable to type '() => number':
+ Type '{}' is not assignable to type 'number'.
+tests/cases/conformance/types/tuple/castingTuple.ts(27,1): error TS2304: Cannot find name 't4'.
+
+
+==== tests/cases/conformance/types/tuple/castingTuple.ts (5 errors) ====
+ interface I { }
+ class A { a = 10; }
+ class C implements I { c };
+ class D implements I { d };
+ class E extends A { e };
+ class F extends A { f };
+ enum E1 { one }
+ enum E2 { one }
+
+ // no error
+ var numStrTuple: [number, string] = [5, "foo"];
+ var emptyObjTuple = <[{}, {}]>numStrTuple;
+ var numStrBoolTuple = <[number, string, boolean]>numStrTuple;
+ var classCDTuple: [C, D] = [new C(), new D()];
+ var interfaceIITuple = <[I, I]>classCDTuple;
+ var classCDATuple = <[C, D, A]>classCDTuple;
+ var eleFromCDA1 = classCDATuple[2]; // A
+ var eleFromCDA2 = classCDATuple[5]; // {}
+ var t10: [E1, E2] = [E1.one, E2.one];
+ var t11 = <[number, number]>t10;
+ var array1 = <{}[]>emptyObjTuple;
+
+ // error
+ var t3 = <[number, number]>numStrTuple;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2353: Neither type '[number, string]' nor type '[number, number]' is assignable to the other:
+!!! error TS2353: Types of property '1' are incompatible:
+!!! error TS2353: Type 'string' is not assignable to type 'number'.
+ var t9 = <[A, I]>classCDTuple;
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS2353: Neither type '[C, D]' nor type '[A, I]' is assignable to the other:
+!!! error TS2353: Types of property '0' are incompatible:
+!!! error TS2353: Type 'C' is not assignable to type 'A':
+!!! error TS2353: Property 'a' is missing in type 'C'.
+ var array1 = numStrTuple;
+ ~~~~~~
+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
+ ~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2353: Neither type '[number, string]' nor type 'number[]' is assignable to the other:
+!!! error TS2353: Types of property 'pop' are incompatible:
+!!! error TS2353: Type '() => {}' is not assignable to type '() => number':
+!!! error TS2353: Type '{}' is not assignable to type 'number'.
+ t4[2] = 10;
+ ~~
+!!! error TS2304: Cannot find name 't4'.
\ No newline at end of file
diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js
new file mode 100644
index 00000000000..c1835e9d117
--- /dev/null
+++ b/tests/baselines/reference/castingTuple.js
@@ -0,0 +1,95 @@
+//// [castingTuple.ts]
+interface I { }
+class A { a = 10; }
+class C implements I { c };
+class D implements I { d };
+class E extends A { e };
+class F extends A { f };
+enum E1 { one }
+enum E2 { one }
+
+// no error
+var numStrTuple: [number, string] = [5, "foo"];
+var emptyObjTuple = <[{}, {}]>numStrTuple;
+var numStrBoolTuple = <[number, string, boolean]>numStrTuple;
+var classCDTuple: [C, D] = [new C(), new D()];
+var interfaceIITuple = <[I, I]>classCDTuple;
+var classCDATuple = <[C, D, A]>classCDTuple;
+var eleFromCDA1 = classCDATuple[2]; // A
+var eleFromCDA2 = classCDATuple[5]; // {}
+var t10: [E1, E2] = [E1.one, E2.one];
+var t11 = <[number, number]>t10;
+var array1 = <{}[]>emptyObjTuple;
+
+// error
+var t3 = <[number, number]>numStrTuple;
+var t9 = <[A, I]>classCDTuple;
+var array1 = numStrTuple;
+t4[2] = 10;
+
+//// [castingTuple.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var A = (function () {
+ function A() {
+ this.a = 10;
+ }
+ return A;
+})();
+var C = (function () {
+ function C() {
+ }
+ return C;
+})();
+;
+var D = (function () {
+ function D() {
+ }
+ return D;
+})();
+;
+var E = (function (_super) {
+ __extends(E, _super);
+ function E() {
+ _super.apply(this, arguments);
+ }
+ return E;
+})(A);
+;
+var F = (function (_super) {
+ __extends(F, _super);
+ function F() {
+ _super.apply(this, arguments);
+ }
+ return F;
+})(A);
+;
+var E1;
+(function (E1) {
+ E1[E1["one"] = 0] = "one";
+})(E1 || (E1 = {}));
+var E2;
+(function (E2) {
+ E2[E2["one"] = 0] = "one";
+})(E2 || (E2 = {}));
+// no error
+var numStrTuple = [5, "foo"];
+var emptyObjTuple = numStrTuple;
+var numStrBoolTuple = numStrTuple;
+var classCDTuple = [new C(), new D()];
+var interfaceIITuple = classCDTuple;
+var classCDATuple = classCDTuple;
+var eleFromCDA1 = classCDATuple[2]; // A
+var eleFromCDA2 = classCDATuple[5]; // {}
+var t10 = [0 /* one */, 0 /* one */];
+var t11 = t10;
+var array1 = emptyObjTuple;
+// error
+var t3 = numStrTuple;
+var t9 = classCDTuple;
+var array1 = numStrTuple;
+t4[2] = 10;
diff --git a/tests/baselines/reference/class1.errors.txt b/tests/baselines/reference/class1.errors.txt
index 91d29d981c2..b90fae9cb40 100644
--- a/tests/baselines/reference/class1.errors.txt
+++ b/tests/baselines/reference/class1.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/class1.ts(1,11): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/class1.ts(2,7): error TS2300: Duplicate identifier 'foo'.
-==== tests/cases/compiler/class1.ts (1 errors) ====
- interface foo{ }
- class foo{ }
+==== tests/cases/compiler/class1.ts (2 errors) ====
+ interface foo{ } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
+ class foo{ } // error
~~~
!!! error TS2300: Duplicate identifier 'foo'.
\ No newline at end of file
diff --git a/tests/baselines/reference/class1.js b/tests/baselines/reference/class1.js
index 96b279e58c6..7a104e237b6 100644
--- a/tests/baselines/reference/class1.js
+++ b/tests/baselines/reference/class1.js
@@ -1,10 +1,10 @@
//// [class1.ts]
-interface foo{ }
-class foo{ }
+interface foo{ } // error
+class foo{ } // error
//// [class1.js]
var foo = (function () {
function foo() {
}
return foo;
-})();
+})(); // error
diff --git a/tests/baselines/reference/classAndInterface1.errors.txt b/tests/baselines/reference/classAndInterface1.errors.txt
index d497fb4c44e..8d31e847d71 100644
--- a/tests/baselines/reference/classAndInterface1.errors.txt
+++ b/tests/baselines/reference/classAndInterface1.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/classAndInterface1.ts(1,8): error TS2300: Duplicate identifier 'cli'.
tests/cases/compiler/classAndInterface1.ts(2,11): error TS2300: Duplicate identifier 'cli'.
-==== tests/cases/compiler/classAndInterface1.ts (1 errors) ====
- class cli { }
+==== tests/cases/compiler/classAndInterface1.ts (2 errors) ====
+ class cli { } // error
+ ~~~
+!!! error TS2300: Duplicate identifier 'cli'.
interface cli { } // error
~~~
!!! error TS2300: Duplicate identifier 'cli'.
\ No newline at end of file
diff --git a/tests/baselines/reference/classAndInterface1.js b/tests/baselines/reference/classAndInterface1.js
index 74eec3e942e..5efabded838 100644
--- a/tests/baselines/reference/classAndInterface1.js
+++ b/tests/baselines/reference/classAndInterface1.js
@@ -1,5 +1,5 @@
//// [classAndInterface1.ts]
-class cli { }
+ class cli { } // error
interface cli { } // error
//// [classAndInterface1.js]
@@ -7,4 +7,4 @@ var cli = (function () {
function cli() {
}
return cli;
-})();
+})(); // error
diff --git a/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt b/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt
index a92f31ef469..aa3e687cf4d 100644
--- a/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt
+++ b/tests/baselines/reference/classAndInterfaceWithSameName.errors.txt
@@ -1,15 +1,21 @@
+tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,7): error TS2300: Duplicate identifier 'C'.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,11): error TS2300: Duplicate identifier 'C'.
+tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(5,11): error TS2300: Duplicate identifier 'D'.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(9,15): error TS2300: Duplicate identifier 'D'.
-==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (2 errors) ====
+==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (4 errors) ====
class C { foo: string; }
+ ~
+!!! error TS2300: Duplicate identifier 'C'.
interface C { foo: string; } // error
~
!!! error TS2300: Duplicate identifier 'C'.
module M {
class D {
+ ~
+!!! error TS2300: Duplicate identifier 'D'.
bar: string;
}
diff --git a/tests/baselines/reference/classAndVariableWithSameName.errors.txt b/tests/baselines/reference/classAndVariableWithSameName.errors.txt
index fb8b7e2dcde..2e8c16d4494 100644
--- a/tests/baselines/reference/classAndVariableWithSameName.errors.txt
+++ b/tests/baselines/reference/classAndVariableWithSameName.errors.txt
@@ -1,15 +1,21 @@
+tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(1,7): error TS2300: Duplicate identifier 'C'.
tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(2,5): error TS2300: Duplicate identifier 'C'.
+tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(5,11): error TS2300: Duplicate identifier 'D'.
tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts(9,9): error TS2300: Duplicate identifier 'D'.
-==== tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts (2 errors) ====
- class C { foo: string; }
+==== tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts (4 errors) ====
+ class C { foo: string; } // error
+ ~
+!!! error TS2300: Duplicate identifier 'C'.
var C = ''; // error
~
!!! error TS2300: Duplicate identifier 'C'.
module M {
- class D {
+ class D { // error
+ ~
+!!! error TS2300: Duplicate identifier 'D'.
bar: string;
}
diff --git a/tests/baselines/reference/classAndVariableWithSameName.js b/tests/baselines/reference/classAndVariableWithSameName.js
index ab17905d5b2..1d547dc5508 100644
--- a/tests/baselines/reference/classAndVariableWithSameName.js
+++ b/tests/baselines/reference/classAndVariableWithSameName.js
@@ -1,9 +1,9 @@
//// [classAndVariableWithSameName.ts]
-class C { foo: string; }
+class C { foo: string; } // error
var C = ''; // error
module M {
- class D {
+ class D { // error
bar: string;
}
@@ -15,7 +15,7 @@ var C = (function () {
function C() {
}
return C;
-})();
+})(); // error
var C = ''; // error
var M;
(function (M) {
diff --git a/tests/baselines/reference/classCannotExtendVar.errors.txt b/tests/baselines/reference/classCannotExtendVar.errors.txt
index deed94615ce..5af07801bb4 100644
--- a/tests/baselines/reference/classCannotExtendVar.errors.txt
+++ b/tests/baselines/reference/classCannotExtendVar.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/classCannotExtendVar.ts(1,5): error TS2300: Duplicate identifier 'Markup'.
tests/cases/compiler/classCannotExtendVar.ts(3,7): error TS2300: Duplicate identifier 'Markup'.
-==== tests/cases/compiler/classCannotExtendVar.ts (1 errors) ====
+==== tests/cases/compiler/classCannotExtendVar.ts (2 errors) ====
var Markup;
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'Markup'.
class Markup {
~~~~~~
diff --git a/tests/baselines/reference/classOverloadForFunction.errors.txt b/tests/baselines/reference/classOverloadForFunction.errors.txt
index 41f960dba66..14bc27fb5ca 100644
--- a/tests/baselines/reference/classOverloadForFunction.errors.txt
+++ b/tests/baselines/reference/classOverloadForFunction.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/classOverloadForFunction.ts(1,7): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/classOverloadForFunction.ts(2,10): error TS2300: Duplicate identifier 'foo'.
-==== tests/cases/compiler/classOverloadForFunction.ts (1 errors) ====
+==== tests/cases/compiler/classOverloadForFunction.ts (2 errors) ====
class foo { };
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
function foo() {}
~~~
!!! error TS2300: Duplicate identifier 'foo'.
diff --git a/tests/baselines/reference/classOverloadForFunction2.errors.txt b/tests/baselines/reference/classOverloadForFunction2.errors.txt
index df635f10129..4dd459c48ec 100644
--- a/tests/baselines/reference/classOverloadForFunction2.errors.txt
+++ b/tests/baselines/reference/classOverloadForFunction2.errors.txt
@@ -1,10 +1,13 @@
+tests/cases/compiler/classOverloadForFunction2.ts(1,10): error TS2300: Duplicate identifier 'bar'.
tests/cases/compiler/classOverloadForFunction2.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/classOverloadForFunction2.ts(2,7): error TS2300: Duplicate identifier 'bar'.
-==== tests/cases/compiler/classOverloadForFunction2.ts (2 errors) ====
+==== tests/cases/compiler/classOverloadForFunction2.ts (3 errors) ====
function bar(): string;
~~~
+!!! error TS2300: Duplicate identifier 'bar'.
+ ~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
class bar {}
~~~
diff --git a/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt b/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt
index 6df51d85be3..6b08be330a0 100644
--- a/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt
+++ b/tests/baselines/reference/classWithTwoConstructorDefinitions.errors.txt
@@ -1,17 +1,23 @@
+tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(2,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(3,5): error TS2392: Multiple constructor implementations are not allowed.
+tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(7,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts(8,5): error TS2392: Multiple constructor implementations are not allowed.
-==== tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts (2 errors) ====
+==== tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts (4 errors) ====
class C {
- constructor() { }
+ constructor() { } // error
+ ~~~~~~~~~~~~~~~~~
+!!! error TS2392: Multiple constructor implementations are not allowed.
constructor(x) { } // error
~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
}
class D {
- constructor(x: T) { }
+ constructor(x: T) { } // error
+ ~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2392: Multiple constructor implementations are not allowed.
constructor(x: T, y: T) { } // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
diff --git a/tests/baselines/reference/classWithTwoConstructorDefinitions.js b/tests/baselines/reference/classWithTwoConstructorDefinitions.js
index 77c98697f1f..31e5498cfc9 100644
--- a/tests/baselines/reference/classWithTwoConstructorDefinitions.js
+++ b/tests/baselines/reference/classWithTwoConstructorDefinitions.js
@@ -1,22 +1,22 @@
//// [classWithTwoConstructorDefinitions.ts]
class C {
- constructor() { }
+ constructor() { } // error
constructor(x) { } // error
}
class D {
- constructor(x: T) { }
+ constructor(x: T) { } // error
constructor(x: T, y: T) { } // error
}
//// [classWithTwoConstructorDefinitions.js]
var C = (function () {
function C() {
- }
+ } // error
return C;
})();
var D = (function () {
function D(x) {
- }
+ } // error
return D;
})();
diff --git a/tests/baselines/reference/clinterfaces.errors.txt b/tests/baselines/reference/clinterfaces.errors.txt
index 62e8fc08725..d5eab2c7994 100644
--- a/tests/baselines/reference/clinterfaces.errors.txt
+++ b/tests/baselines/reference/clinterfaces.errors.txt
@@ -1,22 +1,32 @@
+tests/cases/compiler/clinterfaces.ts(2,11): error TS2300: Duplicate identifier 'C'.
tests/cases/compiler/clinterfaces.ts(3,15): error TS2300: Duplicate identifier 'C'.
+tests/cases/compiler/clinterfaces.ts(4,15): error TS2300: Duplicate identifier 'D'.
tests/cases/compiler/clinterfaces.ts(5,11): error TS2300: Duplicate identifier 'D'.
+tests/cases/compiler/clinterfaces.ts(8,11): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/clinterfaces.ts(12,7): error TS2300: Duplicate identifier 'Foo'.
+tests/cases/compiler/clinterfaces.ts(16,7): error TS2300: Duplicate identifier 'Bar'.
tests/cases/compiler/clinterfaces.ts(20,11): error TS2300: Duplicate identifier 'Bar'.
-==== tests/cases/compiler/clinterfaces.ts (4 errors) ====
+==== tests/cases/compiler/clinterfaces.ts (8 errors) ====
module M {
class C { }
+ ~
+!!! error TS2300: Duplicate identifier 'C'.
interface C { }
~
!!! error TS2300: Duplicate identifier 'C'.
interface D { }
+ ~
+!!! error TS2300: Duplicate identifier 'D'.
class D { }
~
!!! error TS2300: Duplicate identifier 'D'.
}
interface Foo {
+ ~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
a: string;
}
@@ -27,6 +37,8 @@ tests/cases/compiler/clinterfaces.ts(20,11): error TS2300: Duplicate identifier
}
class Bar{
+ ~~~
+!!! error TS2300: Duplicate identifier 'Bar'.
b: number;
}
diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt b/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt
index 7893afce829..914088f6c19 100644
--- a/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt
+++ b/tests/baselines/reference/cloduleWithDuplicateMember1.errors.txt
@@ -1,11 +1,13 @@
tests/cases/compiler/cloduleWithDuplicateMember1.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/cloduleWithDuplicateMember1.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/compiler/cloduleWithDuplicateMember1.ts(3,16): error TS2300: Duplicate identifier 'x'.
+tests/cases/compiler/cloduleWithDuplicateMember1.ts(6,12): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/cloduleWithDuplicateMember1.ts(10,16): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/cloduleWithDuplicateMember1.ts(13,21): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/cloduleWithDuplicateMember1.ts(14,21): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/cloduleWithDuplicateMember1.ts (5 errors) ====
+==== tests/cases/compiler/cloduleWithDuplicateMember1.ts (7 errors) ====
class C {
get x() { return 1; }
~
@@ -13,9 +15,13 @@ tests/cases/compiler/cloduleWithDuplicateMember1.ts(14,21): error TS2300: Duplic
static get x() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
return '';
}
static foo() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
}
module C {
diff --git a/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt b/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt
index 1118f23a98d..55d2fdbddf2 100644
--- a/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt
+++ b/tests/baselines/reference/cloduleWithDuplicateMember2.errors.txt
@@ -1,9 +1,10 @@
tests/cases/compiler/cloduleWithDuplicateMember2.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/cloduleWithDuplicateMember2.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/compiler/cloduleWithDuplicateMember2.ts(7,16): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/cloduleWithDuplicateMember2.ts(10,21): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/cloduleWithDuplicateMember2.ts (3 errors) ====
+==== tests/cases/compiler/cloduleWithDuplicateMember2.ts (4 errors) ====
class C {
set x(y) { }
~
@@ -15,6 +16,8 @@ tests/cases/compiler/cloduleWithDuplicateMember2.ts(10,21): error TS2300: Duplic
module C {
export var x = 1;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
module C {
export function x() { }
diff --git a/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt b/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt
index f1e7d2abeed..0b667108b5f 100644
--- a/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt
+++ b/tests/baselines/reference/conflictingTypeAnnotatedVar.errors.txt
@@ -1,11 +1,14 @@
+tests/cases/compiler/conflictingTypeAnnotatedVar.ts(1,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/conflictingTypeAnnotatedVar.ts(2,10): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/conflictingTypeAnnotatedVar.ts(2,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
tests/cases/compiler/conflictingTypeAnnotatedVar.ts(3,10): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/conflictingTypeAnnotatedVar.ts(3,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
-==== tests/cases/compiler/conflictingTypeAnnotatedVar.ts (4 errors) ====
+==== tests/cases/compiler/conflictingTypeAnnotatedVar.ts (5 errors) ====
var foo: string;
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
function foo(): number { }
~~~
!!! error TS2300: Duplicate identifier 'foo'.
diff --git a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt
index d17f52e90c1..e12f3a59ca1 100644
--- a/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt
+++ b/tests/baselines/reference/constructSignatureWithAccessibilityModifiersOnParameters2.errors.txt
@@ -1,8 +1,11 @@
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(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.
@@ -15,15 +18,19 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatur
tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts(35,10): error TS2369: A parameter property is only allowed in a constructor implementation.
-==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (15 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (18 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'.
@@ -35,6 +42,8 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatur
constructor(private x);
~~~~~~~~~
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
constructor(public x) { }
~
!!! error TS2300: Duplicate identifier 'x'.
diff --git a/tests/baselines/reference/constructorOverloads1.errors.txt b/tests/baselines/reference/constructorOverloads1.errors.txt
index 4b57d5c7839..d72aac5bcd0 100644
--- a/tests/baselines/reference/constructorOverloads1.errors.txt
+++ b/tests/baselines/reference/constructorOverloads1.errors.txt
@@ -1,15 +1,26 @@
+tests/cases/compiler/constructorOverloads1.ts(2,5): error TS2392: Multiple constructor implementations are not allowed.
+tests/cases/compiler/constructorOverloads1.ts(3,5): error TS2392: Multiple constructor implementations are not allowed.
+tests/cases/compiler/constructorOverloads1.ts(4,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads1.ts(7,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'.
tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of type 'unknown[]' is not assignable to parameter of type 'number'.
-==== tests/cases/compiler/constructorOverloads1.ts (3 errors) ====
+==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ====
class Foo {
constructor(s: string);
+ ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2392: Multiple constructor implementations are not allowed.
constructor(n: number);
+ ~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2392: Multiple constructor implementations are not allowed.
constructor(x: any) {
+ ~~~~~~~~~~~~~~~~~~~~~
+
}
+ ~~~~~
+!!! error TS2392: Multiple constructor implementations are not allowed.
constructor(x: any) {
~~~~~~~~~~~~~~~~~~~~~
diff --git a/tests/baselines/reference/constructorOverloads4.errors.txt b/tests/baselines/reference/constructorOverloads4.errors.txt
index 4b272b3f264..d2cc5ecd65b 100644
--- a/tests/baselines/reference/constructorOverloads4.errors.txt
+++ b/tests/baselines/reference/constructorOverloads4.errors.txt
@@ -1,12 +1,15 @@
+tests/cases/compiler/constructorOverloads4.ts(2,18): error TS2300: Duplicate identifier 'Function'.
tests/cases/compiler/constructorOverloads4.ts(5,21): error TS2300: Duplicate identifier 'Function'.
tests/cases/compiler/constructorOverloads4.ts(6,21): error TS2300: Duplicate identifier 'Function'.
tests/cases/compiler/constructorOverloads4.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature.
tests/cases/compiler/constructorOverloads4.ts(11,1): error TS2348: Value of type 'typeof Function' is not callable. Did you mean to include 'new'?
-==== tests/cases/compiler/constructorOverloads4.ts (4 errors) ====
+==== tests/cases/compiler/constructorOverloads4.ts (5 errors) ====
declare module M {
export class Function {
+ ~~~~~~~~
+!!! error TS2300: Duplicate identifier 'Function'.
constructor(...args: string[]);
}
export function Function(...args: any[]): any;
diff --git a/tests/baselines/reference/constructorOverloads5.errors.txt b/tests/baselines/reference/constructorOverloads5.errors.txt
index dd7ec956eac..0a695fc001c 100644
--- a/tests/baselines/reference/constructorOverloads5.errors.txt
+++ b/tests/baselines/reference/constructorOverloads5.errors.txt
@@ -1,12 +1,18 @@
+tests/cases/compiler/constructorOverloads5.ts(4,21): error TS2300: Duplicate identifier 'RegExp'.
+tests/cases/compiler/constructorOverloads5.ts(5,21): error TS2300: Duplicate identifier 'RegExp'.
tests/cases/compiler/constructorOverloads5.ts(6,18): error TS2300: Duplicate identifier 'RegExp'.
-==== tests/cases/compiler/constructorOverloads5.ts (1 errors) ====
+==== tests/cases/compiler/constructorOverloads5.ts (3 errors) ====
interface IArguments {}
declare module M {
export function RegExp(pattern: string): RegExp;
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'RegExp'.
export function RegExp(pattern: string, flags: string): RegExp;
+ ~~~~~~
+!!! error TS2300: Duplicate identifier 'RegExp'.
export class RegExp {
~~~~~~
!!! error TS2300: Duplicate identifier 'RegExp'.
diff --git a/tests/baselines/reference/constructorOverloads7.errors.txt b/tests/baselines/reference/constructorOverloads7.errors.txt
index 4caa358e7bd..e3409dbb399 100644
--- a/tests/baselines/reference/constructorOverloads7.errors.txt
+++ b/tests/baselines/reference/constructorOverloads7.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/constructorOverloads7.ts(1,15): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/constructorOverloads7.ts(15,10): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/constructorOverloads7.ts(22,18): error TS2384: Overload signatures must all be ambient or non-ambient.
-==== tests/cases/compiler/constructorOverloads7.ts (2 errors) ====
+==== tests/cases/compiler/constructorOverloads7.ts (3 errors) ====
declare class Point
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
{
x: number;
y: number;
diff --git a/tests/baselines/reference/constructorOverloads8.errors.txt b/tests/baselines/reference/constructorOverloads8.errors.txt
index 3aa7e509898..ca79964ad3f 100644
--- a/tests/baselines/reference/constructorOverloads8.errors.txt
+++ b/tests/baselines/reference/constructorOverloads8.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/constructorOverloads8.ts(2,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads8.ts(3,5): error TS2392: Multiple constructor implementations are not allowed.
-==== tests/cases/compiler/constructorOverloads8.ts (1 errors) ====
+==== tests/cases/compiler/constructorOverloads8.ts (2 errors) ====
class C {
constructor(x) { }
+ ~~~~~~~~~~~~~~~~~~
+!!! error TS2392: Multiple constructor implementations are not allowed.
constructor(y, x) { } // illegal, 2 constructor implementations
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
diff --git a/tests/baselines/reference/constructorParameterProperties2.errors.txt b/tests/baselines/reference/constructorParameterProperties2.errors.txt
index df759fbe709..42df015bc5b 100644
--- a/tests/baselines/reference/constructorParameterProperties2.errors.txt
+++ b/tests/baselines/reference/constructorParameterProperties2.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(10,5): error TS2300: Duplicate identifier 'y'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(11,24): error TS2300: Duplicate identifier 'y'.
+tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(18,5): error TS2300: Duplicate identifier 'y'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(19,25): error TS2300: Duplicate identifier 'y'.
+tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(26,5): error TS2300: Duplicate identifier 'y'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,27): error TS2300: Duplicate identifier 'y'.
-==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (3 errors) ====
+==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (6 errors) ====
class C {
y: number;
constructor(y: number) { } // ok
@@ -14,6 +17,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co
class D {
y: number;
+ ~
+!!! error TS2300: Duplicate identifier 'y'.
constructor(public y: number) { } // error
~
!!! error TS2300: Duplicate identifier 'y'.
@@ -24,6 +29,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co
class E {
y: number;
+ ~
+!!! error TS2300: Duplicate identifier 'y'.
constructor(private y: number) { } // error
~
!!! error TS2300: Duplicate identifier 'y'.
@@ -34,6 +41,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co
class F {
y: number;
+ ~
+!!! error TS2300: Duplicate identifier 'y'.
constructor(protected y: number) { } // error
~
!!! error TS2300: Duplicate identifier 'y'.
diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt
index 17b5398475a..0e91d11b280 100644
--- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt
+++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt
@@ -72,8 +72,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,31): error TS2304: Cannot find name 'Property'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
-tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,47): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,29): error TS2304: Cannot find name 'yield'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'.
@@ -96,7 +95,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error T
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'.
-==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (96 errors) ====
+==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (95 errors) ====
declare module "fs" {
export class File {
constructor(filename: string);
@@ -370,10 +369,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
var i = a[1];/*[]*/
i = i + i - i * i / i % i & i | i ^ i;/*+ - * / % & | ^*/
var b = true && false || true ^ false;/*& | ^*/
- ~~~~
-!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
- ~~~~~
-!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
+ ~~~~~~~~~~~~
+!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
b = !b;/*!*/
i = ~i;/*~i*/
b = i < (i - 1) && (i + 1) > i;/*< && >*/
diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt
new file mode 100644
index 00000000000..e739c916c8a
--- /dev/null
+++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt
@@ -0,0 +1,40 @@
+tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(11,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]':
+ Types of property '0' are incompatible:
+ Type '{}' is not assignable to type '{ a: string; }':
+ Property 'a' is missing in type '{}'.
+tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(12,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]':
+ Property '2' is missing in type '[number, string]'.
+tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(13,5): error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]':
+ Types of property 'pop' are incompatible:
+ Type '() => {}' is not assignable to type '() => string':
+ Type '{}' is not assignable to type 'string'.
+
+
+==== tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts (3 errors) ====
+ // no error
+ var numStrTuple: [number, string] = [5, "hello"];
+ var numStrTuple2: [number, string] = [5, "foo", true];
+ var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
+ var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5];
+ var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]];
+ numStrTuple = numStrTuple2;
+ numStrTuple = numStrBoolTuple;
+
+ // error
+ objNumTuple = [ {}, 5];
+ ~~~~~~~~~~~
+!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]':
+!!! error TS2322: Types of property '0' are incompatible:
+!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }':
+!!! error TS2322: Property 'a' is missing in type '{}'.
+ numStrBoolTuple = numStrTuple;
+ ~~~~~~~~~~~~~~~
+!!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]':
+!!! error TS2322: Property '2' is missing in type '[number, string]'.
+ var strStrTuple: [string, string] = ["foo", "bar", 5];
+ ~~~~~~~~~~~
+!!! error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]':
+!!! error TS2322: Types of property 'pop' are incompatible:
+!!! error TS2322: Type '() => {}' is not assignable to type '() => string':
+!!! error TS2322: Type '{}' is not assignable to type 'string'.
+
\ No newline at end of file
diff --git a/tests/baselines/reference/contextualTypeWithTuple.js b/tests/baselines/reference/contextualTypeWithTuple.js
new file mode 100644
index 00000000000..0e53cea283b
--- /dev/null
+++ b/tests/baselines/reference/contextualTypeWithTuple.js
@@ -0,0 +1,29 @@
+//// [contextualTypeWithTuple.ts]
+// no error
+var numStrTuple: [number, string] = [5, "hello"];
+var numStrTuple2: [number, string] = [5, "foo", true];
+var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
+var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5];
+var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]];
+numStrTuple = numStrTuple2;
+numStrTuple = numStrBoolTuple;
+
+// error
+objNumTuple = [ {}, 5];
+numStrBoolTuple = numStrTuple;
+var strStrTuple: [string, string] = ["foo", "bar", 5];
+
+
+//// [contextualTypeWithTuple.js]
+// no error
+var numStrTuple = [5, "hello"];
+var numStrTuple2 = [5, "foo", true];
+var numStrBoolTuple = [5, "foo", true];
+var objNumTuple = [{ a: "world" }, 5];
+var strTupleTuple = ["bar", [5, { x: 1, y: 1 }]];
+numStrTuple = numStrTuple2;
+numStrTuple = numStrBoolTuple;
+// error
+objNumTuple = [{}, 5];
+numStrBoolTuple = numStrTuple;
+var strStrTuple = ["foo", "bar", 5];
diff --git a/tests/baselines/reference/contextualTyping.errors.txt b/tests/baselines/reference/contextualTyping.errors.txt
index cea075477ee..ed6e50c1dbd 100644
--- a/tests/baselines/reference/contextualTyping.errors.txt
+++ b/tests/baselines/reference/contextualTyping.errors.txt
@@ -1,9 +1,10 @@
tests/cases/compiler/contextualTyping.ts(189,18): error TS2384: Overload signatures must all be ambient or non-ambient.
+tests/cases/compiler/contextualTyping.ts(197,15): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/contextualTyping.ts(207,10): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/contextualTyping.ts(230,5): error TS2322: Type '{}' is not assignable to type 'B':\n Property 'x' is missing in type '{}'.
-==== tests/cases/compiler/contextualTyping.ts (3 errors) ====
+==== tests/cases/compiler/contextualTyping.ts (4 errors) ====
// DEFAULT INTERFACES
interface IFoo {
n: number;
@@ -203,6 +204,8 @@ tests/cases/compiler/contextualTyping.ts(230,5): error TS2322: Type '{}' is not
// contextually typing from ambient class declarations
declare class Point
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
{
constructor(x: number, y: number);
x: number;
diff --git a/tests/baselines/reference/declInput.errors.txt b/tests/baselines/reference/declInput.errors.txt
index 2fbaf6db6bc..8ec341ce15b 100644
--- a/tests/baselines/reference/declInput.errors.txt
+++ b/tests/baselines/reference/declInput.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/declInput.ts(1,11): error TS2300: Duplicate identifier 'bar'.
tests/cases/compiler/declInput.ts(5,7): error TS2300: Duplicate identifier 'bar'.
-==== tests/cases/compiler/declInput.ts (1 errors) ====
+==== tests/cases/compiler/declInput.ts (2 errors) ====
interface bar {
+ ~~~
+!!! error TS2300: Duplicate identifier 'bar'.
}
diff --git a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt
index a2e81b0eb95..7212121e106 100644
--- a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt
+++ b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt
@@ -4,11 +4,12 @@ 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 (8 errors) ====
+==== tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompatibleWithBaseIndexer.ts (9 errors) ====
interface Base {
[x: number]: { x: number; y: number; };
[x: string]: { x: number; }
@@ -45,6 +46,8 @@ 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; }'.
}
diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt
index 9ff44679e44..004e68314fd 100644
--- a/tests/baselines/reference/duplicateClassElements.errors.txt
+++ b/tests/baselines/reference/duplicateClassElements.errors.txt
@@ -8,30 +8,43 @@ tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors ar
tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+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(6,5): error TS2393: Duplicate function implementation.
+tests/cases/compiler/duplicateClassElements.ts(4,12): error TS2393: Duplicate function implementation.
+tests/cases/compiler/duplicateClassElements.ts(6,12): error TS2393: Duplicate function implementation.
+tests/cases/compiler/duplicateClassElements.ts(8,12): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateClassElements.ts(9,9): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateClassElements.ts(12,9): error TS2300: Duplicate identifier 'x'.
+tests/cases/compiler/duplicateClassElements.ts(21,12): error TS2300: Duplicate identifier 'z'.
tests/cases/compiler/duplicateClassElements.ts(23,9): error TS2300: Duplicate identifier 'z'.
tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate identifier 'z'.
+tests/cases/compiler/duplicateClassElements.ts(29,9): error TS2300: Duplicate identifier 'x2'.
+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(36,9): error TS2300: Duplicate identifier 'z2'.
+tests/cases/compiler/duplicateClassElements.ts(39,9): error TS2300: Duplicate identifier 'z2'.
tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate identifier 'z2'.
-==== tests/cases/compiler/duplicateClassElements.ts (18 errors) ====
+==== tests/cases/compiler/duplicateClassElements.ts (26 errors) ====
class a {
public a;
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
public a;
~
!!! error TS2300: Duplicate identifier 'a'.
public b() {
+ ~
+!!! error TS2393: Duplicate function implementation.
}
public b() {
- ~~~~~~~~~~~~
- }
- ~~~~~
+ ~
!!! error TS2393: Duplicate function implementation.
+ }
public x;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
get x() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -57,6 +70,8 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i
}
public z() {
+ ~
+!!! error TS2300: Duplicate identifier 'z'.
}
get z() {
~
@@ -75,11 +90,15 @@ 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;
~~
@@ -88,11 +107,15 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i
get z2() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~~
+!!! error TS2300: Duplicate identifier 'z2'.
return "Hello";
}
set z2(_y: string) {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~~
+!!! error TS2300: Duplicate identifier 'z2'.
}
public z2() {
~~
diff --git a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt
index 08eb464c8ad..d8065df27c8 100644
--- a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt
+++ b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt
@@ -1,11 +1,16 @@
+tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(1,5): error TS2300: Duplicate identifier 'v'.
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(3,14): error TS2300: Duplicate identifier 'v'.
+tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(6,10): error TS2300: Duplicate identifier 'w'.
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(8,9): error TS2300: Duplicate identifier 'w'.
+tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(12,9): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(13,14): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'.
-==== tests/cases/compiler/duplicateIdentifierInCatchBlock.ts (4 errors) ====
+==== tests/cases/compiler/duplicateIdentifierInCatchBlock.ts (7 errors) ====
var v;
+ ~
+!!! error TS2300: Duplicate identifier 'v'.
try { } catch (e) {
function v() { }
~
@@ -13,6 +18,8 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Sub
}
function w() { }
+ ~
+!!! error TS2300: Duplicate identifier 'w'.
try { } catch (e) {
var w;
~
@@ -21,6 +28,8 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Sub
try { } catch (e) {
var x;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
function x() { } // error
~
!!! error TS2300: Duplicate identifier 'x'.
diff --git a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt
index 783504277e0..6c80d13b2f4 100644
--- a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt
+++ b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.errors.txt
@@ -1,11 +1,16 @@
+tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(2,22): error TS2300: Duplicate identifier 'I'.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(5,18): error TS2300: Duplicate identifier 'I'.
+tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(9,21): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(12,18): error TS2300: Duplicate identifier 'f'.
+tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(37,12): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(41,16): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (3 errors) ====
+==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (6 errors) ====
module M {
export interface I { }
+ ~
+!!! error TS2300: Duplicate identifier 'I'.
}
module M {
export class I { } // error
@@ -15,6 +20,8 @@ tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(41,16): er
module M {
export function f() { }
+ ~
+!!! error TS2300: Duplicate identifier 'f'.
}
module M {
export class f { } // error
@@ -45,6 +52,8 @@ tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(41,16): er
class Foo {
static x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
module Foo {
diff --git a/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt b/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt
index 952b9b3bc42..674d4f601e6 100644
--- a/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt
+++ b/tests/baselines/reference/duplicateInterfaceMembers1.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/duplicateInterfaceMembers1.ts(2,4): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateInterfaceMembers1.ts(3,4): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/duplicateInterfaceMembers1.ts (1 errors) ====
+==== tests/cases/compiler/duplicateInterfaceMembers1.ts (2 errors) ====
interface Bar {
x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
x: number;
~
!!! error TS2300: Duplicate identifier 'x'.
diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt
index 370a7070505..4c3f6d1eb7e 100644
--- a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt
+++ b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt
@@ -2,16 +2,22 @@ tests/cases/compiler/duplicateObjectLiteralProperty.ts(14,9): error TS1056: Acce
tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name.
+tests/cases/compiler/duplicateObjectLiteralProperty.ts(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'.
tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Duplicate identifier 'a'.
-==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (9 errors) ====
+==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (13 errors) ====
var x = {
a: 1,
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
b: true, // OK
a: 56, // Duplicate
~
@@ -23,6 +29,8 @@ 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"'.
@@ -34,9 +42,13 @@ tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Dupl
get a() { return 0; },
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
set a(v: number) { },
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
get a() { return 0; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
diff --git a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt
index 17a55a7876b..6ae8518677d 100644
--- a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt
+++ b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt
@@ -1,11 +1,14 @@
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(3,3): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (2 errors) ====
+==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (3 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 ac21db7830a..108a88d1451 100644
--- a/tests/baselines/reference/duplicatePropertyNames.errors.txt
+++ b/tests/baselines/reference/duplicatePropertyNames.errors.txt
@@ -1,20 +1,32 @@
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(4,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(5,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(14,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(15,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(19,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(20,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(22,5): error TS2393: Duplicate function implementation.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(23,5): error TS2393: Duplicate function implementation.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(25,5): error TS2300: Duplicate identifier 'baz'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(26,5): error TS2300: Duplicate identifier 'baz'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(30,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(31,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(35,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(36,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(38,5): error TS2300: Duplicate identifier 'bar'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(39,5): error TS2300: Duplicate identifier 'bar'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(43,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(44,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/members/duplicatePropertyNames.ts(45,5): error TS2300: Duplicate identifier 'bar'.
tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2300: Duplicate identifier 'bar'.
-==== tests/cases/conformance/types/members/duplicatePropertyNames.ts (10 errors) ====
+==== tests/cases/conformance/types/members/duplicatePropertyNames.ts (20 errors) ====
// duplicate property names are an error in all types
interface Number {
foo: string;
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
foo: string;
~~~
!!! error TS2300: Duplicate identifier 'foo'.
@@ -27,6 +39,8 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2
interface Array {
foo: T;
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
foo: T;
~~~
!!! error TS2300: Duplicate identifier 'foo'.
@@ -34,16 +48,22 @@ 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'.
bar(x) { }
+ ~~~
+!!! error TS2393: Duplicate function implementation.
bar(x) { }
- ~~~~~~~~~~
+ ~~~
!!! error TS2393: Duplicate function implementation.
baz = () => { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'baz'.
baz = () => { }
~~~
!!! error TS2300: Duplicate identifier 'baz'.
@@ -51,6 +71,8 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2
interface I {
foo: string;
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
foo: string;
~~~
!!! error TS2300: Duplicate identifier 'foo'.
@@ -58,11 +80,15 @@ tests/cases/conformance/types/members/duplicatePropertyNames.ts(46,5): error TS2
var a: {
foo: string;
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
foo: string;
~~~
!!! error TS2300: Duplicate identifier 'foo'.
bar: () => {};
+ ~~~
+!!! error TS2300: Duplicate identifier 'bar'.
bar: () => {};
~~~
!!! error TS2300: Duplicate identifier 'bar'.
@@ -70,10 +96,14 @@ 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 9353eb34151..7d6c5d6bafc 100644
--- a/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt
+++ b/tests/baselines/reference/duplicateStringNamedProperty1.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/duplicateStringNamedProperty1.ts(2,5): error TS2300: Duplicate identifier '"artist"'.
tests/cases/compiler/duplicateStringNamedProperty1.ts(3,5): error TS2300: Duplicate identifier 'artist'.
-==== tests/cases/compiler/duplicateStringNamedProperty1.ts (1 errors) ====
+==== tests/cases/compiler/duplicateStringNamedProperty1.ts (2 errors) ====
export interface Album {
"artist": string;
+ ~~~~~~~~
+!!! error TS2300: Duplicate identifier '"artist"'.
artist: string;
~~~~~~
!!! error TS2300: Duplicate identifier 'artist'.
diff --git a/tests/baselines/reference/enumGenericTypeClash.errors.txt b/tests/baselines/reference/enumGenericTypeClash.errors.txt
index adf345870de..23007175e4c 100644
--- a/tests/baselines/reference/enumGenericTypeClash.errors.txt
+++ b/tests/baselines/reference/enumGenericTypeClash.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/enumGenericTypeClash.ts(1,7): error TS2300: Duplicate identifier 'X'.
tests/cases/compiler/enumGenericTypeClash.ts(2,6): error TS2300: Duplicate identifier 'X'.
-==== tests/cases/compiler/enumGenericTypeClash.ts (1 errors) ====
+==== tests/cases/compiler/enumGenericTypeClash.ts (2 errors) ====
class X { }
+ ~
+!!! error TS2300: Duplicate identifier 'X'.
enum X { MyVal }
~
!!! error TS2300: Duplicate identifier 'X'.
diff --git a/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt b/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt
index 26b5da7d0cf..551b5d9d929 100644
--- a/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt
+++ b/tests/baselines/reference/enumIdenticalIdentifierValues.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/enumIdenticalIdentifierValues.ts(2,5): error TS2300: Duplicate identifier '1'.
tests/cases/compiler/enumIdenticalIdentifierValues.ts(3,5): error TS2300: Duplicate identifier '1.0'.
-==== tests/cases/compiler/enumIdenticalIdentifierValues.ts (1 errors) ====
+==== tests/cases/compiler/enumIdenticalIdentifierValues.ts (2 errors) ====
enum Enum {
1,
+ ~
+!!! error TS2300: Duplicate identifier '1'.
1.0
~~~
!!! error TS2300: Duplicate identifier '1.0'.
diff --git a/tests/baselines/reference/es6ClassTest9.errors.txt b/tests/baselines/reference/es6ClassTest9.errors.txt
index 3cd59059f89..ae7d1ba92d5 100644
--- a/tests/baselines/reference/es6ClassTest9.errors.txt
+++ b/tests/baselines/reference/es6ClassTest9.errors.txt
@@ -1,14 +1,17 @@
tests/cases/compiler/es6ClassTest9.ts(1,18): error TS1005: '{' expected.
tests/cases/compiler/es6ClassTest9.ts(1,19): error TS1109: Expression expected.
+tests/cases/compiler/es6ClassTest9.ts(1,15): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/es6ClassTest9.ts(2,10): error TS2300: Duplicate identifier 'foo'.
-==== tests/cases/compiler/es6ClassTest9.ts (3 errors) ====
+==== tests/cases/compiler/es6ClassTest9.ts (4 errors) ====
declare class foo();
~
!!! error TS1005: '{' expected.
~
!!! error TS1109: Expression expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
function foo() {}
~~~
!!! error TS2300: Duplicate identifier 'foo'.
diff --git a/tests/baselines/reference/exportSameNameFuncVar.errors.txt b/tests/baselines/reference/exportSameNameFuncVar.errors.txt
index 0103d0e8968..a06457e88ae 100644
--- a/tests/baselines/reference/exportSameNameFuncVar.errors.txt
+++ b/tests/baselines/reference/exportSameNameFuncVar.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/exportSameNameFuncVar.ts(1,12): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/exportSameNameFuncVar.ts(2,17): error TS2300: Duplicate identifier 'a'.
-==== tests/cases/compiler/exportSameNameFuncVar.ts (1 errors) ====
+==== tests/cases/compiler/exportSameNameFuncVar.ts (2 errors) ====
export var a = 10;
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
export function a() {
~
!!! error TS2300: Duplicate identifier 'a'.
diff --git a/tests/baselines/reference/extension.errors.txt b/tests/baselines/reference/extension.errors.txt
index 9756d2920d1..e55f15f4381 100644
--- a/tests/baselines/reference/extension.errors.txt
+++ b/tests/baselines/reference/extension.errors.txt
@@ -1,11 +1,12 @@
tests/cases/compiler/extension.ts(16,5): error TS1128: Declaration or statement expected.
tests/cases/compiler/extension.ts(16,22): error TS1005: ';' expected.
+tests/cases/compiler/extension.ts(10,18): error TS2300: Duplicate identifier 'C'.
tests/cases/compiler/extension.ts(16,12): error TS2304: Cannot find name 'extension'.
tests/cases/compiler/extension.ts(16,28): error TS2300: Duplicate identifier 'C'.
tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'.
-==== tests/cases/compiler/extension.ts (5 errors) ====
+==== tests/cases/compiler/extension.ts (6 errors) ====
interface I {
x;
}
@@ -16,6 +17,8 @@ tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not ex
declare module M {
export class C {
+ ~
+!!! error TS2300: Duplicate identifier 'C'.
public p:number;
}
}
diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt
index ef205adfd42..dd2374f2447 100644
--- a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt
+++ b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt
@@ -1,10 +1,13 @@
tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/compiler/fieldAndGetterWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/fieldAndGetterWithSameName.ts (2 errors) ====
+==== tests/cases/compiler/fieldAndGetterWithSameName.ts (3 errors) ====
export class C {
x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
get x(): number { return 1; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
diff --git a/tests/baselines/reference/funClodule.errors.txt b/tests/baselines/reference/funClodule.errors.txt
index 20598f276f3..72a9ed0db51 100644
--- a/tests/baselines/reference/funClodule.errors.txt
+++ b/tests/baselines/reference/funClodule.errors.txt
@@ -1,11 +1,21 @@
+tests/cases/compiler/funClodule.ts(1,18): error TS2300: Duplicate identifier 'foo'.
+tests/cases/compiler/funClodule.ts(2,16): error TS2300: Duplicate identifier 'foo'.
tests/cases/compiler/funClodule.ts(5,15): error TS2300: Duplicate identifier 'foo'.
+tests/cases/compiler/funClodule.ts(8,15): error TS2300: Duplicate identifier 'foo2'.
+tests/cases/compiler/funClodule.ts(9,16): error TS2300: Duplicate identifier 'foo2'.
tests/cases/compiler/funClodule.ts(12,18): error TS2300: Duplicate identifier 'foo2'.
+tests/cases/compiler/funClodule.ts(15,10): error TS2300: Duplicate identifier 'foo3'.
+tests/cases/compiler/funClodule.ts(16,8): error TS2300: Duplicate identifier 'foo3'.
tests/cases/compiler/funClodule.ts(19,7): error TS2300: Duplicate identifier 'foo3'.
-==== tests/cases/compiler/funClodule.ts (3 errors) ====
+==== tests/cases/compiler/funClodule.ts (9 errors) ====
declare function foo();
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
declare module foo {
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
export function x(): any;
}
declare class foo { } // Should error
@@ -14,7 +24,11 @@ tests/cases/compiler/funClodule.ts(19,7): error TS2300: Duplicate identifier 'fo
declare class foo2 { }
+ ~~~~
+!!! error TS2300: Duplicate identifier 'foo2'.
declare module foo2 {
+ ~~~~
+!!! error TS2300: Duplicate identifier 'foo2'.
export function x(): any;
}
declare function foo2(); // Should error
@@ -23,7 +37,11 @@ tests/cases/compiler/funClodule.ts(19,7): error TS2300: Duplicate identifier 'fo
function foo3() { }
+ ~~~~
+!!! error TS2300: Duplicate identifier 'foo3'.
module foo3 {
+ ~~~~
+!!! error TS2300: Duplicate identifier 'foo3'.
export function x(): any { }
}
class foo3 { } // Should error
diff --git a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt
index 8b1efe089c1..640844064c4 100644
--- a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt
+++ b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt
@@ -1,10 +1,13 @@
tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/compiler/functionAndPropertyNameConflict.ts(2,12): error TS2300: Duplicate identifier 'aaaaa'.
tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS2300: Duplicate identifier 'aaaaa'.
-==== tests/cases/compiler/functionAndPropertyNameConflict.ts (2 errors) ====
+==== tests/cases/compiler/functionAndPropertyNameConflict.ts (3 errors) ====
class C65 {
public aaaaa() { }
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'aaaaa'.
public get aaaaa() {
~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
diff --git a/tests/baselines/reference/functionCall15.errors.txt b/tests/baselines/reference/functionCall15.errors.txt
index 09c246d34dc..4b6acf34e14 100644
--- a/tests/baselines/reference/functionCall15.errors.txt
+++ b/tests/baselines/reference/functionCall15.errors.txt
@@ -1,7 +1,10 @@
+tests/cases/compiler/functionCall15.ts(1,25): error TS2300: Duplicate identifier 'b'.
tests/cases/compiler/functionCall15.ts(1,39): error TS2300: Duplicate identifier 'b'.
-==== tests/cases/compiler/functionCall15.ts (1 errors) ====
+==== tests/cases/compiler/functionCall15.ts (2 errors) ====
function foo(a?:string, b?:number, ...b:number[]){}
+ ~
+!!! error TS2300: Duplicate identifier 'b'.
~
!!! error TS2300: Duplicate identifier 'b'.
\ No newline at end of file
diff --git a/tests/baselines/reference/functionNameConflicts.errors.txt b/tests/baselines/reference/functionNameConflicts.errors.txt
index 08a2c5c462d..86fa348d817 100644
--- a/tests/baselines/reference/functionNameConflicts.errors.txt
+++ b/tests/baselines/reference/functionNameConflicts.errors.txt
@@ -1,39 +1,54 @@
+tests/cases/conformance/functions/functionNameConflicts.ts(5,14): error TS2300: Duplicate identifier 'fn1'.
tests/cases/conformance/functions/functionNameConflicts.ts(6,9): error TS2300: Duplicate identifier 'fn1'.
+tests/cases/conformance/functions/functionNameConflicts.ts(8,9): error TS2300: Duplicate identifier 'fn2'.
tests/cases/conformance/functions/functionNameConflicts.ts(9,14): error TS2300: Duplicate identifier 'fn2'.
+tests/cases/conformance/functions/functionNameConflicts.ts(12,10): error TS2300: Duplicate identifier 'fn3'.
tests/cases/conformance/functions/functionNameConflicts.ts(13,5): error TS2300: Duplicate identifier 'fn3'.
+tests/cases/conformance/functions/functionNameConflicts.ts(16,9): error TS2300: Duplicate identifier 'fn4'.
tests/cases/conformance/functions/functionNameConflicts.ts(17,14): error TS2300: Duplicate identifier 'fn4'.
+tests/cases/conformance/functions/functionNameConflicts.ts(19,14): error TS2300: Duplicate identifier 'fn5'.
tests/cases/conformance/functions/functionNameConflicts.ts(20,9): error TS2300: Duplicate identifier 'fn5'.
tests/cases/conformance/functions/functionNameConflicts.ts(24,10): error TS2389: Function implementation name must be 'over'.
-==== tests/cases/conformance/functions/functionNameConflicts.ts (6 errors) ====
+==== tests/cases/conformance/functions/functionNameConflicts.ts (11 errors) ====
//Function and variable of the same name in same declaration space
//Function overload with different name from implementation signature
module M {
function fn1() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'fn1'.
var fn1;
~~~
!!! error TS2300: Duplicate identifier 'fn1'.
var fn2;
+ ~~~
+!!! error TS2300: Duplicate identifier 'fn2'.
function fn2() { }
~~~
!!! error TS2300: Duplicate identifier 'fn2'.
}
function fn3() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'fn3'.
var fn3;
~~~
!!! error TS2300: Duplicate identifier 'fn3'.
function func() {
var fn4;
+ ~~~
+!!! error TS2300: Duplicate identifier 'fn4'.
function fn4() { }
~~~
!!! error TS2300: Duplicate identifier 'fn4'.
function fn5() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'fn5'.
var fn5;
~~~
!!! error TS2300: Duplicate identifier 'fn5'.
diff --git a/tests/baselines/reference/functionWithSameNameAsField.errors.txt b/tests/baselines/reference/functionWithSameNameAsField.errors.txt
index e1ba390cf94..168b9191df4 100644
--- a/tests/baselines/reference/functionWithSameNameAsField.errors.txt
+++ b/tests/baselines/reference/functionWithSameNameAsField.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/functionWithSameNameAsField.ts(2,12): error TS2300: Duplicate identifier 'total'.
tests/cases/compiler/functionWithSameNameAsField.ts(3,12): error TS2300: Duplicate identifier 'total'.
-==== tests/cases/compiler/functionWithSameNameAsField.ts (1 errors) ====
+==== tests/cases/compiler/functionWithSameNameAsField.ts (2 errors) ====
class TestProgressBar {
public total: number;
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'total'.
public total(total: number) {
~~~~~
!!! error TS2300: Duplicate identifier 'total'.
diff --git a/tests/baselines/reference/genericCallWithTupleType.errors.txt b/tests/baselines/reference/genericCallWithTupleType.errors.txt
new file mode 100644
index 00000000000..7f84cee760c
--- /dev/null
+++ b/tests/baselines/reference/genericCallWithTupleType.errors.txt
@@ -0,0 +1,47 @@
+tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]':
+ Types of property '0' are incompatible:
+ Type 'number' is not assignable to type 'string'.
+tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]':
+ Types of property '0' are incompatible:
+ Type '{}' is not assignable to type 'string'.
+tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]':
+ Property '1' is missing in type '[{}]'.
+
+
+==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (3 errors) ====
+ interface I {
+ tuple1: [T, U];
+ }
+
+ var i1: I;
+ var i2: I<{}, {}>;
+
+ // no error
+ i1.tuple1 = ["foo", 5];
+ var e1 = i1.tuple1[0]; // string
+ var e2 = i1.tuple1[1]; // number
+ i1.tuple1 = ["foo", 5, false, true];
+ var e3 = i1.tuple1[2]; // {}
+ i1.tuple1[3] = { a: "string" };
+ var e4 = i1.tuple1[3]; // {}
+ i2.tuple1 = ["foo", 5];
+ i2.tuple1 = ["foo", "bar"];
+ i2.tuple1 = [5, "bar"];
+ i2.tuple1 = [{}, {}];
+
+ // error
+ i1.tuple1 = [5, "foo"];
+ ~~~~~~~~~
+!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]':
+!!! error TS2322: Types of property '0' are incompatible:
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
+ i1.tuple1 = [{}, {}];
+ ~~~~~~~~~
+!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]':
+!!! error TS2322: Types of property '0' are incompatible:
+!!! error TS2322: Type '{}' is not assignable to type 'string'.
+ i2.tuple1 = [{}];
+ ~~~~~~~~~
+!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]':
+!!! error TS2322: Property '1' is missing in type '[{}]'.
+
\ No newline at end of file
diff --git a/tests/baselines/reference/genericCallWithTupleType.js b/tests/baselines/reference/genericCallWithTupleType.js
new file mode 100644
index 00000000000..5ac66f66c3c
--- /dev/null
+++ b/tests/baselines/reference/genericCallWithTupleType.js
@@ -0,0 +1,46 @@
+//// [genericCallWithTupleType.ts]
+interface I {
+ tuple1: [T, U];
+}
+
+var i1: I;
+var i2: I<{}, {}>;
+
+// no error
+i1.tuple1 = ["foo", 5];
+var e1 = i1.tuple1[0]; // string
+var e2 = i1.tuple1[1]; // number
+i1.tuple1 = ["foo", 5, false, true];
+var e3 = i1.tuple1[2]; // {}
+i1.tuple1[3] = { a: "string" };
+var e4 = i1.tuple1[3]; // {}
+i2.tuple1 = ["foo", 5];
+i2.tuple1 = ["foo", "bar"];
+i2.tuple1 = [5, "bar"];
+i2.tuple1 = [{}, {}];
+
+// error
+i1.tuple1 = [5, "foo"];
+i1.tuple1 = [{}, {}];
+i2.tuple1 = [{}];
+
+
+//// [genericCallWithTupleType.js]
+var i1;
+var i2;
+// no error
+i1.tuple1 = ["foo", 5];
+var e1 = i1.tuple1[0]; // string
+var e2 = i1.tuple1[1]; // number
+i1.tuple1 = ["foo", 5, false, true];
+var e3 = i1.tuple1[2]; // {}
+i1.tuple1[3] = { a: "string" };
+var e4 = i1.tuple1[3]; // {}
+i2.tuple1 = ["foo", 5];
+i2.tuple1 = ["foo", "bar"];
+i2.tuple1 = [5, "bar"];
+i2.tuple1 = [{}, {}];
+// error
+i1.tuple1 = [5, "foo"];
+i1.tuple1 = [{}, {}];
+i2.tuple1 = [{}];
diff --git a/tests/baselines/reference/genericClassesRedeclaration.errors.txt b/tests/baselines/reference/genericClassesRedeclaration.errors.txt
index 8cf048c3061..abdea2b052b 100644
--- a/tests/baselines/reference/genericClassesRedeclaration.errors.txt
+++ b/tests/baselines/reference/genericClassesRedeclaration.errors.txt
@@ -1,9 +1,11 @@
+tests/cases/compiler/genericClassesRedeclaration.ts(16,11): error TS2300: Duplicate identifier 'StringHashTable'.
+tests/cases/compiler/genericClassesRedeclaration.ts(29,11): error TS2300: Duplicate identifier 'IdentiferNameHashTable'.
tests/cases/compiler/genericClassesRedeclaration.ts(42,9): error TS2374: Duplicate string index signature.
tests/cases/compiler/genericClassesRedeclaration.ts(55,11): error TS2300: Duplicate identifier 'StringHashTable'.
tests/cases/compiler/genericClassesRedeclaration.ts(68,11): error TS2300: Duplicate identifier 'IdentiferNameHashTable'.
-==== tests/cases/compiler/genericClassesRedeclaration.ts (3 errors) ====
+==== tests/cases/compiler/genericClassesRedeclaration.ts (5 errors) ====
declare module TypeScript {
interface IIndexable {
[s: string]: T;
@@ -20,6 +22,8 @@ tests/cases/compiler/genericClassesRedeclaration.ts(68,11): error TS2300: Duplic
lookup(key: string): T;
}
class StringHashTable implements IHashTable {
+ ~~~~~~~~~~~~~~~
+!!! error TS2300: Duplicate identifier 'StringHashTable'.
private itemCount;
private table;
public getAllKeys(): string[];
@@ -33,6 +37,8 @@ tests/cases/compiler/genericClassesRedeclaration.ts(68,11): error TS2300: Duplic
public remove(key: string): void;
}
class IdentiferNameHashTable extends StringHashTable {
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2300: Duplicate identifier 'IdentiferNameHashTable'.
public getAllKeys(): string[];
public add(key: string, data: T): boolean;
public addOrUpdate(key: string, data: T): boolean;
diff --git a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt
index ea6068225d9..a7e8155c220 100644
--- a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt
+++ b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt
@@ -1,18 +1,27 @@
tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(21,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,18): error TS2300: Duplicate identifier '_'.
tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,41): error TS2304: Cannot find name '_'.
+tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,18): error TS2300: Duplicate identifier '_'.
tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,34): error TS2304: Cannot find name '_'.
+tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(4,16): error TS2300: Duplicate identifier '_'.
tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(15,15): error TS2300: Duplicate identifier '_'.
-==== tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts (4 errors) ====
+==== tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts (7 errors) ====
declare function _(value: Array): _;
+ ~
+!!! error TS2300: Duplicate identifier '_'.
~~~~
!!! error TS2304: Cannot find name '_'.
declare function _(value: T): _;
+ ~
+!!! error TS2300: Duplicate identifier '_'.
~~~~
!!! error TS2304: Cannot find name '_'.
declare module _ {
+ ~
+!!! error TS2300: Duplicate identifier '_'.
export function each(
//list: List,
//iterator: ListIterator,
diff --git a/tests/baselines/reference/getEmitOutputExternalModule.baseline b/tests/baselines/reference/getEmitOutputExternalModule.baseline
new file mode 100644
index 00000000000..b5e670c5fd7
--- /dev/null
+++ b/tests/baselines/reference/getEmitOutputExternalModule.baseline
@@ -0,0 +1,9 @@
+EmitOutputStatus : Succeeded
+Filename : declSingleFile.js
+var x = 5;
+var Bar = (function () {
+ function Bar() {
+ }
+ return Bar;
+})();
+
diff --git a/tests/baselines/reference/getEmitOutputExternalModule2.baseline b/tests/baselines/reference/getEmitOutputExternalModule2.baseline
new file mode 100644
index 00000000000..5c03a092257
--- /dev/null
+++ b/tests/baselines/reference/getEmitOutputExternalModule2.baseline
@@ -0,0 +1,15 @@
+EmitOutputStatus : JSGeneratedWithSemanticErrors
+Filename : declSingleFile.js
+var x = 5;
+var Bar = (function () {
+ function Bar() {
+ }
+ return Bar;
+})();
+var x = "world";
+var Bar2 = (function () {
+ function Bar2() {
+ }
+ return Bar2;
+})();
+
diff --git a/tests/baselines/reference/getEmitOutputSingleFile2.baseline b/tests/baselines/reference/getEmitOutputSingleFile2.baseline
index 77fa6b9acdd..2f5dbe3daf8 100644
--- a/tests/baselines/reference/getEmitOutputSingleFile2.baseline
+++ b/tests/baselines/reference/getEmitOutputSingleFile2.baseline
@@ -5,28 +5,4 @@ exports.bar = "hello world";
Filename : tests/cases/fourslash/inputFile3.d.ts
export declare var foo: number;
export declare var bar: string;
-Filename : declSingleFile.js
-var x = 5;
-var Bar = (function () {
- function Bar() {
- }
- return Bar;
-})();
-var x1 = "hello world";
-var Foo = (function () {
- function Foo() {
- }
- return Foo;
-})();
-Filename : declSingleFile.d.ts
-declare var x: number;
-declare class Bar {
- x: string;
- y: number;
-}
-declare var x1: string;
-declare class Foo {
- x: string;
- y: number;
-}
diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt
index b87dba8809c..95fb571d9b8 100644
--- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt
+++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt
@@ -4,19 +4,25 @@ tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors a
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.
tests/cases/compiler/gettersAndSettersErrors.ts(12,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 TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS2379: Getter and setter accessors do not agree in visibility.
tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and setter accessors do not agree in visibility.
-==== tests/cases/compiler/gettersAndSettersErrors.ts (9 errors) ====
+==== tests/cases/compiler/gettersAndSettersErrors.ts (11 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
~~~
diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt
index 01ddc29ea05..5ef1393915d 100644
--- a/tests/baselines/reference/giant.errors.txt
+++ b/tests/baselines/reference/giant.errors.txt
@@ -145,89 +145,143 @@ tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation c
tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts.
tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context.
tests/cases/compiler/giant.ts(676,33): error TS1036: Statements are not allowed in ambient contexts.
+tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(24,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(25,12): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(26,16): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(27,13): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(28,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(28,17): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(29,13): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(30,17): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(33,12): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(36,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(88,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(89,16): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(90,20): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(91,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(92,21): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(92,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(93,17): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(94,21): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(97,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(100,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(167,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(168,16): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(169,20): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(170,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(171,21): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(171,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(172,17): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(173,21): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(176,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(179,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'.
+tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'.
+tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'.
+tests/cases/compiler/giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(282,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(283,12): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(284,16): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(285,13): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(286,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(286,17): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(287,13): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(288,17): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(291,12): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(294,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(346,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(347,16): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(348,20): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(349,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(350,21): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(350,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(351,17): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(352,21): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(355,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(358,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(425,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(426,16): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(427,20): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(428,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(429,21): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(429,21): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/compiler/giant.ts(430,17): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(431,21): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(434,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(437,20): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'.
+tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'.
+tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'.
+tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'.
tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'.
+tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'.
tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'.
+tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'.
tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'.
+tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'.
tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'.
+tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'.
tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'.
+tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required.
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
-==== tests/cases/compiler/giant.ts (227 errors) ====
+==== tests/cases/compiler/giant.ts (281 errors) ====
/*
Prefixes
@@ -251,6 +305,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pF() { }
private rF() { }
public pgF() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
@@ -259,12 +315,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
@@ -273,6 +333,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
@@ -281,12 +343,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS1005: '{' expected.
static tF() { }
static tsF(param:any) { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
@@ -353,6 +419,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pF() { }
private rF() { }
public pgF() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
@@ -361,12 +429,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
@@ -375,6 +447,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
@@ -383,12 +457,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS1005: '{' expected.
static tF() { }
static tsF(param:any) { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
@@ -472,6 +550,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pF() { }
private rF() { }
public pgF() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
@@ -480,12 +560,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
@@ -494,6 +578,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
@@ -502,12 +588,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS1005: '{' expected.
static tF() { }
static tsF(param:any) { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
@@ -601,6 +691,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -609,6 +701,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -617,6 +711,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -625,6 +721,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -637,6 +735,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
static tsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -645,6 +745,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
static tgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -681,6 +783,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pF() { }
private rF() { }
public pgF() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
@@ -689,12 +793,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
@@ -703,6 +811,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
@@ -711,12 +821,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS1005: '{' expected.
static tF() { }
static tsF(param:any) { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
@@ -783,6 +897,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pF() { }
private rF() { }
public pgF() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
@@ -791,12 +907,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
@@ -805,6 +925,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
@@ -813,12 +935,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS1005: '{' expected.
static tF() { }
static tsF(param:any) { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
@@ -902,6 +1028,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pF() { }
private rF() { }
public pgF() { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS2300: Duplicate identifier 'pgF'.
@@ -910,12 +1038,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'psF'.
private rgF() { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS2300: Duplicate identifier 'rgF'.
@@ -924,6 +1056,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'rsF'.
@@ -932,12 +1066,16 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
!!! error TS1005: '{' expected.
static tF() { }
static tsF(param:any) { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS2300: Duplicate identifier 'tsF'.
static tgF() { }
~~~~~~
!!! error TS1005: '{' expected.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS2300: Duplicate identifier 'tgF'.
@@ -1031,6 +1169,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1039,6 +1179,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1047,6 +1189,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1055,6 +1199,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1067,6 +1213,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
static tsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1075,6 +1223,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
static tgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1121,6 +1271,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public pgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'pgF'.
public get pgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1129,6 +1281,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
public psF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'psF'.
public set psF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1137,6 +1291,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rgF'.
private get rgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1145,6 +1301,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
private rsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'rsF'.
private set rsF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1157,6 +1315,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
static tsF(param:any) { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tsF'.
static set tsF(param:any)
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -1165,6 +1325,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
static tgF() { }
~
!!! error TS1037: A function implementation cannot be declared in an ambient context.
+ ~~~
+!!! error TS2300: Duplicate identifier 'tgF'.
static get tgF()
~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt b/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt
index 739ca67724f..39567a11753 100644
--- a/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt
+++ b/tests/baselines/reference/importAndVariableDeclarationConflict3.errors.txt
@@ -1,12 +1,15 @@
+tests/cases/compiler/importAndVariableDeclarationConflict3.ts(5,8): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/importAndVariableDeclarationConflict3.ts(6,8): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/importAndVariableDeclarationConflict3.ts (1 errors) ====
+==== tests/cases/compiler/importAndVariableDeclarationConflict3.ts (2 errors) ====
module m {
export var m = '';
}
import x = m.m;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
import x = m.m;
~
!!! error TS2300: Duplicate identifier 'x'.
diff --git a/tests/baselines/reference/indexerWithTuple.js b/tests/baselines/reference/indexerWithTuple.js
new file mode 100644
index 00000000000..bc3bee9dd17
--- /dev/null
+++ b/tests/baselines/reference/indexerWithTuple.js
@@ -0,0 +1,32 @@
+//// [indexerWithTuple.ts]
+var strNumTuple: [string, number] = ["foo", 10];
+var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]];
+
+// no error
+var idx0 = 0;
+var idx1 = 1;
+var ele10 = strNumTuple[0]; // string
+var ele11 = strNumTuple[1]; // number
+var ele12 = strNumTuple[2]; // {}
+var ele13 = strNumTuple[idx0]; // {}
+var ele14 = strNumTuple[idx1]; // {}
+var ele15 = strNumTuple["0"]; // string
+var ele16 = strNumTuple["1"]; // number
+var strNumTuple1 = numTupleTuple[1]; //[string, number];
+var ele17 = numTupleTuple[2]; // {}
+
+//// [indexerWithTuple.js]
+var strNumTuple = ["foo", 10];
+var numTupleTuple = [10, ["bar", 20]];
+// no error
+var idx0 = 0;
+var idx1 = 1;
+var ele10 = strNumTuple[0]; // string
+var ele11 = strNumTuple[1]; // number
+var ele12 = strNumTuple[2]; // {}
+var ele13 = strNumTuple[idx0]; // {}
+var ele14 = strNumTuple[idx1]; // {}
+var ele15 = strNumTuple["0"]; // string
+var ele16 = strNumTuple["1"]; // number
+var strNumTuple1 = numTupleTuple[1]; //[string, number];
+var ele17 = numTupleTuple[2]; // {}
diff --git a/tests/baselines/reference/indexerWithTuple.types b/tests/baselines/reference/indexerWithTuple.types
new file mode 100644
index 00000000000..7c22cac407f
--- /dev/null
+++ b/tests/baselines/reference/indexerWithTuple.types
@@ -0,0 +1,64 @@
+=== tests/cases/conformance/types/tuple/indexerWithTuple.ts ===
+var strNumTuple: [string, number] = ["foo", 10];
+>strNumTuple : [string, number]
+>["foo", 10] : [string, number]
+
+var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]];
+>numTupleTuple : [number, [string, number]]
+>[10, ["bar", 20]] : [number, [string, number]]
+>["bar", 20] : [string, number]
+
+// no error
+var idx0 = 0;
+>idx0 : number
+
+var idx1 = 1;
+>idx1 : number
+
+var ele10 = strNumTuple[0]; // string
+>ele10 : string
+>strNumTuple[0] : string
+>strNumTuple : [string, number]
+
+var ele11 = strNumTuple[1]; // number
+>ele11 : number
+>strNumTuple[1] : number
+>strNumTuple : [string, number]
+
+var ele12 = strNumTuple[2]; // {}
+>ele12 : {}
+>strNumTuple[2] : {}
+>strNumTuple : [string, number]
+
+var ele13 = strNumTuple[idx0]; // {}
+>ele13 : {}
+>strNumTuple[idx0] : {}
+>strNumTuple : [string, number]
+>idx0 : number
+
+var ele14 = strNumTuple[idx1]; // {}
+>ele14 : {}
+>strNumTuple[idx1] : {}
+>strNumTuple : [string, number]
+>idx1 : number
+
+var ele15 = strNumTuple["0"]; // string
+>ele15 : string
+>strNumTuple["0"] : string
+>strNumTuple : [string, number]
+
+var ele16 = strNumTuple["1"]; // number
+>ele16 : number
+>strNumTuple["1"] : number
+>strNumTuple : [string, number]
+
+var strNumTuple1 = numTupleTuple[1]; //[string, number];
+>strNumTuple1 : [string, number]
+>numTupleTuple[1] : [string, number]
+>numTupleTuple : [number, [string, number]]
+
+var ele17 = numTupleTuple[2]; // {}
+>ele17 : {}
+>numTupleTuple[2] : {}
+>numTupleTuple : [number, [string, number]]
+
diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt
index a9654fabdcf..3d7fcb86784 100644
--- a/tests/baselines/reference/interfaceDeclaration1.errors.txt
+++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt
@@ -1,4 +1,6 @@
+tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate identifier 'item'.
tests/cases/compiler/interfaceDeclaration1.ts(3,5): error TS2300: Duplicate identifier 'item'.
+tests/cases/compiler/interfaceDeclaration1.ts(7,5): error TS2300: Duplicate identifier 'item'.
tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2300: Duplicate identifier 'item'.
tests/cases/compiler/interfaceDeclaration1.ts(22,11): error TS2310: Type 'I5' recursively references itself as a base type.
tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2421: Class 'C1' incorrectly implements interface 'I3':
@@ -8,9 +10,11 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i
Named properties 'foo' of types 'i10' and 'i11' are not identical.
-==== tests/cases/compiler/interfaceDeclaration1.ts (6 errors) ====
+==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ====
interface I1 {
item:number;
+ ~~~~
+!!! error TS2300: Duplicate identifier 'item'.
item:number;
~~~~
!!! error TS2300: Duplicate identifier 'item'.
@@ -18,6 +22,8 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i
interface I2 {
item:any;
+ ~~~~
+!!! error TS2300: Duplicate identifier 'item'.
item:number;
~~~~
!!! error TS2300: Duplicate identifier 'item'.
diff --git a/tests/baselines/reference/interfaceDeclaration2.errors.txt b/tests/baselines/reference/interfaceDeclaration2.errors.txt
index 8ef5e1a40d7..9739d946bc5 100644
--- a/tests/baselines/reference/interfaceDeclaration2.errors.txt
+++ b/tests/baselines/reference/interfaceDeclaration2.errors.txt
@@ -1,11 +1,14 @@
+tests/cases/compiler/interfaceDeclaration2.ts(4,11): error TS2300: Duplicate identifier 'I2'.
tests/cases/compiler/interfaceDeclaration2.ts(5,7): error TS2300: Duplicate identifier 'I2'.
-==== tests/cases/compiler/interfaceDeclaration2.ts (1 errors) ====
+==== tests/cases/compiler/interfaceDeclaration2.ts (2 errors) ====
interface I1 { }
module I1 { }
interface I2 { }
+ ~~
+!!! error TS2300: Duplicate identifier 'I2'.
class I2 { }
~~
!!! error TS2300: Duplicate identifier 'I2'.
diff --git a/tests/baselines/reference/invalidInstantiatedModule.errors.txt b/tests/baselines/reference/invalidInstantiatedModule.errors.txt
index e6cb5491407..5a8ac069803 100644
--- a/tests/baselines/reference/invalidInstantiatedModule.errors.txt
+++ b/tests/baselines/reference/invalidInstantiatedModule.errors.txt
@@ -1,10 +1,13 @@
+tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2304: Cannot find name 'm'.
-==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (2 errors) ====
+==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (3 errors) ====
module M {
export class Point { x: number; y: number }
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
export var Point = 1; // Error
~~~~~
!!! error TS2300: Duplicate identifier 'Point'.
diff --git a/tests/baselines/reference/invalidNestedModules.errors.txt b/tests/baselines/reference/invalidNestedModules.errors.txt
index 1d7e2641ff4..972c177fc0e 100644
--- a/tests/baselines/reference/invalidNestedModules.errors.txt
+++ b/tests/baselines/reference/invalidNestedModules.errors.txt
@@ -1,8 +1,9 @@
tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(1,12): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
+tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(17,18): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'.
-==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (2 errors) ====
+==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (3 errors) ====
module A.B.C {
~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
@@ -22,6 +23,8 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.
module M2.X {
export class Point {
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
x: number; y: number;
}
}
diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt
index 1bc749ba399..39e5cfaa834 100644
--- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt
+++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt
@@ -1,13 +1,15 @@
+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(12,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
Types of property 'thunk' are incompatible:
Type '(num: number) => void' is not assignable to type '(str: string) => void':
Types of parameters 'num' and 'str' are incompatible:
Type 'number' is not assignable to type 'string'.
+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 (3 errors) ====
+==== tests/cases/compiler/lastPropertyInLiteralWins.ts (5 errors) ====
interface Thing {
thunk: (str: string) => void;
}
@@ -16,6 +18,8 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate
}
test({ // Should error, as last one wins, and is wrong type
thunk: (str: string) => {},
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'thunk'.
thunk: (num: number) => {}
~~~~~
!!! error TS2300: Duplicate identifier 'thunk'.
@@ -25,6 +29,8 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunk: (num: number) => {},
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'thunk'.
thunk: (str: string) => {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
diff --git a/tests/baselines/reference/memberOverride.errors.txt b/tests/baselines/reference/memberOverride.errors.txt
index 5cc005b7339..c63803f5aa1 100644
--- a/tests/baselines/reference/memberOverride.errors.txt
+++ b/tests/baselines/reference/memberOverride.errors.txt
@@ -1,12 +1,15 @@
+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(8,5): error TS2323: Type 'string' is not assignable to type 'number'.
-==== tests/cases/compiler/memberOverride.ts (2 errors) ====
+==== tests/cases/compiler/memberOverride.ts (3 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 28aa8fa4be8..0b5984dcc6d 100644
--- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt
+++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt
@@ -1,11 +1,16 @@
+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 (3 errors) ====
+==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (6 errors) ====
interface A {
x: string; // error
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
interface A {
@@ -17,6 +22,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
module M {
interface A {
x: T;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
interface A {
@@ -41,6 +48,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
module M3 {
export interface A {
x: T;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
}
diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt
index 74b6c39b1f7..d0a50f4ae69 100644
--- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt
+++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames2.errors.txt
@@ -1,11 +1,16 @@
+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 (3 errors) ====
+==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames2.ts (6 errors) ====
interface A {
x: string; // error
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
interface A {
@@ -17,6 +22,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
module M {
interface A {
x: T;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
interface A {
@@ -41,6 +48,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
module M3 {
export interface A {
x: T;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
}
}
diff --git a/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt b/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt
index e294d8fbc72..8c81f7e34c8 100644
--- a/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt
+++ b/tests/baselines/reference/mismatchedClassConstructorVariable.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/mismatchedClassConstructorVariable.ts(1,5): error TS2300: Duplicate identifier 'baz'.
tests/cases/compiler/mismatchedClassConstructorVariable.ts(2,7): error TS2300: Duplicate identifier 'baz'.
-==== tests/cases/compiler/mismatchedClassConstructorVariable.ts (1 errors) ====
+==== tests/cases/compiler/mismatchedClassConstructorVariable.ts (2 errors) ====
var baz: foo;
+ ~~~
+!!! error TS2300: Duplicate identifier 'baz'.
class baz { }
~~~
!!! error TS2300: Duplicate identifier 'baz'.
diff --git a/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt b/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt
index 6174a6a95db..564da071648 100644
--- a/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt
+++ b/tests/baselines/reference/module_augmentExistingAmbientVariable.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/module_augmentExistingAmbientVariable.ts(1,13): error TS2300: Duplicate identifier 'console'.
tests/cases/compiler/module_augmentExistingAmbientVariable.ts(3,8): error TS2300: Duplicate identifier 'console'.
-==== tests/cases/compiler/module_augmentExistingAmbientVariable.ts (1 errors) ====
+==== tests/cases/compiler/module_augmentExistingAmbientVariable.ts (2 errors) ====
declare var console: any;
+ ~~~~~~~
+!!! error TS2300: Duplicate identifier 'console'.
module console {
~~~~~~~
diff --git a/tests/baselines/reference/module_augmentExistingVariable.errors.txt b/tests/baselines/reference/module_augmentExistingVariable.errors.txt
index a829d094819..f1d17894077 100644
--- a/tests/baselines/reference/module_augmentExistingVariable.errors.txt
+++ b/tests/baselines/reference/module_augmentExistingVariable.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/module_augmentExistingVariable.ts(1,5): error TS2300: Duplicate identifier 'console'.
tests/cases/compiler/module_augmentExistingVariable.ts(3,8): error TS2300: Duplicate identifier 'console'.
-==== tests/cases/compiler/module_augmentExistingVariable.ts (1 errors) ====
+==== tests/cases/compiler/module_augmentExistingVariable.ts (2 errors) ====
var console: any;
+ ~~~~~~~
+!!! error TS2300: Duplicate identifier 'console'.
module console {
~~~~~~~
diff --git a/tests/baselines/reference/nameCollisions.errors.txt b/tests/baselines/reference/nameCollisions.errors.txt
index b587d842c6f..baa7c6cbfd5 100644
--- a/tests/baselines/reference/nameCollisions.errors.txt
+++ b/tests/baselines/reference/nameCollisions.errors.txt
@@ -1,17 +1,27 @@
+tests/cases/compiler/nameCollisions.ts(2,9): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/nameCollisions.ts(4,12): error TS2300: Duplicate identifier 'x'.
+tests/cases/compiler/nameCollisions.ts(10,12): error TS2300: Duplicate identifier 'z'.
tests/cases/compiler/nameCollisions.ts(13,9): error TS2300: Duplicate identifier 'z'.
tests/cases/compiler/nameCollisions.ts(15,12): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
+tests/cases/compiler/nameCollisions.ts(24,9): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/nameCollisions.ts(25,14): error TS2300: Duplicate identifier 'f'.
+tests/cases/compiler/nameCollisions.ts(27,14): error TS2300: Duplicate identifier 'f2'.
tests/cases/compiler/nameCollisions.ts(28,9): error TS2300: Duplicate identifier 'f2'.
+tests/cases/compiler/nameCollisions.ts(33,11): error TS2300: Duplicate identifier 'C'.
tests/cases/compiler/nameCollisions.ts(34,14): error TS2300: Duplicate identifier 'C'.
+tests/cases/compiler/nameCollisions.ts(36,14): error TS2300: Duplicate identifier 'C2'.
tests/cases/compiler/nameCollisions.ts(37,11): error TS2300: Duplicate identifier 'C2'.
+tests/cases/compiler/nameCollisions.ts(42,11): error TS2300: Duplicate identifier 'cli'.
tests/cases/compiler/nameCollisions.ts(43,15): error TS2300: Duplicate identifier 'cli'.
+tests/cases/compiler/nameCollisions.ts(45,15): error TS2300: Duplicate identifier 'cli2'.
tests/cases/compiler/nameCollisions.ts(46,11): error TS2300: Duplicate identifier 'cli2'.
-==== tests/cases/compiler/nameCollisions.ts (9 errors) ====
+==== tests/cases/compiler/nameCollisions.ts (17 errors) ====
module T {
var x = 2;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
module x { // error
~
@@ -22,6 +32,8 @@ tests/cases/compiler/nameCollisions.ts(46,11): error TS2300: Duplicate identifie
}
module z {
+ ~
+!!! error TS2300: Duplicate identifier 'z'.
var t;
}
var z; // error
@@ -40,11 +52,15 @@ tests/cases/compiler/nameCollisions.ts(46,11): error TS2300: Duplicate identifie
module w { } //ok
var f;
+ ~
+!!! error TS2300: Duplicate identifier 'f'.
function f() { } //error
~
!!! error TS2300: Duplicate identifier 'f'.
function f2() { }
+ ~~
+!!! error TS2300: Duplicate identifier 'f2'.
var f2; // error
~~
!!! error TS2300: Duplicate identifier 'f2'.
@@ -53,11 +69,15 @@ tests/cases/compiler/nameCollisions.ts(46,11): error TS2300: Duplicate identifie
interface i { } //ok
class C { }
+ ~
+!!! error TS2300: Duplicate identifier 'C'.
function C() { } // error
~
!!! error TS2300: Duplicate identifier 'C'.
function C2() { }
+ ~~
+!!! error TS2300: Duplicate identifier 'C2'.
class C2 { } // error
~~
!!! error TS2300: Duplicate identifier 'C2'.
@@ -66,11 +86,15 @@ tests/cases/compiler/nameCollisions.ts(46,11): error TS2300: Duplicate identifie
interface fi { } // ok
class cli { }
+ ~~~
+!!! error TS2300: Duplicate identifier 'cli'.
interface cli { } // error
~~~
!!! error TS2300: Duplicate identifier 'cli'.
interface cli2 { }
+ ~~~~
+!!! error TS2300: Duplicate identifier 'cli2'.
class cli2 { } // error
~~~~
!!! error TS2300: Duplicate identifier 'cli2'.
diff --git a/tests/baselines/reference/numericClassMembers1.errors.txt b/tests/baselines/reference/numericClassMembers1.errors.txt
index 28c06a6fcf5..eb99f26bb4c 100644
--- a/tests/baselines/reference/numericClassMembers1.errors.txt
+++ b/tests/baselines/reference/numericClassMembers1.errors.txt
@@ -1,10 +1,14 @@
+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 (2 errors) ====
+==== tests/cases/compiler/numericClassMembers1.ts (4 errors) ====
class C234 {
0 = 1;
+ ~
+!!! error TS2300: Duplicate identifier '0'.
0.0 = 2;
~~~
!!! error TS2300: Duplicate identifier '0.0'.
@@ -12,6 +16,8 @@ tests/cases/compiler/numericClassMembers1.ts(8,2): error TS2300: Duplicate ident
class C235 {
0.0 = 1;
+ ~~~
+!!! error TS2300: Duplicate identifier '0.0'.
'0' = 2;
~~~
!!! error TS2300: Duplicate identifier ''0''.
diff --git a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt
index d3192f8e3c5..c5890d7c98c 100644
--- a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt
+++ b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt
@@ -1,18 +1,27 @@
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected.
+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(5,12): error TS2300: Duplicate identifier '2'.
+tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(9,5): error TS2300: Duplicate identifier '2'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(10,5): error TS2300: Duplicate identifier '2.'.
+tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(14,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(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 TS2300: Duplicate identifier '2'.
-==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts (6 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts (11 errors) ====
class C {
1: number;
+ ~
+!!! error TS2300: Duplicate identifier '1'.
1.0: number;
~~~
!!! error TS2300: Duplicate identifier '1.0'.
static 2: number;
+ ~
+!!! error TS2300: Duplicate identifier '2'.
static 2: number;
~
!!! error TS2300: Duplicate identifier '2'.
@@ -20,6 +29,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP
interface I {
2: number;
+ ~
+!!! error TS2300: Duplicate identifier '2'.
2.: number;
~~
!!! error TS2300: Duplicate identifier '2.'.
@@ -27,6 +38,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP
var a: {
1: number;
+ ~
+!!! error TS2300: Duplicate identifier '1'.
1: number;
~
!!! error TS2300: Duplicate identifier '1'.
@@ -34,6 +47,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP
var b = {
2: 1
+ ~
+!!! error TS2300: Duplicate identifier '2'.
2: 1
~
!!! error TS1005: ',' expected.
diff --git a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt
index 9ce36b4937c..4ebef99bd07 100644
--- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt
+++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt
@@ -1,14 +1,20 @@
+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(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(22,5): error TS2300: Duplicate identifier '0'.
-==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (4 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (8 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;
~~~
@@ -17,6 +23,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString
interface I {
"1": number;
+ ~~~
+!!! error TS2300: Duplicate identifier '"1"'.
"1.": number; // not a duplicate
1: number;
~
@@ -25,6 +33,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString
var a: {
"1": number;
+ ~~~
+!!! error TS2300: Duplicate identifier '"1"'.
1.0: string;
~~~
!!! error TS2300: Duplicate identifier '1.0'.
@@ -32,6 +42,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString
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 367043a53ef..1fc92ac5a48 100644
--- a/tests/baselines/reference/objectLiteralErrors.errors.txt
+++ b/tests/baselines/reference/objectLiteralErrors.errors.txt
@@ -18,41 +18,77 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23)
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name.
+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 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 TS2300: Duplicate identifier 'a'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS2300: Duplicate identifier 'a'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS2300: Duplicate identifier 'a'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS2300: Duplicate identifier 'a'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS2300: Duplicate identifier 'a'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS2300: Duplicate identifier ''a''.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,12): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS2300: Duplicate identifier 'a'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,12): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS2300: Duplicate identifier '"a"'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,12): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS2300: Duplicate identifier ''a''.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,13): error TS2300: Duplicate identifier '"a"'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS2300: Duplicate identifier ''a''.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,13): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS2300: Duplicate identifier ''1''.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS2300: Duplicate identifier '0'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS2300: Duplicate identifier '0'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS2300: Duplicate identifier '0x0'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS2300: Duplicate identifier '000'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,13): error TS2300: Duplicate identifier '"100"'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS2300: Duplicate identifier '1e2'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier '0x20'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS2300: Duplicate identifier '3.2e1'.
+tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,13): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,12): error TS2380: 'get' and 'set' accessor must have the same type.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,43): error TS2380: 'get' and 'set' accessor must have the same type.
@@ -61,63 +97,99 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,12)
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51): error TS2380: 'get' and 'set' accessor must have the same type.
-==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (61 errors) ====
+==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (97 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 TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier '0'.
~~~
!!! 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'.
@@ -125,71 +197,99 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51)
var f1 = { a: 0, get a() { return 0; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
var f2 = { a: '', get a() { return ''; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
var f3 = { a: 0, get a() { return ''; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
var f4 = { a: true, get a() { return false; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
var f5 = { a: {}, get a() { return {}; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
var f6 = { a: 0, get 'a'() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~~~
!!! error TS2300: Duplicate identifier ''a''.
var f7 = { 'a': 0, get a() { return 0; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~
+!!! error TS2300: Duplicate identifier ''a''.
~
!!! error TS2300: Duplicate identifier 'a'.
var f8 = { 'a': 0, get "a"() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~
+!!! error TS2300: Duplicate identifier ''a''.
~~~
!!! error TS2300: Duplicate identifier '"a"'.
var f9 = { 'a': 0, get 'a'() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~
+!!! error TS2300: Duplicate identifier ''a''.
~~~
!!! error TS2300: Duplicate identifier ''a''.
var f10 = { "a": 0, get 'a'() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~
+!!! error TS2300: Duplicate identifier '"a"'.
~~~
!!! error TS2300: Duplicate identifier ''a''.
var f11 = { 1.0: 0, get '1'() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~
+!!! error TS2300: Duplicate identifier '1.0'.
~~~
!!! error TS2300: Duplicate identifier ''1''.
var f12 = { 0: 0, get 0() { return 0; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier '0'.
~
!!! error TS2300: Duplicate identifier '0'.
var f13 = { 0: 0, get 0() { return 0; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier '0'.
~
!!! error TS2300: Duplicate identifier '0'.
var f14 = { 0: 0, get 0x0() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier '0'.
~~~
!!! error TS2300: Duplicate identifier '0x0'.
var f14 = { 0: 0, get 000() { return 0; } };
@@ -197,21 +297,29 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51)
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier '0'.
~~~
!!! error TS2300: Duplicate identifier '000'.
var f15 = { "100": 0, get 1e2() { return 0; } };
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~~~
+!!! error TS2300: Duplicate identifier '"100"'.
~~~
!!! error TS2300: Duplicate identifier '1e2'.
var f16 = { 0x20: 0, get 3.2e1() { return 0; } };
~~~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~~~~
+!!! error TS2300: Duplicate identifier '0x20'.
~~~~~
!!! error TS2300: Duplicate identifier '3.2e1'.
var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } };
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
diff --git a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt
index 122304d1497..c89cd04d1ee 100644
--- a/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt
+++ b/tests/baselines/reference/objectTypeWithDuplicateNumericProperty.errors.txt
@@ -1,23 +1,29 @@
+tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(5,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(6,5): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(7,5): error TS2300: Duplicate identifier '1.'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(8,5): error TS2300: Duplicate identifier '1.00'.
+tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(12,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(13,5): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(14,5): error TS2300: Duplicate identifier '1.'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(15,5): error TS2300: Duplicate identifier '1.00'.
+tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(19,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(20,5): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(21,5): error TS2300: Duplicate identifier '1.'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(22,5): error TS2300: Duplicate identifier '1.00'.
+tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(26,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(27,5): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(28,5): error TS2300: Duplicate identifier '1.'.
tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(29,5): error TS2300: Duplicate identifier '1.00'.
-==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (12 errors) ====
+==== tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts (16 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'.
@@ -31,6 +37,8 @@ tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(
interface I {
1;
+ ~
+!!! error TS2300: Duplicate identifier '1'.
1.0;
~~~
!!! error TS2300: Duplicate identifier '1.0'.
@@ -44,6 +52,8 @@ tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(
var a: {
1;
+ ~
+!!! error TS2300: Duplicate identifier '1'.
1.0;
~~~
!!! error TS2300: Duplicate identifier '1.0'.
@@ -57,6 +67,8 @@ tests/cases/conformance/types/members/objectTypeWithDuplicateNumericProperty.ts(
var b = {
1: 1,
+ ~
+!!! error TS2300: Duplicate identifier '1'.
1.0: 1,
~~~
!!! error TS2300: Duplicate identifier '1.0'.
diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt
index ed46bfd3344..a8ce88e494e 100644
--- a/tests/baselines/reference/optionalParamArgsTest.errors.txt
+++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt
@@ -1,5 +1,6 @@
tests/cases/compiler/optionalParamArgsTest.ts(35,47): error TS1016: A required parameter cannot follow an optional parameter.
-tests/cases/compiler/optionalParamArgsTest.ts(35,5): error TS2393: Duplicate function implementation.
+tests/cases/compiler/optionalParamArgsTest.ts(31,12): error TS2393: Duplicate function implementation.
+tests/cases/compiler/optionalParamArgsTest.ts(35,12): error TS2393: Duplicate function implementation.
tests/cases/compiler/optionalParamArgsTest.ts(99,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/optionalParamArgsTest.ts(100,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/optionalParamArgsTest.ts(101,1): error TS2346: Supplied parameters do not match any signature of call target.
@@ -22,7 +23,7 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2346: Supplied par
tests/cases/compiler/optionalParamArgsTest.ts(118,1): error TS2346: Supplied parameters do not match any signature of call target.
-==== tests/cases/compiler/optionalParamArgsTest.ts (22 errors) ====
+==== tests/cases/compiler/optionalParamArgsTest.ts (23 errors) ====
// Optional parameter and default argument tests
// Key:
@@ -54,13 +55,15 @@ tests/cases/compiler/optionalParamArgsTest.ts(118,1): error TS2346: Supplied par
public C1M4(C1M4A1:number,C1M4A2?:number) { return C1M4A1 + C1M4A2; }
public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3?:number) { return C1M5A1 + C1M5A2; }
+ ~~~~
+!!! error TS2393: Duplicate function implementation.
// Negative test
// "Optional parameters may only be followed by other optional parameters"
public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3:number) { return C1M5A1 + C1M5A2; }
~~~~~~
!!! error TS1016: A required parameter cannot follow an optional parameter.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~~~~
!!! error TS2393: Duplicate function implementation.
}
diff --git a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt
index 1d081bb64a9..66c1cae2a7e 100644
--- a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt
+++ b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt
@@ -8,13 +8,14 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(32,19): error TS1131: Property
tests/cases/compiler/optionalPropertiesSyntax.ts(33,5): error TS1131: Property or signature expected.
tests/cases/compiler/optionalPropertiesSyntax.ts(34,6): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/optionalPropertiesSyntax.ts(4,5): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/optionalPropertiesSyntax.ts(24,5): error TS2300: Duplicate identifier 'prop'.
tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2300: Duplicate identifier 'prop'.
tests/cases/compiler/optionalPropertiesSyntax.ts(32,5): error TS2375: Duplicate number index signature.
tests/cases/compiler/optionalPropertiesSyntax.ts(33,7): error TS2375: Duplicate number index signature.
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 (15 errors) ====
interface fnSigs {
//functions signatures can be optional
fn(): void;
@@ -51,6 +52,8 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate
interface propertySig {
//Property signatures can be optional
prop: any;
+ ~~~~
+!!! error TS2300: Duplicate identifier 'prop'.
prop?: any;
~~~~
!!! error TS2300: Duplicate identifier 'prop'.
diff --git a/tests/baselines/reference/overloadsWithinClasses.errors.txt b/tests/baselines/reference/overloadsWithinClasses.errors.txt
index 1055290316c..02872861a4b 100644
--- a/tests/baselines/reference/overloadsWithinClasses.errors.txt
+++ b/tests/baselines/reference/overloadsWithinClasses.errors.txt
@@ -1,13 +1,16 @@
-tests/cases/compiler/overloadsWithinClasses.ts(5,5): error TS2393: Duplicate function implementation.
+tests/cases/compiler/overloadsWithinClasses.ts(3,12): error TS2393: Duplicate function implementation.
+tests/cases/compiler/overloadsWithinClasses.ts(5,12): error TS2393: Duplicate function implementation.
-==== tests/cases/compiler/overloadsWithinClasses.ts (1 errors) ====
+==== tests/cases/compiler/overloadsWithinClasses.ts (2 errors) ====
class foo {
static fnOverload( ) {}
+ ~~~~~~~~~~
+!!! error TS2393: Duplicate function implementation.
static fnOverload(foo: string){ } // error
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~
!!! error TS2393: Duplicate function implementation.
}
diff --git a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt
index d1a0513c1f6..5885385a20c 100644
--- a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt
+++ b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt
@@ -1,9 +1,10 @@
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 (3 errors) ====
+==== tests/cases/compiler/parameterPropertyInConstructor2.ts (4 errors) ====
module mod {
class Customers {
constructor(public names: string);
@@ -11,6 +12,8 @@ tests/cases/compiler/parameterPropertyInConstructor2.ts(4,24): error TS2300: Dup
!!! error TS2394: Overload signature is not compatible with function implementation.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'names'.
constructor(public names: string, public ages: number) {
~~~~~
!!! error TS2300: Duplicate identifier 'names'.
diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt
index e1b19738922..cfd6161a48e 100644
--- a/tests/baselines/reference/parser0_004152.errors.txt
+++ b/tests/baselines/reference/parser0_004152.errors.txt
@@ -19,10 +19,12 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,94): error T
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,98): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
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,48): error TS2300: Duplicate identifier '3'.
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,54): error TS2300: Duplicate identifier '3'.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,57): error TS2300: Duplicate identifier '3'.
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,63): error TS2300: Duplicate identifier '0'.
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,69): error TS2300: Duplicate identifier '3'.
tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,72): error TS2300: Duplicate identifier '3'.
@@ -34,7 +36,7 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,96): 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 (36 errors) ====
export class Game {
~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
@@ -79,6 +81,8 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'DisplayPosition'.
+ ~
+!!! error TS2300: Duplicate identifier '3'.
~
!!! error TS2300: Duplicate identifier '3'.
~
@@ -87,6 +91,8 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T
!!! error TS2300: Duplicate identifier '3'.
~
!!! error TS2300: Duplicate identifier '3'.
+ ~
+!!! error TS2300: Duplicate identifier '0'.
~
!!! error TS2300: Duplicate identifier '3'.
~
diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt
index 9a5039cc65c..7fe14c2be3b 100644
--- a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt
+++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt
@@ -1,10 +1,7 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction1.ts(1,10): error TS1003: Identifier expected.
-tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction1.ts(1,9): error TS2391: Function implementation is missing or not immediately following the declaration.
-==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction1.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction1.ts (1 errors) ====
function =>
~~
-!!! error TS1003: Identifier expected.
-
-!!! error TS2391: Function implementation is missing or not immediately following the declaration.
\ No newline at end of file
+!!! error TS1003: Identifier expected.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt
index 7705db0912e..cf56870d14d 100644
--- a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt
+++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt
@@ -2,10 +2,9 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThan
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts(1,13): error TS1005: ',' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts(1,17): error TS1005: ',' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts(1,18): error TS1005: ')' expected.
-tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts(1,9): error TS2391: Function implementation is missing or not immediately following the declaration.
-==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (5 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (4 errors) ====
function (a => b;
~
!!! error TS1003: Identifier expected.
@@ -14,6 +13,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThan
~
!!! error TS1005: ',' expected.
-!!! error TS1005: ')' expected.
-
-!!! error TS2391: Function implementation is missing or not immediately following the declaration.
\ No newline at end of file
+!!! error TS1005: ')' expected.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserErrorRecovery_ModuleElement2.errors.txt b/tests/baselines/reference/parserErrorRecovery_ModuleElement2.errors.txt
index 23f8d8bc166..eb4d6dc3471 100644
--- a/tests/baselines/reference/parserErrorRecovery_ModuleElement2.errors.txt
+++ b/tests/baselines/reference/parserErrorRecovery_ModuleElement2.errors.txt
@@ -1,17 +1,19 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts(7,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts(8,1): error TS1128: Declaration or statement expected.
-tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts(4,1): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts(1,10): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts(4,10): error TS2393: Duplicate function implementation.
-==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts (3 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ModuleElements/parserErrorRecovery_ModuleElement2.ts (4 errors) ====
function foo() {
+ ~~~
+!!! error TS2393: Duplicate function implementation.
}
function foo() {
- ~~~~~~~~~~~~~~~~
- }
- ~
+ ~~~
!!! error TS2393: Duplicate function implementation.
+ }
)
~
diff --git a/tests/baselines/reference/parserMemberFunctionDeclarationAmbiguities1.errors.txt b/tests/baselines/reference/parserMemberFunctionDeclarationAmbiguities1.errors.txt
index 1c239f59b22..e0d49bb8470 100644
--- a/tests/baselines/reference/parserMemberFunctionDeclarationAmbiguities1.errors.txt
+++ b/tests/baselines/reference/parserMemberFunctionDeclarationAmbiguities1.errors.txt
@@ -1,28 +1,40 @@
-tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(5,3): error TS2393: Duplicate function implementation.
-tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(6,3): error TS2393: Duplicate function implementation.
-tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(11,3): error TS2393: Duplicate function implementation.
-tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(12,3): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(2,3): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(3,3): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(5,10): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(6,10): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(8,17): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(9,17): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(11,10): error TS2393: Duplicate function implementation.
+tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts(12,10): error TS2393: Duplicate function implementation.
-==== tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts (4 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclarationAmbiguities1.ts (8 errors) ====
class C {
public() {}
+ ~~~~~~
+!!! error TS2393: Duplicate function implementation.
static() {}
+ ~~~~~~
+!!! error TS2393: Duplicate function implementation.
public public() {}
- ~~~~~~~~~~~~~~~~~~
+ ~~~~~~
!!! error TS2393: Duplicate function implementation.
public static() {}
- ~~~~~~~~~~~~~~~~~~
+ ~~~~~~
!!! error TS2393: Duplicate function implementation.
public static public() {}
+ ~~~~~~
+!!! error TS2393: Duplicate function implementation.
public static static() {}
+ ~~~~~~
+!!! error TS2393: Duplicate function implementation.
static public() {}
- ~~~~~~~~~~~~~~~~~~
+ ~~~~~~
!!! error TS2393: Duplicate function implementation.
static static() {}
- ~~~~~~~~~~~~~~~~~~
+ ~~~~~~
!!! error TS2393: Duplicate function implementation.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt
index 9bdeb723415..d5c992fff66 100644
--- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt
+++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt
@@ -1,9 +1,12 @@
+main.ts(1,1): error TS1006: A file cannot have a reference to itself.
main.ts(2,1): error TS6053: File 'nonExistingFile1.ts' not found.
main.ts(3,1): error TS6053: File 'nonExistingFile2.ts' not found.
-==== main.ts (2 errors) ====
+==== main.ts (3 errors) ====
///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1006: A file cannot have a reference to itself.
///
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6053: File 'nonExistingFile1.ts' not found.
diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt
index 9bdeb723415..d5c992fff66 100644
--- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt
+++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt
@@ -1,9 +1,12 @@
+main.ts(1,1): error TS1006: A file cannot have a reference to itself.
main.ts(2,1): error TS6053: File 'nonExistingFile1.ts' not found.
main.ts(3,1): error TS6053: File 'nonExistingFile2.ts' not found.
-==== main.ts (2 errors) ====
+==== main.ts (3 errors) ====
///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1006: A file cannot have a reference to itself.
///
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6053: File 'nonExistingFile1.ts' not found.
diff --git a/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt b/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt
index ece553abea8..9ef943cc07a 100644
--- a/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt
+++ b/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt
@@ -2,15 +2,20 @@ tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWi
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(3,9): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(9,5): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(10,9): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(14,13): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(15,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(18,9): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts (8 errors) ====
+==== tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts (11 errors) ====
class C {
x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
get x() { // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -22,6 +27,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWi
class D {
x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
set x(v) { } // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -31,6 +38,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWi
class E {
private x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
get x() { // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
diff --git a/tests/baselines/reference/propertyAndFunctionWithSameName.errors.txt b/tests/baselines/reference/propertyAndFunctionWithSameName.errors.txt
index a98382863a4..84428a2dfb1 100644
--- a/tests/baselines/reference/propertyAndFunctionWithSameName.errors.txt
+++ b/tests/baselines/reference/propertyAndFunctionWithSameName.errors.txt
@@ -1,10 +1,14 @@
+tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts(3,5): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts(9,5): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts(10,5): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts (2 errors) ====
+==== tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWithSameName.ts (4 errors) ====
class C {
x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
x() { // error
~
!!! error TS2300: Duplicate identifier 'x'.
@@ -14,6 +18,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndFunctionWi
class D {
x: number;
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
x(v) { } // error
~
!!! error TS2300: Duplicate identifier 'x'.
diff --git a/tests/baselines/reference/propertySignatures.errors.txt b/tests/baselines/reference/propertySignatures.errors.txt
index d5ab5678c00..fd415334e74 100644
--- a/tests/baselines/reference/propertySignatures.errors.txt
+++ b/tests/baselines/reference/propertySignatures.errors.txt
@@ -1,10 +1,13 @@
+tests/cases/compiler/propertySignatures.ts(2,13): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/propertySignatures.ts(2,23): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/propertySignatures.ts(14,12): error TS2304: Cannot find name 'foo'.
-==== tests/cases/compiler/propertySignatures.ts (2 errors) ====
+==== tests/cases/compiler/propertySignatures.ts (3 errors) ====
// Should be error - duplicate identifiers
var foo1: { a:string; a: string; };
+ ~
+!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS2300: Duplicate identifier 'a'.
diff --git a/tests/baselines/reference/reassignStaticProp.errors.txt b/tests/baselines/reference/reassignStaticProp.errors.txt
index eb373437609..bbcfe826787 100644
--- a/tests/baselines/reference/reassignStaticProp.errors.txt
+++ b/tests/baselines/reference/reassignStaticProp.errors.txt
@@ -1,10 +1,13 @@
+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 (1 errors) ====
+==== tests/cases/compiler/reassignStaticProp.ts (2 errors) ====
class foo {
static bar = 1;
+ ~~~
+!!! error TS2300: Duplicate identifier 'bar'.
static bar:string; // errror - duplicate id
~~~
diff --git a/tests/baselines/reference/selfReferencingFile.errors.txt b/tests/baselines/reference/selfReferencingFile.errors.txt
new file mode 100644
index 00000000000..727be1ea0b2
--- /dev/null
+++ b/tests/baselines/reference/selfReferencingFile.errors.txt
@@ -0,0 +1,11 @@
+tests/cases/compiler/selfReferencingFile.ts(1,1): error TS1006: A file cannot have a reference to itself.
+
+
+==== tests/cases/compiler/selfReferencingFile.ts (1 errors) ====
+ ///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1006: A file cannot have a reference to itself.
+
+ class selfReferencingFile {
+
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/selfReferencingFile2.errors.txt b/tests/baselines/reference/selfReferencingFile2.errors.txt
new file mode 100644
index 00000000000..5bd2d75723a
--- /dev/null
+++ b/tests/baselines/reference/selfReferencingFile2.errors.txt
@@ -0,0 +1,11 @@
+tests/cases/compiler/selfReferencingFile2.ts(1,1): error TS6053: File 'tests/cases/selfReferencingFile2.ts' not found.
+
+
+==== tests/cases/compiler/selfReferencingFile2.ts (1 errors) ====
+ ///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS6053: File 'selfReferencingFile2.ts' not found.
+
+ class selfReferencingFile2 {
+
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/selfReferencingFile3.errors.txt b/tests/baselines/reference/selfReferencingFile3.errors.txt
new file mode 100644
index 00000000000..e6e8deb5d47
--- /dev/null
+++ b/tests/baselines/reference/selfReferencingFile3.errors.txt
@@ -0,0 +1,11 @@
+tests/cases/compiler/selfReferencingFile3.ts(1,1): error TS1006: A file cannot have a reference to itself.
+
+
+==== tests/cases/compiler/selfReferencingFile3.ts (1 errors) ====
+ ///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1006: A file cannot have a reference to itself.
+
+ class selfReferencingFile3 {
+
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapValidationEnums.errors.txt b/tests/baselines/reference/sourceMapValidationEnums.errors.txt
index 4ecb81edeea..ae42f0b00b2 100644
--- a/tests/baselines/reference/sourceMapValidationEnums.errors.txt
+++ b/tests/baselines/reference/sourceMapValidationEnums.errors.txt
@@ -1,9 +1,12 @@
+tests/cases/compiler/sourceMapValidationEnums.ts(2,5): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/sourceMapValidationEnums.ts(4,5): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/compiler/sourceMapValidationEnums.ts (1 errors) ====
+==== tests/cases/compiler/sourceMapValidationEnums.ts (2 errors) ====
enum e {
x,
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
y,
x
~
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js
new file mode 100644
index 00000000000..37ef08d97fb
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js
@@ -0,0 +1,26 @@
+//// [tests/cases/compiler/sourceMapWithCaseSensitiveFileNames.ts] ////
+
+//// [app.ts]
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+class c {
+}
+
+//// [app2.ts]
+class d {
+}
+
+//// [fooResult.js]
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+var c = (function () {
+ function c() {
+ }
+ return c;
+})();
+var d = (function () {
+ function d() {
+ }
+ return d;
+})();
+//# sourceMappingURL=fooResult.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map
new file mode 100644
index 00000000000..384caae23ea
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map
@@ -0,0 +1,2 @@
+//// [fooResult.js.map]
+{"version":3,"file":"fooResult.js","sourceRoot":"","sources":["../testFiles/app.ts","../testFiles/app2.ts"],"names":["c","c.constructor","d","d.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,wIAAwI;IAClI,CAAC;IAAPA,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC;ACHD,IAAM,CAAC;IAAPE,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt
new file mode 100644
index 00000000000..b67d4e3be57
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt
@@ -0,0 +1,150 @@
+===================================================================
+JsFile: fooResult.js
+mapUrl: fooResult.js.map
+sourceRoot:
+sources: ../testFiles/app.ts,../testFiles/app2.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/fooResult.js
+sourceFile:../testFiles/app.ts
+-------------------------------------------------------------------
+>>>// Note in the out result we are using same folder name only different in casing
+1 >
+2 >
+3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >// Note in the out result we are using same folder name only different in casing
+ >// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+ >
+2 >
+3 >// Note in the out result we are using same folder name only different in casing
+1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
+2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0)
+---
+>>>// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+1->
+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1->
+ >
+2 >// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
+2 >Emitted(2, 137) Source(2, 137) + SourceIndex(0)
+---
+>>>var c = (function () {
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^^^^^^->
+1 >
+ >class
+2 > c
+1 >Emitted(3, 5) Source(3, 7) + SourceIndex(0)
+2 >Emitted(3, 6) Source(3, 8) + SourceIndex(0)
+---
+>>> function c() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > c
+1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c)
+2 >Emitted(4, 14) Source(3, 7) + SourceIndex(0) name (c)
+3 >Emitted(4, 15) Source(3, 8) + SourceIndex(0) name (c)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c.constructor)
+2 >Emitted(5, 6) Source(4, 2) + SourceIndex(0) name (c.constructor)
+---
+>>> return c;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(6, 5) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(6, 13) Source(4, 2) + SourceIndex(0) name (c)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class c {
+ > }
+1 >Emitted(7, 1) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(7, 2) Source(4, 2) + SourceIndex(0) name (c)
+3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0)
+4 >Emitted(7, 6) Source(4, 2) + SourceIndex(0)
+---
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/fooResult.js
+sourceFile:../testFiles/app2.ts
+-------------------------------------------------------------------
+>>>var d = (function () {
+1->
+2 >^^^^
+3 > ^
+4 > ^^^^^^^^^^^^^^->
+1->
+2 >class
+3 > d
+1->Emitted(8, 1) Source(1, 1) + SourceIndex(1)
+2 >Emitted(8, 5) Source(1, 7) + SourceIndex(1)
+3 >Emitted(8, 6) Source(1, 8) + SourceIndex(1)
+---
+>>> function d() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > d
+1->Emitted(9, 5) Source(1, 1) + SourceIndex(1) name (d)
+2 >Emitted(9, 14) Source(1, 7) + SourceIndex(1) name (d)
+3 >Emitted(9, 15) Source(1, 8) + SourceIndex(1) name (d)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(10, 5) Source(2, 1) + SourceIndex(1) name (d.constructor)
+2 >Emitted(10, 6) Source(2, 2) + SourceIndex(1) name (d.constructor)
+---
+>>> return d;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(11, 5) Source(2, 1) + SourceIndex(1) name (d)
+2 >Emitted(11, 13) Source(2, 2) + SourceIndex(1) name (d)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class d {
+ > }
+1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) name (d)
+2 >Emitted(12, 2) Source(2, 2) + SourceIndex(1) name (d)
+3 >Emitted(12, 2) Source(1, 1) + SourceIndex(1)
+4 >Emitted(12, 6) Source(2, 2) + SourceIndex(1)
+---
+>>>//# sourceMappingURL=fooResult.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.types b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.types
new file mode 100644
index 00000000000..2d42e0b5e4b
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/testFiles/app.ts ===
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+class c {
+>c : c
+}
+
+=== tests/cases/compiler/testFiles/app2.ts ===
+class d {
+>d : d
+}
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js
new file mode 100644
index 00000000000..148a66f15db
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js
@@ -0,0 +1,27 @@
+//// [tests/cases/compiler/sourceMapWithCaseSensitiveFileNamesAndOutDir.ts] ////
+
+//// [app.ts]
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+class c {
+}
+
+//// [app2.ts]
+class d {
+}
+
+//// [app.js]
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+var c = (function () {
+ function c() {
+ }
+ return c;
+})();
+//# sourceMappingURL=app.js.map//// [app2.js]
+var d = (function () {
+ function d() {
+ }
+ return d;
+})();
+//# sourceMappingURL=app2.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map
new file mode 100644
index 00000000000..e665c70c15b
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map
@@ -0,0 +1,3 @@
+//// [app.js.map]
+{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":["c","c.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,wIAAwI;IAClI,CAAC;IAAPA,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}//// [app2.js.map]
+{"version":3,"file":"app2.js","sourceRoot":"","sources":["../testFiles/app2.ts"],"names":["d","d.constructor"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt
new file mode 100644
index 00000000000..7d94304c359
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt
@@ -0,0 +1,156 @@
+===================================================================
+JsFile: app.js
+mapUrl: app.js.map
+sourceRoot:
+sources: ../testFiles/app.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/app.js
+sourceFile:../testFiles/app.ts
+-------------------------------------------------------------------
+>>>// Note in the out result we are using same folder name only different in casing
+1 >
+2 >
+3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >// Note in the out result we are using same folder name only different in casing
+ >// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+ >
+2 >
+3 >// Note in the out result we are using same folder name only different in casing
+1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
+2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0)
+---
+>>>// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+1->
+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1->
+ >
+2 >// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
+2 >Emitted(2, 137) Source(2, 137) + SourceIndex(0)
+---
+>>>var c = (function () {
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^^^^^^->
+1 >
+ >class
+2 > c
+1 >Emitted(3, 5) Source(3, 7) + SourceIndex(0)
+2 >Emitted(3, 6) Source(3, 8) + SourceIndex(0)
+---
+>>> function c() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > c
+1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c)
+2 >Emitted(4, 14) Source(3, 7) + SourceIndex(0) name (c)
+3 >Emitted(4, 15) Source(3, 8) + SourceIndex(0) name (c)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c.constructor)
+2 >Emitted(5, 6) Source(4, 2) + SourceIndex(0) name (c.constructor)
+---
+>>> return c;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(6, 5) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(6, 13) Source(4, 2) + SourceIndex(0) name (c)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class c {
+ > }
+1 >Emitted(7, 1) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(7, 2) Source(4, 2) + SourceIndex(0) name (c)
+3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0)
+4 >Emitted(7, 6) Source(4, 2) + SourceIndex(0)
+---
+>>>//# sourceMappingURL=app.js.map===================================================================
+JsFile: app2.js
+mapUrl: app2.js.map
+sourceRoot:
+sources: ../testFiles/app2.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/app2.js
+sourceFile:../testFiles/app2.ts
+-------------------------------------------------------------------
+>>>var d = (function () {
+1 >
+2 >^^^^
+3 > ^
+4 > ^^^^^^^^^^^^^^->
+1 >
+2 >class
+3 > d
+1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0)
+3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0)
+---
+>>> function d() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > d
+1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (d)
+2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (d)
+3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (d)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (d.constructor)
+2 >Emitted(3, 6) Source(2, 2) + SourceIndex(0) name (d.constructor)
+---
+>>> return d;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(4, 5) Source(2, 1) + SourceIndex(0) name (d)
+2 >Emitted(4, 13) Source(2, 2) + SourceIndex(0) name (d)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class d {
+ > }
+1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) name (d)
+2 >Emitted(5, 2) Source(2, 2) + SourceIndex(0) name (d)
+3 >Emitted(5, 2) Source(1, 1) + SourceIndex(0)
+4 >Emitted(5, 6) Source(2, 2) + SourceIndex(0)
+---
+>>>//# sourceMappingURL=app2.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.types b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.types
new file mode 100644
index 00000000000..2d42e0b5e4b
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/testFiles/app.ts ===
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+class c {
+>c : c
+}
+
+=== tests/cases/compiler/testFiles/app2.ts ===
+class d {
+>d : d
+}
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js
new file mode 100644
index 00000000000..50a3a2f3bc8
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js
@@ -0,0 +1,26 @@
+//// [tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNames.ts] ////
+
+//// [app.ts]
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+class c {
+}
+
+//// [app2.ts]
+class d {
+}
+
+//// [fooResult.js]
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+var c = (function () {
+ function c() {
+ }
+ return c;
+})();
+var d = (function () {
+ function d() {
+ }
+ return d;
+})();
+//# sourceMappingURL=fooResult.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map
new file mode 100644
index 00000000000..0a164a2a2c2
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map
@@ -0,0 +1,2 @@
+//// [fooResult.js.map]
+{"version":3,"file":"fooResult.js","sourceRoot":"","sources":["app.ts","app2.ts"],"names":["c","c.constructor","d","d.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,0GAA0G;IACpG,CAAC;IAAPA,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC;ACHD,IAAM,CAAC;IAAPE,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt
new file mode 100644
index 00000000000..1923426adc6
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt
@@ -0,0 +1,150 @@
+===================================================================
+JsFile: fooResult.js
+mapUrl: fooResult.js.map
+sourceRoot:
+sources: app.ts,app2.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/fooResult.js
+sourceFile:app.ts
+-------------------------------------------------------------------
+>>>// Note in the out result we are using same folder name only different in casing
+1 >
+2 >
+3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >// Note in the out result we are using same folder name only different in casing
+ >// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+ >
+2 >
+3 >// Note in the out result we are using same folder name only different in casing
+1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
+2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0)
+---
+>>>// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+1->
+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1->
+ >
+2 >// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
+2 >Emitted(2, 107) Source(2, 107) + SourceIndex(0)
+---
+>>>var c = (function () {
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^^^^^^->
+1 >
+ >class
+2 > c
+1 >Emitted(3, 5) Source(3, 7) + SourceIndex(0)
+2 >Emitted(3, 6) Source(3, 8) + SourceIndex(0)
+---
+>>> function c() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > c
+1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c)
+2 >Emitted(4, 14) Source(3, 7) + SourceIndex(0) name (c)
+3 >Emitted(4, 15) Source(3, 8) + SourceIndex(0) name (c)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c.constructor)
+2 >Emitted(5, 6) Source(4, 2) + SourceIndex(0) name (c.constructor)
+---
+>>> return c;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(6, 5) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(6, 13) Source(4, 2) + SourceIndex(0) name (c)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class c {
+ > }
+1 >Emitted(7, 1) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(7, 2) Source(4, 2) + SourceIndex(0) name (c)
+3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0)
+4 >Emitted(7, 6) Source(4, 2) + SourceIndex(0)
+---
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/fooResult.js
+sourceFile:app2.ts
+-------------------------------------------------------------------
+>>>var d = (function () {
+1->
+2 >^^^^
+3 > ^
+4 > ^^^^^^^^^^^^^^->
+1->
+2 >class
+3 > d
+1->Emitted(8, 1) Source(1, 1) + SourceIndex(1)
+2 >Emitted(8, 5) Source(1, 7) + SourceIndex(1)
+3 >Emitted(8, 6) Source(1, 8) + SourceIndex(1)
+---
+>>> function d() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > d
+1->Emitted(9, 5) Source(1, 1) + SourceIndex(1) name (d)
+2 >Emitted(9, 14) Source(1, 7) + SourceIndex(1) name (d)
+3 >Emitted(9, 15) Source(1, 8) + SourceIndex(1) name (d)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(10, 5) Source(2, 1) + SourceIndex(1) name (d.constructor)
+2 >Emitted(10, 6) Source(2, 2) + SourceIndex(1) name (d.constructor)
+---
+>>> return d;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(11, 5) Source(2, 1) + SourceIndex(1) name (d)
+2 >Emitted(11, 13) Source(2, 2) + SourceIndex(1) name (d)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class d {
+ > }
+1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) name (d)
+2 >Emitted(12, 2) Source(2, 2) + SourceIndex(1) name (d)
+3 >Emitted(12, 2) Source(1, 1) + SourceIndex(1)
+4 >Emitted(12, 6) Source(2, 2) + SourceIndex(1)
+---
+>>>//# sourceMappingURL=fooResult.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.types b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.types
new file mode 100644
index 00000000000..2dd1319e9dd
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/testFiles/app.ts ===
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+class c {
+>c : c
+}
+
+=== tests/cases/compiler/testFiles/app2.ts ===
+class d {
+>d : d
+}
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js
new file mode 100644
index 00000000000..4dc043e0ce7
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js
@@ -0,0 +1,27 @@
+//// [tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.ts] ////
+
+//// [app.ts]
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+class c {
+}
+
+//// [app2.ts]
+class d {
+}
+
+//// [app.js]
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+var c = (function () {
+ function c() {
+ }
+ return c;
+})();
+//# sourceMappingURL=app.js.map//// [app2.js]
+var d = (function () {
+ function d() {
+ }
+ return d;
+})();
+//# sourceMappingURL=app2.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map
new file mode 100644
index 00000000000..027c795967c
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map
@@ -0,0 +1,3 @@
+//// [app.js.map]
+{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":["c","c.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,0GAA0G;IACpG,CAAC;IAAPA,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}//// [app2.js.map]
+{"version":3,"file":"app2.js","sourceRoot":"","sources":["app2.ts"],"names":["d","d.constructor"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IACPC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt
new file mode 100644
index 00000000000..cfcd91a6552
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt
@@ -0,0 +1,156 @@
+===================================================================
+JsFile: app.js
+mapUrl: app.js.map
+sourceRoot:
+sources: app.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/app.js
+sourceFile:app.ts
+-------------------------------------------------------------------
+>>>// Note in the out result we are using same folder name only different in casing
+1 >
+2 >
+3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >// Note in the out result we are using same folder name only different in casing
+ >// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+ >
+2 >
+3 >// Note in the out result we are using same folder name only different in casing
+1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0)
+2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0)
+---
+>>>// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+1->
+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1->
+ >
+2 >// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
+2 >Emitted(2, 107) Source(2, 107) + SourceIndex(0)
+---
+>>>var c = (function () {
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^^^^^^->
+1 >
+ >class
+2 > c
+1 >Emitted(3, 5) Source(3, 7) + SourceIndex(0)
+2 >Emitted(3, 6) Source(3, 8) + SourceIndex(0)
+---
+>>> function c() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > c
+1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c)
+2 >Emitted(4, 14) Source(3, 7) + SourceIndex(0) name (c)
+3 >Emitted(4, 15) Source(3, 8) + SourceIndex(0) name (c)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(5, 5) Source(4, 1) + SourceIndex(0) name (c.constructor)
+2 >Emitted(5, 6) Source(4, 2) + SourceIndex(0) name (c.constructor)
+---
+>>> return c;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(6, 5) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(6, 13) Source(4, 2) + SourceIndex(0) name (c)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class c {
+ > }
+1 >Emitted(7, 1) Source(4, 1) + SourceIndex(0) name (c)
+2 >Emitted(7, 2) Source(4, 2) + SourceIndex(0) name (c)
+3 >Emitted(7, 2) Source(3, 1) + SourceIndex(0)
+4 >Emitted(7, 6) Source(4, 2) + SourceIndex(0)
+---
+>>>//# sourceMappingURL=app.js.map===================================================================
+JsFile: app2.js
+mapUrl: app2.js.map
+sourceRoot:
+sources: app2.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/compiler/testfiles/app2.js
+sourceFile:app2.ts
+-------------------------------------------------------------------
+>>>var d = (function () {
+1 >
+2 >^^^^
+3 > ^
+4 > ^^^^^^^^^^^^^^->
+1 >
+2 >class
+3 > d
+1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0)
+3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0)
+---
+>>> function d() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > d
+1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (d)
+2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (d)
+3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (d)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 > {
+ >
+2 > }
+1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (d.constructor)
+2 >Emitted(3, 6) Source(2, 2) + SourceIndex(0) name (d.constructor)
+---
+>>> return d;
+1->^^^^
+2 > ^^^^^^^^
+1->
+2 > }
+1->Emitted(4, 5) Source(2, 1) + SourceIndex(0) name (d)
+2 >Emitted(4, 13) Source(2, 2) + SourceIndex(0) name (d)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class d {
+ > }
+1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) name (d)
+2 >Emitted(5, 2) Source(2, 2) + SourceIndex(0) name (d)
+3 >Emitted(5, 2) Source(1, 1) + SourceIndex(0)
+4 >Emitted(5, 6) Source(2, 2) + SourceIndex(0)
+---
+>>>//# sourceMappingURL=app2.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.types b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.types
new file mode 100644
index 00000000000..2dd1319e9dd
--- /dev/null
+++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/testFiles/app.ts ===
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+class c {
+>c : c
+}
+
+=== tests/cases/compiler/testFiles/app2.ts ===
+class d {
+>d : d
+}
diff --git a/tests/baselines/reference/staticClassMemberError.errors.txt b/tests/baselines/reference/staticClassMemberError.errors.txt
index e0768b03967..9483e3387b7 100644
--- a/tests/baselines/reference/staticClassMemberError.errors.txt
+++ b/tests/baselines/reference/staticClassMemberError.errors.txt
@@ -1,9 +1,10 @@
tests/cases/compiler/staticClassMemberError.ts(4,3): error TS2304: Cannot find name 's'.
+tests/cases/compiler/staticClassMemberError.ts(9,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/staticClassMemberError.ts(9,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/staticClassMemberError.ts(10,7): error TS2300: Duplicate identifier 'Foo'.
-==== tests/cases/compiler/staticClassMemberError.ts (3 errors) ====
+==== tests/cases/compiler/staticClassMemberError.ts (4 errors) ====
class C {
static s;
public a() {
@@ -16,6 +17,8 @@ tests/cases/compiler/staticClassMemberError.ts(10,7): error TS2300: Duplicate id
// just want to make sure this one doesn't crash the compiler
function Foo();
~~~
+!!! error TS2300: Duplicate identifier 'Foo'.
+ ~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
class Foo {
~~~
diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt
index ed30960896e..cbc517e0520 100644
--- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt
+++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt
@@ -8,11 +8,12 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(20,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(21,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(22,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2381: A signature with an implementation cannot use a string literal type.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2300: Duplicate identifier 'foo'.
-==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (12 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (13 errors) ====
// String literal types are only valid in overload signatures
function foo(x: any);
@@ -59,6 +60,8 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType
var b = {
foo(x: 'hi') { },
+ ~~~
+!!! error TS2300: Duplicate identifier 'foo'.
~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
foo(x: 'a') { },
diff --git a/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt b/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt
index 8e8af394d39..e15cb03e062 100644
--- a/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt
+++ b/tests/baselines/reference/stringNamedPropertyDuplicates.errors.txt
@@ -1,18 +1,27 @@
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected.
+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(20,5): error TS2300: Duplicate identifier '"a b"'.
-==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts (6 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts (11 errors) ====
class C {
"a b": number;
+ ~~~~~
+!!! error TS2300: Duplicate identifier '"a b"'.
"a b": number;
~~~~~
!!! 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"'.
@@ -20,6 +29,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPr
interface I {
"a b": number;
+ ~~~~~
+!!! error TS2300: Duplicate identifier '"a b"'.
"a b": number;
~~~~~
!!! error TS2300: Duplicate identifier '"a b"'.
@@ -27,6 +38,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPr
var a: {
"a b": number;
+ ~~~~~
+!!! error TS2300: Duplicate identifier '"a b"'.
"a b": number;
~~~~~
!!! error TS2300: Duplicate identifier '"a b"'.
@@ -34,6 +47,8 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPr
var b = {
"a b": 1
+ ~~~~~
+!!! error TS2300: Duplicate identifier '"a b"'.
"a b": 1
~~~~~
!!! error TS1005: ',' expected.
diff --git a/tests/baselines/reference/targetTypeCastTest.errors.txt b/tests/baselines/reference/targetTypeCastTest.errors.txt
index b719ac656fe..c44de5535d0 100644
--- a/tests/baselines/reference/targetTypeCastTest.errors.txt
+++ b/tests/baselines/reference/targetTypeCastTest.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/targetTypeCastTest.ts(1,13): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/targetTypeCastTest.ts(3,10): error TS2300: Duplicate identifier 'Point'.
-==== tests/cases/compiler/targetTypeCastTest.ts (1 errors) ====
+==== tests/cases/compiler/targetTypeCastTest.ts (2 errors) ====
declare var Point: { new(x:number, y:number): {x: number; y: number; }; }
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
function Point(x, y) {
~~~~~
diff --git a/tests/baselines/reference/targetTypeTest1.errors.txt b/tests/baselines/reference/targetTypeTest1.errors.txt
index dccc680abaa..a0b05690a3b 100644
--- a/tests/baselines/reference/targetTypeTest1.errors.txt
+++ b/tests/baselines/reference/targetTypeTest1.errors.txt
@@ -1,10 +1,14 @@
+tests/cases/compiler/targetTypeTest1.ts(1,15): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/targetTypeTest1.ts(14,10): error TS2300: Duplicate identifier 'Point'.
tests/cases/compiler/targetTypeTest1.ts(19,18): error TS2384: Overload signatures must all be ambient or non-ambient.
+tests/cases/compiler/targetTypeTest1.ts(53,15): error TS2300: Duplicate identifier 'C'.
tests/cases/compiler/targetTypeTest1.ts(60,10): error TS2300: Duplicate identifier 'C'.
-==== tests/cases/compiler/targetTypeTest1.ts (3 errors) ====
+==== tests/cases/compiler/targetTypeTest1.ts (5 errors) ====
declare class Point
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'Point'.
{
constructor(x: number, y: number);
public x: number;
@@ -61,6 +65,8 @@ tests/cases/compiler/targetTypeTest1.ts(60,10): error TS2300: Duplicate identifi
}
declare class C {
+ ~
+!!! error TS2300: Duplicate identifier 'C'.
constructor(a:number, b:number);
public a : number;
public b: number;
diff --git a/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt b/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt
index 3edeb834baa..986f2dedf6e 100644
--- a/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt
+++ b/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt
@@ -1,18 +1,24 @@
tests/cases/compiler/trailingSeparatorInFunctionCall.ts(4,7): error TS1009: Trailing comma not allowed.
tests/cases/compiler/trailingSeparatorInFunctionCall.ts(9,8): error TS1009: Trailing comma not allowed.
+tests/cases/compiler/trailingSeparatorInFunctionCall.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target.
+tests/cases/compiler/trailingSeparatorInFunctionCall.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target.
-==== tests/cases/compiler/trailingSeparatorInFunctionCall.ts (2 errors) ====
+==== tests/cases/compiler/trailingSeparatorInFunctionCall.ts (4 errors) ====
function f(x, y) {
}
f(1, 2, );
~
!!! error TS1009: Trailing comma not allowed.
+ ~~~~~~~~~
+!!! error TS2346: Supplied parameters do not match any signature of call target.
function f2(x: T, y: T) {
}
f2(1, 2, );
~
-!!! error TS1009: Trailing comma not allowed.
\ No newline at end of file
+!!! error TS1009: Trailing comma not allowed.
+ ~~~~~~~~~~
+!!! error TS2346: Supplied parameters do not match any signature of call target.
\ No newline at end of file
diff --git a/tests/baselines/reference/twoAccessorsWithSameName.errors.txt b/tests/baselines/reference/twoAccessorsWithSameName.errors.txt
index 6b4990ceeda..81da707c566 100644
--- a/tests/baselines/reference/twoAccessorsWithSameName.errors.txt
+++ b/tests/baselines/reference/twoAccessorsWithSameName.errors.txt
@@ -9,16 +9,21 @@ tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameN
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(24,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(2,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(3,9): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(7,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(8,9): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(19,9): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(24,9): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts (14 errors) ====
+==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts (17 errors) ====
class C {
get x() { return 1; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
get x() { return 1; } // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -30,6 +35,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameN
set x(v) { }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
set x(v) { } // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -52,6 +59,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameN
get x() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
return 1;
},
diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt b/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt
index 2a6db805b19..836a06a8192 100644
--- a/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt
+++ b/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt
@@ -4,15 +4,19 @@ tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameN
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(2,16): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(3,16): error TS2300: Duplicate identifier 'x'.
+tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(7,16): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(8,16): error TS2300: Duplicate identifier 'x'.
-==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts (8 errors) ====
+==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts (10 errors) ====
class C {
static get x() { return 1; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
static get x() { return 1; } // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
@@ -24,6 +28,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameN
static set x(v) { }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
+ ~
+!!! error TS2300: Duplicate identifier 'x'.
static set x(v) { } // error
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
diff --git a/tests/baselines/reference/typeInferenceWithTupleType.js b/tests/baselines/reference/typeInferenceWithTupleType.js
new file mode 100644
index 00000000000..a9d75ad9990
--- /dev/null
+++ b/tests/baselines/reference/typeInferenceWithTupleType.js
@@ -0,0 +1,48 @@
+//// [typeInferenceWithTupleType.ts]
+function combine(x: T, y: U): [T, U] {
+ return [x, y];
+}
+
+var combineResult = combine("string", 10);
+var combineEle1 = combineResult[0]; // string
+var combineEle2 = combineResult[1]; // number
+
+function zip(array1: T[], array2: U[]): [[T, U]] {
+ if (array1.length != array2.length) {
+ return [[undefined, undefined]];
+ }
+ var length = array1.length;
+ var zipResult: [[T, U]];
+ for (var i = 0; i < length; ++i) {
+ zipResult.push([array1[i], array2[i]]);
+ }
+ return zipResult;
+}
+
+var zipResult = zip(["foo", "bar"], [5, 6]);
+var zipResultEle = zipResult[0]; // [string, number]
+var zipResultEleEle = zipResult[0][0]; // string
+
+
+
+//// [typeInferenceWithTupleType.js]
+function combine(x, y) {
+ return [x, y];
+}
+var combineResult = combine("string", 10);
+var combineEle1 = combineResult[0]; // string
+var combineEle2 = combineResult[1]; // number
+function zip(array1, array2) {
+ if (array1.length != array2.length) {
+ return [[undefined, undefined]];
+ }
+ var length = array1.length;
+ var zipResult;
+ for (var i = 0; i < length; ++i) {
+ zipResult.push([array1[i], array2[i]]);
+ }
+ return zipResult;
+}
+var zipResult = zip(["foo", "bar"], [5, 6]);
+var zipResultEle = zipResult[0]; // [string, number]
+var zipResultEleEle = zipResult[0][0]; // string
diff --git a/tests/baselines/reference/typeInferenceWithTupleType.types b/tests/baselines/reference/typeInferenceWithTupleType.types
new file mode 100644
index 00000000000..fbf1cd51920
--- /dev/null
+++ b/tests/baselines/reference/typeInferenceWithTupleType.types
@@ -0,0 +1,114 @@
+=== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts ===
+function combine(x: T, y: U): [T, U] {
+>combine : (x: T, y: U) => [T, U]
+>T : T
+>U : U
+>x : T
+>T : T
+>y : U
+>U : U
+>T : T
+>U : U
+
+ return [x, y];
+>[x, y] : [T, U]
+>x : T
+>y : U
+}
+
+var combineResult = combine("string", 10);
+>combineResult : [string, number]
+>combine("string", 10) : [string, number]
+>combine : (x: T, y: U) => [T, U]
+
+var combineEle1 = combineResult[0]; // string
+>combineEle1 : string
+>combineResult[0] : string
+>combineResult : [string, number]
+
+var combineEle2 = combineResult[1]; // number
+>combineEle2 : number
+>combineResult[1] : number
+>combineResult : [string, number]
+
+function zip(array1: T[], array2: U[]): [[T, U]] {
+>zip : (array1: T[], array2: U[]) => [[T, U]]
+>T : T
+>U : U
+>array1 : T[]
+>T : T
+>array2 : U[]
+>U : U
+>T : T
+>U : U
+
+ if (array1.length != array2.length) {
+>array1.length != array2.length : boolean
+>array1.length : number
+>array1 : T[]
+>length : number
+>array2.length : number
+>array2 : U[]
+>length : number
+
+ return [[undefined, undefined]];
+>[[undefined, undefined]] : [[undefined, undefined]]
+>[undefined, undefined] : [undefined, undefined]
+>undefined : undefined
+>undefined : undefined
+ }
+ var length = array1.length;
+>length : number
+>array1.length : number
+>array1 : T[]
+>length : number
+
+ var zipResult: [[T, U]];
+>zipResult : [[T, U]]
+>T : T
+>U : U
+
+ for (var i = 0; i < length; ++i) {
+>i : number
+>i < length : boolean
+>i : number
+>length : number
+>++i : number
+>i : number
+
+ zipResult.push([array1[i], array2[i]]);
+>zipResult.push([array1[i], array2[i]]) : number
+>zipResult.push : (...items: [T, U][]) => number
+>zipResult : [[T, U]]
+>push : (...items: [T, U][]) => number
+>[array1[i], array2[i]] : [T, U]
+>array1[i] : T
+>array1 : T[]
+>i : number
+>array2[i] : U
+>array2 : U[]
+>i : number
+ }
+ return zipResult;
+>zipResult : [[T, U]]
+}
+
+var zipResult = zip(["foo", "bar"], [5, 6]);
+>zipResult : [[string, number]]
+>zip(["foo", "bar"], [5, 6]) : [[string, number]]
+>zip : (array1: T[], array2: U[]) => [[T, U]]
+>["foo", "bar"] : string[]
+>[5, 6] : number[]
+
+var zipResultEle = zipResult[0]; // [string, number]
+>zipResultEle : [string, number]
+>zipResult[0] : [string, number]
+>zipResult : [[string, number]]
+
+var zipResultEleEle = zipResult[0][0]; // string
+>zipResultEleEle : string
+>zipResult[0][0] : string
+>zipResult[0] : [string, number]
+>zipResult : [[string, number]]
+
+
diff --git a/tests/baselines/reference/varAndFunctionShareName.errors.txt b/tests/baselines/reference/varAndFunctionShareName.errors.txt
index aa518152fcc..dc4dd4e1b3b 100644
--- a/tests/baselines/reference/varAndFunctionShareName.errors.txt
+++ b/tests/baselines/reference/varAndFunctionShareName.errors.txt
@@ -1,8 +1,11 @@
+tests/cases/compiler/varAndFunctionShareName.ts(1,5): error TS2300: Duplicate identifier 'myFn'.
tests/cases/compiler/varAndFunctionShareName.ts(2,10): error TS2300: Duplicate identifier 'myFn'.
-==== tests/cases/compiler/varAndFunctionShareName.ts (1 errors) ====
+==== tests/cases/compiler/varAndFunctionShareName.ts (2 errors) ====
var myFn;
+ ~~~~
+!!! error TS2300: Duplicate identifier 'myFn'.
function myFn(): any { }
~~~~
!!! error TS2300: Duplicate identifier 'myFn'.
\ No newline at end of file
diff --git a/tests/cases/compiler/augmentedTypesClass2.ts b/tests/cases/compiler/augmentedTypesClass2.ts
index a744e2e62e1..c6d64e2bf82 100644
--- a/tests/cases/compiler/augmentedTypesClass2.ts
+++ b/tests/cases/compiler/augmentedTypesClass2.ts
@@ -1,7 +1,7 @@
// Checking class with other things in type space not value space
// class then interface
-class c11 {
+class c11 { // error
foo() {
return 1;
}
diff --git a/tests/cases/compiler/augmentedTypesClass2a.ts b/tests/cases/compiler/augmentedTypesClass2a.ts
index ebb1bf6b1b5..c8098a7f133 100644
--- a/tests/cases/compiler/augmentedTypesClass2a.ts
+++ b/tests/cases/compiler/augmentedTypesClass2a.ts
@@ -1,4 +1,4 @@
//// class then function
-class c2 { public foo() { } }
+class c2 { public foo() { } } // error
function c2() { } // error
var c2 = () => { }
\ No newline at end of file
diff --git a/tests/cases/compiler/augmentedTypesClass4.ts b/tests/cases/compiler/augmentedTypesClass4.ts
index 54d96b617e5..d8ab0708272 100644
--- a/tests/cases/compiler/augmentedTypesClass4.ts
+++ b/tests/cases/compiler/augmentedTypesClass4.ts
@@ -1,3 +1,3 @@
//// class then class
-class c3 { public foo() { } }
+class c3 { public foo() { } } // error
class c3 { public bar() { } } // error
diff --git a/tests/cases/compiler/augmentedTypesEnum.ts b/tests/cases/compiler/augmentedTypesEnum.ts
index 96ec07fef39..2efcde826ce 100644
--- a/tests/cases/compiler/augmentedTypesEnum.ts
+++ b/tests/cases/compiler/augmentedTypesEnum.ts
@@ -1,23 +1,23 @@
// enum then var
-enum e1111 { One }
+enum e1111 { One } // error
var e1111 = 1; // error
// enum then function
-enum e2 { One }
+enum e2 { One } // error
function e2() { } // error
-enum e3 { One }
+enum e3 { One } // error
var e3 = () => { } // error
// enum then class
-enum e4 { One }
+enum e4 { One } // error
class e4 { public foo() { } } // error
// enum then enum
enum e5 { One }
-enum e5 { Two }
+enum e5 { Two } // error
-enum e5a { One }
+enum e5a { One } // error
enum e5a { One } // error
// enum then internal module
diff --git a/tests/cases/compiler/augmentedTypesEnum2.ts b/tests/cases/compiler/augmentedTypesEnum2.ts
index 8801c5d935b..2ad69c12f02 100644
--- a/tests/cases/compiler/augmentedTypesEnum2.ts
+++ b/tests/cases/compiler/augmentedTypesEnum2.ts
@@ -1,14 +1,14 @@
// enum then interface
-enum e1 { One }
+enum e1 { One } // error
-interface e1 {
+interface e1 { // error
foo(): void;
}
// interface then enum works
// enum then class
-enum e2 { One };
+enum e2 { One }; // error
class e2 { // error
foo() {
return 1;
diff --git a/tests/cases/compiler/augmentedTypesFunction.ts b/tests/cases/compiler/augmentedTypesFunction.ts
index 14bb1f718e8..ab6627f9463 100644
--- a/tests/cases/compiler/augmentedTypesFunction.ts
+++ b/tests/cases/compiler/augmentedTypesFunction.ts
@@ -1,23 +1,23 @@
// function then var
-function y1() { }
+function y1() { } // error
var y1 = 1; // error
// function then function
-function y2() { }
+function y2() { } // error
function y2() { } // error
-function y2a() { }
+function y2a() { } // error
var y2a = () => { } // error
// function then class
-function y3() { }
+function y3() { } // error
class y3 { } // error
-function y3a() { }
+function y3a() { } // error
class y3a { public foo() { } } // error
// function then enum
-function y4() { }
+function y4() { } // error
enum y4 { One } // error
// function then internal module
diff --git a/tests/cases/compiler/augmentedTypesInterface.ts b/tests/cases/compiler/augmentedTypesInterface.ts
index b9f84d4d8b2..72c85d6619d 100644
--- a/tests/cases/compiler/augmentedTypesInterface.ts
+++ b/tests/cases/compiler/augmentedTypesInterface.ts
@@ -9,7 +9,7 @@ interface i {
}
// interface then class
-interface i2 {
+interface i2 { // error
foo(): void;
}
@@ -20,7 +20,7 @@ class i2 { // error
}
// interface then enum
-interface i3 {
+interface i3 { // error
foo(): void;
}
enum i3 { One }; // error
diff --git a/tests/cases/compiler/augmentedTypesModules.ts b/tests/cases/compiler/augmentedTypesModules.ts
index 6857abf1718..84f03549a42 100644
--- a/tests/cases/compiler/augmentedTypesModules.ts
+++ b/tests/cases/compiler/augmentedTypesModules.ts
@@ -2,18 +2,18 @@
module m1 { }
var m1 = 1; // Should be allowed
-module m1a { var y = 2; }
-var m1a = 1;
+module m1a { var y = 2; } // error
+var m1a = 1; // error
-module m1b { export var y = 2; }
-var m1b = 1;
+module m1b { export var y = 2; } // error
+var m1b = 1; // error
module m1c {
export interface I { foo(): void; }
}
var m1c = 1; // Should be allowed
-module m1d {
+module m1d { // error
export class I { foo() { } }
}
var m1d = 1; // error
diff --git a/tests/cases/compiler/augmentedTypesVar.ts b/tests/cases/compiler/augmentedTypesVar.ts
index 75cab810c13..c7e40c8b0e7 100644
--- a/tests/cases/compiler/augmentedTypesVar.ts
+++ b/tests/cases/compiler/augmentedTypesVar.ts
@@ -3,17 +3,17 @@ var x1 = 1;
var x1 = 2;
// var then function
-var x2 = 1;
-function x2() { } // should be an error
+var x2 = 1; // error
+function x2() { } // error
-var x3 = 1;
-var x3 = () => { } // should be an error
+var x3 = 1;
+var x3 = () => { } // error
// var then class
-var x4 = 1;
+var x4 = 1; // error
class x4 { } // error
-var x4a = 1;
+var x4a = 1; // error
class x4a { public foo() { } } // error
// var then enum
@@ -24,10 +24,10 @@ enum x5 { One } // error
var x6 = 1;
module x6 { } // ok since non-instantiated
-var x6a = 1;
+var x6a = 1; // error
module x6a { var y = 2; } // error since instantiated
-var x6b = 1;
+var x6b = 1; // error
module x6b { export var y = 2; } // error
// var then import, messes with other error reporting
diff --git a/tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts b/tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts
new file mode 100644
index 00000000000..29f10cbf38e
--- /dev/null
+++ b/tests/cases/compiler/bitwiseCompoundAssignmentOperators.ts
@@ -0,0 +1,31 @@
+var a = true;
+var b = 1;
+a ^= a;
+a = true;
+b ^= b;
+b = 1;
+a ^= b;
+a = true;
+b ^= a;
+b = 1;
+
+var c = false;
+var d = 2;
+c &= c;
+c = false;
+d &= d;
+d = 2;
+c &= d;
+c = false;
+d &= c;
+
+var e = true;
+var f = 0;
+e |= e;
+e = true;
+f |= f;
+f = 0;
+e |= f;
+e = true;
+f |= f;
+
diff --git a/tests/cases/compiler/callOnInstance.ts b/tests/cases/compiler/callOnInstance.ts
index 0125121c12a..0b38dcd12cd 100644
--- a/tests/cases/compiler/callOnInstance.ts
+++ b/tests/cases/compiler/callOnInstance.ts
@@ -1,6 +1,6 @@
-declare function D(): string;
+declare function D(): string; // error
-declare class D { constructor (value: number); } // Duplicate identifier
+declare class D { constructor (value: number); } // error
var s1: string = D(); // OK
diff --git a/tests/cases/compiler/callOverloads1.ts b/tests/cases/compiler/callOverloads1.ts
index 17abfb7890a..e2ce278eec0 100644
--- a/tests/cases/compiler/callOverloads1.ts
+++ b/tests/cases/compiler/callOverloads1.ts
@@ -1,4 +1,4 @@
-class Foo {
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
diff --git a/tests/cases/compiler/callOverloads2.ts b/tests/cases/compiler/callOverloads2.ts
index a5db65f505a..e18815fd46b 100644
--- a/tests/cases/compiler/callOverloads2.ts
+++ b/tests/cases/compiler/callOverloads2.ts
@@ -1,6 +1,6 @@
-class Foo {
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
@@ -8,10 +8,10 @@ class Foo {
}
}
-function Foo();
+function Foo(); // error
-function F1(s:string) {return s;}
-function F1(a:any) { return a;} // error - duplicate identifier
+function F1(s:string) {return s;} // error
+function F1(a:any) { return a;} // error
function Goo(s:string); // error - no implementation
diff --git a/tests/cases/compiler/callOverloads3.ts b/tests/cases/compiler/callOverloads3.ts
index 6b7e1bba907..be14dd478fa 100644
--- a/tests/cases/compiler/callOverloads3.ts
+++ b/tests/cases/compiler/callOverloads3.ts
@@ -1,7 +1,7 @@
-function Foo():Foo;
-function Foo(s:string):Foo;
-class Foo {
+function Foo():Foo; // error
+function Foo(s:string):Foo; // error
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(x: any) {
// WScript.Echo("Constructor function has executed");
diff --git a/tests/cases/compiler/callOverloads4.ts b/tests/cases/compiler/callOverloads4.ts
index 58d89c53bdc..7240e73d0ac 100644
--- a/tests/cases/compiler/callOverloads4.ts
+++ b/tests/cases/compiler/callOverloads4.ts
@@ -1,7 +1,7 @@
-function Foo():Foo;
-function Foo(s:string):Foo;
-class Foo {
+function Foo():Foo; // error
+function Foo(s:string):Foo; // error
+class Foo { // error
bar1() { /*WScript.Echo("bar1");*/ }
constructor(s: string);
constructor(x: any) {
diff --git a/tests/cases/compiler/callOverloads5.ts b/tests/cases/compiler/callOverloads5.ts
index 9e491f7d257..212b68b168a 100644
--- a/tests/cases/compiler/callOverloads5.ts
+++ b/tests/cases/compiler/callOverloads5.ts
@@ -1,6 +1,6 @@
-function Foo():Foo;
-function Foo(s:string):Foo;
-class Foo {
+function Foo():Foo; // error
+function Foo(s:string):Foo; // error
+class Foo { // error
bar1(s:string);
bar1(n:number);
bar1(a:any) { /*WScript.Echo(a);*/ }
diff --git a/tests/cases/compiler/class1.ts b/tests/cases/compiler/class1.ts
index d7c7ce2ae0a..c7b2115b88b 100644
--- a/tests/cases/compiler/class1.ts
+++ b/tests/cases/compiler/class1.ts
@@ -1,2 +1,2 @@
-interface foo{ }
-class foo{ }
\ No newline at end of file
+interface foo{ } // error
+class foo{ } // error
\ No newline at end of file
diff --git a/tests/cases/compiler/classAndInterface1.ts b/tests/cases/compiler/classAndInterface1.ts
index 06ada1c8a49..79b02915857 100644
--- a/tests/cases/compiler/classAndInterface1.ts
+++ b/tests/cases/compiler/classAndInterface1.ts
@@ -1,2 +1,2 @@
-class cli { }
+ class cli { } // error
interface cli { } // error
\ No newline at end of file
diff --git a/tests/cases/compiler/selfReferencingFile.ts b/tests/cases/compiler/selfReferencingFile.ts
new file mode 100644
index 00000000000..cac46da2369
--- /dev/null
+++ b/tests/cases/compiler/selfReferencingFile.ts
@@ -0,0 +1,5 @@
+///
+
+class selfReferencingFile {
+
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/selfReferencingFile2.ts b/tests/cases/compiler/selfReferencingFile2.ts
new file mode 100644
index 00000000000..c98e7a07735
--- /dev/null
+++ b/tests/cases/compiler/selfReferencingFile2.ts
@@ -0,0 +1,5 @@
+///
+
+class selfReferencingFile2 {
+
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/selfReferencingFile3.ts b/tests/cases/compiler/selfReferencingFile3.ts
new file mode 100644
index 00000000000..4242d0b3633
--- /dev/null
+++ b/tests/cases/compiler/selfReferencingFile3.ts
@@ -0,0 +1,5 @@
+///
+
+class selfReferencingFile3 {
+
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/sourceMapWithCaseSensitiveFileNames.ts b/tests/cases/compiler/sourceMapWithCaseSensitiveFileNames.ts
new file mode 100644
index 00000000000..d0dff702aae
--- /dev/null
+++ b/tests/cases/compiler/sourceMapWithCaseSensitiveFileNames.ts
@@ -0,0 +1,12 @@
+// @out: tests/cases/compiler/testfiles/fooResult.js
+// @sourcemap: true
+// @useCaseSensitiveFileNames: true
+// @Filename: testFiles/app.ts
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+class c {
+}
+
+// @Filename: testFiles/app2.ts
+class d {
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/sourceMapWithCaseSensitiveFileNamesAndOutDir.ts b/tests/cases/compiler/sourceMapWithCaseSensitiveFileNamesAndOutDir.ts
new file mode 100644
index 00000000000..17195b434e5
--- /dev/null
+++ b/tests/cases/compiler/sourceMapWithCaseSensitiveFileNamesAndOutDir.ts
@@ -0,0 +1,12 @@
+// @outDir: tests/cases/compiler/testfiles
+// @sourcemap: true
+// @useCaseSensitiveFileNames: true
+// @Filename: testFiles/app.ts
+// Note in the out result we are using same folder name only different in casing
+// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts
+class c {
+}
+
+// @Filename: testFiles/app2.ts
+class d {
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNames.ts b/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNames.ts
new file mode 100644
index 00000000000..85905fb29b9
--- /dev/null
+++ b/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNames.ts
@@ -0,0 +1,12 @@
+// @out: tests/cases/compiler/testfiles/fooResult.js
+// @sourcemap: true
+// @useCaseSensitiveFileNames: false
+// @Filename: testFiles/app.ts
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+class c {
+}
+
+// @Filename: testFiles/app2.ts
+class d {
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.ts b/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.ts
new file mode 100644
index 00000000000..90343b8cffc
--- /dev/null
+++ b/tests/cases/compiler/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.ts
@@ -0,0 +1,12 @@
+// @outDir: tests/cases/compiler/testfiles
+// @sourcemap: true
+// @useCaseSensitiveFileNames: false
+// @Filename: testFiles/app.ts
+// Note in the out result we are using same folder name only different in casing
+// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap
+class c {
+}
+
+// @Filename: testFiles/app2.ts
+class d {
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts b/tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts
index 13bc603fada..cd42d742101 100644
--- a/tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classAndVariableWithSameName.ts
@@ -1,8 +1,8 @@
-class C { foo: string; }
+class C { foo: string; } // error
var C = ''; // error
module M {
- class D {
+ class D { // error
bar: string;
}
diff --git a/tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts b/tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts
index 3744cb1f5f4..b3f535c4c3d 100644
--- a/tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts
+++ b/tests/cases/conformance/classes/constructorDeclarations/classWithTwoConstructorDefinitions.ts
@@ -1,9 +1,9 @@
class C {
- constructor() { }
+ constructor() { } // error
constructor(x) { } // error
}
class D {
- constructor(x: T) { }
+ constructor(x: T) { } // error
constructor(x: T, y: T) { } // error
}
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts
index 3164e0a4734..04f1acd84ca 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts
@@ -17,8 +17,8 @@ c.foo();
c.foo(1);
var b = {
- foo(x = 1),
- foo(x = 1) { },
+ foo(x = 1), // error
+ foo(x = 1) { }, // error
}
b.foo();
diff --git a/tests/cases/conformance/types/tuple/castingTuple.ts b/tests/cases/conformance/types/tuple/castingTuple.ts
new file mode 100644
index 00000000000..f154e5f00c8
--- /dev/null
+++ b/tests/cases/conformance/types/tuple/castingTuple.ts
@@ -0,0 +1,27 @@
+interface I { }
+class A { a = 10; }
+class C implements I { c };
+class D implements I { d };
+class E extends A { e };
+class F extends A { f };
+enum E1 { one }
+enum E2 { one }
+
+// no error
+var numStrTuple: [number, string] = [5, "foo"];
+var emptyObjTuple = <[{}, {}]>numStrTuple;
+var numStrBoolTuple = <[number, string, boolean]>numStrTuple;
+var classCDTuple: [C, D] = [new C(), new D()];
+var interfaceIITuple = <[I, I]>classCDTuple;
+var classCDATuple = <[C, D, A]>classCDTuple;
+var eleFromCDA1 = classCDATuple[2]; // A
+var eleFromCDA2 = classCDATuple[5]; // {}
+var t10: [E1, E2] = [E1.one, E2.one];
+var t11 = <[number, number]>t10;
+var array1 = <{}[]>emptyObjTuple;
+
+// error
+var t3 = <[number, number]>numStrTuple;
+var t9 = <[A, I]>classCDTuple;
+var array1 = numStrTuple;
+t4[2] = 10;
\ No newline at end of file
diff --git a/tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts b/tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts
new file mode 100644
index 00000000000..7e9575d7f82
--- /dev/null
+++ b/tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts
@@ -0,0 +1,13 @@
+// no error
+var numStrTuple: [number, string] = [5, "hello"];
+var numStrTuple2: [number, string] = [5, "foo", true];
+var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
+var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5];
+var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]];
+numStrTuple = numStrTuple2;
+numStrTuple = numStrBoolTuple;
+
+// error
+objNumTuple = [ {}, 5];
+numStrBoolTuple = numStrTuple;
+var strStrTuple: [string, string] = ["foo", "bar", 5];
diff --git a/tests/cases/conformance/types/tuple/indexerWithTuple.ts b/tests/cases/conformance/types/tuple/indexerWithTuple.ts
new file mode 100644
index 00000000000..0b51ecd32ee
--- /dev/null
+++ b/tests/cases/conformance/types/tuple/indexerWithTuple.ts
@@ -0,0 +1,15 @@
+var strNumTuple: [string, number] = ["foo", 10];
+var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]];
+
+// no error
+var idx0 = 0;
+var idx1 = 1;
+var ele10 = strNumTuple[0]; // string
+var ele11 = strNumTuple[1]; // number
+var ele12 = strNumTuple[2]; // {}
+var ele13 = strNumTuple[idx0]; // {}
+var ele14 = strNumTuple[idx1]; // {}
+var ele15 = strNumTuple["0"]; // string
+var ele16 = strNumTuple["1"]; // number
+var strNumTuple1 = numTupleTuple[1]; //[string, number];
+var ele17 = numTupleTuple[2]; // {}
\ No newline at end of file
diff --git a/tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts b/tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts
new file mode 100644
index 00000000000..d19353d29ef
--- /dev/null
+++ b/tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts
@@ -0,0 +1,24 @@
+function combine(x: T, y: U): [T, U] {
+ return [x, y];
+}
+
+var combineResult = combine("string", 10);
+var combineEle1 = combineResult[0]; // string
+var combineEle2 = combineResult[1]; // number
+
+function zip(array1: T[], array2: U[]): [[T, U]] {
+ if (array1.length != array2.length) {
+ return [[undefined, undefined]];
+ }
+ var length = array1.length;
+ var zipResult: [[T, U]];
+ for (var i = 0; i < length; ++i) {
+ zipResult.push([array1[i], array2[i]]);
+ }
+ return zipResult;
+}
+
+var zipResult = zip(["foo", "bar"], [5, 6]);
+var zipResultEle = zipResult[0]; // [string, number]
+var zipResultEleEle = zipResult[0][0]; // string
+
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts
new file mode 100644
index 00000000000..3811809742c
--- /dev/null
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts
@@ -0,0 +1,18 @@
+var numStrTuple: [number, string];
+var numNumTuple: [number, number];
+var numEmptyObjTuple: [number, {}];
+var emptyObjTuple: [{}];
+
+var numArray: number[];
+var emptyObjArray: {}[];
+
+// no error
+numArray = numNumTuple;
+emptyObjArray = emptyObjTuple;
+emptyObjArray = numStrTuple;
+emptyObjArray = numNumTuple;
+emptyObjArray = numEmptyObjTuple;
+
+// error
+numArray = numStrTuple;
+emptyObjTuple = emptyObjArray;
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts
new file mode 100644
index 00000000000..6d5aff974eb
--- /dev/null
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts
@@ -0,0 +1,25 @@
+function f1(x: number): string { return "foo"; }
+
+function f2(x: number): number { return 10; }
+
+function f3(x: number): boolean { return true; }
+
+enum E1 { one }
+
+enum E2 { two }
+
+
+var t1: [(x: number) => string, (x: number) => number];
+var t2: [E1, E2];
+var t3: [number, any];
+var t4: [E1, E2, number];
+
+// no error
+t1 = [f1, f2];
+t2 = [E1.one, E2.two];
+t3 = [5, undefined];
+t4 = [E1.one, E2.two, 20];
+var e1 = t1[2]; // {}
+var e2 = t2[2]; // {}
+var e3 = t3[2]; // any
+var e4 = t4[3]; // number
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts
new file mode 100644
index 00000000000..e3487f6bee2
--- /dev/null
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple2.ts
@@ -0,0 +1,21 @@
+interface base { }
+interface base1 { i }
+class C implements base { c }
+class D implements base { d }
+class E implements base { e }
+class F extends C { f }
+
+class C1 implements base1 { i = "foo"; c }
+class D1 extends C1 { i = "bar"; d }
+
+var t1: [C, base];
+var t2: [C, D];
+var t3: [C1, D1];
+var t4: [base1, C1];
+var t5: [C1, F]
+
+var e11 = t1[4]; // base
+var e21 = t2[4]; // {}
+var e31 = t3[4]; // C1
+var e41 = t4[2]; // base1
+var e51 = t5[2]; // {}
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts
new file mode 100644
index 00000000000..60198e1c510
--- /dev/null
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts
@@ -0,0 +1,24 @@
+interface I {
+ tuple1: [T, U];
+}
+
+var i1: I;
+var i2: I<{}, {}>;
+
+// no error
+i1.tuple1 = ["foo", 5];
+var e1 = i1.tuple1[0]; // string
+var e2 = i1.tuple1[1]; // number
+i1.tuple1 = ["foo", 5, false, true];
+var e3 = i1.tuple1[2]; // {}
+i1.tuple1[3] = { a: "string" };
+var e4 = i1.tuple1[3]; // {}
+i2.tuple1 = ["foo", 5];
+i2.tuple1 = ["foo", "bar"];
+i2.tuple1 = [5, "bar"];
+i2.tuple1 = [{}, {}];
+
+// error
+i1.tuple1 = [5, "foo"];
+i1.tuple1 = [{}, {}];
+i2.tuple1 = [{}];
diff --git a/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts b/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts
index 3315a226528..adbdd4820a0 100644
--- a/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts
+++ b/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts
@@ -9,4 +9,4 @@
goTo.marker();
var func = 'fn() { }';
edit.insert(func);
-verify.numberOfErrorsInCurrentFile(1);
+verify.numberOfErrorsInCurrentFile(2);
diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers.ts
new file mode 100644
index 00000000000..de09f059680
--- /dev/null
+++ b/tests/cases/fourslash/completionListInstanceProtectedMembers.ts
@@ -0,0 +1,63 @@
+///
+
+////class Base {
+//// private privateMethod() { }
+//// private privateProperty;
+////
+//// protected protectedMethod() { }
+//// protected protectedProperty;
+////
+//// public publicMethod() { }
+//// public publicProperty;
+////
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////
+//// test() {
+//// this./*1*/;
+////
+//// var b: Base;
+//// var c: C1;
+////
+//// b./*2*/;
+//// c./*3*/;
+//// }
+////}
+////
+////class C1 extends Base {
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////}
+
+
+// Same class, everything is visible
+goTo.marker("1");
+verify.memberListContains('privateMethod');
+verify.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+goTo.marker("2");
+verify.memberListContains('privateMethod');
+verify.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+// Can not access protected properties overridden in subclass
+goTo.marker("3");
+verify.memberListContains('privateMethod');
+verify.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
\ No newline at end of file
diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts
new file mode 100644
index 00000000000..72b6f3a1f7b
--- /dev/null
+++ b/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts
@@ -0,0 +1,76 @@
+///
+
+////class Base {
+//// private privateMethod() { }
+//// private privateProperty;
+////
+//// protected protectedMethod() { }
+//// protected protectedProperty;
+////
+//// public publicMethod() { }
+//// public publicProperty;
+////
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////}
+////
+////class C1 extends Base {
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////
+//// test() {
+//// this./*1*/;
+//// super./*2*/;
+////
+//// var b: Base;
+//// var c: C1;
+////
+//// b./*3*/;
+//// c./*4*/;
+//// }
+////}
+
+
+// Same class, everything is visible
+goTo.marker("1");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+// Can not access properties on super
+goTo.marker("2");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.not.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
+
+// Can not access protected properties through base class
+goTo.marker("3");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
+
+// Same class, everything is visible
+goTo.marker("4");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts
new file mode 100644
index 00000000000..2b3bf2ac2d9
--- /dev/null
+++ b/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts
@@ -0,0 +1,46 @@
+///
+
+////class Base {
+//// private privateMethod() { }
+//// private privateProperty;
+////
+//// protected protectedMethod() { }
+//// protected protectedProperty;
+////
+//// public publicMethod() { }
+//// public publicProperty;
+////
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////}
+////
+////class C1 extends Base {
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////}
+////
+//// var b: Base;
+//// var c: C1;
+//// b./*1*/;
+//// c./*2*/;
+
+// Only public properties are visible outside the class
+goTo.marker("1");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
+
+goTo.marker("2");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts
new file mode 100644
index 00000000000..27f9bb5a1cf
--- /dev/null
+++ b/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts
@@ -0,0 +1,34 @@
+///
+
+////class Base {
+//// private privateMethod() { }
+//// private privateProperty;
+////
+//// protected protectedMethod() { }
+//// protected protectedProperty;
+////
+//// public publicMethod() { }
+//// public publicProperty;
+////
+//// protected protectedOverriddenMethod() { }
+//// protected protectedOverriddenProperty;
+////}
+////
+////class C1 extends Base {
+//// public protectedOverriddenMethod() { }
+//// public protectedOverriddenProperty;
+////}
+////
+//// var c: C1;
+//// c./*1*/
+
+
+goTo.marker("1");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
diff --git a/tests/cases/fourslash/completionListOnAliases.ts b/tests/cases/fourslash/completionListOnAliases.ts
new file mode 100644
index 00000000000..785a65a76bd
--- /dev/null
+++ b/tests/cases/fourslash/completionListOnAliases.ts
@@ -0,0 +1,15 @@
+///
+
+////module M {
+//// export var value;
+////
+//// import x = M;
+//// /*1*/
+//// x./*2*/
+////}
+
+goTo.marker("1");
+verify.memberListContains("x", undefined, undefined, undefined ,/*kind: */ "alias");
+
+goTo.marker("2");
+verify.memberListContains("value");
diff --git a/tests/cases/fourslash/completionListOnAliases2.ts b/tests/cases/fourslash/completionListOnAliases2.ts
new file mode 100644
index 00000000000..6a74f3a525b
--- /dev/null
+++ b/tests/cases/fourslash/completionListOnAliases2.ts
@@ -0,0 +1,74 @@
+///
+
+////module M {
+//// export interface I { }
+//// export class C {
+//// static property;
+//// }
+//// export enum E {
+//// value = 0
+//// }
+//// export module N {
+//// export var v;
+//// }
+//// export var V = 0;
+//// export function F() { }
+//// export import A = M;
+////}
+////
+////import m = M;
+////import c = M.C;
+////import e = M.E;
+////import n = M.N;
+////import v = M.V;
+////import f = M.F;
+////import a = M.A;
+////
+////m./*1*/;
+////c./*2*/;
+////e./*3*/;
+////n./*4*/;
+////v./*5*/;
+////f./*6*/;
+////a./*7*/;
+
+
+// Module m
+goTo.marker("1");
+verify.memberListContains("I");
+verify.memberListContains("C");
+verify.memberListContains("E");
+verify.memberListContains("N");
+verify.memberListContains("V");
+verify.memberListContains("F");
+verify.memberListContains("A");
+
+// Class C
+goTo.marker("2");
+verify.memberListContains("property");
+
+// Enum E
+goTo.marker("3");
+verify.memberListContains("value");
+
+// Module N
+goTo.marker("4");
+verify.memberListContains("v");
+
+// var V
+goTo.marker("5");
+verify.memberListContains("toFixed");
+
+// function F
+goTo.marker("6");
+verify.memberListContains("call");
+
+// alias a
+goTo.marker("7");
+verify.memberListContains("I");
+verify.memberListContains("C");
+verify.memberListContains("E");
+verify.memberListContains("N");
+verify.memberListContains("V");
+verify.memberListContains("F");
+verify.memberListContains("A");
diff --git a/tests/cases/fourslash/completionListOnAliases3.ts b/tests/cases/fourslash/completionListOnAliases3.ts
new file mode 100644
index 00000000000..8c5194af968
--- /dev/null
+++ b/tests/cases/fourslash/completionListOnAliases3.ts
@@ -0,0 +1,13 @@
+///
+
+////declare module 'foobar' {
+//// interface Q { x: number; }
+////}
+////declare module 'thing' {
+//// import x = require('foobar');
+//// var m: x./*1*/;
+////}
+
+// Q does not show up in member list of x
+goTo.marker("1");
+verify.memberListContains("Q");
diff --git a/tests/cases/fourslash/completionListProtectedMembers.ts b/tests/cases/fourslash/completionListProtectedMembers.ts
new file mode 100644
index 00000000000..4715a9fb714
--- /dev/null
+++ b/tests/cases/fourslash/completionListProtectedMembers.ts
@@ -0,0 +1,44 @@
+///
+
+////class Base {
+//// protected y;
+//// constructor(protected x) {}
+//// method() { this./*1*/; }
+////}
+////class D1 extends Base {
+//// protected z;
+//// method1() { this./*2*/; }
+////}
+////class D2 extends Base {
+//// method2() { this./*3*/; }
+////}
+////class D3 extends D1 {
+//// method2() { this./*4*/; }
+////}
+////var b: Base;
+////f./*5*/
+
+goTo.marker("1");
+verify.memberListContains("y");
+verify.memberListContains("x");
+verify.not.memberListContains("z");
+
+goTo.marker("2");
+verify.memberListContains("y");
+verify.memberListContains("x");
+verify.memberListContains("z");
+
+goTo.marker("3");
+verify.memberListContains("y");
+verify.memberListContains("x");
+verify.not.memberListContains("z");
+
+goTo.marker("4");
+verify.memberListContains("y");
+verify.memberListContains("x");
+verify.memberListContains("z");
+
+goTo.marker("5");
+verify.not.memberListContains("x");
+verify.not.memberListContains("y");
+verify.not.memberListContains("z");
diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers.ts b/tests/cases/fourslash/completionListStaticProtectedMembers.ts
new file mode 100644
index 00000000000..af56f28ef06
--- /dev/null
+++ b/tests/cases/fourslash/completionListStaticProtectedMembers.ts
@@ -0,0 +1,59 @@
+///
+
+////class Base {
+//// private static privateMethod() { }
+//// private static privateProperty;
+////
+//// protected static protectedMethod() { }
+//// protected static protectedProperty;
+////
+//// public static publicMethod() { }
+//// public static publicProperty;
+////
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////
+//// static test() {
+//// Base./*1*/;
+//// this./*2*/;
+//// C1./*3*/;
+//// }
+////}
+////
+////class C1 extends Base {
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////}
+
+
+// Same class, everything is visible
+goTo.marker("1");
+verify.memberListContains('privateMethod');
+verify.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+goTo.marker("2");
+verify.memberListContains('privateMethod');
+verify.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+// Can not access protected properties overridden in subclass
+goTo.marker("3");
+verify.memberListContains('privateMethod');
+verify.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
\ No newline at end of file
diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts
new file mode 100644
index 00000000000..9964a91d21b
--- /dev/null
+++ b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts
@@ -0,0 +1,70 @@
+///
+
+////class Base {
+//// private static privateMethod() { }
+//// private static privateProperty;
+////
+//// protected static protectedMethod() { }
+//// protected static protectedProperty;
+////
+//// public static publicMethod() { }
+//// public static publicProperty;
+////
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////}
+////
+////class C2 extends Base {
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////
+//// static test() {
+//// Base./*1*/;
+//// C2./*2*/;
+//// this./*3*/;
+//// super./*4*/;
+//// }
+////}
+
+
+// Same class, everything is visible
+goTo.marker("1");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+goTo.marker("2");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+goTo.marker("3");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+// only public and protected methods of the base class are accessible through super
+goTo.marker("4");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.not.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
\ No newline at end of file
diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts
new file mode 100644
index 00000000000..f80186c93c0
--- /dev/null
+++ b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts
@@ -0,0 +1,45 @@
+///
+
+////class Base {
+//// private static privateMethod() { }
+//// private static privateProperty;
+////
+//// protected static protectedMethod() { }
+//// protected static protectedProperty;
+////
+//// public static publicMethod() { }
+//// public static publicProperty;
+////
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////}
+////
+////class C3 extends Base {
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////}
+////
+////Base./*1*/;
+////C3./*2*/;
+
+
+// Only public properties are visible outside the class
+goTo.marker("1");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
+
+goTo.marker("2");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.not.memberListContains('protectedOverriddenMethod');
+verify.not.memberListContains('protectedOverriddenProperty');
\ No newline at end of file
diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts
new file mode 100644
index 00000000000..72cc081f2fc
--- /dev/null
+++ b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts
@@ -0,0 +1,49 @@
+///
+
+////class Base {
+//// private static privateMethod() { }
+//// private static privateProperty;
+////
+//// protected static protectedMethod() { }
+//// protected static protectedProperty;
+////
+//// public static publicMethod() { }
+//// public static publicProperty;
+////
+//// protected static protectedOverriddenMethod() { }
+//// protected static protectedOverriddenProperty;
+////}
+////
+/////// Make the protected members public
+////class C4 extends Base {
+//// public static protectedOverriddenMethod() { }
+//// public static protectedOverriddenProperty;
+////}
+////class Derived extends C4 {
+//// test() {
+//// Derived./*1*/
+//// }
+////}
+//// Derived./*2*/
+
+// Sub class, everything but private is visible
+goTo.marker("1");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.memberListContains('protectedMethod');
+verify.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
+
+// Can see protected methods elevated to public
+goTo.marker("2");
+verify.not.memberListContains('privateMethod');
+verify.not.memberListContains('privateProperty');
+verify.not.memberListContains('protectedMethod');
+verify.not.memberListContains('protectedProperty');
+verify.memberListContains('publicMethod');
+verify.memberListContains('publicProperty');
+verify.memberListContains('protectedOverriddenMethod');
+verify.memberListContains('protectedOverriddenProperty');
diff --git a/tests/cases/fourslash/completionListSuperMembers.ts b/tests/cases/fourslash/completionListSuperMembers.ts
index c203a8774fb..6c7ddd5c7b3 100644
--- a/tests/cases/fourslash/completionListSuperMembers.ts
+++ b/tests/cases/fourslash/completionListSuperMembers.ts
@@ -25,7 +25,7 @@
goTo.marker();
-verify.memberListContains("publicProperty");
+verify.not.memberListContains("publicProperty");
verify.memberListContains("publicInstanceMethod");
// No statics
verify.not.memberListContains("publicStaticProperty");
diff --git a/tests/cases/fourslash/definitionNameOnEnumMember.ts b/tests/cases/fourslash/definitionNameOnEnumMember.ts
new file mode 100644
index 00000000000..d88e1ef688e
--- /dev/null
+++ b/tests/cases/fourslash/definitionNameOnEnumMember.ts
@@ -0,0 +1,11 @@
+///
+
+////enum e {
+//// firstMember,
+//// secondMember,
+//// thirdMember
+////}
+////var enumMember = e./*1*/thirdMember;
+
+goTo.marker("1");
+verify.verifyDefinitionsName("thirdMember", "e");
\ No newline at end of file
diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts
index 35b6894b1ce..f57a910245d 100644
--- a/tests/cases/fourslash/fourslash.ts
+++ b/tests/cases/fourslash/fourslash.ts
@@ -237,10 +237,13 @@ module FourSlashInterface {
public definitionLocationExists() {
FourSlash.currentTestState.verifyDefinitionLocationExists(this.negative);
}
+
+ public verifyDefinitionsName(name: string, containerName: string) {
+ FourSlash.currentTestState.verifyDefinitionsName(this.negative, name, containerName);
+ }
}
export class verify extends verifyNegatable {
-
public caretAtMarker(markerName?: string) {
FourSlash.currentTestState.verifyCaretAtMarker(markerName);
}
@@ -294,6 +297,10 @@ module FourSlashInterface {
FourSlash.currentTestState.verifySignatureHelpCount(expected);
}
+ public signatureHelpArgumentCountIs(expected: number) {
+ FourSlash.currentTestState.verifySignatureHelpArgumentCount(expected);
+ }
+
public currentSignatureParamterCountIs(expected: number) {
FourSlash.currentTestState.verifyCurrentSignatureHelpParameterCount(expected);
}
@@ -413,6 +420,10 @@ module FourSlashInterface {
public renameInfoFailed(message?: string) {
FourSlash.currentTestState.verifyRenameInfoFailed(message)
}
+
+ public renameLocations(findInStrings: boolean, findInComments: boolean) {
+ FourSlash.currentTestState.verifyRenameLocations(findInStrings, findInComments);
+ }
}
export class edit {
diff --git a/tests/cases/fourslash/getEmitOutputExternalModule.ts b/tests/cases/fourslash/getEmitOutputExternalModule.ts
new file mode 100644
index 00000000000..ef9fb348c57
--- /dev/null
+++ b/tests/cases/fourslash/getEmitOutputExternalModule.ts
@@ -0,0 +1,19 @@
+///
+
+// @BaselineFile: getEmitOutputExternalModule.baseline
+// @out: declSingleFile.js
+
+// @Filename: inputFile1.ts
+// @emitThisFile: true
+//// var x: number = 5;
+//// class Bar {
+//// x : string;
+//// y : number
+//// }
+
+// @Filename: inputFile2.ts
+//// export module M {
+//// class C {c}
+//// }
+
+verify.baselineGetEmitOutput();
\ No newline at end of file
diff --git a/tests/cases/fourslash/getEmitOutputExternalModule2.ts b/tests/cases/fourslash/getEmitOutputExternalModule2.ts
new file mode 100644
index 00000000000..abecc219698
--- /dev/null
+++ b/tests/cases/fourslash/getEmitOutputExternalModule2.ts
@@ -0,0 +1,26 @@
+///
+
+// @BaselineFile: getEmitOutputExternalModule2.baseline
+// @out: declSingleFile.js
+
+// @Filename: inputFile1.ts
+//// var x: number = 5;
+//// class Bar {
+//// x : string;
+//// y : number
+//// }
+
+// @Filename: inputFile2.ts
+// @emitThisFile: true
+//// var x: string = "world";
+//// class Bar2 {
+//// x : string;
+//// y : number
+//// }
+
+// @Filename: inputFile3.ts
+//// export module M {
+//// class C {c}
+//// }
+
+verify.baselineGetEmitOutput();
\ No newline at end of file
diff --git a/tests/cases/fourslash/getOccurrencesIfElse5.ts b/tests/cases/fourslash/getOccurrencesIfElse5.ts
new file mode 100644
index 00000000000..b0519630b7b
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesIfElse5.ts
@@ -0,0 +1,42 @@
+///
+
+////if/*1*/ (true) {
+//// if/*2*/ (false) {
+//// }
+//// else/*3*/ {
+//// }
+//// if/*4*/ (true) {
+//// }
+//// else/*5*/ {
+//// if/*6*/ (false)
+//// if/*7*/ (true)
+//// var x = undefined;
+//// }
+////}
+////else/*8*/ if (null) {
+////}
+////else/*9*/ /* whar garbl */ if/*10*/ (undefined) {
+////}
+////else/*11*/
+////if/*12*/ (false) {
+////}
+////else/*13*/ { }
+
+function verifyOccurencesAtMarker(marker: string, count: number) {
+ goTo.marker(marker);
+ verify.occurrencesAtPositionCount(count);
+}
+
+verifyOccurencesAtMarker("1", 7);
+verifyOccurencesAtMarker("2", 2);
+verifyOccurencesAtMarker("3", 2);
+verifyOccurencesAtMarker("4", 2);
+verifyOccurencesAtMarker("5", 2);
+verifyOccurencesAtMarker("6", 1);
+verifyOccurencesAtMarker("7", 1);
+verifyOccurencesAtMarker("8", 7);
+verifyOccurencesAtMarker("9", 7);
+verifyOccurencesAtMarker("10", 7);
+verifyOccurencesAtMarker("11", 7);
+verifyOccurencesAtMarker("12", 7);
+verifyOccurencesAtMarker("13", 7);
diff --git a/tests/cases/fourslash/getOccurrencesIfElseNegatives.ts b/tests/cases/fourslash/getOccurrencesIfElseNegatives.ts
deleted file mode 100644
index 601eba63c64..00000000000
--- a/tests/cases/fourslash/getOccurrencesIfElseNegatives.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-///
-
-////if/*1*/ (true) {
-//// if/*2*/ (false) {
-//// }
-//// else/*3*/ {
-//// }
-//// if/*4*/ (true) {
-//// }
-//// else/*5*/ {
-//// if/*6*/ (false)
-//// if/*7*/ (true)
-//// var x = undefined;
-//// }
-////}
-////else/*8*/ if (null) {
-////}
-////else/*9*/ /* whar garbl */ if/*10*/ (undefined) {
-////}
-////else/*11*/
-////if/*12*/ (false) {
-////}
-////else/*13*/ { }
-
-
-test.markers().forEach(m => {
- goTo.position(m.position, m.fileName)
- verify.occurrencesAtPositionCount(0);
-});
diff --git a/tests/cases/fourslash/getOccurrencesLoopBreakContinue6.ts b/tests/cases/fourslash/getOccurrencesLoopBreakContinue6.ts
new file mode 100644
index 00000000000..0127245dd50
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesLoopBreakContinue6.ts
@@ -0,0 +1,70 @@
+///
+
+////var arr = [1, 2, 3, 4];
+////label1: for (var n in arr) {
+//// break;
+//// continue;
+//// break label1;
+//// continue label1;
+////
+//// label2: for (var i = 0; i < arr[n]; i++) {
+//// break label1;
+//// continue label1;
+////
+//// break;
+//// continue;
+//// break label2;
+//// continue label2;
+////
+//// function foo() {
+//// label3: while (true) {
+//// break;
+//// continue;
+//// break label3;
+//// continue label3;
+////
+//// // these cross function boundaries
+//// br/*1*/eak label1;
+//// cont/*2*/inue label1;
+//// bre/*3*/ak label2;
+//// c/*4*/ontinue label2;
+////
+//// label4: do {
+//// break;
+//// continue;
+//// break label4;
+//// continue label4;
+////
+//// break label3;
+//// continue label3;
+////
+//// switch (10) {
+//// case 1:
+//// case 2:
+//// break;
+//// break label4;
+//// default:
+//// continue;
+//// }
+////
+//// // these cross function boundaries
+//// br/*5*/eak label1;
+//// co/*6*/ntinue label1;
+//// br/*7*/eak label2;
+//// con/*8*/tinue label2;
+//// () => { b/*9*/reak; }
+//// } while (true)
+//// }
+//// }
+//// }
+////}
+////
+////label5: while (true) break label5;
+////
+////label7: while (true) co/*10*/ntinue label5;
+
+test.markers().forEach(m => {
+ goTo.position(m.position);
+
+ verify.occurrencesAtPositionCount(0);
+});
diff --git a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts
new file mode 100644
index 00000000000..f9d47b07478
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts
@@ -0,0 +1,26 @@
+////module m {
+//// export interface Foo {
+//// [|abc|]
+//// }
+////}
+////
+////import Bar = m.Foo;
+////
+////export interface I extends Bar {
+//// [|abc|]
+////}
+////
+////class C implements Bar {
+//// [|abc|]
+////}
+////
+////(new C()).[|abc|];
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range);
+ });
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
\ No newline at end of file
diff --git a/tests/cases/fourslash/getOccurrencesReturnNegatives.ts b/tests/cases/fourslash/getOccurrencesReturn4.ts
similarity index 52%
rename from tests/cases/fourslash/getOccurrencesReturnNegatives.ts
rename to tests/cases/fourslash/getOccurrencesReturn4.ts
index 79cb3c659c6..4e25162f80f 100644
--- a/tests/cases/fourslash/getOccurrencesReturnNegatives.ts
+++ b/tests/cases/fourslash/getOccurrencesReturn4.ts
@@ -19,7 +19,15 @@
//// return/*7*/ true;
////}
-test.markers().forEach(m => {
- goTo.position(m.position, m.fileName)
- verify.occurrencesAtPositionCount(0);
-});
\ No newline at end of file
+function verifyOccurencesAtMarker(marker: string, count: number) {
+ goTo.marker(marker);
+ verify.occurrencesAtPositionCount(count);
+}
+
+verifyOccurencesAtMarker("1", 4);
+verifyOccurencesAtMarker("2", 4);
+verifyOccurencesAtMarker("3", 4);
+verifyOccurencesAtMarker("4", 4);
+verifyOccurencesAtMarker("5", 1);
+verifyOccurencesAtMarker("6", 3);
+verifyOccurencesAtMarker("7", 3);
\ No newline at end of file
diff --git a/tests/cases/fourslash/getOccurrencesSetAndGet.ts b/tests/cases/fourslash/getOccurrencesSetAndGet.ts
new file mode 100644
index 00000000000..b1ab6f44c6b
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesSetAndGet.ts
@@ -0,0 +1,34 @@
+///
+
+////class Foo {
+//// [|set|] bar(b: any) {
+//// }
+////
+//// public [|get|] bar(): any {
+//// return undefined;
+//// }
+////
+//// public set set(s: any) {
+//// }
+////
+//// public get set(): any {
+//// return undefined;
+//// }
+////
+//// public set get(g: any) {
+//// }
+////
+//// public get get(): any {
+//// return undefined;
+//// }
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
diff --git a/tests/cases/fourslash/getOccurrencesSetAndGet2.ts b/tests/cases/fourslash/getOccurrencesSetAndGet2.ts
new file mode 100644
index 00000000000..1345394b8ee
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesSetAndGet2.ts
@@ -0,0 +1,34 @@
+///
+
+////class Foo {
+//// set bar(b: any) {
+//// }
+////
+//// public get bar(): any {
+//// return undefined;
+//// }
+////
+//// public [|set|] set(s: any) {
+//// }
+////
+//// public [|get|] set(): any {
+//// return undefined;
+//// }
+////
+//// public set get(g: any) {
+//// }
+////
+//// public get get(): any {
+//// return undefined;
+//// }
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
diff --git a/tests/cases/fourslash/getOccurrencesSetAndGet3.ts b/tests/cases/fourslash/getOccurrencesSetAndGet3.ts
new file mode 100644
index 00000000000..4105a407571
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesSetAndGet3.ts
@@ -0,0 +1,34 @@
+///
+
+////class Foo {
+//// set bar(b: any) {
+//// }
+////
+//// public get bar(): any {
+//// return undefined;
+//// }
+////
+//// public set set(s: any) {
+//// }
+////
+//// public get set(): any {
+//// return undefined;
+//// }
+////
+//// public [|set|] get(g: any) {
+//// }
+////
+//// public [|get|] get(): any {
+//// return undefined;
+//// }
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
diff --git a/tests/cases/fourslash/getOccurrencesSwitchCaseDefault5.ts b/tests/cases/fourslash/getOccurrencesSwitchCaseDefault5.ts
new file mode 100644
index 00000000000..162c2e1a94f
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesSwitchCaseDefault5.ts
@@ -0,0 +1,40 @@
+///
+
+////switch/*1*/ (10) {
+//// case/*2*/ 1:
+//// case/*3*/ 2:
+//// case/*4*/ 4:
+//// case/*5*/ 8:
+//// foo: switch/*6*/ (20) {
+//// case/*7*/ 1:
+//// case/*8*/ 2:
+//// break/*9*/;
+//// default/*10*/:
+//// break foo;
+//// }
+//// case/*11*/ 0xBEEF:
+//// default/*12*/:
+//// break/*13*/;
+//// case 16/*14*/:
+////}
+
+function verifyOccurencesAtMarker(marker: string, count: number) {
+ goTo.marker(marker);
+ verify.occurrencesAtPositionCount(count);
+}
+
+verifyOccurencesAtMarker("1", 9);
+verifyOccurencesAtMarker("2", 9);
+verifyOccurencesAtMarker("3", 9);
+verifyOccurencesAtMarker("4", 9);
+verifyOccurencesAtMarker("5", 9);
+verifyOccurencesAtMarker("6", 6);
+verifyOccurencesAtMarker("7", 6);
+verifyOccurencesAtMarker("8", 6);
+verifyOccurencesAtMarker("9", 6);
+verifyOccurencesAtMarker("10", 6);
+verifyOccurencesAtMarker("11", 9);
+verifyOccurencesAtMarker("12", 9);
+verifyOccurencesAtMarker("13", 9);
+verifyOccurencesAtMarker("14", 0);
+
diff --git a/tests/cases/fourslash/getOccurrencesSwitchCaseDefaultNegatives.ts b/tests/cases/fourslash/getOccurrencesSwitchCaseDefaultNegatives.ts
deleted file mode 100644
index cfb70b0c11a..00000000000
--- a/tests/cases/fourslash/getOccurrencesSwitchCaseDefaultNegatives.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-///
-
-////switch/*1*/ (10) {
-//// case/*2*/ 1:
-//// case/*3*/ 2:
-//// case/*4*/ 4:
-//// case/*5*/ 8:
-//// foo: switch/*6*/ (20) {
-//// case/*7*/ 1:
-//// case/*8*/ 2:
-//// break/*9*/;
-//// default/*10*/:
-//// break foo;
-//// }
-//// case/*11*/ 0xBEEF:
-//// default/*12*/:
-//// break/*13*/;
-//// case 16/*14*/:
-////}
-
-
-for (var i = 1; i <= test.markers().length; i++) {
- goTo.marker("" + i);
- verify.occurrencesAtPositionCount(0);
-}
diff --git a/tests/cases/fourslash/getOccurrencesThisNegatives.ts b/tests/cases/fourslash/getOccurrencesThis6.ts
similarity index 85%
rename from tests/cases/fourslash/getOccurrencesThisNegatives.ts
rename to tests/cases/fourslash/getOccurrencesThis6.ts
index 95c676e0add..6ff779c0b46 100644
--- a/tests/cases/fourslash/getOccurrencesThisNegatives.ts
+++ b/tests/cases/fourslash/getOccurrencesThis6.ts
@@ -142,8 +142,14 @@
////}
-test.markers().forEach(m => {
- goTo.position(m.position, m.fileName)
+function verifyOccurencesAtMarker(marker: string, count: number) {
+ goTo.marker(marker);
+ verify.occurrencesAtPositionCount(count);
+}
- verify.occurrencesAtPositionCount(0);
-});
\ No newline at end of file
+verifyOccurencesAtMarker("1", 2);
+verifyOccurencesAtMarker("2", 6);
+verifyOccurencesAtMarker("3", 1);
+verifyOccurencesAtMarker("4", 1);
+verifyOccurencesAtMarker("5", 1);
+verifyOccurencesAtMarker("6", 0);
\ No newline at end of file
diff --git a/tests/cases/fourslash/getOccurrencesThrow.ts b/tests/cases/fourslash/getOccurrencesThrow.ts
new file mode 100644
index 00000000000..c25551db92e
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow.ts
@@ -0,0 +1,58 @@
+///
+
+////function f(a: number) {
+//// try {
+//// throw "Hello";
+////
+//// try {
+//// throw 10;
+//// }
+//// catch (x) {
+//// [|return|] 100;
+//// }
+//// finally {
+//// throw 10;
+//// }
+//// }
+//// catch (x) {
+//// [|throw|] "Something";
+//// }
+//// finally {
+//// [|throw|] "Also something";
+//// }
+//// if (a > 0) {
+//// [|return|] (function () {
+//// return;
+//// return;
+//// return;
+////
+//// if (false) {
+//// return true;
+//// }
+//// throw "Hello!";
+//// })() || true;
+//// }
+////
+//// [|th/**/row|] 10;
+////
+//// var unusued = [1, 2, 3, 4].map(x => { throw 4 })
+////
+//// [|return|];
+//// [|return|] true;
+//// [|throw|] false;
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
+goTo.marker();
+test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+});
diff --git a/tests/cases/fourslash/getOccurrencesThrow2.ts b/tests/cases/fourslash/getOccurrencesThrow2.ts
new file mode 100644
index 00000000000..99e18020396
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow2.ts
@@ -0,0 +1,58 @@
+///
+
+////function f(a: number) {
+//// try {
+//// throw "Hello";
+////
+//// try {
+//// [|t/**/hrow|] 10;
+//// }
+//// catch (x) {
+//// return 100;
+//// }
+//// finally {
+//// throw 10;
+//// }
+//// }
+//// catch (x) {
+//// throw "Something";
+//// }
+//// finally {
+//// throw "Also something";
+//// }
+//// if (a > 0) {
+//// return (function () {
+//// return;
+//// return;
+//// return;
+////
+//// if (false) {
+//// return true;
+//// }
+//// throw "Hello!";
+//// })() || true;
+//// }
+////
+//// throw 10;
+////
+//// var unusued = [1, 2, 3, 4].map(x => { throw 4 })
+////
+//// return;
+//// return true;
+//// throw false;
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
+goTo.marker();
+test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+});
diff --git a/tests/cases/fourslash/getOccurrencesThrow3.ts b/tests/cases/fourslash/getOccurrencesThrow3.ts
new file mode 100644
index 00000000000..313d04b8e38
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow3.ts
@@ -0,0 +1,58 @@
+///
+
+////function f(a: number) {
+//// try {
+//// [|throw|] "Hello";
+////
+//// try {
+//// throw 10;
+//// }
+//// catch (x) {
+//// return 100;
+//// }
+//// finally {
+//// [|thr/**/ow|] 10;
+//// }
+//// }
+//// catch (x) {
+//// throw "Something";
+//// }
+//// finally {
+//// throw "Also something";
+//// }
+//// if (a > 0) {
+//// return (function () {
+//// return;
+//// return;
+//// return;
+////
+//// if (false) {
+//// return true;
+//// }
+//// throw "Hello!";
+//// })() || true;
+//// }
+////
+//// throw 10;
+////
+//// var unusued = [1, 2, 3, 4].map(x => { throw 4 })
+////
+//// return;
+//// return true;
+//// throw false;
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
+goTo.marker();
+test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+});
diff --git a/tests/cases/fourslash/getOccurrencesThrow4.ts b/tests/cases/fourslash/getOccurrencesThrow4.ts
new file mode 100644
index 00000000000..adf321526af
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow4.ts
@@ -0,0 +1,58 @@
+///
+
+////function f(a: number) {
+//// try {
+//// throw "Hello";
+////
+//// try {
+//// throw 10;
+//// }
+//// catch (x) {
+//// return 100;
+//// }
+//// finally {
+//// throw 10;
+//// }
+//// }
+//// catch (x) {
+//// throw "Something";
+//// }
+//// finally {
+//// throw "Also something";
+//// }
+//// if (a > 0) {
+//// return (function () {
+//// [|return|];
+//// [|return|];
+//// [|return|];
+////
+//// if (false) {
+//// [|return|] true;
+//// }
+//// [|th/**/row|] "Hello!";
+//// })() || true;
+//// }
+////
+//// throw 10;
+////
+//// var unusued = [1, 2, 3, 4].map(x => { throw 4 })
+////
+//// return;
+//// return true;
+//// throw false;
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
+goTo.marker();
+test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+});
diff --git a/tests/cases/fourslash/getOccurrencesThrow5.ts b/tests/cases/fourslash/getOccurrencesThrow5.ts
new file mode 100644
index 00000000000..3e5ba4bca13
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow5.ts
@@ -0,0 +1,58 @@
+///
+
+////function f(a: number) {
+//// try {
+//// throw "Hello";
+////
+//// try {
+//// throw 10;
+//// }
+//// catch (x) {
+//// return 100;
+//// }
+//// finally {
+//// throw 10;
+//// }
+//// }
+//// catch (x) {
+//// throw "Something";
+//// }
+//// finally {
+//// throw "Also something";
+//// }
+//// if (a > 0) {
+//// return (function () {
+//// return;
+//// return;
+//// return;
+////
+//// if (false) {
+//// return true;
+//// }
+//// throw "Hello!";
+//// })() || true;
+//// }
+////
+//// throw 10;
+////
+//// var unusued = [1, 2, 3, 4].map(x => { [|thr/**/ow|] 4 })
+////
+//// return;
+//// return true;
+//// throw false;
+////}
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
+goTo.marker();
+test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+});
diff --git a/tests/cases/fourslash/getOccurrencesThrow6.ts b/tests/cases/fourslash/getOccurrencesThrow6.ts
new file mode 100644
index 00000000000..2769c9933db
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow6.ts
@@ -0,0 +1,28 @@
+///
+
+////[|throw|] 100;
+////
+////try {
+//// throw 0;
+//// var x = () => { throw 0; };
+////}
+////catch (y) {
+//// var x = () => { throw 0; };
+//// [|throw|] 200;
+////}
+////finally {
+//// [|throw|] 300;
+////}
+
+
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
diff --git a/tests/cases/fourslash/getOccurrencesThrow7.ts b/tests/cases/fourslash/getOccurrencesThrow7.ts
new file mode 100644
index 00000000000..46e899a891b
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow7.ts
@@ -0,0 +1,31 @@
+///
+
+////try {
+//// [|throw|] 10;
+////
+//// try {
+//// throw 10;
+//// }
+//// catch (x) {
+//// [|throw|] 10;
+//// }
+//// finally {
+//// [|throw|] 10;
+//// }
+////}
+////finally {
+//// [|throw|] 10;
+////}
+////
+////[|throw|] 10;
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
diff --git a/tests/cases/fourslash/getOccurrencesThrow8.ts b/tests/cases/fourslash/getOccurrencesThrow8.ts
new file mode 100644
index 00000000000..679e13c8d5a
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesThrow8.ts
@@ -0,0 +1,31 @@
+///
+
+////try {
+//// throw 10;
+////
+//// try {
+//// [|throw|] 10;
+//// }
+//// catch (x) {
+//// throw 10;
+//// }
+//// finally {
+//// throw 10;
+//// }
+////}
+////finally {
+//// throw 10;
+////}
+////
+////throw 10;
+
+test.ranges().forEach(r => {
+ goTo.position(r.start);
+
+ test.ranges().forEach(range => {
+ verify.occurrencesAtPositionContains(range, false);
+ });
+
+ verify.occurrencesAtPositionCount(test.ranges().length);
+});
+
diff --git a/tests/cases/fourslash/getOccurrencesTryCatchFinally4.ts b/tests/cases/fourslash/getOccurrencesTryCatchFinally4.ts
new file mode 100644
index 00000000000..dc6b0540312
--- /dev/null
+++ b/tests/cases/fourslash/getOccurrencesTryCatchFinally4.ts
@@ -0,0 +1,30 @@
+///
+
+////try/*1*/ {
+//// try/*2*/ {
+//// }
+//// catch/*3*/ (x) {
+//// }
+////
+//// try/*4*/ {
+//// }
+//// finally/*5*/ {/*8*/
+//// }
+////}
+////catch/*6*/ (e) {
+////}
+////finally/*7*/ {
+////}
+function verifyOccurencesAtMarker(marker: string, count: number) {
+ goTo.marker(marker);
+ verify.occurrencesAtPositionCount(count);
+}
+
+verifyOccurencesAtMarker("1", 3);
+verifyOccurencesAtMarker("2", 2);
+verifyOccurencesAtMarker("3", 2);
+verifyOccurencesAtMarker("4", 2);
+verifyOccurencesAtMarker("5", 2);
+verifyOccurencesAtMarker("6", 3);
+verifyOccurencesAtMarker("7", 3);
+verifyOccurencesAtMarker("8", 0);
\ No newline at end of file
diff --git a/tests/cases/fourslash/getOccurrencesTryCatchFinallyNegatives.ts b/tests/cases/fourslash/getOccurrencesTryCatchFinallyNegatives.ts
deleted file mode 100644
index d5889ff84e9..00000000000
--- a/tests/cases/fourslash/getOccurrencesTryCatchFinallyNegatives.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-///
-
-////try/*1*/ {
-//// try/*2*/ {
-//// }
-//// catch/*3*/ (x) {
-//// }
-////
-//// try/*4*/ {
-//// }
-//// finally/*5*/ {/*8*/
-//// }
-////}
-////catch/*6*/ (e) {
-////}
-////finally/*7*/ {
-////}
-
-
-for (var i = 1; i <= test.markers().length; i++) {
- goTo.marker("" + i);
- verify.occurrencesAtPositionCount(0);
-}
\ No newline at end of file
diff --git a/tests/cases/fourslash/goToDefinitionSimple.ts b/tests/cases/fourslash/goToDefinitionSimple.ts
index f931610aa2a..47c1909cf12 100644
--- a/tests/cases/fourslash/goToDefinitionSimple.ts
+++ b/tests/cases/fourslash/goToDefinitionSimple.ts
@@ -5,7 +5,12 @@
// @Filename: Consumption.ts
//// var n = new /*1*/c();
+//// var n = new c/*3*/();
goTo.marker('1');
goTo.definition();
verify.caretAtMarker('2');
+
+goTo.marker('3');
+goTo.definition();
+verify.caretAtMarker('2');
diff --git a/tests/cases/fourslash/inheritedModuleMembersForClodule2.ts b/tests/cases/fourslash/inheritedModuleMembersForClodule2.ts
index 2be62b045c2..7380936d6b2 100644
--- a/tests/cases/fourslash/inheritedModuleMembersForClodule2.ts
+++ b/tests/cases/fourslash/inheritedModuleMembersForClodule2.ts
@@ -14,4 +14,4 @@
goTo.marker();
verify.quickInfoExists();
-verify.numberOfErrorsInCurrentFile(2);
\ No newline at end of file
+verify.numberOfErrorsInCurrentFile(4);
\ No newline at end of file
diff --git a/tests/cases/fourslash/insertReturnStatementInDuplicateIdentifierFunction.ts b/tests/cases/fourslash/insertReturnStatementInDuplicateIdentifierFunction.ts
index a5fd6623610..8abdac6d206 100644
--- a/tests/cases/fourslash/insertReturnStatementInDuplicateIdentifierFunction.ts
+++ b/tests/cases/fourslash/insertReturnStatementInDuplicateIdentifierFunction.ts
@@ -6,9 +6,9 @@
goTo.marker();
// One error: duplicate identifier 'foo'
-verify.numberOfErrorsInCurrentFile(1);
+verify.numberOfErrorsInCurrentFile(2);
// Shouldn't change the number of errors
edit.insert('return null;');
-verify.numberOfErrorsInCurrentFile(1);
+verify.numberOfErrorsInCurrentFile(2);
diff --git a/tests/cases/fourslash/navbar_contains-no-duplicates.ts b/tests/cases/fourslash/navbar_contains-no-duplicates.ts
index 4334d30229f..49d570ed770 100644
--- a/tests/cases/fourslash/navbar_contains-no-duplicates.ts
+++ b/tests/cases/fourslash/navbar_contains-no-duplicates.ts
@@ -27,7 +27,6 @@
//// export var {| "itemName": "x", "kind": "var" |}x = 3;
//// }
-verify.getScriptLexicalStructureListCount(12);
test.markers().forEach(marker => {
if (marker.data) {
verify.getScriptLexicalStructureListContains(
@@ -39,3 +38,4 @@ test.markers().forEach(marker => {
marker.position);
}
});
+verify.getScriptLexicalStructureListCount(12);
\ No newline at end of file
diff --git a/tests/cases/fourslash/navigationItemsOverloads1.ts b/tests/cases/fourslash/navigationItemsOverloads1.ts
new file mode 100644
index 00000000000..5f1981fe917
--- /dev/null
+++ b/tests/cases/fourslash/navigationItemsOverloads1.ts
@@ -0,0 +1,30 @@
+///
+
+////function overload(a: string): boolean;
+////function overload(b: boolean): boolean;
+////function overload(b: number): boolean;
+////function overload(f: typeof overload): boolean;
+////function overload(x: any, b = (function overload() { return false })): boolean {
+//// throw overload;
+////}
+////
+////interface I {
+//// interfaceMethodSignature(a: string): boolean;
+//// interfaceMethodSignature(b: boolean): boolean;
+//// interfaceMethodSignature(b: number): boolean;
+//// interfaceMethodSignature(f: I): boolean;
+////}
+////
+////class C {
+//// methodOverload(a: string): boolean;
+//// methodOverload(b: boolean): boolean;
+//// methodOverload(b: number): boolean;
+//// methodOverload(f: I): boolean;
+//// methodOverload(x: any, b = (function overload() { return false })): boolean {
+//// throw C;
+//// }
+////}
+
+verify.navigationItemsListCount(1, "overload", "exact");
+verify.navigationItemsListCount(1, "interfaceMethodSignature", "exact");
+verify.navigationItemsListCount(1, "methodOverload", "exact");
diff --git a/tests/cases/fourslash/navigationItemsOverloads2.ts b/tests/cases/fourslash/navigationItemsOverloads2.ts
new file mode 100644
index 00000000000..c5824b639bc
--- /dev/null
+++ b/tests/cases/fourslash/navigationItemsOverloads2.ts
@@ -0,0 +1,12 @@
+///
+
+////interface I {
+//// interfaceMethodSignature(a: string): boolean;
+//// interfaceMethodSignature(b: number): boolean;
+//// interfaceMethodSignature(f: I): boolean;
+////}
+////interface I {
+//// interfaceMethodSignature(b: boolean): boolean;
+////}
+
+verify.navigationItemsListCount(2, "interfaceMethodSignature", "exact");
diff --git a/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts b/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts
new file mode 100644
index 00000000000..7b8ebc9181f
--- /dev/null
+++ b/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts
@@ -0,0 +1,29 @@
+///
+
+////function overload1(a: string): boolean;
+////function overload1(b: boolean): boolean;
+////function overload1(b: number): boolean;
+////
+////var heyImNotInterruptingAnythingAmI = '?';
+////
+////function overload1(f: typeof overload): boolean;
+////function overload1(x: any, b = (function overload() { return false })): boolean {
+//// throw overload;
+////}
+
+////function overload2(a: string): boolean;
+////function overload2(b: boolean): boolean;
+////function overload2(b: number): boolean;
+////
+////function iJustRuinEverything(x: any, b = (function overload() { return false })): boolean {
+//// throw overload;
+////}
+////
+////function overload2(f: typeof overload): boolean;
+////function overload2(x: any, b = (function overload() { return false })): boolean {
+//// throw overload;
+////}
+
+verify.navigationItemsListCount(2, "overload1", "exact");
+verify.navigationItemsListCount(2, "overload2", "exact");
+verify.navigationItemsListCount(4, "overload", "prefix");
\ No newline at end of file
diff --git a/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts b/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts
new file mode 100644
index 00000000000..c1f6ccae2f5
--- /dev/null
+++ b/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts
@@ -0,0 +1,23 @@
+///
+
+////function overload1(a: string): boolean;
+////function overload1(b: boolean): boolean;
+////function overload1(x: any, b = (function overload() { return false })): boolean {
+//// throw overload1;
+////}
+////function overload1(b: number): boolean;
+////function overload1(f: typeof overload): boolean;
+
+////function overload2(a: string): boolean;
+////function overload2(b: boolean): boolean;
+////function overload2(x: any, b = (function overload() { return false })): boolean {
+//// function overload2(): boolean;
+//// function overload2(x: any): boolean;
+//// throw overload2;
+////}
+////function overload2(b: number): boolean;
+////function overload2(f: typeof overload): boolean;
+
+verify.navigationItemsListCount(1, "overload1", "exact");
+verify.navigationItemsListCount(3, "overload2", "exact");
+verify.navigationItemsListCount(4, "overload", "prefix");
\ No newline at end of file
diff --git a/tests/cases/fourslash/renameCommentsAndStrings1.ts b/tests/cases/fourslash/renameCommentsAndStrings1.ts
new file mode 100644
index 00000000000..b5c8ac6aacc
--- /dev/null
+++ b/tests/cases/fourslash/renameCommentsAndStrings1.ts
@@ -0,0 +1,11 @@
+///
+
+///////
+
+////function /**/[|Bar|]() {
+//// // This is a reference to Bar in a comment.
+//// "this is a reference to Bar in a string"
+////}
+
+goTo.marker();
+verify.renameLocations(/*findInStrings:*/ false, /*findInComments:*/ false);
\ No newline at end of file
diff --git a/tests/cases/fourslash/renameCommentsAndStrings2.ts b/tests/cases/fourslash/renameCommentsAndStrings2.ts
new file mode 100644
index 00000000000..590f3a0833f
--- /dev/null
+++ b/tests/cases/fourslash/renameCommentsAndStrings2.ts
@@ -0,0 +1,11 @@
+///
+
+///////
+
+////function /**/[|Bar|]() {
+//// // This is a reference to Bar in a comment.
+//// "this is a reference to [|Bar|] in a string"
+////}
+
+goTo.marker();
+verify.renameLocations(/*findInStrings:*/ true, /*findInComments:*/ false);
\ No newline at end of file
diff --git a/tests/cases/fourslash/renameCommentsAndStrings3.ts b/tests/cases/fourslash/renameCommentsAndStrings3.ts
new file mode 100644
index 00000000000..5f1aa09a948
--- /dev/null
+++ b/tests/cases/fourslash/renameCommentsAndStrings3.ts
@@ -0,0 +1,11 @@
+///
+
+///////
+
+////function /**/[|Bar|]() {
+//// // This is a reference to [|Bar|] in a comment.
+//// "this is a reference to Bar in a string"
+////}
+
+goTo.marker();
+verify.renameLocations(/*findInStrings:*/ false, /*findInComments:*/ true);
\ No newline at end of file
diff --git a/tests/cases/fourslash/renameCommentsAndStrings4.ts b/tests/cases/fourslash/renameCommentsAndStrings4.ts
new file mode 100644
index 00000000000..4f8b7b98cd4
--- /dev/null
+++ b/tests/cases/fourslash/renameCommentsAndStrings4.ts
@@ -0,0 +1,11 @@
+///
+
+///////
+
+////function /**/[|Bar|]() {
+//// // This is a reference to [|Bar|] in a comment.
+//// "this is a reference to [|Bar|] in a string"
+////}
+
+goTo.marker();
+verify.renameLocations(/*findInStrings:*/ true, /*findInComments:*/ true);
\ No newline at end of file
diff --git a/tests/cases/fourslash/renameNameOnEnumMember.ts b/tests/cases/fourslash/renameNameOnEnumMember.ts
new file mode 100644
index 00000000000..155c293cc84
--- /dev/null
+++ b/tests/cases/fourslash/renameNameOnEnumMember.ts
@@ -0,0 +1,11 @@
+///
+
+////enum e {
+//// firstMember,
+//// secondMember,
+//// thirdMember
+////}
+////var enumMember = e.[|/**/thirdMember|];
+
+goTo.marker("");
+verify.renameInfoSucceeded("thirdMember", "e.thirdMember");
\ No newline at end of file
diff --git a/tests/cases/fourslash/scriptLexicalStructureFunctions.ts b/tests/cases/fourslash/scriptLexicalStructureFunctions.ts
new file mode 100644
index 00000000000..b683790c60d
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureFunctions.ts
@@ -0,0 +1,23 @@
+///
+
+////{| "itemName": "", "kind": "module" |}
+////
+////{| "itemName": "foo", "kind": "function" |}function foo() {
+//// var x = 10;
+//// {| "itemName": "bar", "kind": "function", "parentName": "foo" |}function bar() {
+//// var y = 10;
+//// {| "itemName": "biz", "kind": "function", "parentName": "bar" |}function biz() {
+//// var z = 10;
+//// }
+//// }
+////}
+////
+////{| "itemName": "baz", "kind": "function", "parentName": "" |}function baz() {
+//// var v = 10;
+////}
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+verify.getScriptLexicalStructureListCount(8); // 4 functions + global. Note: there are 8 because of the functions show up at the top level and as child items.
diff --git a/tests/cases/fourslash/scriptLexicalStructureFunctionsBroken.ts b/tests/cases/fourslash/scriptLexicalStructureFunctionsBroken.ts
new file mode 100644
index 00000000000..7846a9723d1
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureFunctionsBroken.ts
@@ -0,0 +1,12 @@
+///
+
+////{| "itemName": "f", "kind": "function" |}
+////function f() {
+//// function;
+////}
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+verify.getScriptLexicalStructureListCount(3); // and 'f'.
\ No newline at end of file
diff --git a/tests/cases/fourslash/scriptLexicalStructureFunctionsBroken2.ts b/tests/cases/fourslash/scriptLexicalStructureFunctionsBroken2.ts
new file mode 100644
index 00000000000..50bf91e02d6
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureFunctionsBroken2.ts
@@ -0,0 +1,13 @@
+///
+
+////function;
+////{| "itemName": "f", "kind": "function" |}
+////function f() {
+//// function;
+////}
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+verify.getScriptLexicalStructureListCount(3); // and 'f'
\ No newline at end of file
diff --git a/tests/cases/fourslash/scriptLexicalStructureItems.ts b/tests/cases/fourslash/scriptLexicalStructureItems.ts
index 025fd223fb9..e18f49c1db9 100644
--- a/tests/cases/fourslash/scriptLexicalStructureItems.ts
+++ b/tests/cases/fourslash/scriptLexicalStructureItems.ts
@@ -49,3 +49,4 @@ test.markers().forEach((marker) => {
}
});
+verify.getScriptLexicalStructureListCount(23);
diff --git a/tests/cases/fourslash_old/scriptLexicalStructureItemsContainsNoAnonymouseFunctions.ts b/tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts
similarity index 95%
rename from tests/cases/fourslash_old/scriptLexicalStructureItemsContainsNoAnonymouseFunctions.ts
rename to tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts
index 2c8ef5825db..a4086450176 100644
--- a/tests/cases/fourslash_old/scriptLexicalStructureItemsContainsNoAnonymouseFunctions.ts
+++ b/tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts
@@ -28,7 +28,7 @@
////}
////function bar() {
////}
-debugger;
+
goTo.marker("file1");
verify.getScriptLexicalStructureListCount(0);
@@ -41,4 +41,4 @@ goTo.marker("file3");
verify.getScriptLexicalStructureListContains("", "module");
verify.getScriptLexicalStructureListContains("foo", "function");
verify.getScriptLexicalStructureListContains("bar", "function");
-verify.getScriptLexicalStructureListCount(3);
\ No newline at end of file
+verify.getScriptLexicalStructureListCount(5);
\ No newline at end of file
diff --git a/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules.ts b/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules.ts
index dd8f64d87a2..550f1aed783 100644
--- a/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules.ts
+++ b/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules.ts
@@ -4,8 +4,8 @@
//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string;
////}
-verify.getScriptLexicalStructureListCount(2); // external module node + class + property
-
test.markers().forEach((marker) => {
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
+
+verify.getScriptLexicalStructureListCount(2); // external module node + class + property
diff --git a/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules2.ts b/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules2.ts
new file mode 100644
index 00000000000..b0bf6eb3fa2
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules2.ts
@@ -0,0 +1,15 @@
+///
+
+// @Filename: test/file.ts
+////{| "itemName": "Bar", "kind": "class" |}export class Bar {
+//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string;
+////}
+////{| "itemName": "\"file\"", "kind": "module" |}
+////{| "itemName": "x", "kind": "var", "parentName": "\"file\"" |}
+////export var x: number;
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+verify.getScriptLexicalStructureListCount(4); // external module node + variable in module + class + property
diff --git a/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules3.ts b/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules3.ts
new file mode 100644
index 00000000000..9ef49e38776
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureItemsExternalModules3.ts
@@ -0,0 +1,15 @@
+///
+
+// @Filename: test/my fil"e.ts
+////{| "itemName": "Bar", "kind": "class" |}export class Bar {
+//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string;
+////}
+////{| "itemName": "\"my fil\\\"e\"", "kind": "module" |}
+////{| "itemName": "x", "kind": "var", "parentName": "\"file\"" |}
+////export var x: number;
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+verify.getScriptLexicalStructureListCount(4); // external module node + variable in module + class + property
diff --git a/tests/cases/fourslash_old/scriptLexicalStructureItemsModuleVariables.ts b/tests/cases/fourslash/scriptLexicalStructureItemsModuleVariables.ts
similarity index 100%
rename from tests/cases/fourslash_old/scriptLexicalStructureItemsModuleVariables.ts
rename to tests/cases/fourslash/scriptLexicalStructureItemsModuleVariables.ts
diff --git a/tests/cases/fourslash/scriptLexicalStructureModules.ts b/tests/cases/fourslash/scriptLexicalStructureModules.ts
new file mode 100644
index 00000000000..ee0f91cc73c
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureModules.ts
@@ -0,0 +1,48 @@
+
+////{| "itemName": "\"X.Y.Z\"", "kind": "module" |}
+////declare module "X.Y.Z" {
+////}
+////
+////{| "itemName": "'X2.Y2.Z2'", "kind": "module" |}
+////declare module 'X2.Y2.Z2' {
+////}
+////
+////{| "itemName": "A.B.C", "kind": "module" |}
+////module A.B.C {
+//// {| "itemName": "x", "kind": "var", "parentName": "A.B.C" |}
+//// export var x;
+////}
+////
+////{| "itemName": "A.B", "kind": "module" |}
+////module A.B {
+//// {| "itemName": "y", "kind": "var", "parentName": "A.B" |}
+//// export var y;
+////}
+////
+////{| "itemName": "A", "kind": "module" |}
+////module A {
+//// {| "itemName": "z", "kind": "var", "parentName": "A" |}
+//// export var z;
+////}
+////
+////{| "itemName": "A", "kind": "module" |}
+////module A {
+//// {| "itemName": "B", "kind": "module", "parentName": "E" |}
+//// module B {
+//// {| "itemName": "C", "kind": "module", "parentName": "F" |}
+//// module C {
+//// {| "itemName": "x", "kind": "var", "parentName": "C" |}
+//// declare var x;
+//// }
+//// }
+////}
+
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+/// We have 8 module keywords, and 4 var keywords.
+/// The declarations of A.B.C.x do not get merged, so the 4 vars are independent.
+/// The two 'A' modules, however, do get merged, so in reality we have 7 modules.
+verify.getScriptLexicalStructureListCount(11);
diff --git a/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts b/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts
new file mode 100644
index 00000000000..796a4caa2d8
--- /dev/null
+++ b/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts
@@ -0,0 +1,41 @@
+
+////{| "itemName": "\"Multiline\\r\\nMadness\"", "kind": "module" |}
+////declare module "Multiline\r\nMadness" {
+////}
+////
+////{| "itemName": "\"Multiline\\\nMadness\"", "kind": "module" |}
+////declare module "Multiline\
+////Madness" {
+////}
+////{| "itemName": "\"MultilineMadness\"", "kind": "module" |}
+////declare module "MultilineMadness" {}
+////
+////{| "itemName": "Foo", "kind": "interface" |}
+////interface Foo {
+//// {| "itemName": "\"a1\\\\\\r\\nb\"", "kind": "property", "parentName": "Foo" |}
+//// "a1\\\r\nb";
+//// {| "itemName": "\"a2\\\n \\\n b\"", "kind": "method", "parentName": "Foo" |}
+//// "a2\
+//// \
+//// b"(): Foo;
+////}
+////
+////{| "itemName": "Bar", "kind": "class" |}
+////class Bar implements Foo {
+//// {| "itemName": "'a1\\\\\\r\\nb'", "kind": "property", "parentName": "Bar" |}
+//// 'a1\\\r\nb': Foo;
+////
+//// {| "itemName": "'a2\\\n \\\n b'", "kind": "method", "parentName": "Bar" |}
+//// 'a2\
+//// \
+//// b'(): Foo {
+//// return this;
+//// }
+////}
+
+
+test.markers().forEach((marker) => {
+ verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
+});
+
+verify.getScriptLexicalStructureListCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules
\ No newline at end of file
diff --git a/tests/cases/fourslash/semanticClassification1.ts b/tests/cases/fourslash/semanticClassification1.ts
index 0a0cc68250e..ad9e88ea842 100644
--- a/tests/cases/fourslash/semanticClassification1.ts
+++ b/tests/cases/fourslash/semanticClassification1.ts
@@ -6,7 +6,6 @@
//// }
//// interface X extends M.I { }
-debugger;
var c = classification;
verify.semanticClassificationsAre(
c.moduleName("M"), c.interfaceName("I"), c.interfaceName("X"), c.moduleName("M"), c.interfaceName("I"));
diff --git a/tests/cases/fourslash/semanticClassification2.ts b/tests/cases/fourslash/semanticClassification2.ts
new file mode 100644
index 00000000000..810636dba3e
--- /dev/null
+++ b/tests/cases/fourslash/semanticClassification2.ts
@@ -0,0 +1,11 @@
+///
+
+//// interface Thing {
+//// toExponential(): number;
+//// }
+////
+//// var Thing = 0;
+//// Thing.toExponential();
+
+var c = classification;
+verify.semanticClassificationsAre(c.interfaceName("Thing"));
\ No newline at end of file
diff --git a/tests/cases/fourslash/signatureHelpOnOverloads.ts b/tests/cases/fourslash/signatureHelpOnOverloads.ts
index 83d7b75a4cf..9712c9dc301 100644
--- a/tests/cases/fourslash/signatureHelpOnOverloads.ts
+++ b/tests/cases/fourslash/signatureHelpOnOverloads.ts
@@ -13,6 +13,6 @@ verify.currentParameterSpanIs("x: string");
edit.insert("'',");
verify.signatureHelpCountIs(2);
-// verify.currentSignatureHelpIs("fn(x: string, y: number): any");
-// verify.currentParameterHelpArgumentNameIs("y");
-// verify.currentParameterSpanIs("y: number");
+verify.currentSignatureHelpIs("fn(x: string, y: number): any");
+verify.currentParameterHelpArgumentNameIs("y");
+verify.currentParameterSpanIs("y: number");
diff --git a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts
new file mode 100644
index 00000000000..fe18f655ed4
--- /dev/null
+++ b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts
@@ -0,0 +1,20 @@
+///
+
+////declare function f(s: string);
+////declare function f(n: number);
+////declare function f(s: string, b: boolean);
+////declare function f(n: number, b: boolean);
+////
+////f(1/**/
+
+goTo.marker();
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(n: number): any");
+verify.currentParameterHelpArgumentNameIs("n");
+verify.currentParameterSpanIs("n: number");
+
+edit.insert(", ");
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(n: number, b: boolean): any");
+verify.currentParameterHelpArgumentNameIs("b");
+verify.currentParameterSpanIs("b: boolean");
\ No newline at end of file
diff --git a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts
new file mode 100644
index 00000000000..1f87f3b9a0c
--- /dev/null
+++ b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts
@@ -0,0 +1,20 @@
+///
+
+////declare function f(s: string);
+////declare function f(n: number);
+////declare function f(s: string, b: boolean);
+////declare function f(n: number, b: boolean);
+////
+////f(1/**/ var
+
+goTo.marker();
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(n: number): any");
+verify.currentParameterHelpArgumentNameIs("n");
+verify.currentParameterSpanIs("n: number");
+
+edit.insert(", ");
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(n: number, b: boolean): any");
+verify.currentParameterHelpArgumentNameIs("b");
+verify.currentParameterSpanIs("b: boolean");
\ No newline at end of file
diff --git a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts
new file mode 100644
index 00000000000..c217a12ef58
--- /dev/null
+++ b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts
@@ -0,0 +1,26 @@
+///
+
+////declare function f();
+////declare function f(s: string);
+////declare function f(s: string, b: boolean);
+////declare function f(n: number, b: boolean);
+////
+////f(/**/
+
+goTo.marker();
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(): any");
+verify.currentSignatureParamterCountIs(0);
+verify.signatureHelpArgumentCountIs(0);
+
+edit.insert(", ");
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(s: string, b: boolean): any");
+verify.currentSignatureParamterCountIs(2);
+verify.currentParameterHelpArgumentNameIs("b");
+verify.currentParameterSpanIs("b: boolean");
+
+edit.insert(", ");
+verify.signatureHelpCountIs(4);
+verify.currentSignatureHelpIs("f(s: string, b: boolean): any");
+verify.currentSignatureParamterCountIs(2);
\ No newline at end of file
diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts
index d89cf702693..ee5350a25eb 100644
--- a/tests/cases/unittests/services/colorization.ts
+++ b/tests/cases/unittests/services/colorization.ts
@@ -217,5 +217,57 @@ describe('Colorization', function () {
keyword("var"),
finalEndOfLineState(ts.EndOfLineState.Start));
});
+
+ it("classifies multiple keywords properly", function () {
+ test("public static",
+ ts.EndOfLineState.Start,
+ keyword("public"),
+ keyword("static"),
+ finalEndOfLineState(ts.EndOfLineState.Start));
+
+ test("public var",
+ ts.EndOfLineState.Start,
+ keyword("public"),
+ identifier("var"),
+ finalEndOfLineState(ts.EndOfLineState.Start));
+ });
+
+ it("classifies partially written generics correctly.", function () {
+ test("Foo number",
+ ts.EndOfLineState.Start,
+ identifier("Foo"),
+ operator("<"),
+ identifier("Foo"),
+ operator(">"
+ identifier("keyword"),
+ finalEndOfLineState(ts.EndOfLineState.Start));
+ });
});
});
\ No newline at end of file