diff --git a/Jakefile b/Jakefile index dc8070fd751..ca1ee20a3ce 100644 --- a/Jakefile +++ b/Jakefile @@ -8,6 +8,7 @@ var child_process = require("child_process"); // Variables var compilerDirectory = "src/compiler/"; var servicesDirectory = "src/services/"; +var serverDirectory = "src/server/"; var harnessDirectory = "src/harness/"; var libraryDirectory = "src/lib/"; var scriptsDirectory = "scripts/"; @@ -64,8 +65,10 @@ var servicesSources = [ return path.join(compilerDirectory, f); }).concat([ "breakpoints.ts", + "navigateTo.ts", "navigationBar.ts", "outliningElementsCollector.ts", + "patternMatcher.ts", "services.ts", "shims.ts", "signatureHelp.ts", @@ -90,6 +93,16 @@ var servicesSources = [ return path.join(servicesDirectory, f); })); +var serverSources = [ + "node.d.ts", + "editorServices.ts", + "protocol.d.ts", + "session.ts", + "server.ts" +].map(function (f) { + return path.join(serverDirectory, f); +}); + var definitionsRoots = [ "compiler/types.d.ts", "compiler/scanner.d.ts", @@ -127,9 +140,17 @@ var harnessSources = [ "incrementalParser.ts", "services/colorization.ts", "services/documentRegistry.ts", - "services/preProcessFile.ts" + "services/preProcessFile.ts", + "services/patternMatcher.ts" ].map(function (f) { return path.join(unittestsDirectory, f); +})).concat([ + "protocol.d.ts", + "session.ts", + "client.ts", + "editorServices.ts", +].map(function (f) { + return path.join(serverDirectory, f); })); var librarySourceMap = [ @@ -327,6 +348,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename); compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false); var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); +var nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, @@ -336,7 +358,10 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca /*preserveConstEnums*/ true, /*keepComments*/ false, /*noResolve*/ false, - /*stripInternal*/ false); + /*stripInternal*/ false, + /*callback*/ function () { + jake.cpR(servicesFile, nodePackageFile, {silent: true}); + }); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); @@ -378,9 +403,12 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright jake.rmRf(tempDirPath, {silent: true}); }); +var serverFile = path.join(builtLocalDirectory, "tsserver.js"); +compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true); + // Local target to build the compiler and services desc("Builds the full compiler and services"); -task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]); +task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile]); // Local target to build only tsc.js desc("Builds only the compiler"); @@ -435,7 +463,7 @@ task("generate-spec", [specMd]) // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() { - var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); + var expectedFiles = [tscFile, servicesFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); var missingFiles = expectedFiles.filter(function (f) { return !fs.existsSync(f); }); @@ -542,7 +570,7 @@ task("runtests", ["tests", builtLocalDirectory], function() { } if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 50000; + testTimeout = 100000; } colors = process.env.colors || process.env.color diff --git a/bin/tsserver b/bin/tsserver new file mode 100644 index 00000000000..003eb0d22af --- /dev/null +++ b/bin/tsserver @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./tsserver.js') diff --git a/package.json b/package.json index 2bd89706606..9261174b68f 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,10 @@ "url": "https://github.com/Microsoft/TypeScript.git" }, "preferGlobal": true, - "main": "./bin/typescriptServices.js", + "main": "./bin/typescript.js", "bin": { - "tsc": "./bin/tsc" + "tsc": "./bin/tsc", + "tsserver": "./bin/tsserver" }, "engines": { "node": ">=0.8.0" diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1f66e797393..11e1ec57fa3 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -51,17 +51,6 @@ module ts { } } - /** - * A declaration has a dynamic name if both of the following are true: - * 1. The declaration has a computed property name - * 2. The computed name is *not* expressed as Symbol., where name - * is a property of the Symbol constructor that denotes a built in - * Symbol. - */ - export function hasDynamicName(declaration: Declaration): boolean { - return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; - } - export function bindSourceFile(file: SourceFile): void { var start = new Date().getTime(); bindSourceFileWorker(file); @@ -98,13 +87,18 @@ module ts { if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node; } - // Should not be called on a declaration with a computed property name. + // Should not be called on a declaration with a computed property name, + // unless it is a well known Symbol. function getDeclarationName(node: Declaration): string { if (node.name) { if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) { return '"' + (node.name).text + '"'; } - Debug.assert(!hasDynamicName(node)); + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (node.name).expression; + Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); + return getPropertyNameForKnownSymbolName((nameExpression).name.text); + } return (node.name).text; } switch (node.kind) { @@ -496,6 +490,7 @@ module ts { case SyntaxKind.CatchClause: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.SwitchStatement: bindChildren(node, 0, /*isBlockScopeContainer*/ true); break; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e7723e7cbae..42dfa92f494 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -67,6 +67,7 @@ module ts { var stringType = createIntrinsicType(TypeFlags.String, "string"); var numberType = createIntrinsicType(TypeFlags.Number, "number"); var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); + var esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); var voidType = createIntrinsicType(TypeFlags.Void, "void"); var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); @@ -84,6 +85,7 @@ module ts { var globals: SymbolTable = {}; var globalArraySymbol: Symbol; + var globalESSymbolConstructorSymbol: Symbol; var globalObjectType: ObjectType; var globalFunctionType: ObjectType; @@ -93,6 +95,7 @@ module ts { var globalBooleanType: ObjectType; var globalRegExpType: ObjectType; var globalTemplateStringsArrayType: ObjectType; + var globalESSymbolType: ObjectType; var anyArrayType: Type; @@ -120,6 +123,10 @@ module ts { "boolean": { type: booleanType, flags: TypeFlags.Boolean + }, + "symbol": { + type: esSymbolType, + flags: TypeFlags.ESSymbol } }; @@ -706,9 +713,15 @@ module ts { return type; } - // A reserved member name starts with two underscores followed by a non-underscore + // A reserved member name starts with two underscores, but the third character cannot be an underscore + // or the @ symbol. A third underscore indicates an escaped form of an identifer that started + // with at least two underscores. The @ character indicates that the name is denoted by a well known ES + // Symbol instance. function isReservedMemberName(name: string) { - return name.charCodeAt(0) === CharacterCodes._ && name.charCodeAt(1) === CharacterCodes._ && name.charCodeAt(2) !== CharacterCodes._; + return name.charCodeAt(0) === CharacterCodes._ && + name.charCodeAt(1) === CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes.at; } function getNamedMembers(members: SymbolTable): Symbol[] { @@ -1708,8 +1721,8 @@ module ts { } } else { - // For an array binding element the specified or inferred type of the parent must be assignable to any[] - if (!isTypeAssignableTo(parentType, anyArrayType)) { + // For an array binding element the specified or inferred type of the parent must be an array-like type + if (!isArrayLikeType(parentType)) { error(pattern, Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } @@ -2489,9 +2502,9 @@ module ts { return getPropertiesOfObjectType(getApparentType(type)); } - // For a type parameter, return the base constraint of the type parameter. For the string, number, and - // boolean primitive types, return the corresponding object types.Otherwise return the type itself. - // Note that the apparent type of a union type is the union type itself. + // For a type parameter, return the base constraint of the type parameter. For the string, number, + // boolean, and symbol primitive types, return the corresponding object types. Otherwise return the + // type itself. Note that the apparent type of a union type is the union type itself. function getApparentType(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { do { @@ -2510,6 +2523,9 @@ module ts { else if (type.flags & TypeFlags.Boolean) { type = globalBooleanType; } + else if (type.flags & TypeFlags.ESSymbol) { + type = globalESSymbolType; + } return type; } @@ -2999,12 +3015,24 @@ module ts { return type; } - function getGlobalSymbol(name: string): Symbol { - return resolveName(undefined, name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Value, Diagnostics.Cannot_find_global_value_0); + } + + function getGlobalTypeSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0); + } + + function getGlobalSymbol(name: string, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name: string): ObjectType { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType: Type): Type { @@ -3174,6 +3202,8 @@ module ts { return numberType; case SyntaxKind.BooleanKeyword: return booleanType; + case SyntaxKind.SymbolKeyword: + return esSymbolType; case SyntaxKind.VoidKeyword: return voidType; case SyntaxKind.StringLiteral: @@ -3379,7 +3409,7 @@ module ts { return isContextSensitive((node).whenTrue) || isContextSensitive((node).whenFalse); case SyntaxKind.BinaryExpression: - return (node).operator === SyntaxKind.BarBarToken && + return (node).operatorToken.kind === SyntaxKind.BarBarToken && (isContextSensitive((node).left) || isContextSensitive((node).right)); case SyntaxKind.PropertyAssignment: return isContextSensitive((node).initializer); @@ -4160,6 +4190,11 @@ module ts { return type.flags & TypeFlags.Reference && (type).target === globalArrayType; } + function isArrayLikeType(type: Type): boolean { + // A type is array-like if it is not the undefined or null type and if it is assignable to any[] + return !(type.flags & (TypeFlags.Undefined | TypeFlags.Null)) && isTypeAssignableTo(type, anyArrayType); + } + function isTupleLikeType(type: Type): boolean { return !!getPropertyOfType(type, "0"); } @@ -4561,7 +4596,7 @@ module ts { return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node: BinaryExpression) { - if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) { + if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) { var n = node.left; while (n.kind === SyntaxKind.ParenthesizedExpression) { n = (n).expression; @@ -4612,6 +4647,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.WithStatement: case SyntaxKind.SwitchStatement: @@ -4693,10 +4729,10 @@ module ts { case SyntaxKind.BinaryExpression: // In the right operand of an && or ||, narrow based on left operand if (child === (node).right) { - if ((node).operator === SyntaxKind.AmpersandAmpersandToken) { + if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ true); } - else if ((node).operator === SyntaxKind.BarBarToken) { + else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ false); } } @@ -4734,13 +4770,13 @@ module ts { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) { + if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } if (assumeTrue) { // Assumed result is true. If check was not for a primitive type, remove all primitive types if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean, /*isOfTypeKind*/ true); + return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, /*isOfTypeKind*/ true); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -4824,7 +4860,7 @@ module ts { case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: - var operator = (expr).operator; + var operator = (expr).operatorToken.kind; if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -5171,7 +5207,7 @@ module ts { function getContextualTypeForBinaryOperand(node: Expression): Type { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { @@ -5421,7 +5457,7 @@ module ts { // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node: Node): boolean { var parent = node.parent; - if (parent.kind === SyntaxKind.BinaryExpression && (parent).operator === SyntaxKind.EqualsToken && (parent).left === node) { + if (parent.kind === SyntaxKind.BinaryExpression && (parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent).left === node) { return true; } if (parent.kind === SyntaxKind.PropertyAssignment) { @@ -5435,7 +5471,7 @@ module ts { function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -5475,7 +5511,7 @@ module ts { function isNumericComputedName(name: ComputedPropertyName): boolean { // It seems odd to consider an expression of type Any to result in a numeric name, // but this behavior is consistent with checkIndexedAccess - return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); } function isNumericLiteralName(name: string) { @@ -5508,10 +5544,13 @@ module ts { if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - // This will allow types number, string, or any. It will also allow enums, the unknown + // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) { - error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } @@ -5760,8 +5799,8 @@ module ts { // See if we can index as a property. if (node.argumentExpression) { - if (node.argumentExpression.kind === SyntaxKind.StringLiteral || node.argumentExpression.kind === SyntaxKind.NumericLiteral) { - var name = (node.argumentExpression).text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -5775,10 +5814,10 @@ module ts { } // Check for compatible indexer types. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { // Try to use a number indexer. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; @@ -5800,11 +5839,78 @@ module ts { } // REVIEW: Users should know the type that was actually used. - error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + /** + * If indexArgumentExpression is a string literal or number literal, returns its text. + * If indexArgumentExpression is a well known symbol, returns the property name corresponding + * to this symbol, as long as it is a proper symbol reference. + * Otherwise, returns undefined. + */ + function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression, indexArgumentType: Type): string { + if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { + return (indexArgumentExpression).text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { + var rightHandSideName = ((indexArgumentExpression).name).text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + + return undefined; + } + + /** + * A proper symbol reference requires the following: + * 1. The property access denotes a property that exists + * 2. The expression is of the form Symbol. + * 3. The property access is of the primitive type symbol. + * 4. Symbol in this context resolves to the global Symbol object + */ + function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean { + if (expressionType === unknownType) { + // There is already an error, so no need to report one. + return false; + } + + if (!isWellKnownSymbolSyntactically(expression)) { + return false; + } + + // Make sure the property type is the primitive symbol type + if ((expressionType.flags & TypeFlags.ESSymbol) === 0) { + if (reportError) { + error(expression, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(expression)); + } + return false; + } + + // The name is Symbol., so make sure Symbol actually resolves to the + // global Symbol object + var leftHandSide = (expression).expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + // Already errored when we tried to look up the symbol + return false; + } + + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + + return true; + } + function resolveUntypedCall(node: CallLikeExpression): Signature { if (node.kind === SyntaxKind.TaggedTemplateExpression) { checkExpression((node).template); @@ -6714,7 +6820,7 @@ module ts { } function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean { - if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { + if (!allConstituentTypesHaveKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { error(operand, diagnostic); return false; } @@ -6830,6 +6936,9 @@ module ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: + if (someConstituentTypeHasKind(operandType, TypeFlags.ESSymbol)) { + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); + } return numberType; case SyntaxKind.ExclamationToken: return booleanType; @@ -6865,8 +6974,26 @@ module ts { return numberType; } - // Return true if type has the given flags, or is a union type composed of types that all have those flags - function isTypeOfKind(type: Type, kind: TypeFlags): boolean { + // Just like isTypeOfKind below, except that it returns true if *any* constituent + // has this kind. + function someConstituentTypeHasKind(type: Type, kind: TypeFlags): boolean { + if (type.flags & kind) { + return true; + } + if (type.flags & TypeFlags.Union) { + var types = (type).types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + + // Return true if type has the given flags, or is a union type composed of types that all have those flags. + function allConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } @@ -6896,7 +7023,7 @@ module ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (isTypeOfKind(leftType, TypeFlags.Primitive)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -6911,10 +7038,10 @@ module ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { - error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -6947,7 +7074,7 @@ module ts { function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { // TODOO(andersh): Allow iterable source type in ES6 - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } @@ -6981,7 +7108,7 @@ module ts { } function checkDestructuringAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { checkBinaryExpression(target, contextualMapper); target = (target).left; } @@ -7004,13 +7131,13 @@ module ts { function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { // Grammar checking - if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operatorToken.kind)) { // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; + var operator = node.operatorToken.kind; if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } @@ -7051,8 +7178,8 @@ module ts { // 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)); + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operatorToken.kind), tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal @@ -7075,19 +7202,26 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var resultType: Type; - if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } - else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { - // If one or both operands are of the String primitive type, the result is of the String primitive type. - resultType = stringType; - } - else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { - // Otherwise, the result is of type Any. - // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, TypeFlags.StringLike) || allConstituentTypesHaveKind(rightType, TypeFlags.StringLike)) { + // If one or both operands are of the String primitive type, the result is of the String primitive type. + resultType = stringType; + } + else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { + // Otherwise, the result is of type Any. + // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. + resultType = anyType; + } + + // Symbols are not allowed at all in arithmetic expressions + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { @@ -7099,14 +7233,18 @@ module ts { checkAssignmentOperator(resultType); } return resultType; - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.EqualsEqualsEqualsToken: - case SyntaxKind.ExclamationEqualsEqualsToken: case SyntaxKind.LessThanToken: case SyntaxKind.GreaterThanToken: case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + // Fall through + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.EqualsEqualsEqualsToken: + case SyntaxKind.ExclamationEqualsEqualsToken: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -7126,6 +7264,20 @@ module ts { return rightType; } + // Return type is true if there was no error, false if there was an error. + function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { + var offendingSymbolOperand = + someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left : + someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right : + undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); + return false; + } + + return true; + } + function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind { switch (operator) { case SyntaxKind.BarToken: @@ -7160,7 +7312,7 @@ module ts { } function reportOperatorError() { - error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } @@ -7211,7 +7363,10 @@ module ts { } function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7222,7 +7377,10 @@ module ts { // Grammar checking checkGrammarMethod(node); - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7485,7 +7643,7 @@ module ts { function checkPropertyDeclaration(node: PropertyDeclaration) { // Grammar checking - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } @@ -8034,12 +8192,16 @@ module ts { function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { checkSignatureDeclaration(node); - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); } - else { + + if (!hasDynamicName(node)) { // first we want to check the local symbol that contain this declaration // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode @@ -8076,7 +8238,7 @@ module ts { function checkBlock(node: Block) { // Grammar checking for SyntaxKind.Block if (node.kind === SyntaxKind.Block) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); } forEach(node.statements, checkSourceElement); @@ -8297,12 +8459,14 @@ module ts { function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { checkSourceElement(node.type); // For a computed property, just check the initializer and exit - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } // For a binding pattern, check contained binding elements if (isBindingPattern(node.name)) { @@ -8390,14 +8554,14 @@ module ts { function checkExpressionStatement(node: ExpressionStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node) + checkGrammarStatementInAmbientContext(node) checkExpression(node.expression); } function checkIfStatement(node: IfStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); @@ -8406,7 +8570,7 @@ module ts { function checkDoStatement(node: DoStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); @@ -8414,7 +8578,7 @@ module ts { function checkWhileStatement(node: WhileStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); @@ -8422,7 +8586,7 @@ module ts { function checkForStatement(node: ForStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.initializer && node.initializer.kind == SyntaxKind.VariableDeclarationList) { checkGrammarVariableDeclarationList(node.initializer); } @@ -8442,18 +8606,14 @@ module ts { checkSourceElement(node.statement); } + function checkForOfStatement(node: ForOfStatement) { + // TODO: not yet implemented + checkGrammarForOfStatement(node); + } + function checkForInStatement(node: ForInStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } + checkGrammarForInOrForOfStatement(node); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form @@ -8465,9 +8625,6 @@ module ts { if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { @@ -8477,7 +8634,7 @@ module ts { // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -8489,7 +8646,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -8498,7 +8655,7 @@ module ts { function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); // TODO: Check that target label is valid } @@ -8509,7 +8666,7 @@ module ts { function checkReturnStatement(node: ReturnStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -8540,7 +8697,7 @@ module ts { function checkWithStatement(node: WithStatement) { // Grammar checking for withStatement - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.parserContextFlags & ParserContextFlags.StrictMode) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); } @@ -8552,7 +8709,7 @@ module ts { function checkSwitchStatement(node: SwitchStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause: CaseOrDefaultClause; var hasDuplicateDefaultClause = false; @@ -8589,7 +8746,7 @@ module ts { function checkLabeledStatement(node: LabeledStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (isAnyFunction(current)) { @@ -8610,7 +8767,7 @@ module ts { function checkThrowStatement(node: ThrowStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); } @@ -8623,7 +8780,7 @@ module ts { function checkTryStatement(node: TryStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; @@ -8740,6 +8897,7 @@ module ts { case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, (name).text); } @@ -8958,7 +9116,7 @@ module ts { var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -9094,7 +9252,7 @@ module ts { if (right === undefined) { return undefined; } - switch ((e).operator) { + switch ((e).operatorToken.kind) { case SyntaxKind.BarToken: return left | right; case SyntaxKind.AmpersandToken: return left & right; case SyntaxKind.GreaterThanGreaterThanToken: return left >> right; @@ -9445,6 +9603,8 @@ module ts { return checkForStatement(node); case SyntaxKind.ForInStatement: return checkForInStatement(node); + case SyntaxKind.ForOfStatement: + return checkForOfStatement(node); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return checkBreakOrContinueStatement(node); @@ -9479,10 +9639,10 @@ module ts { case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.EmptyStatement: - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); return; case SyntaxKind.DebuggerStatement: - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); return; } } @@ -9554,6 +9714,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: case SyntaxKind.ReturnStatement: @@ -9750,6 +9911,7 @@ module ts { case SyntaxKind.NumberKeyword: case SyntaxKind.StringKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: return true; case SyntaxKind.VoidKeyword: return node.parent.kind !== SyntaxKind.VoidExpression; @@ -10274,7 +10436,7 @@ module ts { getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -10282,11 +10444,24 @@ module ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. - globalTemplateStringsArrayType = languageVersion >= ScriptTarget.ES6 - ? getGlobalType("TemplateStringsArray") - : unknownType; + if (languageVersion >= ScriptTarget.ES6) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + + // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it + // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have + // a global Symbol already, particularly if it is a class. + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } + anyArrayType = createArrayType(anyType); } @@ -10501,25 +10676,25 @@ module ts { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & NodeFlags.Modifier) { + if (parameter.flags & NodeFlags.Modifier) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { + if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); } } @@ -10652,10 +10827,7 @@ module ts { } var computedPropertyName = node; - if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { + if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operatorToken.kind === SyntaxKind.CommaToken) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -10750,6 +10922,49 @@ module ts { } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement: ForInStatement | ForOfStatement): boolean { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + + if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); + } + var firstDeclaration = variableList.declarations[0]; + if (firstDeclaration.initializer) { + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + + return false; + } + + function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { + // Temporarily disallow for-of statements until type check work is complete. + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < ScriptTarget.ES6) { + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + + return checkGrammarForInOrForOfStatement(forOfStatement); + } + function checkGrammarAccessor(accessor: MethodDeclaration): boolean { var kind = accessor.kind; if (languageVersion < ScriptTarget.ES5) { @@ -10792,8 +11007,8 @@ module ts { } } - function checkGrammarForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) { - if (node.kind === SyntaxKind.ComputedPropertyName) { + function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { + if (node.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically((node).expression)) { return grammarErrorOnNode(node, message); } } @@ -10824,17 +11039,17 @@ module ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -10842,6 +11057,7 @@ module ts { switch (node.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: return true; @@ -10998,6 +11214,7 @@ module ts { case SyntaxKind.WithStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: return false; case SyntaxKind.LabeledStatement: return allowLetAndConstDeclarations(parent.parent); @@ -11048,6 +11265,9 @@ module ts { var inAmbientContext = isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -11128,17 +11348,17 @@ module ts { function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -11185,7 +11405,7 @@ module ts { return isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node: Node): boolean { + function checkGrammarStatementInAmbientContext(node: Node): boolean { if (isInAmbientContext(node)) { // An accessors is already reported about the ambient context if (isAccessor(node.parent.kind)) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index ad0af35c514..cf20df7c446 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -122,12 +122,12 @@ module ts { An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, @@ -146,6 +146,9 @@ module ts { Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -165,7 +168,7 @@ module ts { Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, @@ -187,7 +190,7 @@ module ts { Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -203,7 +206,7 @@ module ts { The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -298,11 +301,26 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, 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_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -372,15 +390,6 @@ module ts { Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 4089, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 4090, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, @@ -457,5 +466,6 @@ module ts { yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a8904876971..80542fe8201 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -479,11 +479,11 @@ "category": "Error", "code": 1164 }, - "Computed property names are not allowed in an ambient context.": { + "A computed property name in an ambient context must directly refer to a built-in symbol.": { "category": "Error", "code": 1165 }, - "Computed property names are not allowed in class property declarations.": { + "A computed property name in a class property declaration must directly refer to a built-in symbol.": { "category": "Error", "code": 1166 }, @@ -491,15 +491,15 @@ "category": "Error", "code": 1167 }, - "Computed property names are not allowed in method overloads.": { + "A computed property name in a method overload must directly refer to a built-in symbol.": { "category": "Error", "code": 1168 }, - "Computed property names are not allowed in interfaces.": { + "A computed property name in an interface must directly refer to a built-in symbol.": { "category": "Error", "code": 1169 }, - "Computed property names are not allowed in type literals.": { + "A computed property name in a type literal must directly refer to a built-in symbol.": { "category": "Error", "code": 1170 }, @@ -575,6 +575,18 @@ "category": "Error", "code": 1187 }, + "Only a single variable declaration is allowed in a 'for...of' statement.": { + "category": "Error", + "code": 1188 + }, + "The variable declaration of a 'for...in' statement cannot have an initializer.": { + "category": "Error", + "code": 1189 + }, + "The variable declaration of a 'for...of' statement cannot have an initializer.": { + "category": "Error", + "code": 1190 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -652,7 +664,7 @@ "category": "Error", "code": 2318 }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { + "Named property '{0}' of types '{1}' and '{2}' are not identical.": { "category": "Error", "code": 2319 }, @@ -740,7 +752,7 @@ "category": "Error", "code": 2341 }, - "An index expression argument must be of type 'string', 'number', or 'any'.": { + "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": { "category": "Error", "code": 2342 }, @@ -804,7 +816,7 @@ "category": "Error", "code": 2359 }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { + "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": { "category": "Error", "code": 2360 }, @@ -1184,7 +1196,7 @@ "category": "Error", "code": 2463 }, - "A computed property name must be of type 'string', 'number', or 'any'.": { + "A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": { "category": "Error", "code": 2464 }, @@ -1198,11 +1210,71 @@ }, "A computed property name cannot reference a type parameter from its containing type.": { "category": "Error", - "code": 2466 + "code": 2467 + }, + "Cannot find global value '{0}'.": { + "category": "Error", + "code": 2468 + }, + "The '{0}' operator cannot be applied to type 'symbol'.": { + "category": "Error", + "code": 2469 + }, + "'Symbol' reference does not refer to the global Symbol constructor object.": { + "category": "Error", + "code": 2470 + }, + "A computed property name of the form '{0}' must be of type 'symbol'.": { + "category": "Error", + "code": 2471 }, "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 2468 + "code": 2472 + }, + "Enum declarations must all be const or non-const.": { + "category": "Error", + "code": 2473 + }, + "In 'const' enum declarations member initializer must be constant expression.": { + "category": "Error", + "code": 2474 + }, + "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { + "category": "Error", + "code": 2475 + }, + "A const enum member can only be accessed using a string literal.": { + "category": "Error", + "code": 2476 + }, + "'const' enum member initializer was evaluated to a non-finite value.": { + "category": "Error", + "code": 2477 + }, + "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { + "category": "Error", + "code": 2478 + }, + "Property '{0}' does not exist on 'const' enum '{1}'.": { + "category": "Error", + "code": 2479 + }, + "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { + "category": "Error", + "code": 2480 + }, + "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { + "category": "Error", + "code": 2481 + }, + "'for...of' statements are only available when targeting ECMAScript 6 or higher.": { + "category": "Error", + "code": 2482 + }, + "The left-hand side of a 'for...of' statement cannot use a type annotation.": { + "category": "Error", + "code": 2483 }, "Import declaration '{0}' is using private name '{1}'.": { @@ -1480,43 +1552,7 @@ "Exported type alias '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4081 - }, - "Enum declarations must all be const or non-const.": { - "category": "Error", - "code": 4082 - }, - "In 'const' enum declarations member initializer must be constant expression.": { - "category": "Error", - "code": 4083 - }, - "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { - "category": "Error", - "code": 4084 - }, - "A const enum member can only be accessed using a string literal.": { - "category": "Error", - "code": 4085 - }, - "'const' enum member initializer was evaluated to a non-finite value.": { - "category": "Error", - "code": 4086 - }, - "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { - "category": "Error", - "code": 4087 - }, - "Property '{0}' does not exist on 'const' enum '{1}'.": { - "category": "Error", - "code": 4088 - }, - "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { - "category": "Error", - "code": 4089 - }, - "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { - "category": "Error", - "code": 4090 - }, + }, "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 @@ -1821,5 +1857,9 @@ "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": { "category": "Error", "code": 9002 + }, + "'for...of' statements are not currently supported.": { + "category": "Error", + "code": 9003 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0eb3dbd0e54..5d4fddf0df9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -21,6 +21,12 @@ module ts { diagnosticMessage: DiagnosticMessage; typeName?: DeclarationName; } + + interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + } + type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter { @@ -170,16 +176,17 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = getLineStarts(currentSourceFile).length; + var lineCount = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), - comment.pos); + firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } // These are number of spaces writer is going to write at current indent @@ -195,7 +202,7 @@ module ts { // } // module m { // /* this is line 1 -- Assume current writer indent 8 - // * line --3 = 8 - 4 + 5 + // * line --3 = 8 - 4 + 5 // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } @@ -271,11 +278,11 @@ module ts { }); } - function getAllAccessorDeclarations(node: ClassDeclaration, accessor: AccessorDeclaration) { + function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration) { var firstAccessor: AccessorDeclaration; var getAccessor: AccessorDeclaration; var setAccessor: AccessorDeclaration; - if (accessor.name.kind === SyntaxKind.ComputedPropertyName) { + if (hasDynamicName(accessor)) { firstAccessor = accessor; if (accessor.kind === SyntaxKind.GetAccessor) { getAccessor = accessor; @@ -288,20 +295,23 @@ module ts { } } else { - forEach(node.members,(member: Declaration) => { - if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && - (member.name).text === (accessor.name).text && - (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { - if (!firstAccessor) { - firstAccessor = member; - } + forEach(declarations, (member: Declaration) => { + if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) + && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } - if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { - getAccessor = member; - } + if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { + getAccessor = member; + } - if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { - setAccessor = member; + if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { + setAccessor = member; + } } } }); @@ -359,8 +369,8 @@ module ts { var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; - // Contains the reference paths that needs to go in the declaration file. - // Collecting this separately because reference paths need to be first thing in the declaration file + // Contains the reference paths that needs to go in the declaration file. + // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option var referencePathsOutput = ""; @@ -467,7 +477,7 @@ module ts { // Eg. // export function bar(a: foo.Foo) { } // import foo = require("foo"); - // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, + // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); @@ -579,6 +589,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.StringLiteral: return writeTextOfNode(currentSourceFile, type); @@ -608,7 +619,7 @@ module ts { } function emitEntityName(entityName: EntityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, + var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration entityName.parent.kind === SyntaxKind.ImportDeclaration ? entityName.parent : enclosingDeclaration); @@ -692,7 +703,7 @@ module ts { function emitModuleElementDeclarationFlags(node: Node) { // If the node is parented in the current source file we need to emit export declare or just export if (node.parent === currentSourceFile) { - // If the node is exported + // If the node is exported if (node.flags & NodeFlags.Export) { write("export "); } @@ -730,7 +741,7 @@ module ts { } function writeImportDeclaration(node: ImportDeclaration) { - // note usage of writer. methods instead of aliases created, just to make sure we are using + // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); if (node.flags & NodeFlags.Export) { @@ -1083,7 +1094,7 @@ module ts { } function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableLikeDeclaration) { - // if this is property of type literal, + // if this is property of type literal, // or is parameter of method/call/construct/index signature of type literal // emit only if type is specified if (node.type) { @@ -1116,8 +1127,8 @@ module ts { if (hasDynamicName(node)) { return; } - - var accessors = getAllAccessorDeclarations(node.parent, node); + + var accessors = getAllAccessorDeclarations((node.parent).members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -1498,7 +1509,7 @@ module ts { referencePathsOutput += "/// " + newLine; } } - + export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { var diagnostics: Diagnostic[] = []; var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); @@ -1592,7 +1603,7 @@ module ts { var emitEnd = function (node: Node) { }; /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind + * This by default writes the text provided with the given tokenKind * but if optional emitFn callback is provided the text is emitted using the callback instead of default text * @param tokenKind the kind of the token to search and emit * @param startPos the position in the source to start searching for the token @@ -1678,13 +1689,13 @@ module ts { // 1. Relative Column 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex + // 2. Relative sourceIndex sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); // 3. Relative sourceLine 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based + // 4. Relative sourceColumn 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); // 5. Relative namePosition 0 based @@ -1734,6 +1745,11 @@ module ts { function recordSourceMapSpan(pos: number) { var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); + + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); @@ -1742,8 +1758,8 @@ module ts { lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { // Encode the last recordedSpan before assigning new encodeLastRecordedSourceMapSpan(); @@ -1784,7 +1800,7 @@ module ts { function recordNewSourceFileStart(node: SourceFile) { // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path + // If sourceroot option: Use the relative path corresponding to the common directory path // otherwise source locations relative to map file location var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; @@ -1924,7 +1940,7 @@ module ts { sourceMapDecodedMappings: [] }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the // relative paths of the sources list in the sourcemap sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== CharacterCodes.slash) { @@ -2002,13 +2018,20 @@ module ts { return result; } - function recordTempDeclaration(name: Identifier) { + function recordTempDeclaration(name: Identifier): void { if (!tempVariables) { tempVariables = []; } tempVariables.push(name); } + function createAndRecordTempVariable(location: Node): Identifier { + var temp = createTempVariable(location, /*forLoopVariable*/ false); + recordTempDeclaration(temp); + + return temp; + } + function emitTempDeclarations(newLine: boolean) { if (tempVariables) { if (newLine) { @@ -2057,10 +2080,53 @@ module ts { } } - function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { - if (multiLine) { - increaseIndent(); + function emitLinePreservingList(parent: Node, nodes: NodeArray, allowTrailingComma: boolean, spacesBetweenBraces: boolean) { + Debug.assert(nodes.length > 0); + + increaseIndent(); + + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } } + else { + writeLine(); + } + + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + + emit(nodes[i]); + } + + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, lastOrUndefined(nodes)); + + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + + decreaseIndent(); + + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + + function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -2079,7 +2145,6 @@ module ts { write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -2090,12 +2155,6 @@ module ts { } } - function emitMultiLineList(nodes: Node[]) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ true, /*trailingComma*/ false); - } - } - function emitLines(nodes: Node[]) { emitLinesStartingAt(nodes, /*startIndex*/ 0); } @@ -2122,7 +2181,7 @@ module ts { function emitLiteral(node: LiteralExpression) { var text = languageVersion < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : - node.text; + node.text; if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -2308,15 +2367,15 @@ module ts { // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' // which have greater precedence and '-' which has equal precedence. // All unary operators have a higher precedence apart from yield. - // Arrow functions and conditionals have a lower precedence, + // Arrow functions and conditionals have a lower precedence, // although we convert the former into regular function expressions in ES5 mode, // and in ES6 mode this function won't get called anyway. - // + // // TODO (drosen): Note that we need to account for the upcoming 'yield' and // spread ('...') unary operators that are anticipated for ES6. switch (expression.kind) { case SyntaxKind.BinaryExpression: - switch ((expression).operator) { + switch ((expression).operatorToken.kind) { case SyntaxKind.AsteriskToken: case SyntaxKind.SlashToken: case SyntaxKind.PercentToken: @@ -2342,7 +2401,10 @@ module ts { // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. + // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node: DeclarationName) { + Debug.assert(node.kind !== SyntaxKind.BindingElement); + if (node.kind === SyntaxKind.StringLiteral) { emitLiteral(node); } @@ -2515,7 +2577,13 @@ module ts { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -2526,15 +2594,18 @@ module ts { } } + function isSpreadElementExpression(node: Node) { + return node.kind === SyntaxKind.SpreadElementExpression; + } + function emitArrayLiteral(node: ArrayLiteralExpression) { var elements = node.elements; if (elements.length === 0) { write("[]"); } - else if (languageVersion >= ScriptTarget.ES6) { + else if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) { write("["); - emitList(elements, 0, elements.length, /*multiLine*/ (node.flags & NodeFlags.MultiLine) !== 0, - /*trailingComma*/ elements.hasTrailingComma); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); write("]"); } else { @@ -2543,20 +2614,242 @@ module ts { } } - function emitObjectLiteral(node: ObjectLiteralExpression) { - write("{"); - var properties = node.properties; - if (properties.length) { - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; - if (!multiLine) { - write(" "); + function createSynthesizedNode(kind: SyntaxKind): Node { + var node = createNode(kind); + node.pos = -1; + node.end = -1; + + return node; + } + + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral: ObjectLiteralExpression, firstComputedPropertyIndex: number): ParenthesizedExpression { + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + + // Hold onto the initial non-computed properties in a new object literal, + // then create the rest through property accesses on the temp variable. + var initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + initialObjectLiteral.properties = >originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= NodeFlags.MultiLine; + + // The comma expressions that will patch the object literal. + // This will end up being something like '_a = { ... }, _a.x = 10, _a.y = 20, _a'. + var propertyPatches = createBinaryExpression(tempVar, SyntaxKind.EqualsToken, initialObjectLiteral); + + ts.forEach(originalObjectLiteral.properties, property => { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + // TODO(drosen): Preserve comments + //var leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); + //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); + //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); + + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, patchedProperty); } - emitList(properties, 0, properties.length, /*multiLine*/ multiLine, - /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); - if (!multiLine) { - write(" "); + }); + + // Finally, return the temp variable. + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, tempVar); + + var result = createParenthesizedExpression(propertyPatches); + + // TODO(drosen): Preserve comments + // var leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); + // var trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); + //addCommentsToSynthesizedNode(result, leadingComments, trailingComments); + + return result; + } + + function addCommentsToSynthesizedNode(node: SynthesizedNode, leadingCommentRanges: CommentRange[], trailingCommentRanges: CommentRange[]): void { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + + // Returns 'undefined' if a property has already been accounted for + // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). + function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + + return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide); + } + + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { + switch (property.kind) { + case SyntaxKind.PropertyAssignment: + return (property).initializer; + + case SyntaxKind.ShorthandPropertyAssignment: + var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + return createPropertyAccessExpression(prefix, (property).name); + + case SyntaxKind.MethodDeclaration: + return createFunctionExpression((property).parameters, (property).body); + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + var { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); + + // Only emit the first accessor. + if (firstAccessor !== property) { + return undefined; + } + + var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + + var descriptorProperties = >[]; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + + var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + + propertyDescriptor.properties = descriptorProperties; + + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + + default: + Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); + } + } + + function createParenthesizedExpression(expression: Expression) { + var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + result.expression = expression; + + return result; + } + + function createNodeArray(...elements: T[]): NodeArray { + var result = >elements; + result.pos = -1; + result.end = -1; + + return result; + } + + function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + var result = createSynthesizedNode(SyntaxKind.BinaryExpression); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + + return result; + } + + function createMemberAccessForPropertyName(expression: LeftHandSideExpression, memberName: DeclarationName): PropertyAccessExpression | ElementAccessExpression { + if (memberName.kind === SyntaxKind.Identifier) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.ComputedPropertyName) { + return createElementAccessExpression(expression, (memberName).expression); + } + else { + Debug.fail(`Kind '${memberName.kind}' not accounted for.`); + } + } + + function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { + var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); + result.name = name; + result.initializer = initializer; + + return result; + } + + function createFunctionExpression(parameters: NodeArray, body: Block): FunctionExpression { + var result = createSynthesizedNode(SyntaxKind.FunctionExpression); + result.parameters = parameters; + result.body = body; + + return result; + } + + function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression { + var result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); + result.expression = expression; + result.name = name; + + return result; + } + + function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression { + var result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + result.expression = expression; + result.argumentExpression = argumentExpression; + + return result; + } + + function createIdentifier(name: string) { + var result = createSynthesizedNode(SyntaxKind.Identifier); + result.text = name; + + return result; + } + + function createCallExpression(invokedExpression: MemberExpression, arguments: NodeArray) { + var result = createSynthesizedNode(SyntaxKind.CallExpression); + result.expression = invokedExpression; + result.arguments = arguments; + + return result; + } + + function emitObjectLiteral(node: ObjectLiteralExpression): void { + var properties = node.properties; + + if (languageVersion < ScriptTarget.ES6) { + var numProperties = properties.length; + + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === SyntaxKind.ComputedPropertyName) { + numInitialNonComputedProperties = i; + break; + } + } + + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; } } + + // Ordinary case: either the object has no computed properties + // or we're compiling with an ES6+ target. + write("{"); + + var properties = node.properties; + if (properties.length) { + emitLinePreservingList(node, properties, /*allowTrailingComma:*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces:*/ true) + } + write("}"); } @@ -2590,7 +2883,7 @@ module ts { // export var obj = { y }; // } // The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version - if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion <= ScriptTarget.ES5 || resolver.getExpressionNamePrefix(node.name)) { // Emit identifier as an identifier write(": "); // Even though this is stored as identifier treat it as an expression @@ -2653,8 +2946,8 @@ module ts { emit(node); return node; } - var temp = createTempVariable(node); - recordTempDeclaration(temp); + var temp = createAndRecordTempVariable(node); + write("("); emit(temp); write(" = "); @@ -2762,7 +3055,7 @@ module ts { var operand = (node.expression).expression; // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; + // (-A).x; while (operand.kind == SyntaxKind.TypeAssertionExpression) { operand = (operand).expression; } @@ -2770,7 +3063,7 @@ module ts { // We have an expression of the form: (SubExpr) // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. // Omitting the parentheses, however, could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: + // code if the casted expression has a lower precedence than the rest of the expression, e.g.: // (new A).foo should be emitted as (new A).foo and not new A.foo // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() @@ -2842,19 +3135,84 @@ module ts { } function emitBinaryExpression(node: BinaryExpression) { - if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken && + if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== SyntaxKind.CommaToken) write(" "); - write(tokenToString(node.operator)); - write(" "); + + if (node.operatorToken.kind !== SyntaxKind.CommaToken) { + write(" "); + } + + write(tokenToString(node.operatorToken.kind)); + + // We'd like to preserve newlines found in the original binary expression. i.e. if a user has: + // + // Foo() || + // Bar(); + // + // Then we'd like to emit it as such. It seems like we'd only need to check for a newline and + // then just indent and emit. However, that will lead to a problem with deeply nested code. + // i.e. if you have: + // + // Foo() || + // Bar() || + // Baz(); + // + // Then we don't want to emit it as: + // + // Foo() || + // Bar() || + // Baz(); + // + // So we only indent if the right side of the binary expression starts further in on the line + // versus the left. + var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + + // Check if the right expression is on a different line versus the operator itself. If so, + // we'll emit newline. + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + // Also, if the right expression starts further in on the line than the left, then we'll indent. + var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + + if (shouldIndent) { + increaseIndent(); + } + + writeLine(); + } + else { + write(" "); + } + emit(node.right); + + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number { + var lineStart = getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) { + break; + } + } + + return i - lineStart; + } + function emitConditionalExpression(node: ConditionalExpression) { emit(node.condition); write(" ? "); @@ -2863,7 +3221,7 @@ module ts { emit(node.whenFalse); } - function isSingleLineBlock(node: Node) { + function isSingleLineEmptyBlock(node: Node) { if (node && node.kind === SyntaxKind.Block) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); @@ -2871,7 +3229,7 @@ module ts { } function emitBlock(node: Block) { - if (isSingleLineBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(SyntaxKind.OpenBraceToken, node.pos); write(" "); emitToken(SyntaxKind.CloseBraceToken, node.statements.end); @@ -2984,7 +3342,7 @@ module ts { emitEmbeddedStatement(node.statement); } - function emitForInStatement(node: ForInStatement) { + function emitForInOrForOfStatement(node: ForInStatement | ForOfStatement) { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); @@ -3005,7 +3363,13 @@ module ts { else { emit(node.initializer); } - write(" in "); + + if (node.kind === SyntaxKind.ForInStatement) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); emitToken(SyntaxKind.CloseParenToken, node.expression.end); emitEmbeddedStatement(node.statement); @@ -3045,9 +3409,14 @@ module ts { emitToken(SyntaxKind.CloseBraceToken, node.clauses.end); } - function isOnSameLine(node1: Node, node2: Node) { + function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + } + + function nodeEndPositionsAreOnSameLine(node1: Node, node2: Node) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { @@ -3064,7 +3433,7 @@ module ts { else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -3185,7 +3554,7 @@ module ts { // Return the expression 'value === void 0 ? defaultValue : value' var equals = createNode(SyntaxKind.BinaryExpression); equals.left = value; - equals.operator = SyntaxKind.EqualsEqualsEqualsToken; + equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken); equals.right = createVoidZero(); var cond = createNode(SyntaxKind.ConditionalExpression); cond.condition = equals; @@ -3268,7 +3637,7 @@ module ts { } function emitDestructuringAssignment(target: Expression, value: Expression) { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { value = createDefaultValueCheck(value,(target).right); target = (target).left; } @@ -3554,77 +3923,14 @@ module ts { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body)) { + if (isSingleLineEmptyBlock(node.body) || !node.body) { write(" { }"); } + else if (node.body.kind === SyntaxKind.Block) { + emitBlockFunctionBody(node, node.body); + } else { - write(" {"); - scopeEmitStart(node); - - if (!node.body) { - writeLine(); - write("}"); - } - else { - increaseIndent(); - - emitDetachedComments(node.body.kind === SyntaxKind.Block ? (node.body).statements : node.body); - - var startIndex = 0; - if (node.body.kind === SyntaxKind.Block) { - startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); - } - var outPos = writer.getTextPos(); - - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - - // Don't emit comments on this body. We'll have already taken care of it above - // when we called emitDetachedComments. - emitNode(node.body, /*disableComments:*/ true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === SyntaxKind.Block) { - emitLinesStartingAt((node.body).statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, /*disableComments:*/ true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (node.body.kind === SyntaxKind.Block) { - emitLeadingCommentsOfPosition((node.body).statements.end); - decreaseIndent(); - emitToken(SyntaxKind.CloseBraceToken, (node.body).statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } - } - - scopeEmitEnd(); + emitExpressionFunctionBody(node, node.body); } if (node.flags & NodeFlags.Export) { @@ -3636,11 +3942,101 @@ module ts { emitEnd(node); write(";"); } + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + // Returns true if any preamble code was emitted. + function emitFunctionBodyPreamble(node: FunctionLikeDeclaration): void { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + + function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) { + write(" {"); + scopeEmitStart(node); + + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + + // If we didn't have to emit any preamble code, then attempt to keep the arrow + // function on one line. + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + + // Don't emit comments on this body. We'll have already taken care of it above + // when we called emitDetachedComments. + emitNode(body, /*disableComments:*/ true); + emitEnd(body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, /*disableComments:*/ true); + write(";"); + emitTrailingComments(node.body); + + emitTempDeclarations(/*newLine*/ true); + decreaseIndent(); + writeLine(); + } + + emitStart(node.body); + write("}"); + emitEnd(node.body); + + scopeEmitEnd(); + } + + function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { + write(" {"); + scopeEmitStart(node); + + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(/*newLine*/ false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + + emitToken(SyntaxKind.CloseBraceToken, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement { if (ctor.body) { var statement = (ctor.body).statements[0]; @@ -3674,6 +4070,7 @@ module ts { } function emitMemberAccessForPropertyName(memberName: DeclarationName) { + // TODO: (jfreeman,drosen): comment on why this is emitNode instead of emit here. if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); emitNode(memberName); @@ -3723,13 +4120,14 @@ module ts { emitLeadingComments(member); emitStart(member); emitStart((member).name); - emitNode(node.name); + emitNode(node.name); // TODO (shkamat,drosen): comment for why emitNode instead of emit. if (!(member.flags & NodeFlags.Static)) { write(".prototype"); } emitMemberAccessForPropertyName((member).name); emitEnd((member).name); write(" = "); + // TODO (drosen): Should we performing emitStart twice on emitStart(member)? emitStart(member); emitFunctionDeclaration(member); emitEnd(member); @@ -3738,7 +4136,7 @@ module ts { emitTrailingComments(member); } else if (member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) { - var accessors = getAllAccessorDeclarations(node, member); + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -3749,6 +4147,7 @@ module ts { write(".prototype"); } write(", "); + // TODO: Shouldn't emitStart on name occur *here*? emitExpressionForPropertyName((member).name); emitEnd((member).name); write(", {"); @@ -4304,12 +4703,12 @@ module ts { return false; case SyntaxKind.ModuleDeclaration: - // Only emit the leading/trailing comments for a module if we're actually + // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); case SyntaxKind.EnumDeclaration: - // Only emit the leading/trailing comments for an enum if we're actually + // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); } @@ -4424,8 +4823,9 @@ module ts { return emitWhileStatement(node); case SyntaxKind.ForStatement: return emitForStatement(node); + case SyntaxKind.ForOfStatement: case SyntaxKind.ForInStatement: - return emitForInStatement(node); + return emitForInOrForOfStatement(node); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return emitBreakOrContinueStatement(node); @@ -4532,7 +4932,7 @@ module ts { } emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node: TextRange) { @@ -4548,7 +4948,7 @@ module ts { if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so + // comment is not part of the copyright comments. Return what we have so // far. return detachedComments; } @@ -4563,8 +4963,8 @@ module ts { // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); @@ -4587,7 +4987,7 @@ module ts { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && comment.pos + 2 < comment.end && @@ -4605,7 +5005,7 @@ module ts { function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile) { var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - // TODO(shkamat): Should we not write any declaration file if any of them can produce error, + // TODO(shkamat): Should we not write any declaration file if any of them can produce error, // or should we just not write this file like we are doing now if (!emitDeclarationResult.reportedDeclarationError) { var declarationOutput = emitDeclarationResult.referencePathsOutput; @@ -4622,7 +5022,7 @@ module ts { writeFile(host, diagnostics, removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - + function emitFile(jsFilePath: string, sourceFile?: SourceFile) { emitJavaScript(jsFilePath, sourceFile); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 630418dc485..aaa19e4c801 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -152,6 +152,7 @@ module ts { return visitNode(cbNode, (node).operand); case SyntaxKind.BinaryExpression: return visitNode(cbNode, (node).left) || + visitNode(cbNode, (node).operatorToken) || visitNode(cbNode, (node).right); case SyntaxKind.ConditionalExpression: return visitNode(cbNode, (node).condition) || @@ -191,6 +192,10 @@ module ts { return visitNode(cbNode, (node).initializer) || visitNode(cbNode, (node).expression) || visitNode(cbNode, (node).statement); + case SyntaxKind.ForOfStatement: + return visitNode(cbNode, (node).initializer) || + visitNode(cbNode, (node).expression) || + visitNode(cbNode, (node).statement); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return visitNode(cbNode, (node).label); @@ -1307,6 +1312,12 @@ module ts { return undefined; } + function parseTokenNode(): T { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. if (token === SyntaxKind.SemicolonToken) { @@ -1598,8 +1609,8 @@ module ts { } // in the case where we're parsing the variable declarator of a 'for-in' statement, we - // are done if we see an 'in' keyword in front of us. - if (token === SyntaxKind.InKeyword) { + // are done if we see an 'in' keyword in front of us. Same with for-of + if (isInOrOfKeyword(token)) { return true; } @@ -1877,6 +1888,7 @@ module ts { case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.WhileStatement: case SyntaxKind.WithStatement: @@ -2079,14 +2091,6 @@ module ts { return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - - - function parseTokenNode(): T { - var node = createNode(token); - nextToken(); - return finishNode(node); - } - function parseTemplateExpression(): TemplateExpression { var template = createNode(SyntaxKind.TemplateExpression); @@ -2593,6 +2597,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -2617,6 +2622,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.TypeOfKeyword: case SyntaxKind.OpenBraceToken: @@ -2794,8 +2800,9 @@ module ts { // Expression[in] , AssignmentExpression[in] var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(SyntaxKind.CommaToken)) { - expr = makeBinaryExpression(expr, SyntaxKind.CommaToken, parseAssignmentExpressionOrHigher()); + var operatorToken: Node; + while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -2874,9 +2881,7 @@ module ts { // Note: we call reScanGreaterToken so that we get an appropriately merged token // for cases like > > = becoming >>= if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } // It wasn't an assignment or a lambda. This is a conditional expression: @@ -3159,6 +3164,10 @@ module ts { return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t: SyntaxKind) { + return t === SyntaxKind.InKeyword || t === SyntaxKind.OfKeyword; + } + function parseBinaryExpressionRest(precedence: number, leftOperand: Expression): Expression { while (true) { // We either have a binary operator here, or we're finished. We call @@ -3176,9 +3185,7 @@ module ts { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; @@ -3234,10 +3241,10 @@ module ts { return -1; } - function makeBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression { var node = createNode(SyntaxKind.BinaryExpression, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } @@ -3788,7 +3795,7 @@ module ts { return finishNode(node); } - function parseForOrForInStatement(): Statement { + function parseForOrForInOrForOfStatement(): Statement { var pos = getNodePos(); parseExpected(SyntaxKind.ForKeyword); parseExpected(SyntaxKind.OpenParenToken); @@ -3796,21 +3803,27 @@ module ts { var initializer: VariableDeclarationList | Expression = undefined; if (token !== SyntaxKind.SemicolonToken) { if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) { - initializer = parseVariableDeclarationList(/*disallowIn:*/ true); + initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true); } else { initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement: IterationStatement; + var forOrForInOrForOfStatement: IterationStatement; if (parseOptional(SyntaxKind.InKeyword)) { var forInStatement = createNode(SyntaxKind.ForInStatement, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); - forOrForInStatement = forInStatement; + forOrForInOrForOfStatement = forInStatement; } - else { + else if (parseOptional(SyntaxKind.OfKeyword)) { + var forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(SyntaxKind.CloseParenToken); + forOrForInOrForOfStatement = forOfStatement; + } else { var forStatement = createNode(SyntaxKind.ForStatement, pos); forStatement.initializer = initializer; parseExpected(SyntaxKind.SemicolonToken); @@ -3822,12 +3835,12 @@ module ts { forStatement.iterator = allowInAnd(parseExpression); } parseExpected(SyntaxKind.CloseParenToken); - forOrForInStatement = forStatement; + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); + forOrForInOrForOfStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind: SyntaxKind): BreakOrContinueStatement { @@ -4073,7 +4086,7 @@ module ts { case SyntaxKind.WhileKeyword: return parseWhileStatement(); case SyntaxKind.ForKeyword: - return parseForOrForInStatement(); + return parseForOrForInOrForOfStatement(); case SyntaxKind.ContinueKeyword: return parseBreakOrContinueStatement(SyntaxKind.ContinueStatement); case SyntaxKind.BreakKeyword: @@ -4215,11 +4228,13 @@ module ts { var node = createNode(SyntaxKind.VariableDeclaration); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(/*inParameter*/ false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(/*inParameter*/ false); + } return finishNode(node); } - function parseVariableDeclarationList(disallowIn: boolean): VariableDeclarationList { + function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList { var node = createNode(SyntaxKind.VariableDeclarationList); switch (token) { @@ -4236,20 +4251,39 @@ module ts { } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); + // The user may have written the following: + // + // for (var of X) { } + // + // In this case, we want to parse an empty declaration list, and then parse 'of' + // as a keyword. The reason this is not automatic is that 'of' is a valid identifier. + // So we need to look ahead to determine if 'of' should be treated as a keyword in + // this context. + // The checker will then give an error that there is an empty declaration list. + if (token === SyntaxKind.OfKeyword && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); - setDisallowInContext(savedDisallowIn); + node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); + + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + + function canFollowContextualOfKeyword(): boolean { + return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken; + } function parseVariableStatement(fullStart: number, modifiers: ModifiersArray): VariableStatement { var node = createNode(SyntaxKind.VariableStatement, fullStart); setModifiers(node, modifiers); - node.declarationList = parseVariableDeclarationList(/*disallowIn:*/ false); + node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false); parseSemicolon(); return finishNode(node); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index fbbd69bbd69..311c746eafa 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -82,6 +82,7 @@ module ts { "string": SyntaxKind.StringKeyword, "super": SyntaxKind.SuperKeyword, "switch": SyntaxKind.SwitchKeyword, + "symbol": SyntaxKind.SymbolKeyword, "this": SyntaxKind.ThisKeyword, "throw": SyntaxKind.ThrowKeyword, "true": SyntaxKind.TrueKeyword, @@ -93,6 +94,7 @@ module ts { "while": SyntaxKind.WhileKeyword, "with": SyntaxKind.WithKeyword, "yield": SyntaxKind.YieldKeyword, + "of": SyntaxKind.OfKeyword, "{": SyntaxKind.OpenBraceToken, "}": SyntaxKind.CloseBraceToken, "(": SyntaxKind.OpenParenToken, @@ -223,7 +225,7 @@ module ts { return false; } - function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) { + /* @internal */ export function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) { return languageVersion >= ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); @@ -278,13 +280,13 @@ module ts { return result; } - export function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + export function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { - Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number { + Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } export function getLineStarts(sourceFile: SourceFile): number[] { @@ -298,11 +300,11 @@ module ts { // the binary search returns the negative value of the next line start // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20 // then the search will return -2 - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 3f7e6362e19..a3755650aed 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -72,7 +72,7 @@ module ts { function countLines(program: Program): number { var count = 0; forEach(program.getSourceFiles(), file => { - count += getLineAndCharacterOfPosition(file, file.end).line; + count += getLineStarts(file).length; }); return count; } @@ -88,11 +88,11 @@ module ts { if (diagnostic.file) { var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; + output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); - output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) + sys.newLine; + output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`; sys.write(output); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 12c5af21e12..02627184fb7 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -140,8 +140,9 @@ module ts { NumberKeyword, SetKeyword, StringKeyword, + SymbolKeyword, TypeKeyword, - + OfKeyword, // LastKeyword and LastToken // Parse tree nodes // Names @@ -210,6 +211,7 @@ module ts { WhileStatement, ForStatement, ForInStatement, + ForOfStatement, ContinueStatement, BreakStatement, ReturnStatement, @@ -259,7 +261,7 @@ module ts { FirstReservedWord = BreakKeyword, LastReservedWord = WithKeyword, FirstKeyword = BreakKeyword, - LastKeyword = TypeKeyword, + LastKeyword = OfKeyword, FirstFutureReservedWord = ImplementsKeyword, LastFutureReservedWord = YieldKeyword, FirstTypeNode = TypeReference, @@ -267,7 +269,7 @@ module ts { FirstPunctuation = OpenBraceToken, LastPunctuation = CaretEqualsToken, FirstToken = Unknown, - LastToken = TypeKeyword, + LastToken = OfKeyword, FirstTriviaToken = SingleLineCommentTrivia, LastTriviaToken = ConflictMarkerTrivia, FirstLiteralToken = NumericLiteral, @@ -621,7 +623,7 @@ module ts { export interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } @@ -752,6 +754,11 @@ module ts { expression: Expression; } + export interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + export interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -1298,9 +1305,10 @@ module ts { ObjectLiteral = 0x00020000, // Originates in an object literal ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type + ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6 - Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, - Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum, + Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null, + Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum, StringLike = String | StringLiteral, NumberLike = Number | Enum, ObjectType = Class | Interface | Reference | Tuple | Anonymous, @@ -1638,6 +1646,7 @@ module ts { equals = 0x3D, // = exclamation = 0x21, // ! greaterThan = 0x3E, // > + hash = 0x23, // # lessThan = 0x3C, // < minus = 0x2D, // - openBrace = 0x7B, // { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5a50e2799dc..2bc41f0f1cc 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -105,11 +105,16 @@ module ts { return node; } + export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { + Debug.assert(line >= 0); + return getLineStarts(sourceFile)[line]; + } + // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); var loc = getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return `${ file.fileName }(${ loc.line + 1 },${ loc.character + 1 })`; } export function getStartPosOfNode(node: Node): number { @@ -343,6 +348,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WithStatement: case SyntaxKind.SwitchStatement: case SyntaxKind.CaseClause: @@ -560,7 +566,8 @@ module ts { forStatement.condition === node || forStatement.iterator === node; case SyntaxKind.ForInStatement: - var forInStatement = parent; + case SyntaxKind.ForOfStatement: + var forInStatement = parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forInStatement.expression === node; case SyntaxKind.TypeAssertionExpression: @@ -688,6 +695,7 @@ module ts { case SyntaxKind.ExpressionStatement: case SyntaxKind.EmptyStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.IfStatement: case SyntaxKind.LabeledStatement: @@ -835,6 +843,54 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + export function hasDynamicName(declaration: Declaration): boolean { + return declaration.name && + declaration.name.kind === SyntaxKind.ComputedPropertyName && + !isWellKnownSymbolSyntactically((declaration.name).expression); + } + + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + export function isWellKnownSymbolSyntactically(node: Expression): boolean { + return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); + } + + export function getPropertyNameForPropertyNameNode(name: DeclarationName): string { + if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral) { + return (name).text; + } + if (name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (name).expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = (nameExpression).name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + + return undefined; + } + + export function getPropertyNameForKnownSymbolName(symbolName: string): string { + return "__@" + symbolName; + } + + /** + * Includes the word "Symbol" with unicode escapes + */ + export function isESSymbolIdentifier(node: Node): boolean { + return node.kind === SyntaxKind.Identifier && (node).text === "Symbol"; + } + export function isModifier(token: SyntaxKind): boolean { switch (token) { case SyntaxKind.PublicKeyword: diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 603a78b5f75..59fc2c23f5c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -282,6 +282,8 @@ module FourSlash { return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions); case FourSlashTestType.Shims: return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions); + case FourSlashTestType.Server: + return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions); default: throw new Error("Unknown FourSlash test type: "); } @@ -396,7 +398,7 @@ module FourSlash { var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); - this.scenarioActions.push(''); + this.scenarioActions.push(``); } public moveCaretRight(count = 1) { @@ -418,6 +420,9 @@ module FourSlash { this.activeFile = fileToOpen; var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); this.scenarioActions.push(''); + + // Let the host know that this file is now open + this.languageServiceAdapterHost.openFile(fileToOpen.fileName); } public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) { @@ -1927,7 +1932,7 @@ module FourSlash { } var missingItem = { name: name, kind: kind }; - this.raiseError('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, null, " ") + ')'); } private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) { @@ -2010,39 +2015,31 @@ module FourSlash { // Get the text of the entire line the caret is currently at private getCurrentLineContent() { - // The current caret position (in line/col terms) - var line = this.getCurrentCaretFilePosition().line; - // The line/col of the start of this line - var pos = this.languageServiceAdapterHost.lineColToPosition(this.activeFile.fileName, line, 1); - // The index of the current file + var text = this.getFileContent(this.activeFile.fileName) - // The text from the start of the line to the end of the file - var text = this.getFileContent(this.activeFile.fileName).substring(pos); + var pos = this.currentCaretPosition; + var startPos = pos, endPos = pos; - // Truncate to the first newline - var newlinePos = text.indexOf('\n'); - if (newlinePos === -1) { - return text; - } - else { - if (text.charAt(newlinePos - 1) === '\r') { - newlinePos--; + while (startPos > 0) { + var ch = text.charCodeAt(startPos - 1); + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; } - return text.substr(0, newlinePos); - } - } - private getCurrentCaretFilePosition() { - var result = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition); - if (result.line >= 0) { - result.line++; + startPos--; } - if (result.character >= 0) { - result.character++; + while (endPos < text.length) { + var ch = text.charCodeAt(endPos); + + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; + } + + endPos++; } - return result; + return text.substring(startPos, endPos); } private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) { @@ -2120,7 +2117,7 @@ module FourSlash { } private getLineColStringAtPosition(position: number) { - var pos = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, position); + var pos = this.languageServiceAdapterHost.positionToLineAndCharacter(this.activeFile.fileName, position); return 'line ' + (pos.line + 1) + ', col ' + pos.character; } diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index fe3b6c7a91f..1ab6e31cdbb 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -4,7 +4,8 @@ const enum FourSlashTestType { Native, - Shims + Shims, + Server } class FourSlashRunner extends RunnerBase { @@ -22,6 +23,10 @@ class FourSlashRunner extends RunnerBase { this.basePath = 'tests/cases/fourslash/shims'; this.testSuiteName = 'fourslash-shims'; break; + case FourSlashTestType.Server: + this.basePath = 'tests/cases/fourslash/server'; + this.testSuiteName = 'fourslash-server'; + break; } } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 86a68af1145..26c06c7950c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -16,14 +16,15 @@ /// /// +/// +/// +/// /// /// /// /// -declare var require: any; -declare var process: any; -var Buffer = require('buffer').Buffer; +var Buffer: BufferConstructor = require('buffer').Buffer; // this will work in the browser via browserify var _chai: typeof chai = require('chai'); @@ -1184,13 +1185,13 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; + var errorLineInfo = err.file ? err.file.getLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 }; return { fileName: err.file && err.file.fileName, start: err.start, end: err.start + err.length, - line: errorLineInfo.line, - character: errorLineInfo.character, + line: errorLineInfo.line + 1, + character: errorLineInfo.character + 1, message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine), category: ts.DiagnosticCategory[err.category].toLowerCase(), code: err.code diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2f95f5072d0..a9c28fb70bd 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -1,5 +1,6 @@ /// /// +/// /// module Harness.LanguageService { @@ -23,18 +24,18 @@ module Harness.LanguageService { this.version++; } - public editContent(minChar: number, limChar: number, newText: string): void { + public editContent(start: number, end: number, newText: string): void { // Apply edits - var prefix = this.content.substring(0, minChar); + var prefix = this.content.substring(0, start); var middle = newText; - var suffix = this.content.substring(limChar); + var suffix = this.content.substring(end); this.setContent(prefix + middle + suffix); // Store edit range + new length of script this.editRanges.push({ length: this.content.length, textChangeRange: ts.createTextChangeRange( - ts.createTextSpanFromBounds(minChar, limChar), newText.length) + ts.createTextSpanFromBounds(start, end), newText.length) }); // Update version # @@ -145,52 +146,28 @@ module Harness.LanguageService { this.fileNameToScript[fileName] = new ScriptInfo(fileName, content); } - public updateScript(fileName: string, content: string) { + public editScript(fileName: string, start: number, end: number, newText: string) { var script = this.getScriptInfo(fileName); if (script !== null) { - script.updateContent(content); - return; - } - - this.addScript(fileName, content); - } - - public editScript(fileName: string, minChar: number, limChar: number, newText: string) { - var script = this.getScriptInfo(fileName); - if (script !== null) { - script.editContent(minChar, limChar, newText); + script.editContent(start, end, newText); return; } throw new Error("No script with name '" + fileName + "'"); } - /** - * @param line 1 based index - * @param col 1 based index - */ - public lineColToPosition(fileName: string, line: number, col: number): number { - var script: ScriptInfo = this.fileNameToScript[fileName]; - assert.isNotNull(script); - assert.isTrue(line >= 1); - assert.isTrue(col >= 1); - - return ts.computePositionFromLineAndCharacter(script.lineMap, line, col); + public openFile(fileName: string): void { } /** * @param line 0 based index * @param col 0 based index */ - public positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { + public positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - var result = ts.computeLineAndCharacterOfPosition(script.lineMap, position); - - assert.isTrue(result.line >= 1); - assert.isTrue(result.character >= 1); - return { line: result.line - 1, character: result.character - 1 }; + return ts.computeLineAndCharacterOfPosition(script.lineMap, position); } } @@ -236,10 +213,8 @@ module Harness.LanguageService { getFilenames(): string[] { return this.nativeHost.getFilenames(); } getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); } addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } - updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); } - editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); } - lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); } - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineCol(fileName, position); } + editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); } + positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); } getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); } getCancellationToken(): ts.CancellationToken { return this.nativeHost.getCancellationToken(); } @@ -442,5 +417,156 @@ module Harness.LanguageService { return convertResult; } } + + // Server adapter + class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost { + private client: ts.server.SessionClient; + + constructor(cancellationToken: ts.CancellationToken, settings: ts.CompilerOptions) { + super(cancellationToken, settings); + } + + onMessage(message: string): void { + + } + + writeMessage(message: string): void { + + } + + setClient(client: ts.server.SessionClient) { + this.client = client; + } + + openFile(fileName: string): void { + super.openFile(fileName); + this.client.openFile(fileName); + } + + editScript(fileName: string, start: number, end: number, newText: string) { + super.editScript(fileName, start, end, newText); + this.client.changeFile(fileName, start, end, newText); + } + } + + class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { + args: string[] = []; + newLine: string; + useCaseSensitiveFileNames: boolean = false; + + constructor(private host: NativeLanguageServiceHost) { + this.newLine = this.host.getNewLine(); + } + + onMessage(message: string): void { + + } + + writeMessage(message: string): void { + } + + write(message: string): void { + this.writeMessage(message); + } + + readFile(fileName: string): string { + if (fileName.indexOf(Harness.Compiler.defaultLibFileName) >= 0) { + fileName = Harness.Compiler.defaultLibFileName; + } + + var snapshot = this.host.getScriptSnapshot(fileName); + return snapshot && snapshot.getText(0, snapshot.getLength()); + } + + writeFile(name: string, text: string, writeByteOrderMark: boolean): void { + } + + resolvePath(path: string): string { + return path; + } + + fileExists(path: string): boolean { + return !!this.host.getScriptSnapshot(path); + } + + directoryExists(path: string): boolean { + return false; + } + + getExecutingFilePath(): string { + return ""; + } + + exit(exitCode: number): void { + } + + createDirectory(directoryName: string): void { + throw new Error("Not Implemented Yet."); + } + + getCurrentDirectory(): string { + return this.host.getCurrentDirectory(); + } + + readDirectory(path: string, extension?: string): string[] { + throw new Error("Not implemented Yet."); + } + + watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher { + return { close() { } }; + } + + close(): void { + } + + info(message: string): void { + return this.host.log(message); + } + + msg(message: string) { + return this.host.log(message); + } + + endGroup(): void { + } + + perftrc(message: string): void { + return this.host.log(message); + } + + startGroup(): void { + } + } + + export class ServerLanugageServiceAdapter implements LanguageServiceAdapter { + private host: SessionClientHost; + private client: ts.server.SessionClient; + constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) { + // This is the main host that tests use to direct tests + var clientHost = new SessionClientHost(cancellationToken, options); + var client = new ts.server.SessionClient(clientHost); + + // This host is just a proxy for the clientHost, it uses the client + // host to answer server queries about files on disk + var serverHost = new SessionServerHost(clientHost); + var server = new ts.server.Session(serverHost, serverHost); + + // Fake the connection between the client and the server + serverHost.writeMessage = client.onMessage.bind(client); + clientHost.writeMessage = server.onMessage.bind(server); + + // Wire the client to the host to get notifications when a file is open + // or edited. + clientHost.setClient(client); + + // Set the properties + this.client = client; + this.host = clientHost; + } + getHost() { return this.host; } + getLanguageService(): ts.LanguageService { return this.client; } + getClassifier(): ts.Classifier { throw new Error("getClassifier is not available using the server interface."); } + getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { throw new Error("getPreProcessedFileInfo is not available using the server interface."); } + } } \ No newline at end of file diff --git a/src/harness/runner.ts b/src/harness/runner.ts index 942ae56bf6f..e1e5429b007 100644 --- a/src/harness/runner.ts +++ b/src/harness/runner.ts @@ -66,6 +66,9 @@ if (testConfigFile !== '') { case 'fourslash-shims': runners.push(new FourSlashRunner(FourSlashTestType.Shims)); break; + case 'fourslash-server': + runners.push(new FourSlashRunner(FourSlashTestType.Server)); + break; case 'fourslash-generated': runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native)); break; @@ -95,6 +98,7 @@ if (runners.length === 0) { // language services runners.push(new FourSlashRunner(FourSlashTestType.Native)); runners.push(new FourSlashRunner(FourSlashTestType.Shims)); + runners.push(new FourSlashRunner(FourSlashTestType.Server)); //runners.push(new GeneratedFourslashRunner()); } diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 1d8b3efef68..54cdc27e3b3 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,15 +85,17 @@ 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 lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos); 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 // baseline comparisons easier. In the long term, we will want to just call typeToString this.results.push({ - line: lineAndCharacter.line - 1, - column: lineAndCharacter.character, + line: lineAndCharacter.line, + // todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving + // that behavior to prevent having a lot of baselines to fix up. + column: lineAndCharacter.character + 1, syntaxKind: node.kind, sourceText: sourceText, type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index b666b11b969..50238e94bb4 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -1,4 +1,4 @@ -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -7,7 +7,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -20,21 +20,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -42,42 +42,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -108,7 +108,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -230,7 +230,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -329,7 +329,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -447,12 +447,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -474,7 +474,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -588,11 +588,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -649,8 +649,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -666,7 +666,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -686,8 +686,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -702,7 +702,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -713,7 +713,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -733,7 +733,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -870,7 +870,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -1137,7 +1137,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -1427,7 +1427,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -1717,7 +1717,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -2007,7 +2007,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -2297,7 +2297,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -2587,7 +2587,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -2877,7 +2877,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -3167,7 +3167,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -3457,7 +3457,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -3521,7 +3521,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/src/server/client.ts b/src/server/client.ts new file mode 100644 index 00000000000..60486e80371 --- /dev/null +++ b/src/server/client.ts @@ -0,0 +1,494 @@ +/// + +module ts.server { + + export interface SessionClientHost extends LanguageServiceHost { + writeMessage(message: string): void; + } + + interface CompletionEntry extends CompletionInfo { + fileName: string; + position: number; + } + + interface RenameEntry extends RenameInfo { + fileName: string; + position: number; + locations: RenameLocation[]; + findInStrings: boolean; + findInComments: boolean; + } + + export class SessionClient implements LanguageService { + private sequence: number = 0; + private fileMapping: ts.Map = {}; + private lineMaps: ts.Map = {}; + private messages: string[] = []; + private lastRenameEntry: RenameEntry; + + constructor(private host: SessionClientHost) { + } + + public onMessage(message: string): void { + this.messages.push(message); + } + + private writeMessage(message: string): void { + this.host.writeMessage(message); + } + + private getLineMap(fileName: string): number[] { + var lineMap = ts.lookUp(this.lineMaps, fileName); + if (!lineMap) { + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); + } + return lineMap; + } + + private lineColToPosition(fileName: string, lineCol: protocol.Location): number { + return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineCol.line - 1, lineCol.col - 1); + } + + private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location { + var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); + return { + line: lineCol.line + 1, + col: lineCol.character + 1 + }; + } + + private convertCodeEditsToTextChange(fileName: string, codeEdit: protocol.CodeEdit): ts.TextChange { + var start = this.lineColToPosition(fileName, codeEdit.start); + var end = this.lineColToPosition(fileName, codeEdit.end); + + return { + span: ts.createTextSpanFromBounds(start, end), + newText: codeEdit.newText + }; + } + + private processRequest(command: string, arguments?: any): T { + var request: protocol.Request = { + seq: this.sequence++, + type: "request", + command: command, + arguments: arguments + }; + + this.writeMessage(JSON.stringify(request)); + + return request; + } + + private processResponse(request: protocol.Request): T { + var lastMessage = this.messages.shift(); + Debug.assert(!!lastMessage, "Did not recieve any responses."); + + // Read the content length + var contentLengthPrefix = "Content-Length: "; + var lines = lastMessage.split("\r\n"); + Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); + + var contentLengthText = lines[0]; + Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); + var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); + + // Read the body + var responseBody = lines[2]; + + // Verify content length + Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); + + try { + var response: T = JSON.parse(responseBody); + } + catch (e) { + throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error detailes: " + e.message); + } + + // verify the sequence numbers + Debug.assert(response.request_seq === request.seq, "Malformed response: response sequance number did not match request sequence number."); + + // unmarshal errors + if (!response.success) { + throw new Error("Error " + response.message); + } + + Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); + + return response; + } + + openFile(fileName: string): void { + var args: protocol.FileRequestArgs = { file: fileName }; + this.processRequest(CommandNames.Open, args); + } + + closeFile(fileName: string): void { + var args: protocol.FileRequestArgs = { file: fileName }; + this.processRequest(CommandNames.Close, args); + } + + changeFile(fileName: string, start: number, end: number, newText: string): void { + // clear the line map after an edit + this.lineMaps[fileName] = undefined; + + var lineCol = this.positionToOneBasedLineCol(fileName, start); + var endLineCol = this.positionToOneBasedLineCol(fileName, end); + + var args: protocol.ChangeRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + endLine: endLineCol.line, + endCol: endLineCol.col, + insertString: newText + }; + + this.processRequest(CommandNames.Change, args); + } + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col + }; + + var request = this.processRequest(CommandNames.Quickinfo, args); + var response = this.processResponse(request); + + var start = this.lineColToPosition(fileName, response.body.start); + var end = this.lineColToPosition(fileName, response.body.end); + + return { + kind: response.body.kind, + kindModifiers: response.body.kindModifiers, + textSpan: ts.createTextSpanFromBounds(start, end), + displayParts: [{ kind: "text", text: response.body.displayString }], + documentation: [{ kind: "text", text: response.body.documentation }] + }; + } + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.CompletionsRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + prefix: undefined + }; + + var request = this.processRequest(CommandNames.Completions, args); + var response = this.processResponse(request); + + return { + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: response.body, + fileName: fileName, + position: position + }; + } + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.CompletionDetailsRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + entryNames: [entryName] + }; + + var request = this.processRequest(CommandNames.CompletionDetails, args); + var response = this.processResponse(request); + Debug.assert(response.body.length == 1, "Unexpected length of completion details response body."); + return response.body[0]; + } + + getNavigateToItems(searchTerm: string): NavigateToItem[] { + var args: protocol.NavtoRequestArgs = { + searchTerm, + file: this.host.getScriptFileNames()[0] + }; + + var request = this.processRequest(CommandNames.Navto, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var fileName = entry.file; + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + + return { + name: entry.name, + containerName: entry.containerName || "", + containerKind: entry.containerKind || "", + kind: entry.kind, + kindModifiers: entry.kindModifiers, + matchKind: entry.matchKind, + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(start, end) + }; + }); + } + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { + var startLineCol = this.positionToOneBasedLineCol(fileName, start); + var endLineCol = this.positionToOneBasedLineCol(fileName, end); + var args: protocol.FormatRequestArgs = { + file: fileName, + line: startLineCol.line, + col: startLineCol.col, + endLine: endLineCol.line, + endCol: endLineCol.col, + }; + + // TODO: handle FormatCodeOptions + var request = this.processRequest(CommandNames.Format, args); + var response = this.processResponse(request); + + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + } + + getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { + return this.getFormattingEditsForRange(fileName, 0, this.host.getScriptSnapshot(fileName).getLength(), options); + } + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FormatOnKeyRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + key: key + }; + + // TODO: handle FormatCodeOptions + var request = this.processRequest(CommandNames.Formatonkey, args); + var response = this.processResponse(request); + + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + } + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.Definition, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var fileName = entry.file; + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + containerKind: "", + containerName: "", + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: "", + name: "" + }; + }); + } + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.References, args); + var response = this.processResponse(request); + + return response.body.refs.map(entry => { + var fileName = entry.file; + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: entry.isWriteAccess, + }; + }); + } + + getEmitOutput(fileName: string): EmitOutput { + throw new Error("Not Implemented Yet."); + } + + getSyntacticDiagnostics(fileName: string): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getSemanticDiagnostics(fileName: string): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getCompilerOptionsDiagnostics(): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.RenameRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + findInStrings, + findInComments + }; + + var request = this.processRequest(CommandNames.Rename, args); + var response = this.processResponse(request); + var locations: RenameLocation[] = []; + response.body.locs.map((entry: protocol.SpanGroup) => { + var fileName = entry.file; + entry.locs.map((loc: protocol.TextSpan) => { + var start = this.lineColToPosition(fileName, loc.start); + var end = this.lineColToPosition(fileName, loc.end); + locations.push({ + textSpan: ts.createTextSpanFromBounds(start, end), + fileName: fileName + }); + }); + }); + return this.lastRenameEntry = { + canRename: response.body.info.canRename, + displayName: response.body.info.displayName, + fullDisplayName: response.body.info.fullDisplayName, + kind: response.body.info.kind, + kindModifiers: response.body.info.kindModifiers, + localizedErrorMessage: response.body.info.localizedErrorMessage, + triggerSpan: ts.createTextSpanFromBounds(position, position), + fileName: fileName, + position: position, + findInStrings: findInStrings, + findInComments: findInComments, + locations: locations + }; + } + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { + if (!this.lastRenameEntry || + this.lastRenameEntry.fileName !== fileName || + this.lastRenameEntry.position !== position || + this.lastRenameEntry.findInStrings != findInStrings || + this.lastRenameEntry.findInComments != findInComments) { + this.getRenameInfo(fileName, position, findInStrings, findInComments); + } + + return this.lastRenameEntry.locations; + } + + decodeNavigationBarItems(items: protocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { + if (!items) { + return []; + } + + return items.map(item => ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers || "", + spans: item.spans.map(span=> createTextSpanFromBounds(this.lineColToPosition(fileName, span.start), this.lineColToPosition(fileName, span.end))), + childItems: this.decodeNavigationBarItems(item.childItems, fileName), + indent: 0, + bolded: false, + grayed: false + })); + } + + getNavigationBarItems(fileName: string): NavigationBarItem[] { + var args: protocol.FileRequestArgs = { + file: fileName + }; + + var request = this.processRequest(CommandNames.NavBar, args); + var response = this.processResponse(request); + + return this.decodeNavigationBarItems(response.body, fileName); + } + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { + throw new Error("Not Implemented Yet."); + } + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan { + throw new Error("Not Implemented Yet."); + } + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { + throw new Error("Not Implemented Yet."); + } + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + throw new Error("Not Implemented Yet."); + } + + getOutliningSpans(fileName: string): OutliningSpan[] { + throw new Error("Not Implemented Yet."); + } + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { + throw new Error("Not Implemented Yet."); + } + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.Brace, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + start: start, + length: end - start, + }; + }); + } + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number { + throw new Error("Not Implemented Yet."); + } + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + throw new Error("Not Implemented Yet."); + } + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + throw new Error("Not Implemented Yet."); + } + + getProgram(): Program { + throw new Error("SourceFile objects are not serializable through the server protocol."); + } + + getSourceFile(fileName: string): SourceFile { + throw new Error("SourceFile objects are not serializable through the server protocol."); + } + + cleanupSemanticCache(): void { + throw new Error("cleanupSemanticCache is not available through the server layer."); + } + + dispose(): void { + throw new Error("dispose is not available through the server layer."); + } + } +} diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts new file mode 100644 index 00000000000..5b5ee27d707 --- /dev/null +++ b/src/server/editorServices.ts @@ -0,0 +1,1646 @@ +/// +/// +/// + +module ts.server { + export interface Logger { + close(): void; + perftrc(s: string): void; + info(s: string): void; + startGroup(): void; + endGroup(): void; + msg(s: string, type?: string): void; + } + + var lineCollectionCapacity = 4; + + class ScriptInfo { + svc: ScriptVersionCache; + children: ScriptInfo[] = []; // files referenced by this file + + defaultProject: Project; // project to use by default for file + + fileWatcher: FileWatcher; + + constructor(private host: ServerHost, public fileName: string, public content: string, public isOpen = false) { + this.svc = ScriptVersionCache.fromString(content); + } + + close() { + this.isOpen = false; + } + + addChild(childInfo: ScriptInfo) { + this.children.push(childInfo); + } + + snap() { + return this.svc.getSnapshot(); + } + + getText() { + var snap = this.snap(); + return snap.getText(0, snap.getLength()); + } + + getLineInfo(line: number) { + var snap = this.snap(); + return snap.index.lineNumberToInfo(line); + } + + editContent(start: number, end: number, newText: string): void { + this.svc.edit(start, end - start, newText); + } + + getTextChangeRangeBetweenVersions(startVersion: number, endVersion: number): ts.TextChangeRange { + return this.svc.getTextChangesBetweenVersions(startVersion, endVersion); + } + + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { + return this.snap().getChangeRange(oldSnapshot); + } + } + + class LSHost implements ts.LanguageServiceHost { + ls: ts.LanguageService = null; + compilationSettings: ts.CompilerOptions; + filenameToScript: ts.Map = {}; + + constructor(public host: ServerHost, public project: Project) { + } + + getDefaultLibFileName() { + var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); + return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); + } + + getScriptSnapshot(filename: string): ts.IScriptSnapshot { + var scriptInfo = this.getScriptInfo(filename); + if (scriptInfo) { + return scriptInfo.snap(); + } + } + + setCompilationSettings(opt: ts.CompilerOptions) { + this.compilationSettings = opt; + } + + lineAffectsRefs(filename: string, line: number) { + var info = this.getScriptInfo(filename); + var lineInfo = info.getLineInfo(line); + if (lineInfo && lineInfo.text) { + var regex = /reference|import|\/\*|\*\//; + return regex.test(lineInfo.text); + } + } + + getCompilationSettings() { + // change this to return active project settings for file + return this.compilationSettings; + } + + getScriptFileNames() { + var filenames: string[] = []; + for (var filename in this.filenameToScript) { + if (this.filenameToScript[filename] && this.filenameToScript[filename].isOpen) { + filenames.push(filename); + } + } + return filenames; + } + + getScriptVersion(filename: string) { + return this.getScriptInfo(filename).svc.latestVersion().toString(); + } + + getCurrentDirectory(): string { + return ""; + } + + getScriptIsOpen(filename: string) { + return this.getScriptInfo(filename).isOpen; + } + + removeReferencedFile(info: ScriptInfo) { + if (!info.isOpen) { + this.filenameToScript[info.fileName] = undefined; + } + } + + getScriptInfo(filename: string): ScriptInfo { + var scriptInfo = ts.lookUp(this.filenameToScript, filename); + if (!scriptInfo) { + scriptInfo = this.project.openReferencedFile(filename); + if (scriptInfo) { + this.filenameToScript[scriptInfo.fileName] = scriptInfo; + } + } + else { + } + return scriptInfo; + } + + addRoot(info: ScriptInfo) { + var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); + if (!scriptInfo) { + this.filenameToScript[info.fileName] = info; + return info; + } + } + + saveTo(filename: string, tmpfilename: string) { + var script = this.getScriptInfo(filename); + if (script) { + var snap = script.snap(); + this.host.writeFile(tmpfilename, snap.getText(0, snap.getLength())); + } + } + + reloadScript(filename: string, tmpfilename: string, cb: () => any) { + var script = this.getScriptInfo(filename); + if (script) { + script.svc.reloadFromFile(tmpfilename, cb); + } + } + + editScript(filename: string, start: number, end: number, newText: string) { + var script = this.getScriptInfo(filename); + if (script) { + script.editContent(start, end, newText); + return; + } + + throw new Error("No script with name '" + filename + "'"); + } + + resolvePath(path: string): string { + var start = new Date().getTime(); + var result = this.host.resolvePath(path); + return result; + } + + fileExists(path: string): boolean { + var start = new Date().getTime(); + var result = this.host.fileExists(path); + return result; + } + + directoryExists(path: string): boolean { + return this.host.directoryExists(path); + } + + /** + * @param line 1 based index + */ + lineToTextSpan(filename: string, line: number): ts.TextSpan { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + + var lineInfo = index.lineNumberToInfo(line + 1); + var len: number; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.col - lineInfo.col; + } + return ts.createTextSpan(lineInfo.col, len); + } + + /** + * @param line 1 based index + * @param col 1 based index + */ + lineColToPosition(filename: string, line: number, col: number): number { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + + var lineInfo = index.lineNumberToInfo(line); + // TODO: assert this column is actually on the line + return (lineInfo.col + col - 1); + } + + /** + * @param line 1-based index + * @param col 1-based index + */ + positionToLineCol(filename: string, position: number): ILineInfo { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + var lineCol = index.charOffsetToLineNumberAndPos(position); + return { line: lineCol.line, col: lineCol.col + 1 }; + } + } + + // assumes normalized paths + function getAbsolutePath(filename: string, directory: string) { + var rootLength = ts.getRootLength(filename); + if (rootLength > 0) { + return filename; + } + else { + var splitFilename = filename.split('/'); + var splitDir = directory.split('/'); + var i = 0; + var dirTail = 0; + var sflen = splitFilename.length; + while ((i < sflen) && (splitFilename[i].charAt(0) == '.')) { + var dots = splitFilename[i]; + if (dots == '..') { + dirTail++; + } + else if (dots != '.') { + return undefined; + } + i++; + } + return splitDir.slice(0, splitDir.length - dirTail).concat(splitFilename.slice(i)).join('/'); + } + } + + interface ProjectOptions { + // these fields can be present in the project file + files?: string[]; + formatCodeOptions?: ts.FormatCodeOptions; + compilerOptions?: ts.CompilerOptions; + } + + export class Project { + compilerService: CompilerService; + projectOptions: ProjectOptions; + projectFilename: string; + program: ts.Program; + filenameToSourceFile: ts.Map = {}; + updateGraphSeq = 0; + + constructor(public projectService: ProjectService) { + this.compilerService = new CompilerService(this); + } + + openReferencedFile(filename: string) { + return this.projectService.openFile(filename, false); + } + + getSourceFile(info: ScriptInfo) { + return this.filenameToSourceFile[info.fileName]; + } + + getSourceFileFromName(filename: string) { + var info = this.projectService.getScriptInfo(filename); + if (info) { + return this.getSourceFile(info); + } + } + + removeReferencedFile(info: ScriptInfo) { + this.compilerService.host.removeReferencedFile(info); + this.updateGraph(); + } + + updateFileMap() { + this.filenameToSourceFile = {}; + var sourceFiles = this.program.getSourceFiles(); + for (var i = 0, len = sourceFiles.length; i < len; i++) { + var normFilename = ts.normalizePath(sourceFiles[i].fileName); + this.filenameToSourceFile[normFilename] = sourceFiles[i]; + } + } + + finishGraph() { + this.updateGraph(); + this.compilerService.languageService.getNavigateToItems(".*"); + } + + updateGraph() { + this.program = this.compilerService.languageService.getProgram(); + this.updateFileMap(); + } + + isConfiguredProject() { + return this.projectFilename; + } + + // add a root file to project + addRoot(info: ScriptInfo) { + info.defaultProject = this; + return this.compilerService.host.addRoot(info); + } + + filesToString() { + var strBuilder = ""; + ts.forEachValue(this.filenameToSourceFile, + sourceFile => { strBuilder += sourceFile.fileName + "\n"; }); + return strBuilder; + } + + setProjectOptions(projectOptions: ProjectOptions) { + this.projectOptions = projectOptions; + if (projectOptions.compilerOptions) { + this.compilerService.setCompilerOptions(projectOptions.compilerOptions); + } + // TODO: format code options + } + } + + interface ProjectOpenResult { + success?: boolean; + errorMsg?: string; + project?: Project; + } + + function copyListRemovingItem(item: T, list: T[]) { + var copiedList: T[] = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + + interface ProjectServiceEventHandler { + (eventName: string, project: Project): void; + } + + export class ProjectService { + filenameToScriptInfo: ts.Map = {}; + // open, non-configured files in two lists + openFileRoots: ScriptInfo[] = []; + openFilesReferenced: ScriptInfo[] = []; + // projects covering open files + inferredProjects: Project[] = []; + + constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) { + // ts.disableIncrementalParsing = true; + } + + watchedFileChanged(fileName: string) { + var info = this.filenameToScriptInfo[fileName]; + if (!info) { + this.psLogger.info("Error: got watch notification for unknown file: " + fileName); + } + + if (!this.host.fileExists(fileName)) { + // File was deleted + this.fileDeletedInFilesystem(info); + } + else { + if (info && (!info.isOpen)) { + info.svc.reloadFromFile(info.fileName); + } + } + } + + + log(msg: string, type = "Err") { + this.psLogger.msg(msg, type); + } + + closeLog() { + this.psLogger.close(); + } + + createInferredProject(root: ScriptInfo) { + var iproj = new Project(this); + iproj.addRoot(root); + iproj.finishGraph(); + this.inferredProjects.push(iproj); + return iproj; + } + + fileDeletedInFilesystem(info: ScriptInfo) { + this.psLogger.info(info.fileName + " deleted"); + + if (info.fileWatcher) { + info.fileWatcher.close(); + info.fileWatcher = undefined; + } + + if (!info.isOpen) { + this.filenameToScriptInfo[info.fileName] = undefined; + var referencingProjects = this.findReferencingProjects(info); + for (var i = 0, len = referencingProjects.length; i < len; i++) { + referencingProjects[i].removeReferencedFile(info); + } + } + this.printProjects(); + } + + addOpenFile(info: ScriptInfo) { + this.findReferencingProjects(info); + if (info.defaultProject) { + this.openFilesReferenced.push(info); + } + else { + // create new inferred project p with the newly opened file as root + info.defaultProject = this.createInferredProject(info); + var openFileRoots: ScriptInfo[] = []; + // for each inferred project root r + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + var r = this.openFileRoots[i]; + // if r referenced by the new project + if (info.defaultProject.getSourceFile(r)) { + // remove project rooted at r + this.inferredProjects = + copyListRemovingItem(r.defaultProject, this.inferredProjects); + // put r in referenced open file list + this.openFilesReferenced.push(r); + // set default project of r to the new project + r.defaultProject = info.defaultProject; + } + else { + // otherwise, keep r as root of inferred project + openFileRoots.push(r); + } + } + this.openFileRoots = openFileRoots; + this.openFileRoots.push(info); + } + } + + closeOpenFile(info: ScriptInfo) { + var openFileRoots: ScriptInfo[] = []; + var removedProject: Project; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + // if closed file is root of project + if (info == this.openFileRoots[i]) { + // remove that project and remember it + removedProject = info.defaultProject; + } + else { + openFileRoots.push(this.openFileRoots[i]); + } + } + this.openFileRoots = openFileRoots; + if (removedProject) { + // remove project from inferred projects list + this.inferredProjects = copyListRemovingItem(removedProject, this.inferredProjects); + var openFilesReferenced: ScriptInfo[] = []; + var orphanFiles: ScriptInfo[] = []; + // for all open, referenced files f + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var f = this.openFilesReferenced[i]; + // if f was referenced by the removed project, remember it + if (f.defaultProject == removedProject) { + f.defaultProject = undefined; + orphanFiles.push(f); + } + else { + // otherwise add it back to the list of referenced files + openFilesReferenced.push(f); + } + } + this.openFilesReferenced = openFilesReferenced; + // treat orphaned files as newly opened + for (var i = 0, len = orphanFiles.length; i < len; i++) { + this.addOpenFile(orphanFiles[i]); + } + } + else { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + info.close(); + } + + findReferencingProjects(info: ScriptInfo) { + var referencingProjects: Project[] = []; + info.defaultProject = undefined; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + this.inferredProjects[i].updateGraph(); + if (this.inferredProjects[i].getSourceFile(info)) { + info.defaultProject = this.inferredProjects[i]; + referencingProjects.push(this.inferredProjects[i]); + } + } + return referencingProjects; + } + + getScriptInfo(filename: string) { + filename = ts.normalizePath(filename); + return ts.lookUp(this.filenameToScriptInfo, filename); + } + + /** + * @param filename is absolute pathname + */ + openFile(fileName: string, openedByClient = false) { + fileName = ts.normalizePath(fileName); + var info = ts.lookUp(this.filenameToScriptInfo, fileName); + if (!info) { + var content: string; + if (this.host.fileExists(fileName)) { + content = this.host.readFile(fileName); + } + if (!content) { + if (openedByClient) { + content = ""; + } + } + if (content !== undefined) { + info = new ScriptInfo(this.host, fileName, content, openedByClient); + this.filenameToScriptInfo[fileName] = info; + if (!info.isOpen) { + info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); }); + } + } + } + if (info) { + if (openedByClient) { + info.isOpen = true; + } + } + return info; + } + + /** + * Open file whose contents is managed by the client + * @param filename is absolute pathname + */ + + openClientFile(filename: string) { + // TODO: tsconfig check + var info = this.openFile(filename, true); + this.addOpenFile(info); + this.printProjects(); + return info; + } + + /** + * Close file whose contents is managed by the client + * @param filename is absolute pathname + */ + + closeClientFile(filename: string) { + // TODO: tsconfig check + var info = ts.lookUp(this.filenameToScriptInfo, filename); + if (info) { + this.closeOpenFile(info); + info.isOpen = false; + } + this.printProjects(); + } + + getProjectsReferencingFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + var projects: Project[] = []; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + if (this.inferredProjects[i].getSourceFile(scriptInfo)) { + projects.push(this.inferredProjects[i]); + } + } + return projects; + } + } + + getProjectForFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + return scriptInfo.defaultProject; + } + } + + printProjectsForFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + this.psLogger.startGroup(); + this.psLogger.info("Projects for " + filename) + var projects = this.getProjectsReferencingFile(filename); + for (var i = 0, len = projects.length; i < len; i++) { + this.psLogger.info("Inferred Project " + i.toString()); + } + this.psLogger.endGroup(); + } + else { + this.psLogger.info(filename + " not in any project"); + } + } + + printProjects() { + this.psLogger.startGroup(); + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + var project = this.inferredProjects[i]; + this.psLogger.info("Project " + i.toString()); + this.psLogger.info(project.filesToString()); + this.psLogger.info("-----------------------------------------------"); + } + this.psLogger.info("Open file roots: ") + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + this.psLogger.info(this.openFileRoots[i].fileName); + } + this.psLogger.info("Open files referenced: ") + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + this.psLogger.info(this.openFilesReferenced[i].fileName); + } + this.psLogger.endGroup(); + } + + openConfigFile(configFilename: string): ProjectOpenResult { + configFilename = ts.normalizePath(configFilename); + // file references will be relative to dirPath (or absolute) + var dirPath = ts.getDirectoryPath(configFilename); + var rawConfig = ts.readConfigFile(configFilename); + if (!rawConfig) { + return { errorMsg: "tsconfig syntax error" }; + } + else { + // REVIEW: specify no base path so can get absolute path below + var parsedCommandLine = ts.parseConfigFile(rawConfig); + + if (parsedCommandLine.errors) { + // TODO: gather diagnostics and transmit + return { errorMsg: "tsconfig option errors" }; + } + else if (parsedCommandLine.fileNames) { + var proj = this.createProject(configFilename); + for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) { + var rootFilename = parsedCommandLine.fileNames[i]; + var normRootFilename = ts.normalizePath(rootFilename); + normRootFilename = getAbsolutePath(normRootFilename, dirPath); + if (this.host.fileExists(normRootFilename)) { + var info = this.openFile(normRootFilename); + proj.addRoot(info); + } + else { + return { errorMsg: "specified file " + rootFilename + " not found" }; + } + } + var projectOptions: ProjectOptions = { + files: parsedCommandLine.fileNames, + compilerOptions: parsedCommandLine.options + }; + if (rawConfig.formatCodeOptions) { + projectOptions.formatCodeOptions = rawConfig.formatCodeOptions; + } + proj.setProjectOptions(projectOptions); + return { success: true, project: proj }; + } + else { + return { errorMsg: "no files found" }; + } + } + } + + createProject(projectFilename: string) { + var eproj = new Project(this); + eproj.projectFilename = projectFilename; + return eproj; + } + + } + + class CompilerService { + host: LSHost; + languageService: ts.LanguageService; + classifier: ts.Classifier; + settings = ts.getDefaultCompilerOptions(); + documentRegistry = ts.createDocumentRegistry(); + formatCodeOptions: ts.FormatCodeOptions = CompilerService.defaultFormatCodeOptions; + + constructor(public project: Project) { + this.host = new LSHost(project.projectService.host, project); + // override default ES6 (remove when compiler default back at ES5) + this.settings.target = ts.ScriptTarget.ES5; + this.host.setCompilationSettings(this.settings); + this.languageService = ts.createLanguageService(this.host, this.documentRegistry); + this.classifier = ts.createClassifier(); + } + + setCompilerOptions(opt: ts.CompilerOptions) { + this.settings = opt; + this.host.setCompilationSettings(opt); + } + + isExternalModule(filename: string): boolean { + var sourceFile = this.languageService.getSourceFile(filename); + return ts.isExternalModule(sourceFile); + } + + static defaultFormatCodeOptions: ts.FormatCodeOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: ts.sys.newLine, + ConvertTabsToSpaces: true, + InsertSpaceAfterCommaDelimiter: true, + InsertSpaceAfterSemicolonInForStatements: true, + InsertSpaceBeforeAndAfterBinaryOperators: true, + InsertSpaceAfterKeywordsInControlFlowStatements: true, + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + PlaceOpenBraceOnNewLineForFunctions: false, + PlaceOpenBraceOnNewLineForControlBlocks: false, + } + + } + + interface LineCollection { + charCount(): number; + lineCount(): number; + isLeaf(): boolean; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + } + + export interface ILineInfo { + line: number; + col: number; + text?: string; + leaf?: LineLeaf; + } + + enum CharRangeSection { + PreStart, + Start, + Entire, + Mid, + End, + PostEnd + } + + interface ILineIndexWalker { + goSubtree: boolean; + done: boolean; + leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void; + pre? (relativeStart: number, relativeLength: number, lineCollection: LineCollection, + parent: LineNode, nodeType: CharRangeSection): LineCollection; + post? (relativeStart: number, relativeLength: number, lineCollection: LineCollection, + parent: LineNode, nodeType: CharRangeSection): LineCollection; + } + + class BaseLineIndexWalker implements ILineIndexWalker { + goSubtree = true; + done = false; + leaf(rangeStart: number, rangeLength: number, ll: LineLeaf) { + } + } + + class EditWalker extends BaseLineIndexWalker { + lineIndex = new LineIndex(); + // path to start of range + startPath: LineCollection[]; + endBranch: LineCollection[] = []; + branchNode: LineNode; + // path to current node + stack: LineNode[]; + state = CharRangeSection.Entire; + lineCollectionAtBranch: LineCollection; + initialText = ""; + trailingText = ""; + suppressTrailingText = false; + + constructor() { + super(); + this.lineIndex.root = new LineNode(); + this.startPath = [this.lineIndex.root]; + this.stack = [this.lineIndex.root]; + } + + insertLines(insertedText: string) { + if (this.suppressTrailingText) { + this.trailingText = ""; + } + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] == "") { + lines.length--; + } + } + var branchParent: LineNode; + var lastZeroCount: LineCollection; + + for (var k = this.endBranch.length - 1; k >= 0; k--) { + (this.endBranch[k]).updateCounts(); + if (this.endBranch[k].charCount() == 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; + } + else { + branchParent = this.branchNode; + } + } + } + if (lastZeroCount) { + branchParent.remove(lastZeroCount); + } + + // path at least length two (root and leaf) + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + + if (len > 0) { + leafNode.text = lines[0]; + + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1, len = lines.length; i < len; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); + } + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + (this.startPath[j]).updateCounts(); + } + } + } + else { + // no content for leaf node, so delete it + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + (this.startPath[j]).updateCounts(); + } + } + + return this.lineIndex; + } + + post(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection): LineCollection { + // have visited the path for start of range, now looking for end + // if range is on single line, we will never make this state transition + if (lineCollection == this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; + } + // always pop stack because post only called when child has been visited + this.stack.length--; + return undefined; + } + + pre(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection) { + // currentNode corresponds to parent, but in the new tree + var currentNode = this.stack[this.stack.length - 1]; + + if ((this.state == CharRangeSection.Entire) && (nodeType == CharRangeSection.Start)) { + // if range is on single line, we will never make this state transition + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; + } + + var child: LineCollection; + function fresh(node: LineCollection): LineCollection { + if (node.isLeaf()) { + return new LineLeaf(""); + } + else return new LineNode(); + } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state != CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state == CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state != CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state != CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state != CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; + } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; + } + // just gather text from the leaves + leaf(relativeStart: number, relativeLength: number, ll: LineLeaf) { + if (this.state == CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); + } + else if (this.state == CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + else { + // state is CharRangeSection.End + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + } + } + + // text change information + class TextChange { + constructor(public pos: number, public deleteLen: number, public insertedText?: string) { + } + + getTextChangeRange() { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), + this.insertedText ? this.insertedText.length : 0); + } + } + + class ScriptVersionCache { + changes: TextChange[] = []; + versions: LineIndexSnapshot[] = []; + minVersion = 0; // no versions earlier than min version will maintain change history + private currentVersion = 0; + + static changeNumberThreshold = 8; + static changeLengthThreshold = 256; + + // REVIEW: can optimize by coalescing simple edits + edit(pos: number, deleteLen: number, insertedText?: string) { + this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || + (deleteLen > ScriptVersionCache.changeLengthThreshold) || + (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + this.getSnapshot(); + } + } + + latest() { + return this.versions[this.currentVersion]; + } + + latestVersion() { + if (this.changes.length > 0) { + this.getSnapshot(); + } + return this.currentVersion; + } + + reloadFromFile(filename: string, cb?: () => any) { + var content = ts.sys.readFile(filename); + this.reload(content); + if (cb) + cb(); + } + + // reload whole script, leaving no change history behind reload + reload(script: string) { + this.currentVersion++; + this.changes = []; // history wiped out by reload + var snap = new LineIndexSnapshot(this.currentVersion, this); + this.versions[this.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + // REVIEW: could use linked list + for (var i = this.minVersion; i < this.currentVersion; i++) { + this.versions[i] = undefined; + } + this.minVersion = this.currentVersion; + + } + + getSnapshot() { + var snap = this.versions[this.currentVersion]; + if (this.changes.length > 0) { + var snapIndex = this.latest().index; + for (var i = 0, len = this.changes.length; i < len; i++) { + var change = this.changes[i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); + } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[snap.version] = snap; + this.changes = []; + } + return snap; + } + + getTextChangesBetweenVersions(oldVersion: number, newVersion: number) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges: ts.TextChangeRange[] = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[i]; + for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { + var textChange = snap.changesSincePreviousVersion[j]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } + } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + } + else { + return undefined; + } + } + else { + return ts.unchangedTextChangeRange; + } + } + + static fromString(script: string) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + } + } + + class LineIndexSnapshot implements ts.IScriptSnapshot { + index: LineIndex; + changesSincePreviousVersion: TextChange[] = []; + + constructor(public version: number, public cache: ScriptVersionCache) { + } + + getText(rangeStart: number, rangeEnd: number) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + } + + getLength() { + return this.index.root.charCount(); + } + + // this requires linear space so don't hold on to these + getLineStartPositions(): number[] { + var starts: number[] = [-1]; + var count = 1; + var pos = 0; + this.index.every((ll, s, len) => { + starts[count++] = pos; + pos += ll.text.length; + return true; + }, 0); + return starts; + } + + getLineMapper() { + return ((line: number) => { + return this.index.lineNumberToInfo(line).col; + }); + } + + getTextChangeRangeSinceVersion(scriptVersion: number) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + } + } + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { + var oldSnap = oldSnapshot; + return this.getTextChangeRangeSinceVersion(oldSnap.version); + } + } + + class LineIndex { + root: LineNode; + // set this to true to check each edit for accuracy + checkEdits = false; + + charOffsetToLineNumberAndPos(charOffset: number) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + } + + lineNumberToInfo(lineNumber: number): ILineInfo { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; + } + else { + return { + line: lineNumber, + col: this.root.charCount() + } + } + } + + load(lines: string[]) { + if (lines.length > 0) { + var leaves: LineLeaf[] = []; + for (var i = 0, len = lines.length; i < len; i++) { + leaves[i] = new LineLeaf(lines[i]); + } + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); + } + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + this.root.walk(rangeStart, rangeLength, walkFns); + } + + getText(rangeStart: number, rangeLength: number) { + var accum = ""; + if (rangeLength > 0) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: (relativeStart: number, relativeLength: number, ll: LineLeaf) => { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); + } + return accum; + } + + every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart: number, relativeLength: number, ll: LineLeaf) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + } + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; + } + + edit(pos: number, deleteLength: number, newText?: string) { + function editFlat(source: string, s: number, dl: number, nt = "") { + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() == 0) { + // TODO: assert deleteLength == 0 + if (newText) { + this.load(LineIndex.linesFromText(newText).lines); + return this; + } + } + else { + if (this.checkEdits) { + var checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (deleteLength > 0) { + // check whether last characters deleted are line break + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.col == 0))) { + // move range end just past line that will merge with previous line + deleteLength += lineInfo.text.length; + // store text by appending to end of insertedText + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } + } + } + else if (pos >= this.root.charCount()) { + // insert at end + var endString = this.getText(pos - 1, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; + } + pos = pos - 1; + deleteLength = 0; + walker.suppressTrailingText = true; + } + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + Debug.assert(checkText == updatedText, "buffer edit mismatch"); + } + return walker.lineIndex; + } + } + + static buildTreeFromBottom(nodes: LineCollection[]): LineNode { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes: LineNode[] = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; + } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length == 1) { + return interiorNodes[0]; + } + else { + return this.buildTreeFromBottom(interiorNodes); + } + } + + static linesFromText(text: string) { + var lineStarts = ts.computeLineStarts(text); + + if (lineStarts.length == 0) { + return { lines: [], lineMap: lineStarts }; + } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + } + + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; + } + return { lines: lines, lineMap: lineStarts }; + } + } + + class LineNode implements LineCollection { + totalChars = 0; + totalLines = 0; + children: LineCollection[] = []; + + isLeaf() { + return false; + } + + updateCounts() { + this.totalChars = 0; + this.totalLines = 0; + for (var i = 0, len = this.children.length; i < len; i++) { + var child = this.children[i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } + } + + execWalk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker, childIndex: number, nodeType: CharRangeSection) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + } + else { + walkFns.goSubtree = true; + } + return walkFns.done; + } + + skipChild(relativeStart: number, relativeLength: number, childIndex: number, walkFns: ILineIndexWalker, nodeType: CharRangeSection) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; + } + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + // find sub-tree containing start + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + child = this.children[++childIndex]; + childCharCount = child.charCount(); + } + // Case I: both start and end of range in same subtree + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + // Case II: start and end of range in different subtrees (possibly with subtrees in the middle) + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + child = this.children[++childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; + } + adjustedLength -= childCharCount; + child = this.children[++childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + // Process any subtrees after the one containing range end + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + } + } + } + } + + charOffsetToLineNumberAndPos(lineNumber: number, charOffset: number): ILineInfo { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + col: charOffset, + } + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + col: childInfo.charOffset, + text: ((childInfo.child)).text, + leaf: ((childInfo.child)) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), col: lineInfo.leaf.charCount() }; + } + } + + lineNumberToInfo(lineNumber: number, charOffset: number): ILineInfo { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + col: charOffset + } + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + col: childInfo.charOffset, + text: ((childInfo.child)).text, + leaf: ((childInfo.child)) + } + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + } + + childFromLineNumber(lineNumber: number, charOffset: number) { + var child: LineCollection; + var relativeLineNumber = lineNumber; + for (var i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + } + + childFromCharOffset(lineNumber: number, charOffset: number) { + var child: LineCollection; + for (var i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + } + } + + splitAfter(childIndex: number) { + var splitNode: LineNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex++]); + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + } + + remove(child: LineCollection) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + } + + findChildIndex(child: LineCollection) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] != child) && (childIndex < clen)) childIndex++; + return childIndex; + } + + insertAt(child: LineCollection, nodes: LineCollection[]) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + // if child is last and there is more room and only one node to place, place it + if ((clen < lineCollectionCapacity) && (childIndex == (clen - 1)) && (nodeCount == 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex++] = nodes[nodeIndex++]; + } + var splitNodes: LineNode[] = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex++]); + if (splitNode.children.length == lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length == 0) { + splitNodes.length--; + } + } + } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (i = 0; i < splitNodeCount; i++) { + (splitNodes[i]).updateCounts(); + } + return splitNodes; + } + } + + // assume there is room for the item; return true if more room + add(collection: LineCollection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + } + + charCount() { + return this.totalChars; + } + + lineCount() { + return this.totalLines; + } + } + + class LineLeaf implements LineCollection { + udata: any; + + constructor(public text: string) { + + } + + setUdata(data: any) { + this.udata = data; + } + + getUdata() { + return this.udata; + } + + isLeaf() { + return true; + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + walkFns.leaf(rangeStart, rangeLength, this); + } + + charCount() { + return this.text.length; + } + + lineCount() { + return 1; + } + } +} \ No newline at end of file diff --git a/src/server/node.d.ts b/src/server/node.d.ts new file mode 100644 index 00000000000..2002f973a37 --- /dev/null +++ b/src/server/node.d.ts @@ -0,0 +1,677 @@ +// Type definitions for Node.js v0.10.1 +// Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript , DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/************************************************ +* * +* Node.js v0.10.1 API * +* * +************************************************/ + +/************************************************ +* * +* GLOBAL * +* * +************************************************/ +declare var process: NodeJS.Process; +declare var global: any; + +declare var __filename: string; +declare var __dirname: string; + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearTimeout(timeoutId: NodeJS.Timer): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearInterval(intervalId: NodeJS.Timer): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearImmediate(immediateId: any): void; + +declare var require: { + (id: string): any; + resolve(id: string): string; + cache: any; + extensions: any; + main: any; +}; + +declare var module: { + exports: any; + require(id: string): any; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; +}; + +// Same as module.exports +declare var exports: any; +declare var SlowBuffer: { + new (str: string, encoding?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: Buffer[], totalLength?: number): Buffer; +}; + + +// Buffer class +interface Buffer extends NodeBuffer { } +interface BufferConstructor { + new (str: string, encoding ?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding ?: string): number; + concat(list: Buffer[], totalLength ?: number): Buffer; +} +declare var Buffer: BufferConstructor; + +/************************************************ +* * +* GLOBAL INTERFACES * +* * +************************************************/ +declare module NodeJS { + export interface ErrnoException extends Error { + errno?: any; + code?: string; + path?: string; + syscall?: string; + } + + export interface EventEmitter { + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + + export interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + } + + export interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface ReadWriteStream extends ReadableStream, WritableStream { } + + export interface Process extends EventEmitter { + stdout: WritableStream; + stderr: WritableStream; + stdin: ReadableStream; + argv: string[]; + execPath: string; + abort(): void; + chdir(directory: string): void; + cwd(): string; + env: any; + exit(code?: number): void; + getgid(): number; + setgid(id: number): void; + setgid(id: string): void; + getuid(): number; + setuid(id: number): void; + setuid(id: string): void; + version: string; + versions: { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + openssl: string; + }; + config: { + target_defaults: { + cflags: any[]; + default_configuration: string; + defines: string[]; + include_dirs: string[]; + libraries: string[]; + }; + variables: { + clang: number; + host_arch: string; + node_install_npm: boolean; + node_install_waf: boolean; + node_prefix: string; + node_shared_openssl: boolean; + node_shared_v8: boolean; + node_shared_zlib: boolean; + node_use_dtrace: boolean; + node_use_etw: boolean; + node_use_openssl: boolean; + target_arch: string; + v8_no_strict_aliasing: number; + v8_use_snapshot: boolean; + visibility: string; + }; + }; + kill(pid: number, signal?: string): void; + pid: number; + title: string; + arch: string; + platform: string; + memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; + nextTick(callback: Function): void; + umask(mask?: number): number; + uptime(): number; + hrtime(time?: number[]): number[]; + + // Worker + send? (message: any, sendHandle?: any): void; + } + + export interface Timer { + ref(): void; + unref(): void; + } +} + + +/** + * @deprecated + */ +interface NodeBuffer { + [index: number]: number; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): any; + length: number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + readUInt8(offset: number, noAsset?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + writeUInt8(value: number, offset: number, noAssert?: boolean): void; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeInt8(value: number, offset: number, noAssert?: boolean): void; + writeInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeFloatLE(value: number, offset: number, noAssert?: boolean): void; + writeFloatBE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): void; + fill(value: any, offset?: number, end?: number): void; +} + +declare module NodeJS { + export interface Path { + normalize(p: string): string; + join(...paths: any[]): string; + resolve(...pathSegments: any[]): string; + relative(from: string, to: string): string; + dirname(p: string): string; + basename(p: string, ext?: string): string; + extname(p: string): string; + sep: string; + } +} + +declare module NodeJS { + export interface ReadLineInstance extends EventEmitter { + setPrompt(prompt: string, length: number): void; + prompt(preserveCursor?: boolean): void; + question(query: string, callback: Function): void; + pause(): void; + resume(): void; + close(): void; + write(data: any, key?: any): void; + } + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output: NodeJS.WritableStream; + completer?: Function; + terminal?: boolean; + } + + export interface ReadLine { + createInterface(options: ReadLineOptions): ReadLineInstance; + } +} + +declare module NodeJS { + module events { + export class EventEmitter implements NodeJS.EventEmitter { + static listenerCount(emitter: EventEmitter, event: string): number; + + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + } +} + +declare module NodeJS { + module stream { + + export interface Stream extends events.EventEmitter { + pipe(destination: T, options?: { end?: boolean; }): T; + } + + export interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + } + + export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { + readable: boolean; + constructor(opts?: ReadableOptions); + _read(size: number): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + } + + export interface WritableOptions { + highWaterMark?: number; + decodeStrings?: boolean; + } + + export class Writable extends events.EventEmitter implements NodeJS.WritableStream { + writable: boolean; + constructor(opts?: WritableOptions); + _write(data: Buffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean; + } + + // Note: Duplex extends both Readable and Writable. + export class Duplex extends Readable implements NodeJS.ReadWriteStream { + writable: boolean; + constructor(opts?: DuplexOptions); + _write(data: Buffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface TransformOptions extends ReadableOptions, WritableOptions { } + + // Note: Transform lacks the _read and _write methods of Readable/Writable. + export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { + readable: boolean; + writable: boolean; + constructor(opts?: TransformOptions); + _transform(chunk: Buffer, encoding: string, callback: Function): void; + _transform(chunk: string, encoding: string, callback: Function): void; + _flush(callback: Function): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export class PassThrough extends Transform { } + } +} + +declare module NodeJS { + module fs { + interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + } + interface FSWatcher extends events.EventEmitter { + close(): void; + } + + export interface ReadStream extends stream.Readable { } + export interface WriteStream extends stream.Writable { } + + export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncateSync(path: string, len?: number): void; + export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncateSync(fd: number, len?: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + export function readlinkSync(path: string): string; + export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpathSync(path: string, cache?: { [path: string]: string }): string; + export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function unlinkSync(path: string): void; + export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function rmdirSync(path: string): void; + export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdirSync(path: string, mode?: number): void; + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function openSync(path: string, flags: string, mode?: number): number; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function utimesSync(path: string, atime: Date, mtime: Date): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function futimesSync(fd: number, atime: Date, mtime: Date): void; + export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFileSync(filename: string, encoding: string): string; + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; + export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: number; + bufferSize?: number; + }): ReadStream; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: string; + bufferSize?: number; + }): ReadStream; + export function createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + string?: string; + }): WriteStream; + } +} + +declare module NodeJS { + module path { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + } +} + +declare module NodeJS { + module _debugger { + export interface Packet { + raw: string; + headers: string[]; + body: Message; + } + + export interface Message { + seq: number; + type: string; + } + + export interface RequestInfo { + command: string; + arguments: any; + } + + export interface Request extends Message, RequestInfo { + } + + export interface Event extends Message { + event: string; + body?: any; + } + + export interface Response extends Message { + request_seq: number; + success: boolean; + /** Contains error message if success == false. */ + message?: string; + /** Contains message body if success == true. */ + body?: any; + } + + export interface BreakpointMessageBody { + type: string; + target: number; + line: number; + } + + export class Protocol { + res: Packet; + state: string; + execute(data: string): void; + serialize(rq: Request): string; + onResponse: (pkt: Packet) => void; + } + + export var NO_FRAME: number; + export var port: number; + + export interface ScriptDesc { + name: string; + id: number; + isNative?: boolean; + handle?: number; + type: string; + lineOffset?: number; + columnOffset?: number; + lineCount?: number; + } + + export interface Breakpoint { + id: number; + scriptId: number; + script: ScriptDesc; + line: number; + condition?: string; + scriptReq?: string; + } + + export interface RequestHandler { + (err: boolean, body: Message, res: Packet): void; + request_seq?: number; + } + + export interface ResponseBodyHandler { + (err: boolean, body?: any): void; + request_seq?: number; + } + + export interface ExceptionInfo { + text: string; + } + + export interface BreakResponse { + script?: ScriptDesc; + exception?: ExceptionInfo; + sourceLine: number; + sourceLineText: string; + sourceColumn: number; + } + + export function SourceInfo(body: BreakResponse): string; + + export class Client extends events.EventEmitter { + protocol: Protocol; + scripts: ScriptDesc[]; + handles: ScriptDesc[]; + breakpoints: Breakpoint[]; + currentSourceLine: number; + currentSourceColumn: number; + currentSourceLineText: string; + currentFrame: number; + currentScript: string; + + connect(port: number, host: string): void; + req(req: any, cb: RequestHandler): void; + reqFrameEval(code: string, frame: number, cb: RequestHandler): void; + mirrorObject(obj: any, depth: number, cb: ResponseBodyHandler): void; + setBreakpoint(rq: BreakpointMessageBody, cb: RequestHandler): void; + clearBreakpoint(rq: Request, cb: RequestHandler): void; + listbreakpoints(cb: RequestHandler): void; + reqSource(from: number, to: number, cb: RequestHandler): void; + reqScripts(cb: any): void; + reqContinue(cb: RequestHandler): void; + } + } +} \ No newline at end of file diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts new file mode 100644 index 00000000000..b07fb20d48d --- /dev/null +++ b/src/server/protocol.d.ts @@ -0,0 +1,823 @@ +/** + * Declaration module describing the TypeScript Server protocol + */ +declare module ts.server.protocol { + /** + * A TypeScript Server message + */ + export interface Message { + /** + * Sequence number of the message + */ + seq: number; + + /** + * One of "request", "response", or "event" + */ + type: string; + } + + /** + * Client-initiated request message + */ + export interface Request extends Message { + /** + * The command to execute + */ + command: string; + + /** + * Object containing arguments for the command + */ + arguments?: any; + } + + /** + * Server-initiated event message + */ + export interface Event extends Message { + /** + * Name of event + */ + event: string; + + /** + * Event-specific information + */ + body?: any; + } + + /** + * Response by server to client request message. + */ + export interface Response extends Message { + /** + * Sequence number of the request message. + */ + request_seq: number; + + /** + * Outcome of the request. + */ + success: boolean; + + /** + * The command requested. + */ + command: string; + + /** + * Contains error message if success == false. + */ + message?: string; + + /** + * Contains message body if success == true. + */ + body?: any; + } + + /** + * Arguments for FileRequest messages. + */ + export interface FileRequestArgs { + /** + * The file for the request (absolute pathname required). + */ + file: string; + } + + /** + * Request whose sole parameter is a file name. + */ + export interface FileRequest extends Request { + arguments: FileRequestArgs; + } + + /** + * Instances of this interface specify a location in a source file: + * (file, line, col), where line and column are 1-based. + */ + export interface FileLocationRequestArgs extends FileRequestArgs { + /** + * The line number for the request (1-based). + */ + line: number; + + /** + * The column for the request (1-based). + */ + col: number; + } + + /** + * A request whose arguments specify a file location (file, line, col). + */ + export interface FileLocationRequest extends FileRequest { + arguments: FileLocationRequestArgs; + } + + /** + * Go to definition request; value of command field is + * "definition". Return response giving the file locations that + * define the symbol found in file at location line, col. + */ + export interface DefinitionRequest extends FileLocationRequest { + } + + /** + * Location in source code expressed as (one-based) line and column. + */ + export interface Location { + line: number; + col: number; + } + + /** + * Object found in response messages defining a span of text in source code. + */ + export interface TextSpan { + /** + * First character of the definition. + */ + start: Location; + + /** + * One character past last character of the definition. + */ + end: Location; + } + + /** + * Object found in response messages defining a span of text in a specific source file. + */ + export interface FileSpan extends TextSpan { + /** + * File containing text span. + */ + file: string; + } + + /** + * Definition response message. Gives text range for definition. + */ + export interface DefinitionResponse extends Response { + body?: FileSpan[]; + } + + /** + * Find references request; value of command field is + * "references". Return response giving the file locations that + * reference the symbol found in file at location line, col. + */ + export interface ReferencesRequest extends FileLocationRequest { + } + + export interface ReferencesResponseItem extends FileSpan { + /** Text of line containing the reference. Including this + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ + lineText: string; + + /** + * True if reference is a write location, false otherwise. + */ + isWriteAccess: boolean; + } + + /** + * The body of a "references" response message. + */ + export interface ReferencesResponseBody { + /** + * The file locations referencing the symbol. + */ + refs: ReferencesResponseItem[]; + + /** + * The name of the symbol. + */ + symbolName: string; + + /** + * The start column of the symbol (on the line provided by the references request). + */ + symbolStartCol: number; + + /** + * The full display name of the symbol. + */ + symbolDisplayString: string; + } + + /** + * Response to "references" request. + */ + export interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; + } + + export interface RenameRequestArgs extends FileLocationRequestArgs { + findInComments?: boolean; + findInStrings?: boolean; + } + + + /** + * Rename request; value of command field is "rename". Return + * response giving the file locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ + export interface RenameRequest extends FileLocationRequest { + arguments: RenameRequestArgs; + } + + /** + * Information about the item to be renamed. + */ + export interface RenameInfo { + /** + * True if item can be renamed. + */ + canRename: boolean; + + /** + * Error message if item can not be renamed. + */ + localizedErrorMessage?: string; + + /** + * Display name of the item to be renamed. + */ + displayName: string; + + /** + * Full display name of item to be renamed. + */ + fullDisplayName: string; + + /** + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + } + + /** + * A group of text spans, all in 'file'. + */ + export interface SpanGroup { + /** The file to which the spans apply */ + file: string; + /** The text spans in this group */ + locs: TextSpan[]; + } + + export interface RenameResponseBody { + /** + * Information about the item to be renamed. + */ + info: RenameInfo; + + /** + * An array of span groups (one per file) that refer to the item to be renamed. + */ + locs: SpanGroup[]; + } + + /** + * Rename response message. + */ + export interface RenameResponse extends Response { + body?: RenameResponseBody; + } + + /** + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ + export interface OpenRequest extends FileRequest { + } + + /** + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ + export interface CloseRequest extends FileRequest { + } + + /** + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ + export interface QuickInfoRequest extends FileLocationRequest { + } + + /** + * Body of QuickInfoResponse. + */ + export interface QuickInfoResponseBody { + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + + /** + * Starting file location of symbol. + */ + start: Location; + + /** + * One past last character of symbol. + */ + end: Location; + + /** + * Type and kind of symbol. + */ + displayString: string; + + /** + * Documentation associated with symbol. + */ + documentation: string; + } + + /** + * Quickinfo response message. + */ + export interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + + /** + * Arguments for format messages. + */ + export interface FormatRequestArgs extends FileLocationRequestArgs { + /** + * Last line of range for which to format text in file. + */ + endLine: number; + + /** + * Last column of range for which to format text in file. + */ + endCol: number; + } + + /** + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ + export interface FormatRequest extends FileLocationRequest { + arguments: FormatRequestArgs; + } + + /** + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ + export interface CodeEdit { + /** + * First character of the text span to edit. + */ + start: Location; + + /** + * One character past last character of the text span to edit. + */ + end: Location; + + /** + * Replace the span defined above with this string (may be + * the empty string). + */ + newText: string; + } + + /** + * Format and format on key response message. + */ + export interface FormatResponse extends Response { + body?: CodeEdit[]; + } + + /** + * Arguments for format on key messages. + */ + export interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + /** + * Key pressed (';', '\n', or '}'). + */ + key: string; + } + + /** + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ + export interface FormatOnKeyRequest extends FileLocationRequest { + arguments: FormatOnKeyRequestArgs; + } + + /** + * Arguments for completions messages. + */ + export interface CompletionsRequestArgs extends FileLocationRequestArgs { + /** + * Optional prefix to apply to possible completions. + */ + prefix?: string; + } + + /** + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ + export interface CompletionsRequest extends FileLocationRequest { + arguments: CompletionsRequestArgs; + } + + /** + * Arguments for completion details request. + */ + export interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + /** + * Names of one or more entries for which to obtain details. + */ + entryNames: string[]; + } + + /** + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ + export interface CompletionDetailsRequest extends FileLocationRequest { + arguments: CompletionDetailsRequestArgs; + } + + /** + * Part of a symbol description. + */ + export interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ + text: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + } + + /** + * An item found in a completion response. + */ + export interface CompletionEntry { + /** + * The symbol's name. + */ + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + } + + /** + * Additional completion entry details, available on demand + */ + export interface CompletionEntryDetails extends CompletionEntry { + /** + * Display parts of the symbol (similar to quick info). + */ + displayParts: SymbolDisplayPart[]; + + /** + * Documentation strings for the symbol. + */ + documentation: SymbolDisplayPart[]; + } + + export interface CompletionsResponse extends Response { + body?: CompletionEntry[]; + } + + export interface CompletionDetailsResponse extends Response { + body?: CompletionEntryDetails[]; + } + + /** + * Arguments for geterr messages. + */ + export interface GeterrRequestArgs { + /** + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ + files: string[]; + + /** + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ + delay: number; + } + + /** + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ + export interface GeterrRequest extends Request { + arguments: GeterrRequestArgs; + } + + /** + * Item of diagnostic information found in a DiagnosticEvent message. + */ + export interface Diagnostic { + /** + * Starting file location at which text appies. + */ + start: Location; + + /** + * The last file location at which the text applies. + */ + end: Location; + + /** + * Text of diagnostic message. + */ + text: string; + } + + export interface DiagnosticEventBody { + /** + * The file for which diagnostic information is reported. + */ + file: string; + + /** + * An array of diagnostic information items. + */ + diagnostics: Diagnostic[]; + } + + /** + * Event message for "syntaxDiag" and "semanticDiag" event types. + * These events provide syntactic and semantic errors for a file. + */ + export interface DiagnosticEvent extends Event { + body?: DiagnosticEventBody; + } + + /** + * Arguments for reload request. + */ + export interface ReloadRequestArgs extends FileRequestArgs { + /** + * Name of temporary file from which to reload file + * contents. May be same as file. + */ + tmpfile: string; + } + + /** + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ + export interface ReloadRequest extends FileRequest { + arguments: ReloadRequestArgs; + } + + /** + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ + export interface ReloadResponse extends Response { + } + + /** + * Arguments for saveto request. + */ + export interface SavetoRequestArgs extends FileRequestArgs { + /** + * Name of temporary file into which to save server's view of + * file contents. + */ + tmpfile: string; + } + + /** + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ + export interface SavetoRequest extends FileRequest { + arguments: SavetoRequestArgs; + } + + /** + * Arguments for navto request message. + */ + export interface NavtoRequestArgs extends FileRequestArgs { + /** + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ + searchTerm: string; + } + + /** + * Navto request message; value of command field is "navto". + * Return list of objects giving file locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ + export interface NavtoRequest extends FileRequest { + arguments: NavtoRequestArgs; + } + + /** + * An item found in a navto response. + */ + export interface NavtoItem { + /** + * The symbol's name. + */ + name: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + + /** + * exact, substring, or prefix. + */ + matchKind?: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + + /** + * The file in which the symbol is found. + */ + file: string; + + /** + * The location within file at which the symbol is found. + */ + start: Location; + + /** + * One past the last character of the symbol. + */ + end: Location; + + /** + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ + containerName?: string; + + /** + * Kind of symbol's container symbol (if any). + */ + containerKind?: string; + } + + /** + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ + export interface NavtoResponse extends Response { + body?: NavtoItem[]; + } + + /** + * Arguments for change request message. + */ + export interface ChangeRequestArgs extends FormatRequestArgs { + /** + * Optional string to insert at location (file, line, col). + */ + insertString?: string; + } + + /** + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ + export interface ChangeRequest extends FileLocationRequest { + arguments: ChangeRequestArgs; + } + + /** + * Response to "brace" request. + */ + export interface BraceResponse extends Response { + body?: TextSpan[]; + } + + /** + * Brace matching request; value of command field is "brace". + * Return response giving the file locations of matching braces + * found in file at location line, col. + */ + export interface BraceRequest extends FileLocationRequest { + } + + /** + * NavBar itesm request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. + */ + export interface NavBarRequest extends FileRequest { + } + + export interface NavigationBarItem { + /** + * The item's display text. + */ + text: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + + /** + * The definition locations of the item. + */ + spans: TextSpan[]; + + /** + * Optional children. + */ + childItems?: NavigationBarItem[]; + } + + export interface NavBarResponse extends Response { + body?: NavigationBarItem[]; + } +} diff --git a/src/server/server.ts b/src/server/server.ts new file mode 100644 index 00000000000..8921a4b4768 --- /dev/null +++ b/src/server/server.ts @@ -0,0 +1,219 @@ +/// +/// + +module ts.server { + var nodeproto: typeof NodeJS._debugger = require('_debugger'); + var readline: NodeJS.ReadLine = require('readline'); + var path: NodeJS.Path = require('path'); + var fs: typeof NodeJS.fs = require('fs'); + + var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + terminal: false, + }); + + class Logger implements ts.server.Logger { + fd = -1; + seq = 0; + inGroup = false; + firstInGroup = true; + + constructor(public logFilename: string) { + } + + static padStringRight(str: string, padding: string) { + return (str + padding).slice(0, padding.length); + } + + close() { + if (this.fd >= 0) { + fs.close(this.fd); + } + } + + perftrc(s: string) { + this.msg(s, "Perf"); + } + + info(s: string) { + this.msg(s, "Info"); + } + + startGroup() { + this.inGroup = true; + this.firstInGroup = true; + } + + endGroup() { + this.inGroup = false; + this.seq++; + this.firstInGroup = true; + } + + msg(s: string, type = "Err") { + if (this.fd < 0) { + this.fd = fs.openSync(this.logFilename, "w"); + } + if (this.fd >= 0) { + s = s + "\n"; + var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " "); + if (this.firstInGroup) { + s = prefix + s; + this.firstInGroup = false; + } + if (!this.inGroup) { + this.seq++; + this.firstInGroup = true; + } + var buf = new Buffer(s); + fs.writeSync(this.fd, buf, 0, buf.length, null); + } + } + } + + interface WatchedFile { + fileName: string; + callback: (fileName: string) => void; + mtime: Date; + } + + class WatchedFileSet { + private watchedFiles: WatchedFile[] = []; + private nextFileToCheck = 0; + private watchTimer: NodeJS.Timer; + private static fileDeleted = 34; + + // average async stat takes about 30 microseconds + // set chunk size to do 30 files in < 1 millisecond + constructor(public interval = 2500, public chunkSize = 30) { + } + + private static copyListRemovingItem(item: T, list: T[]) { + var copiedList: T[] = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + + private static getModifiedTime(fileName: string): Date { + return fs.statSync(fileName).mtime; + } + + private poll(checkedIndex: number) { + var watchedFile = this.watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + + fs.stat(watchedFile.fileName,(err, stats) => { + if (err) { + var msg = err.message; + if (err.errno) { + msg += " errno: " + err.errno.toString(); + } + if (err.errno == WatchedFileSet.fileDeleted) { + watchedFile.callback(watchedFile.fileName); + } + } + else if (watchedFile.mtime.getTime() != stats.mtime.getTime()) { + watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName); + } + }); + } + + // this implementation uses polling and + // stat due to inconsistencies of fs.watch + // and efficiency of stat on modern filesystems + private startWatchTimer() { + this.watchTimer = setInterval(() => { + var count = 0; + var nextToCheck = this.nextFileToCheck; + var firstCheck = -1; + while ((count < this.chunkSize) && (nextToCheck != firstCheck)) { + this.poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === this.watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + this.nextFileToCheck = nextToCheck; + }, this.interval); + } + + addFile(fileName: string, callback: (fileName: string) => void ): WatchedFile { + var file: WatchedFile = { + fileName, + callback, + mtime: WatchedFileSet.getModifiedTime(fileName) + }; + + this.watchedFiles.push(file); + if (this.watchedFiles.length === 1) { + this.startWatchTimer(); + } + return file; + } + + removeFile(file: WatchedFile) { + this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles); + } + } + + class IOSession extends Session { + constructor(host: ServerHost, logger: ts.server.Logger) { + super(host, logger); + } + + listen() { + rl.on('line',(input: string) => { + var message = input.trim(); + this.onMessage(message); + }); + + rl.on('close',() => { + this.projectService.closeLog(); + this.projectService.log("Exiting..."); + process.exit(0); + }); + } + } + + // This places log file in the directory containing editorServices.js + // TODO: check that this location is writable + var logger = new Logger(__dirname + "/.log" + process.pid.toString()); + + + // REVIEW: for now this implementation uses polling. + // The advantage of polling is that it works reliably + // on all os and with network mounted files. + // For 90 referenced files, the average time to detect + // changes is 2*msInterval (by default 5 seconds). + // The overhead of this is .04 percent (1/2500) with + // average pause of < 1 millisecond (and max + // pause less than 1.5 milliseconds); question is + // do we anticipate reference sets in the 100s and + // do we care about waiting 10-20 seconds to detect + // changes for large reference sets? If so, do we want + // to increase the chunk size or decrease the interval + // time dynamically to match the large reference set? + var watchedFileSet = new WatchedFileSet(); + ts.sys.watchFile = function (fileName, callback) { + var watchedFile = watchedFileSet.addFile(fileName, callback); + return { + close: () => watchedFileSet.removeFile(watchedFile) + } + + }; + + // Start listening + new IOSession(ts.sys, logger).listen(); +} \ No newline at end of file diff --git a/src/server/session.ts b/src/server/session.ts new file mode 100644 index 00000000000..19f6cd3645e --- /dev/null +++ b/src/server/session.ts @@ -0,0 +1,801 @@ +/// +/// +/// +/// +/// + +module ts.server { + var spaceCache = [" ", " ", " ", " "]; + + interface StackTraceError extends Error { + stack?: string; + } + + function generateSpaces(n: number): string { + if (!spaceCache[n]) { + var strBuilder = ""; + for (var i = 0; i < n; i++) { + strBuilder += " "; + } + spaceCache[n] = strBuilder; + } + return spaceCache[n]; + } + + interface FileStart { + file: string; + start: ILineInfo; + } + + function compareNumber(a: number, b: number) { + if (a < b) { + return -1; + } + else if (a == b) { + return 0; + } + else return 1; + } + + function compareFileStart(a: FileStart, b: FileStart) { + if (a.file < b.file) { + return -1; + } + else if (a.file == b.file) { + var n = compareNumber(a.start.line, b.start.line); + if (n == 0) { + return compareNumber(a.start.col, b.start.col); + } + else return n; + } + else { + return 1; + } + } + + function sortNavItems(items: ts.NavigateToItem[]) { + return items.sort((a, b) => { + if (a.matchKind < b.matchKind) { + return -1; + } + else if (a.matchKind == b.matchKind) { + var lowa = a.name.toLowerCase(); + var lowb = b.name.toLowerCase(); + if (lowa < lowb) { + return -1; + } + else if (lowa == lowb) { + return 0; + } + else { + return 1; + } + } + else { + return 1; + } + }) + } + + function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { + return { + start: project.compilerService.host.positionToLineCol(fileName, diag.start), + end: project.compilerService.host.positionToLineCol(fileName, diag.start + diag.length), + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + }; + } + + interface PendingErrorCheck { + fileName: string; + project: Project; + } + + function allEditsBeforePos(edits: ts.TextChange[], pos: number) { + for (var i = 0, len = edits.length; i < len; i++) { + if (ts.textSpanEnd(edits[i].span) >= pos) { + return false; + } + } + return true; + } + + export module CommandNames { + export var Change = "change"; + export var Close = "close"; + export var Completions = "completions"; + export var CompletionDetails = "completionEntryDetails"; + export var Definition = "definition"; + export var Format = "format"; + export var Formatonkey = "formatonkey"; + export var Geterr = "geterr"; + export var NavBar = "navbar"; + export var Navto = "navto"; + export var Open = "open"; + export var Quickinfo = "quickinfo"; + export var References = "references"; + export var Reload = "reload"; + export var Rename = "rename"; + export var Saveto = "saveto"; + export var Brace = "brace"; + export var Unknown = "unknown"; + } + + module Errors { + export var NoProject = new Error("No Project."); + export var NoContent = new Error("No Content."); + } + + export interface ServerHost extends ts.System { + } + + export class Session { + projectService: ProjectService; + pendingOperation = false; + fileHash: ts.Map = {}; + nextFileId = 1; + errorTimer: NodeJS.Timer; + immediateId: any; + changeSeq = 0; + + constructor(private host: ServerHost, private logger: Logger) { + this.projectService = new ProjectService(host, logger); + } + + logError(err: Error, cmd: string) { + var typedErr = err; + var msg = "Exception on executing command " + cmd; + if (typedErr.message) { + msg += ":\n" + typedErr.message; + if (typedErr.stack) { + msg += "\n" + typedErr.stack; + } + } + this.projectService.log(msg); + } + + sendLineToClient(line: string) { + this.host.write(line + this.host.newLine); + } + + send(msg: NodeJS._debugger.Message) { + var json = JSON.stringify(msg); + this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + + '\r\n\r\n' + json); + } + + event(info: any, eventName: string) { + var ev: NodeJS._debugger.Event = { + seq: 0, + type: "event", + event: eventName, + body: info, + }; + this.send(ev); + } + + response(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { + var res: protocol.Response = { + seq: 0, + type: "response", + command: cmdName, + request_seq: reqSeq, + success: !errorMsg, + } + if (!errorMsg) { + res.body = info; + } + else { + res.message = errorMsg; + } + this.send(res); + } + + output(body: any, commandName: string, requestSequence = 0, errorMessage?: string) { + this.response(body, commandName, requestSequence, errorMessage); + } + + semanticCheck(file: string, project: Project) { + var diags = project.compilerService.languageService.getSemanticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + } + } + + syntacticCheck(file: string, project: Project) { + var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } + } + + errorCheck(file: string, project: Project) { + this.syntacticCheck(file, project); + this.semanticCheck(file, project); + } + + updateErrorCheck(checkList: PendingErrorCheck[], seq: number, + matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) { + if (followMs > ms) { + followMs = ms; + } + if (this.errorTimer) { + clearTimeout(this.errorTimer); + } + if (this.immediateId) { + clearImmediate(this.immediateId); + this.immediateId = undefined; + } + var index = 0; + var checkOne = () => { + if (matchSeq(seq)) { + var checkSpec = checkList[index++]; + if (checkSpec.project.getSourceFileFromName(checkSpec.fileName)) { + this.syntacticCheck(checkSpec.fileName, checkSpec.project); + this.immediateId = setImmediate(() => { + this.semanticCheck(checkSpec.fileName, checkSpec.project); + this.immediateId = undefined; + if (checkList.length > index) { + this.errorTimer = setTimeout(checkOne, followMs); + } + else { + this.errorTimer = undefined; + } + }); + } + } + } + if ((checkList.length > index) && (matchSeq(seq))) { + this.errorTimer = setTimeout(checkOne, ms); + } + } + + getDefinition(line: number, col: number, fileName: string): protocol.FileSpan[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var definitions = compilerService.languageService.getDefinitionAtPosition(file, position); + if (!definitions) { + throw Errors.NoContent; + } + + return definitions.map(def => ({ + file: def.fileName, + start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + })); + } + + getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var renameInfo = compilerService.languageService.getRenameInfo(file, position); + if (!renameInfo) { + throw Errors.NoContent; + } + + if (!renameInfo.canRename) { + return { + info: renameInfo, + locs: [] + }; + } + + var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocations) { + throw Errors.NoContent; + } + + var bakedRenameLocs = renameLocations.map(location => ({ + file: location.fileName, + start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), + })).sort((a, b) => { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + // reverse sort assuming no overlap + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; + } + else { + return b.start.col - a.start.col; + } + } + }).reduce((accum: protocol.SpanGroup[], cur: protocol.FileSpan) => { + var curFileAccum: protocol.SpanGroup; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file != cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + + return { info: renameInfo, locs: bakedRenameLocs }; + } + + getReferences(line: number, col: number, fileName: string): protocol.ReferencesResponseBody { + // TODO: get all projects for this file; report refs for all projects deleting duplicates + // can avoid duplicates by eliminating same ref file from subsequent projects + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var references = compilerService.languageService.getReferencesAtPosition(file, position); + if (!references) { + throw Errors.NoContent; + } + + var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!nameInfo) { + throw Errors.NoContent; + } + + var displayString = ts.displayPartsToString(nameInfo.displayParts); + var nameSpan = nameInfo.textSpan; + var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col; + var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var bakedRefs: protocol.ReferencesResponseItem[] = references.map((ref) => { + var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); + var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + var snap = compilerService.host.getScriptSnapshot(ref.fileName); + var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess + }; + }).sort(compareFileStart); + return { + refs: bakedRefs, + symbolName: nameText, + symbolStartCol: nameColStart, + symbolDisplayString: displayString + }; + } + + openClientFile(fileName: string) { + var file = ts.normalizePath(fileName); + this.projectService.openClientFile(file); + } + + getQuickInfo(line: number, col: number, fileName: string): protocol.QuickInfoResponseBody { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!quickInfo) { + throw Errors.NoContent; + } + + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)), + displayString: displayString, + documentation: docString, + }; + } + + getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): protocol.CodeEdit[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var startPosition = compilerService.host.lineColToPosition(file, line, col); + var endPosition = compilerService.host.lineColToPosition(file, endLine, endCol); + + // TODO: avoid duplicate code (with formatonkey) + var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions); + if (!edits) { + throw Errors.NoContent; + } + + return edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, edit.span.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + } + + getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): protocol.CodeEdit[] { + var file = ts.normalizePath(fileName); + + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, + compilerService.formatCodeOptions); + if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, position))) { + // TODO: get these options from host + var editorOptions: ts.EditorOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: "\n", + ConvertTabsToSpaces: true, + }; + var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var spaces = generateSpaces(indentPosition); + if (indentPosition > 0) { + edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); + } + } + + if (!edits) { + throw Errors.NoContent; + } + + return edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, + edit.span.start), + end: compilerService.host.positionToLineCol(file, + ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + } + + getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionEntry[] { + if (!prefix) { + prefix = ""; + } + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var completions = compilerService.languageService.getCompletionsAtPosition(file, position); + if (!completions) { + throw Errors.NoContent; + } + + return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => { + if (completions.isMemberCompletion || entry.name.indexOf(prefix) == 0) { + result.push(entry); + } + return result; + }, []); + } + + getCompletionEntryDetails(line: number, col: number, + entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + return entryNames.reduce((accum: protocol.CompletionEntryDetails[], entryName: string) => { + var details = compilerService.languageService.getCompletionEntryDetails(file, position, entryName); + if (details) { + accum.push(details); + } + return accum; + }, []); + } + + getDiagnostics(delay: number, fileNames: string[]) { + var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + if (project) { + accum.push({ fileName, project }); + } + return accum; + }, []); + + if (checkList.length > 0) { + this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, delay) + } + } + + change(line: number, col: number, endLine: number, endCol: number, insertString: string, fileName: string) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var start = compilerService.host.lineColToPosition(file, line, col); + var end = compilerService.host.lineColToPosition(file, endLine, endCol); + if (start >= 0) { + compilerService.host.editScript(file, start, end, insertString); + this.changeSeq++; + } + } + } + + reload(fileName: string, tempFileName: string, reqSeq = 0) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + this.changeSeq++; + // make sure no changes happen before this one is finished + project.compilerService.host.reloadScript(file, tmpfile,() => { + this.output(undefined, CommandNames.Reload, reqSeq); + }); + } + } + + saveToTmp(fileName: string, tempFileName: string) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); + + var project = this.projectService.getProjectForFile(file); + if (project) { + project.compilerService.host.saveTo(file, tmpfile); + } + } + + closeClientFile(fileName: string) { + var file = ts.normalizePath(fileName); + this.projectService.closeClientFile(file); + } + + decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): protocol.NavigationBarItem[] { + if (!items) { + return undefined; + } + + var compilerService = project.compilerService; + + return items.map(item => ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(span => ({ + start: compilerService.host.positionToLineCol(fileName, span.start), + end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) + })), + childItems: this.decorateNavigationBarItem(project, fileName, item.childItems) + })); + } + + getNavigationBarItems(fileName: string): protocol.NavigationBarItem[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var items = compilerService.languageService.getNavigationBarItems(file); + if (!items) { + throw Errors.NoContent; + } + + return this.decorateNavigationBarItem(project, fileName, items); + } + + getNavigateToItems(searchTerm: string, fileName: string): protocol.NavtoItem[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm)); + if (!navItems) { + throw Errors.NoContent; + } + + return navItems.map((navItem) => { + var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start); + var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + var bakedItem: protocol.NavtoItem = { + name: navItem.name, + kind: navItem.kind, + file: navItem.fileName, + start: start, + end: end, + }; + if (navItem.kindModifiers && (navItem.kindModifiers != "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind != 'none') { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); + } + + getBraceMatching(line: number, col: number, fileName: string): protocol.TextSpan[] { + var file = ts.normalizePath(fileName); + + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position); + if (!spans) { + throw Errors.NoContent; + } + + return spans.map(span => ({ + start: compilerService.host.positionToLineCol(file, span.start), + end: compilerService.host.positionToLineCol(file, span.start + span.length) + })); + } + + onMessage(message: string) { + try { + var request = JSON.parse(message); + var response: any; + switch (request.command) { + case CommandNames.Definition: { + var defArgs = request.arguments; + response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); + break; + } + case CommandNames.References: { + var refArgs = request.arguments; + response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); + break; + } + case CommandNames.Rename: { + var renameArgs = request.arguments; + response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); + break; + } + case CommandNames.Open: { + var openArgs = request.arguments; + this.openClientFile(openArgs.file); + break; + } + case CommandNames.Quickinfo: { + var quickinfoArgs = request.arguments; + response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); + break; + } + case CommandNames.Format: { + var formatArgs = request.arguments; + response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); + break; + } + case CommandNames.Formatonkey: { + var formatOnKeyArgs = request.arguments; + response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); + break; + } + case CommandNames.Completions: { + var completionsArgs = request.arguments; + response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); + break; + } + case CommandNames.CompletionDetails: { + var completionDetailsArgs = request.arguments; + response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, + request.arguments.file); + break; + } + case CommandNames.Geterr: { + var geterrArgs = request.arguments; + response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); + break; + } + case CommandNames.Change: { + var changeArgs = request.arguments; + this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, + changeArgs.insertString, changeArgs.file); + break; + } + case CommandNames.Reload: { + var reloadArgs = request.arguments; + this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); + break; + } + case CommandNames.Saveto: { + var savetoArgs = request.arguments; + this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + break; + } + case CommandNames.Close: { + var closeArgs = request.arguments; + this.closeClientFile(closeArgs.file); + break; + } + case CommandNames.Navto: { + var navtoArgs = request.arguments; + response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file); + break; + } + case CommandNames.Brace: { + var braceArguments = request.arguments; + response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); + break; + } + case CommandNames.NavBar: { + var navBarArgs = request.arguments; + response = this.getNavigationBarItems(navBarArgs.file); + break; + } + default: { + this.projectService.log("Unrecognized JSON command: " + message); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + break; + } + } + + if (response) { + this.output(response, request.command, request.seq); + } + + } catch (err) { + if (err instanceof OperationCanceledException) { + // Handle cancellation exceptions + } + this.logError(err, message); + this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message); + } + } + } +} diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index e49d035559b..8170b108562 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -14,17 +14,17 @@ module ts.BreakpointResolver { } var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line - // eg: var x =10; |--- curser is here + // eg: var x =10; |--- cursor is here // var y = 10; // token at position will return var keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); // Its a blank line - if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -42,7 +42,7 @@ module ts.BreakpointResolver { } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { - if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); @@ -69,7 +69,7 @@ module ts.BreakpointResolver { return textSpan(node); } - if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operator === SyntaxKind.CommaToken) { + if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operatorToken.kind === SyntaxKind.CommaToken) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } @@ -151,8 +151,9 @@ module ts.BreakpointResolver { return spanInForStatement(node); case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: // span on for (a in ...) - return textSpan(node, findNextToken((node).expression, node)); + return textSpan(node, findNextToken((node).expression, node)); case SyntaxKind.SwitchStatement: // span on switch(...) @@ -261,7 +262,8 @@ module ts.BreakpointResolver { function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { + if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) { return spanInNode(variableDeclaration.parent.parent); } @@ -362,6 +364,7 @@ module ts.BreakpointResolver { case SyntaxKind.WhileStatement: case SyntaxKind.IfStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 969f7260744..180ff0c9e95 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,8 +67,8 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - if (line === 1) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { return []; } // get the span for the previous\current line @@ -100,7 +100,7 @@ module ts.formatting { export function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { // format from the beginning of the line var span = { - pos: getStartLinePositionForPosition(start, sourceFile), + pos: getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection); @@ -112,7 +112,7 @@ module ts.formatting { return []; } var span = { - pos: getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,8 +357,8 @@ module ts.formatting { } } else { - var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; - var startLinePosition = getStartLinePositionForPosition(startPos, sourceFile); + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,18 +807,18 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); - if (indentation !== tokenStart.character - 1) { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); - recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + recordReplace(startLinePosition, tokenStart.character, indentationString); } } } function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 2bfb155921e..b7573526f78 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index e9485158aba..962f142f609 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -93,17 +93,16 @@ module ts.formatting { savedPos = scanner.getStartPos(); } - function shouldRescanGreaterThanToken(container: Node): boolean { - if (container.kind !== SyntaxKind.BinaryExpression) { - return false; - } - switch ((container).operator) { - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - return true; + function shouldRescanGreaterThanToken(node: Node): boolean { + if (node) { + switch (node.kind) { + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + return true; + } } return false; @@ -164,7 +163,7 @@ module ts.formatting { if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) { currentToken = scanner.reScanGreaterToken(); - Debug.assert((n).operator === currentToken); + Debug.assert(n.kind === currentToken); lastScanAction = ScanAction.RescanGreaterThanToken; } else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 9fcc787030d..b5470579787 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -464,6 +464,9 @@ module ts.formatting { // "in" keyword in for (var x in []) { } case SyntaxKind.ForInStatement: return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; + // Technically, "of" is not a binary operator, but format it the same way as "in" + case SyntaxKind.ForOfStatement: + return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword; } return false; } @@ -592,6 +595,7 @@ module ts.formatting { case SyntaxKind.SwitchStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WhileStatement: case SyntaxKind.TryStatement: case SyntaxKind.DoStatement: diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 3aa97fe6ae6..04849420e70 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); } /* @@ -204,7 +204,7 @@ module ts.formatting { } function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -279,7 +279,6 @@ module ts.formatting { } } - function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number { Debug.assert(index >= 0 && index < list.length); var node = list[index]; @@ -292,7 +291,7 @@ module ts.formatting { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -303,7 +302,7 @@ module ts.formatting { } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } @@ -359,6 +358,7 @@ module ts.formatting { case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.IfStatement: case SyntaxKind.FunctionDeclaration: diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index 61fcb26dc9b..ff9cb91ce68 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -126,7 +126,7 @@ module ts.formatting { static AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([SyntaxKind.MultiLineCommentTrivia])); static Keywords = TokenRange.FromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword); static BinaryOperators = TokenRange.FromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator); - static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword]); + static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword]); static UnaryPrefixOperators = TokenRange.FromTokens([SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken]); static UnaryPrefixExpressions = TokenRange.FromTokens([SyntaxKind.NumericLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.OpenBraceToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPreincrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); @@ -134,7 +134,7 @@ module ts.formatting { static UnaryPredecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPostdecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.NewKeyword]); static Comments = TokenRange.FromTokens([SyntaxKind.SingleLineCommentTrivia, SyntaxKind.MultiLineCommentTrivia]); - static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); + static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); } } } \ No newline at end of file diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts new file mode 100644 index 00000000000..d008cac80f7 --- /dev/null +++ b/src/services/navigateTo.ts @@ -0,0 +1,117 @@ +module ts.NavigateTo { + type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }; + + enum MatchKind { + none = 0, + exact = 1, + substring = 2, + prefix = 3 + } + + export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{ + // Split search value in terms array + var terms = searchValue.split(" "); + + // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version + var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); + + var rawItems: RawNavigateToItem[] = []; + + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + forEach(program.getSourceFiles(), sourceFile => { + cancellationToken.throwIfCancellationRequested(); + + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + // TODO(jfreeman): Skip this declaration if it has a computed name + var name = (declaration.name).text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== MatchKind.none) { + rawItems.push({ name, fileName, matchKind, declaration }); + } + } + }); + + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + + var items = map(rawItems, createNavigateToItem); + + return items; + + // This means "compare in a case insensitive manner." + var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; + function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { + // TODO(cyrusn): get the gamut of comparisons that VS already uses here. + // Right now we just sort by kind first, and then by name of the item. + // We first sort case insensitively. So "Aaa" will come before "bar". + // Then we sort case sensitively, so "aaa" will come before "Aaa". + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + + function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem { + var declaration = rawItem.declaration; + var container = getContainerNode(declaration); + return { + name: rawItem.name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + // TODO(jfreeman): What should be the containerName when the container has a computed name? + containerName: container && container.name ? (container.name).text : "", + containerKind: container && container.name ? getNodeKind(container) : "" + }; + } + + function hasAnyUpperCaseCharacter(s: string): boolean { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || + (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + + return false; + } + + function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { + var matchKind = MatchKind.none; + + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + // in case of case-insensitive search searchTerm.term will already be lower-cased + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + // Didn't match. + return MatchKind.none; + } + + var termKind = MatchKind.substring; + if (index === 0) { + // here we know that match occur at the beginning of the string. + // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match + termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; + } + + // Update our match kind if we don't have one, or if this match is better. + if (matchKind === MatchKind.none || termKind < matchKind) { + matchKind = termKind; + } + } + } + + return matchKind; + } + } +} \ No newline at end of file diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 771fe48219f..b254397f8b0 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -97,8 +97,7 @@ module ts.NavigationBar { function sortNodes(nodes: Node[]): Node[] { return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { if (n1.name && n2.name) { - // TODO(jfreeman): How do we sort declarations with computed names? - return (n1.name).text.localeCompare((n2.name).text); + return getPropertyNameForPropertyNameNode(n1.name).localeCompare(getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -426,7 +425,7 @@ module ts.NavigationBar { // Add the constructor parameters in as children of the class (for property parameters). // Note that *all* parameters will be added to the nodes array, but parameters that // are not properties will be filtered out later by createChildItem. - var nodes: Node[] = removeComputedProperties(node); + var nodes: Node[] = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, constructor.parameters); } @@ -455,7 +454,7 @@ module ts.NavigationBar { } function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.interfaceElement, @@ -466,10 +465,17 @@ module ts.NavigationBar { } } - function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] { + function removeComputedProperties(node: EnumDeclaration): Declaration[] { return filter(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName); } + /** + * Like removeComputedProperties, but retains the properties with well known symbol names + */ + function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[]{ + return filter(node.members, member => !hasDynamicName(member)); + } + function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration { while (node.body.kind === SyntaxKind.ModuleDeclaration) { node = node.body; diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 0b39f54ca29..b65ad7e36c8 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -61,6 +61,7 @@ module ts { // to be the entire span of the parent. if (parent.kind === SyntaxKind.DoStatement || parent.kind === SyntaxKind.ForInStatement || + parent.kind === SyntaxKind.ForOfStatement || parent.kind === SyntaxKind.ForStatement || parent.kind === SyntaxKind.IfStatement || parent.kind === SyntaxKind.WhileStatement || diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts new file mode 100644 index 00000000000..da07c4400bc --- /dev/null +++ b/src/services/patternMatcher.ts @@ -0,0 +1,813 @@ +module ts { + // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. + export enum PatternMatchKind { + Exact, + Prefix, + Substring, + CamelCase + } + + // Information about a match made by the pattern matcher between a candidate and the + // search pattern. + export interface PatternMatch { + // What kind of match this was. Exact matches are better than prefix matches which are + // better than substring matches which are better than CamelCase matches. + kind: PatternMatchKind; + + // If this was a camel case match, how strong the match is. Higher number means + // it was a better match. + camelCaseWeight?: number; + + // If this was a match where all constituent parts of the candidate and search pattern + // matched case sensitively or case insensitively. Case sensitive matches of the kind + // are better matches than insensitive matches. + isCaseSensitive: boolean; + + // Whether or not this match occurred with the punctuation from the search pattern stripped + // out or not. Matches without the punctuation stripped are better than ones with punctuation + // stripped. + punctuationStripped: boolean; + } + + // The pattern matcher maintains an internal cache of information as it is used. Therefore, + // you should not keep it around forever and should get and release the matcher appropriately + // once you no longer need it. + export interface PatternMatcher { + // Used to match a candidate against the last segment of a possibly dotted pattern. This + // is useful as a quick check to prevent having to compute a container before calling + // "getMatches". + // + // For example, if the search pattern is "ts.c.SK" and the candidate is "SyntaxKind", then + // this will return a successful match, having only tested "SK" against "SyntaxKind". At + // that point a call can be made to 'getMatches("SyntaxKind", "ts.compiler")', with the + // work to create 'ts.compiler' only being done once the first match succeeded. + getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; + + // Fully checks a candidate, with an dotted container, against the search pattern. + // The candidate must match the last part of the search pattern, and the dotted container + // must match the preceding segments of the pattern. + getMatches(candidate: string, dottedContainer: string): PatternMatch[]; + + // Whether or not the pattern contained dots or not. Clients can use this to determine + // If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient. + patternContainsDots: boolean; + } + + // First we break up the pattern given by dots. Each portion of the pattern between the + // dots is a 'Segment'. The 'Segment' contains information about the entire section of + // text between the dots, as well as information about any individual 'Words' that we + // can break the segment into. A 'Word' is simply a contiguous sequence of characters + // that can appear in a typescript identifier. So "GetKeyword" would be one word, while + // "Get Keyword" would be two words. Once we have the individual 'words', we break those + // into constituent 'character spans' of interest. For example, while 'UIElement' is one + // word, it make character spans corresponding to "U", "I" and "Element". These spans + // are then used when doing camel cased matches against candidate patterns. + interface Segment { + // Information about the entire piece of text between the dots. For example, if the + // text between the dots is 'GetKeyword', then TotalTextChunk.Text will be 'GetKeyword' and + // TotalTextChunk.CharacterSpans will correspond to 'Get', 'Keyword'. + totalTextChunk: TextChunk; + + // Information about the subwords compromising the total word. For example, if the + // text between the dots is 'GetFoo KeywordBar', then the subwords will be 'GetFoo' + // and 'KeywordBar'. Those individual words will have CharacterSpans of ('Get' and + // 'Foo') and('Keyword' and 'Bar') respectively. + subWordTextChunks: TextChunk[]; + } + + // Information about a chunk of text from the pattern. The chunk is a piece of text, with + // cached information about the character spans within in. Character spans are used for + // camel case matching. + interface TextChunk { + // The text of the chunk. This should be a contiguous sequence of character that could + // occur in a symbol name. + text: string; + + // The text of a chunk in lower case. Cached because it is needed often to check for + // case insensitive matches. + textLowerCase: string; + + // Whether or not this chunk is entirely lowercase. We have different rules when searching + // for something entirely lowercase or not. + isLowerCase: boolean; + + // The spans in this text chunk that we think are of interest and should be matched + // independently. For example, if the chunk is for "UIElement" the the spans of interest + // correspond to "U", "I" and "Element". If "UIElement" isn't found as an exaxt, prefix. + // or substring match, then the character spans will be used to attempt a camel case match. + characterSpans: TextSpan[]; + } + + function createPatternMatch(kind: PatternMatchKind, punctuationStripped: boolean, isCaseSensitive: boolean, camelCaseWeight?: number): PatternMatch { + return { + kind, + punctuationStripped, + isCaseSensitive, + camelCaseWeight + }; + } + + export function createPatternMatcher(pattern: string): PatternMatcher { + // We'll often see the same candidate string many times when searching (For example, when + // we see the name of a module that is used everywhere, or the name of an overload). As + // such, we cache the information we compute about the candidate for the life of this + // pattern matcher so we don't have to compute it multiple times. + var stringToWordSpans: Map = {}; + + pattern = pattern.trim(); + + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); + var invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); + + return { + getMatches, + getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + + // Quick checks so we can bail out when asked to match a candidate. + function skipMatch(candidate: string) { + return invalidPattern || !candidate; + } + + function getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + return matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + } + + function getMatches(candidate: string, dottedContainer: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > containerParts.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return null; + } + + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; + i >= 0; + i--, j--) { + + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; + } + + addRange(totalMatch, containerMatch); + } + + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + + function getWordSpans(word: string): TextSpan[] { + if (!hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + + return stringToWordSpans[word]; + } + + function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + // a) Check if the part matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + return createPatternMatch(PatternMatchKind.Exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); + } + else { + // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive + // manner. If it does, return that there was a prefix match. + return createPatternMatch(PatternMatchKind.Prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); + } + } + + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + // c) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i] + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, + /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); + } + } + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ true); + } + } + + if (!isLowercase) { + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); + } + + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); + } + } + } + + if (isLowercase) { + // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ false); + } + } + } + + return undefined; + } + + function containsSpaceOrAsterisk(text: string): boolean { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) { + return true; + } + } + + return false; + } + + function matchSegment(candidate: string, segment: Segment): PatternMatch[] { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); + if (match) { + return [match]; + } + } + + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + // + // b) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was a prefix match. + // + // c) If the word is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // f) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Only if all words have some sort of match is the pattern considered matched. + + var subWordTextChunks = segment.subWordTextChunks; + var matches: PatternMatch[] = undefined; + + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); + if (!result) { + return undefined; + } + + matches = matches || []; + matches.push(result); + } + + return matches; + } + + function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + + if (patternPartLength > candidateSpan.length) { + // Pattern part is longer than the candidate part. There can never be a match. + return false; + } + + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + + return true; + } + + function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): number { + var chunkCharacterSpans = chunk.characterSpans; + + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch: number = undefined; + var contiguous: boolean = undefined; + + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + // We did match! We shall assign a weight to this + var weight = 0; + + // Was this contiguous? + if (contiguous) { + weight += 1; + } + + // Did we start at the beginning of the candidate? + if (firstMatch === 0) { + weight += 2; + } + + return weight; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return undefined; + } + + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + + gotOneMatchThisCandidate = true; + + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + + candidatePart = createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + + // Move onto the next candidate. + currentCandidate++; + } + } + } + + // Helper function to compare two matches to determine which is better. Matches are first + // ordered by kind (so all prefix matches always beat all substring matches). Then, if the + // match is a camel case match, the relative weights of hte match are used to determine + // which is better (with a greater weight being better). Then if the match is of the same + // type, then a case sensitive match is considered better than an insensitive one. + function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + + function comparePunctuation(result1: PatternMatch, result2: PatternMatch) { + // Consider a match to be better if it was successful without stripping punctuation + // versus a match that had to strip punctuation to succeed. + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + + return 0; + } + + function compareCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + + return 0; + } + + function compareType(result1: PatternMatch, result2: PatternMatch) { + return result1.kind - result2.kind; + } + + function compareCamelCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.kind === PatternMatchKind.CamelCase && result2.kind === PatternMatchKind.CamelCase) { + // Swap the values here. If result1 has a higher weight, then we want it to come + // first. + return result2.camelCaseWeight - result1.camelCaseWeight; + } + + return 0; + } + + function createSegment(text: string): Segment { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + } + } + + // A segment is considered invalid if we couldn't find any words in it. + function segmentIsInvalid(segment: Segment) { + return segment.subWordTextChunks.length === 0; + } + + function isUpperCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + + function isLowerCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + + function containsUpperCaseLetter(string: string): boolean { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + + return false; + } + + function startsWith(string: string, search: string) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + + return true; + } + + // Assumes 'value' is already lowercase. + function indexOfIgnoringCase(string: string, value: string): number { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + + return -1; + } + + // Assumes 'value' is already lowercase. + function startsWithIgnoringCase(string: string, value: string, start: number): boolean { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + + if (ch1 !== ch2) { + return false; + } + } + + return true; + } + + function toLowerCase(ch: number): number { + // Fast convert for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return CharacterCodes.a + (ch - CharacterCodes.A); + } + + if (ch < CharacterCodes.maxAsciiCharacter) { + return ch; + } + + // TODO: find a way to compute this for any unicode characters in a + // non-allocating manner. + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + + function isDigit(ch: number) { + // TODO(cyrusn): Find a way to support this for unicode digits. + return ch >= CharacterCodes._0 && ch <= CharacterCodes._9; + } + + function isWordChar(ch: number) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$; + } + + function breakPatternIntoTextChunks(pattern: string): TextChunk[] { + var result: TextChunk[] = []; + var wordStart = 0; + var wordLength = 0; + + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + + return result; + } + + function createTextChunk(text: string): TextChunk { + var textLowerCase = text.toLowerCase(); + return { + text, + textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + } + } + + /* @internal */ export function breakIntoCharacterSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ false); + } + + /* @internal */ export function breakIntoWordSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ true); + } + + function breakIntoSpans(identifier: string, word: boolean): TextSpan[] { + var result: TextSpan[] = []; + + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(createTextSpan(wordStart, i - wordStart)); + } + + wordStart = i; + } + } + + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(createTextSpan(wordStart, identifier.length - wordStart)); + } + + return result; + } + + function charIsPunctuation(ch: number) { + switch (ch) { + case CharacterCodes.exclamation: + case CharacterCodes.doubleQuote: + case CharacterCodes.hash: + case CharacterCodes.percent: + case CharacterCodes.ampersand: + case CharacterCodes.singleQuote: + case CharacterCodes.openParen: + case CharacterCodes.closeParen: + case CharacterCodes.asterisk: + case CharacterCodes.comma: + case CharacterCodes.minus: + case CharacterCodes.dot: + case CharacterCodes.slash: + case CharacterCodes.colon: + case CharacterCodes.semicolon: + case CharacterCodes.question: + case CharacterCodes.at: + case CharacterCodes.openBracket: + case CharacterCodes.backslash: + case CharacterCodes.closeBracket: + case CharacterCodes._: + case CharacterCodes.openBrace: + case CharacterCodes.closeBrace: + return true; + } + + return false; + } + + function isAllPunctuation(identifier: string, start: number, end: number): boolean { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + + // We don't consider _ or $ as punctuation as there may be things with that name. + if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) { + return false; + } + } + + return true; + } + + function transitionFromUpperToLower(identifier: string, word: boolean, index: number, wordStart: number): boolean { + if (word) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + + if (currentIsUpper && nextIsLower) { + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + + return true; + } + } + } + + return false; + } + + function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + + // See if the casing indicates we're starting a new word. Note: if we're breaking on + // words, then just seeing an upper case character isn't enough. Instead, it has to + // be uppercase and the previous character can't be uppercase. + // + // For example, breaking "AddMetadata" on words would make: Add Metadata + // + // on characters would be: A dd M etadata + // + // Break "AM" on words would be: AM + // + // on characters would be: A M + // + // We break the search string on characters. But we break the symbol name on words. + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; + return transition; + } +} \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 0a901f0df0b..5099fb05c7b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,14 +2,15 @@ /// /// +/// /// +/// /// /// /// /// module ts { - export var servicesVersion = "0.4" export interface Node { @@ -61,9 +62,9 @@ module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -612,7 +613,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } // Now consume white spaces max @@ -750,16 +751,16 @@ module ts { return updateSourceFile(this, newText, textChangeRange); } - public getLineAndCharacterFromPosition(position: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, position); + public getLineAndCharacterOfPosition(position: number): LineAndCharacter { + return ts.getLineAndCharacterOfPosition(this, position); } public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionFromLineAndCharacter(line: number, character: number): number { - return getPositionFromLineAndCharacter(this, line, character); + public getPositionOfLineAndCharacter(line: number, character: number): number { + return ts.getPositionOfLineAndCharacter(this, line, character); } public getNamedDeclarations() { @@ -900,7 +901,7 @@ module ts { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; @@ -991,6 +992,7 @@ module ts { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number| string; } export interface DefinitionInfo { @@ -1377,13 +1379,6 @@ module ts { public static typeAlias = "type alias name"; } - enum MatchKind { - none = 0, - exact = 1, - substring = 2, - prefix = 3 - } - /// Language Service interface CompletionSession { @@ -1991,6 +1986,62 @@ module ts { }); } + /* @internal */ export function getContainerNode(node: Node): Node { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + return node; + } + } + } + + /* @internal */ export function getNodeKind(node: Node): string { + switch (node.kind) { + case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; + case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; + case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; + case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; + case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; + case SyntaxKind.VariableDeclaration: + return isConst(node) + ? ScriptElementKind.constElement + : isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; + case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; + case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + return ScriptElementKind.memberFunctionElement; + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + return ScriptElementKind.memberVariableElement; + case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; + case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; + case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; + case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; + case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; + case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; + case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService { var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider: formatting.RulesProvider; @@ -2721,29 +2772,6 @@ module ts { } } - function getContainerNode(node: Node): Node { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case SyntaxKind.SourceFile: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - return node; - } - } - } - // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string { var flags = symbol.getFlags(); @@ -2830,39 +2858,6 @@ module ts { return ScriptElementKind.unknown; } - function getNodeKind(node: Node): string { - switch (node.kind) { - case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; - case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; - case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; - case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; - case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; - case SyntaxKind.VariableDeclaration: - return isConst(node) - ? ScriptElementKind.constElement - : isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; - case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; - case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - return ScriptElementKind.memberFunctionElement; - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - return ScriptElementKind.memberVariableElement; - case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; - case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; - case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; - case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; - case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; - case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; - case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - } - return ScriptElementKind.unknown; - } - function getSymbolModifiers(symbol: Symbol): string { return symbol && symbol.declarations && symbol.declarations.length > 0 ? getNodeModifiers(symbol.declarations[0]) @@ -3441,7 +3436,9 @@ module ts { } break; case SyntaxKind.ForKeyword: - if (hasKind(node.parent, SyntaxKind.ForStatement) || hasKind(node.parent, SyntaxKind.ForInStatement)) { + if (hasKind(node.parent, SyntaxKind.ForStatement) || + hasKind(node.parent, SyntaxKind.ForInStatement) || + hasKind(node.parent, SyntaxKind.ForOfStatement)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -3718,6 +3715,7 @@ module ts { switch (owner.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: return getLoopBreakContinueOccurrences(owner) @@ -3762,6 +3760,7 @@ module ts { // Fall through. case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: if (!statement.label || isLabeledBy(node, statement.label.text)) { @@ -4649,7 +4648,7 @@ module ts { return true; } else if (parent.kind === SyntaxKind.BinaryExpression && (parent).left === node) { - var operator = (parent).operator; + var operator = (parent).operatorToken.kind; return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment; } } @@ -4658,89 +4657,10 @@ module ts { } /// NavigateTo - function getNavigateToItems(searchValue: string): NavigateToItem[] { + function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] { synchronizeHostData(); - // Split search value in terms array - var terms = searchValue.split(" "); - - // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version - var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); - - var items: NavigateToItem[] = []; - - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - forEach(program.getSourceFiles(), sourceFile => { - cancellationToken.throwIfCancellationRequested(); - - var fileName = sourceFile.fileName; - var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - // TODO(jfreeman): Skip this declaration if it has a computed name - var name = (declaration.name).text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== MatchKind.none) { - var container = getContainerNode(declaration); - items.push({ - name: name, - kind: getNodeKind(declaration), - kindModifiers: getNodeModifiers(declaration), - matchKind: MatchKind[matchKind], - fileName: fileName, - textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - // TODO(jfreeman): What should be the containerName when the container has a computed name? - containerName: container && container.name ? (container.name).text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }); - } - } - }); - - return items; - - function hasAnyUpperCaseCharacter(s: string): boolean { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || - (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - - return false; - } - - function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { - var matchKind = MatchKind.none; - - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - // in case of case-insensitive search searchTerm.term will already be lower-cased - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - // Didn't match. - return MatchKind.none; - } - - var termKind = MatchKind.substring; - if (index === 0) { - // here we know that match occur at the beginning of the string. - // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match - termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; - } - - // Update our match kind if we don't have one, or if this match is better. - if (matchKind === MatchKind.none || termKind < matchKind) { - matchKind = termKind; - } - } - } - - return matchKind; - } + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics: Diagnostic[]): boolean { @@ -5540,11 +5460,13 @@ module ts { var declarations = symbol.getDeclarations(); if (declarations && declarations.length > 0) { // Disallow rename for elements that are defined in the standard TypeScript library. - var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings()); - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) { - return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } } } @@ -5566,10 +5488,6 @@ module ts { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)); - function endsWith(string: string, value: string): boolean { - return string.lastIndexOf(value) + value.length === string.length; - } - function getRenameInfoError(localizedErrorMessage: string): RenameInfo { return { canRename: false, @@ -5680,7 +5598,7 @@ module ts { keyword2 === SyntaxKind.ConstructorKeyword || keyword2 === SyntaxKind.StaticKeyword) { - // Allow things like "public get", "public constructor" and "public static". + // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; } @@ -5697,7 +5615,7 @@ module ts { // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. - function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): ClassificationResult { + function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { var offset = 0; var token = SyntaxKind.Unknown; var lastNonTriviaToken = SyntaxKind.Unknown; @@ -5799,7 +5717,8 @@ module ts { else if (token === SyntaxKind.AnyKeyword || token === SyntaxKind.StringKeyword || token === SyntaxKind.NumberKeyword || - token === SyntaxKind.BooleanKeyword) { + token === SyntaxKind.BooleanKeyword || + token === SyntaxKind.SymbolKeyword) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // 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, diff --git a/src/services/shims.ts b/src/services/shims.ts index a0eb1cb1ac4..01950772903 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -138,7 +138,7 @@ module ts { * Returns a JSON-encoded value of the type: * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; */ - getNavigateToItems(searchValue: string): string; + getNavigateToItems(searchValue: string, maxResultCount?: number): string; /** * Returns a JSON-encoded value of the type: @@ -274,10 +274,7 @@ module ts { } public getDefaultLibFileName(options: CompilerOptions): string { - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - return ""; - //return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); } } @@ -631,11 +628,11 @@ module ts { /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ - public getNavigateToItems(searchValue: string): string { + public getNavigateToItems(searchValue: string, maxResultCount?: number): string { return this.forwardJSONCall( - "getNavigateToItems('" + searchValue + "')", + "getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")", () => { - var items = this.languageService.getNavigateToItems(searchValue); + var items = this.languageService.getNavigateToItems(searchValue, maxResultCount); return items; }); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 10d00398160..13156523045 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -6,12 +6,11 @@ module ts { } export function getEndLinePosition(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); + Debug.assert(line >= 0); var lineStarts = sourceFile.getLineStarts(); - // lines returned by SourceFile.getLineAndCharacterForPosition are 1-based - var lineIndex = line - 1; - if (lineIndex === lineStarts.length - 1) { + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { // last line - return EOF return sourceFile.text.length - 1; } @@ -32,15 +31,10 @@ module ts { } } - export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); - return sourceFile.getLineStarts()[line - 1]; - } - - export function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number { + export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - return lineStarts[line - 1]; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; } export function rangeContainsRange(r1: TextRange, r2: TextRange): boolean { diff --git a/tests/baselines/reference/2dArrays.js b/tests/baselines/reference/2dArrays.js index 7840f3d8c54..fe8ab380ba7 100644 --- a/tests/baselines/reference/2dArrays.js +++ b/tests/baselines/reference/2dArrays.js @@ -30,9 +30,7 @@ var Board = (function () { function Board() { } Board.prototype.allShipsSunk = function () { - return this.ships.every(function (val) { - return val.isSunk; - }); + return this.ships.every(function (val) { return val.isSunk; }); }; return Board; })(); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index b91a706aa45..b7ae84a2312 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; @@ -179,110 +179,113 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -291,7 +294,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -524,7 +527,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -622,6 +625,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -1031,8 +1038,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1318,6 +1326,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1384,8 +1393,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1469,9 +1478,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1533,7 +1542,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1608,6 +1617,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1946,8 +1956,8 @@ function compile(fileNames, options) { var emitResult = program.emit(); var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(function (diagnostic) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); }); var exitCode = emitResult.emitSkipped ? 1 : 0; console.log("Process exiting with code '" + exitCode + "'."); @@ -1955,8 +1965,6 @@ function compile(fileNames, options) { } exports.compile = compile; compile(process.argv.slice(2), { - noEmitOnError: true, - noImplicitAny: true, - target: 1 /* ES5 */, - module: 1 /* CommonJS */ + noEmitOnError: true, noImplicitAny: true, + target: 1 /* ES5 */, module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index ae53c666807..9a31d48980b 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -56,27 +56,27 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostics : ts.Diagnostic[] allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void +>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); ->console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); +>console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any >console.log : any >console : any >log : any @@ -85,9 +85,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -553,274 +555,283 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 122, +>OfKeyword : SyntaxKind + + QualifiedName = 123, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 124, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 125, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 126, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 127, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 128, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 129, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 130, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 131, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 132, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 133, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 134, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 135, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 136, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 137, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 138, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 139, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 140, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 141, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 142, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 143, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 144, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 145, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 146, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 147, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 148, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 149, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 150, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 151, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 152, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 153, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 154, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 155, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 156, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 157, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 158, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 159, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 160, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 161, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 162, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 163, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 164, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 165, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 166, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 167, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 168, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 169, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 170, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 171, >TemplateSpan : SyntaxKind - Block = 170, + Block = 172, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 173, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 174, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 175, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 176, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 177, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 178, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 179, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 180, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 181, +>ForOfStatement : SyntaxKind + + ContinueStatement = 182, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 183, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 184, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 185, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 186, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 187, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 188, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 189, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 190, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 191, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 192, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 193, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 194, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 195, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 196, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 197, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 198, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 199, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 200, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 201, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 202, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 203, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 204, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 205, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 206, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 207, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 208, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 209, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 210, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 211, >SyntaxList : SyntaxKind - Count = 209, + Count = 212, >Count : SyntaxKind FirstAssignment = 52, @@ -838,7 +849,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 122, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -847,10 +858,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 137, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 145, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -862,7 +873,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -889,7 +900,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 123, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1576,9 +1587,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -1870,6 +1881,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -3318,10 +3342,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4163,6 +4190,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4368,15 +4398,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4735,16 +4765,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -4961,9 +4991,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5202,6 +5233,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 68c13edb7db..50ed483b4a3 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } @@ -210,110 +210,113 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -322,7 +325,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -555,7 +558,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -653,6 +656,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -1062,8 +1069,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1349,6 +1357,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1415,8 +1424,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1500,9 +1509,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1564,7 +1573,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1639,6 +1648,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1976,25 +1986,26 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 176 /* WhileStatement */: - case 175 /* DoStatement */: - if (node.statement.kind !== 170 /* Block */) { + case 179 /* ForStatement */: + case 180 /* ForInStatement */: + case 178 /* WhileStatement */: + case 177 /* DoStatement */: + if (node.statement.kind !== 172 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 174 /* IfStatement */: + case 176 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 170 /* Block */) { + if (ifStatement.thenStatement.kind !== 172 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 170 /* Block */ && ifStatement.elseStatement.kind !== 174 /* IfStatement */) { + if (ifStatement.elseStatement && + ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; - case 163 /* BinaryExpression */: - var op = node.operator; + case 165 /* BinaryExpression */: + var op = node.operatorToken.kind; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); } @@ -2003,8 +2014,8 @@ function delint(sourceFile) { ts.forEachChild(node, delintNode); } function report(node, message) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(sourceFile.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + message); } } exports.delint = delint; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 0c153e7b1dc..512cd689303 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -173,15 +173,17 @@ export function delint(sourceFile: ts.SourceFile) { >SyntaxKind : typeof ts.SyntaxKind >BinaryExpression : ts.SyntaxKind - var op = (node).operator; + var op = (node).operatorToken.kind; >op : ts.SyntaxKind ->(node).operator : ts.SyntaxKind +>(node).operatorToken.kind : ts.SyntaxKind +>(node).operatorToken : ts.Node >(node) : ts.BinaryExpression >node : ts.BinaryExpression >ts : unknown >BinaryExpression : ts.BinaryExpression >node : ts.Node ->operator : ts.SyntaxKind +>operatorToken : ts.Node +>kind : ts.SyntaxKind if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { >op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean @@ -224,28 +226,30 @@ export function delint(sourceFile: ts.SourceFile) { >Node : ts.Node >message : string - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); >lineChar : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >sourceFile : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >node.getStart() : number >node.getStart : (sourceFile?: ts.SourceFile) => number >node : ts.Node >getStart : (sourceFile?: ts.SourceFile) => number - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) ->console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any >console.log : any >console : any >log : any >sourceFile.fileName : string >sourceFile : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -697,274 +701,283 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 122, +>OfKeyword : SyntaxKind + + QualifiedName = 123, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 124, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 125, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 126, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 127, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 128, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 129, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 130, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 131, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 132, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 133, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 134, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 135, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 136, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 137, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 138, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 139, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 140, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 141, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 142, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 143, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 144, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 145, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 146, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 147, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 148, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 149, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 150, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 151, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 152, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 153, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 154, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 155, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 156, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 157, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 158, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 159, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 160, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 161, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 162, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 163, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 164, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 165, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 166, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 167, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 168, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 169, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 170, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 171, >TemplateSpan : SyntaxKind - Block = 170, + Block = 172, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 173, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 174, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 175, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 176, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 177, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 178, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 179, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 180, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 181, +>ForOfStatement : SyntaxKind + + ContinueStatement = 182, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 183, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 184, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 185, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 186, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 187, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 188, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 189, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 190, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 191, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 192, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 193, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 194, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 195, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 196, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 197, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 198, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 199, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 200, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 201, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 202, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 203, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 204, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 205, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 206, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 207, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 208, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 209, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 210, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 211, >SyntaxList : SyntaxKind - Count = 209, + Count = 212, >Count : SyntaxKind FirstAssignment = 52, @@ -982,7 +995,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 122, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -991,10 +1004,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 137, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 145, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1006,7 +1019,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1033,7 +1046,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 123, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1720,9 +1733,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2014,6 +2027,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -3462,10 +3488,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4307,6 +4336,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4512,15 +4544,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4879,16 +4911,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5105,9 +5137,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5346,6 +5379,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 0e80f6b55b9..8b3c64099cc 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; @@ -211,110 +211,113 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -323,7 +326,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -556,7 +559,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -654,6 +657,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -1063,8 +1070,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1350,6 +1358,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1416,8 +1425,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1501,9 +1510,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1565,7 +1574,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1640,6 +1649,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -2005,7 +2015,7 @@ function transform(contents, compilerOptions) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 0c201b0a5fd..83ef90f7268 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -177,7 +177,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >diagnostics : ts.Diagnostic[] return { ->{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } +>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } outputs: outputs, >outputs : any[] @@ -185,30 +185,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { errors: errors.map(function (e) { >errors : string[] ->errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] +>errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] >errors.map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] >errors : ts.Diagnostic[] >map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] ->function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string +>function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string >e : ts.Diagnostic - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) : string >e.file.fileName + "(" : string >e.file.fileName : string >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile >fileName : string ->e.file.getLineAndCharacterFromPosition(e.start).line : number ->e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter ->e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>(e.file.getLineAndCharacterOfPosition(e.start).line + 1) : number +>e.file.getLineAndCharacterOfPosition(e.start).line + 1 : number +>e.file.getLineAndCharacterOfPosition(e.start).line : number +>e.file.getLineAndCharacterOfPosition(e.start) : ts.LineAndCharacter +>e.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.start : number >e : ts.Diagnostic >start : number @@ -649,274 +651,283 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 122, +>OfKeyword : SyntaxKind + + QualifiedName = 123, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 124, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 125, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 126, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 127, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 128, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 129, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 130, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 131, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 132, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 133, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 134, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 135, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 136, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 137, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 138, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 139, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 140, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 141, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 142, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 143, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 144, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 145, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 146, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 147, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 148, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 149, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 150, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 151, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 152, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 153, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 154, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 155, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 156, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 157, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 158, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 159, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 160, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 161, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 162, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 163, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 164, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 165, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 166, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 167, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 168, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 169, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 170, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 171, >TemplateSpan : SyntaxKind - Block = 170, + Block = 172, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 173, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 174, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 175, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 176, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 177, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 178, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 179, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 180, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 181, +>ForOfStatement : SyntaxKind + + ContinueStatement = 182, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 183, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 184, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 185, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 186, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 187, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 188, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 189, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 190, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 191, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 192, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 193, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 194, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 195, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 196, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 197, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 198, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 199, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 200, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 201, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 202, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 203, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 204, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 205, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 206, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 207, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 208, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 209, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 210, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 211, >SyntaxList : SyntaxKind - Count = 209, + Count = 212, >Count : SyntaxKind FirstAssignment = 52, @@ -934,7 +945,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 122, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -943,10 +954,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 137, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 145, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -958,7 +969,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -985,7 +996,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 123, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1672,9 +1683,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -1966,6 +1977,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -3414,10 +3438,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4259,6 +4286,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4464,15 +4494,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4831,16 +4861,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5057,9 +5087,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5298,6 +5329,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 27a2ce5e415..d9488db8bc1 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); @@ -248,110 +248,113 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -360,7 +363,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -593,7 +596,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -691,6 +694,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -1100,8 +1107,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1387,6 +1395,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1453,8 +1462,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1538,9 +1547,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1602,7 +1611,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1677,6 +1686,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -2065,8 +2075,8 @@ function watch(rootFileNames, options) { var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(function (diagnostic) { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(" Error " + diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); } else { console.log(" Error: " + diagnostic.messageText); diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 4e137cae59d..11a726ea39f 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -317,11 +317,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >fileName : string allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void +>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic if (diagnostic.file) { @@ -329,20 +329,20 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); ->console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); +>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any >console.log : any >console : any >log : any @@ -351,9 +351,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -822,274 +824,283 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 122, +>OfKeyword : SyntaxKind + + QualifiedName = 123, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 124, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 125, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 126, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 127, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 128, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 129, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 130, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 131, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 132, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 133, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 134, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 135, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 136, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 137, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 138, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 139, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 140, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 141, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 142, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 143, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 144, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 145, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 146, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 147, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 148, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 149, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 150, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 151, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 152, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 153, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 154, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 155, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 156, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 157, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 158, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 159, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 160, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 161, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 162, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 163, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 164, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 165, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 166, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 167, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 168, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 169, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 170, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 171, >TemplateSpan : SyntaxKind - Block = 170, + Block = 172, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 173, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 174, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 175, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 176, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 177, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 178, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 179, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 180, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 181, +>ForOfStatement : SyntaxKind + + ContinueStatement = 182, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 183, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 184, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 185, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 186, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 187, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 188, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 189, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 190, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 191, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 192, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 193, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 194, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 195, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 196, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 197, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 198, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 199, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 200, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 201, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 202, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 203, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 204, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 205, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 206, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 207, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 208, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 209, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 210, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 211, >SyntaxList : SyntaxKind - Count = 209, + Count = 212, >Count : SyntaxKind FirstAssignment = 52, @@ -1107,7 +1118,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 122, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -1116,10 +1127,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 137, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 145, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1131,7 +1142,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1158,7 +1169,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 123, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1845,9 +1856,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2139,6 +2150,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -3587,10 +3611,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4432,6 +4459,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4637,15 +4667,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -5004,16 +5034,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5230,9 +5260,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5471,6 +5502,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index 827557bdbad..5f01b6acff1 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -19,9 +19,7 @@ module clodule { var clodule = (function () { function clodule() { } - clodule.sfn = function (id) { - return 42; - }; + clodule.sfn = function (id) { return 42; }; return clodule; })(); var clodule; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index ae8d594c2f8..a86bc7d2e90 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); var Point; (function (Point) { - function Origin() { - return null; - } + function Origin() { return null; } Point.Origin = Origin; //expected duplicate identifier error })(Point || (Point = {})); var A; @@ -47,17 +43,13 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } + function Origin() { return ""; } Point.Origin = Origin; //expected duplicate identifier error })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 5bbe60297cc..f462ea9eaa9 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); var Point; (function (Point) { - function Origin() { - return ""; - } // not an error, since not exported + function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { @@ -46,16 +42,12 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } // not an error since not exported + function Origin() { return ""; } // not an error since not exported })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ES5SymbolProperty1.errors.txt b/tests/baselines/reference/ES5SymbolProperty1.errors.txt new file mode 100644 index 00000000000..1b135dcc916 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (1 errors) ==== + interface SymbolConstructor { + foo: string; + } + var Symbol: SymbolConstructor; + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } + + obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js new file mode 100644 index 00000000000..e977df7dc6b --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -0,0 +1,19 @@ +//// [ES5SymbolProperty1.ts] +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; + +//// [ES5SymbolProperty1.js] +var Symbol; +var obj = (_a = {}, _a[Symbol.foo] = +0, +_a); +obj[Symbol.foo]; +var _a; diff --git a/tests/baselines/reference/ES5SymbolProperty2.errors.txt b/tests/baselines/reference/ES5SymbolProperty2.errors.txt new file mode 100644 index 00000000000..9a6526a2f86 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (2 errors) ==== + module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + (new C)[Symbol.iterator]; + } + + (new M.C)[Symbol.iterator]; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js new file mode 100644 index 00000000000..effd1e610f4 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -0,0 +1,26 @@ +//// [ES5SymbolProperty2.ts] +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; + +//// [ES5SymbolProperty2.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); + M.C = C; + (new C)[Symbol.iterator]; +})(M || (M = {})); +(new M.C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty3.errors.txt b/tests/baselines/reference/ES5SymbolProperty3.errors.txt new file mode 100644 index 00000000000..7c6cc5a9cd7 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (1 errors) ==== + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js new file mode 100644 index 00000000000..52ea7e091ee --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty3.ts] +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty3.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.errors.txt b/tests/baselines/reference/ES5SymbolProperty4.errors.txt new file mode 100644 index 00000000000..18f065c6bd5 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (1 errors) ==== + var Symbol: { iterator: string }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js new file mode 100644 index 00000000000..ae8a539f351 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty4.ts] +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty4.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty5.errors.txt b/tests/baselines/reference/ES5SymbolProperty5.errors.txt new file mode 100644 index 00000000000..bbfb64b6459 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (1 errors) ==== + var Symbol: { iterator: symbol }; + + class C { + [Symbol.iterator]() { } + } + + (new C)[Symbol.iterator](0) // Should error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js new file mode 100644 index 00000000000..63b12667d0f --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty5.ts] +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error + +//// [ES5SymbolProperty5.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.errors.txt b/tests/baselines/reference/ES5SymbolProperty6.errors.txt new file mode 100644 index 00000000000..7e7cb32995a --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (2 errors) ==== + class C { + [Symbol.iterator]() { } + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } + + (new C)[Symbol.iterator] + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6.js new file mode 100644 index 00000000000..10eda091e5e --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.js @@ -0,0 +1,15 @@ +//// [ES5SymbolProperty6.ts] +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty6.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.errors.txt b/tests/baselines/reference/ES5SymbolProperty7.errors.txt new file mode 100644 index 00000000000..21f6f005b3c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (1 errors) ==== + var Symbol: { iterator: any }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js new file mode 100644 index 00000000000..d3f796ce758 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty7.ts] +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty7.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolType1.js b/tests/baselines/reference/ES5SymbolType1.js new file mode 100644 index 00000000000..5b555c19e7c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.js @@ -0,0 +1,7 @@ +//// [ES5SymbolType1.ts] +var s: symbol; +s.toString(); + +//// [ES5SymbolType1.js] +var s; +s.toString(); diff --git a/tests/baselines/reference/ES5SymbolType1.types b/tests/baselines/reference/ES5SymbolType1.types new file mode 100644 index 00000000000..79d93902fd6 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/Symbols/ES5SymbolType1.ts === +var s: symbol; +>s : symbol + +s.toString(); +>s.toString() : string +>s.toString : () => string +>s : symbol +>toString : () => string + diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 2c8d034649e..c35015af7cf 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (2 errors) ==== var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 5f9f0a2a49e..3f6d2499cef 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,4 +2,7 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = { [yield]: foo }; +var v = (_a = {}, _a[yield] = +foo, +_a); +var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index ef744681fa1..152b1ffc7cc 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,15 +1,12 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ==== function * foo() { ~ !!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS9000: 'yield' expressions are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 388275ed4fa..04c946a96eb 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,5 +5,8 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { - var v = { []: foo }; + var v = (_a = {}, _a[] = + foo, + _a); + var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js index 595f7fc9124..71076523414 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js @@ -2,5 +2,4 @@ var v = { * } //// [FunctionPropertyAssignments4_es6.js] -var v = { : function () { -} }; +var v = { : function () { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index c8c356a57ad..596764e58ea 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,13 +1,10 @@ tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ==== var v = { *[foo()]() { } } ~ !!! error TS9001: Generators are not currently supported. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index fbde587036d..0b786632bdf 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,4 +2,6 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = { [foo()]: function () { } }; +var v = (_a = {}, _a[foo()] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index f111e6e1bdf..3bae1b645fe 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -7,5 +7,6 @@ var v = { * foo() { //// [YieldExpression10_es6.js] var v = { foo: function () { - ; -} }; + ; + } +}; diff --git a/tests/baselines/reference/YieldExpression13_es6.js b/tests/baselines/reference/YieldExpression13_es6.js index 328fc80dbdd..093759e6bd9 100644 --- a/tests/baselines/reference/YieldExpression13_es6.js +++ b/tests/baselines/reference/YieldExpression13_es6.js @@ -2,6 +2,4 @@ function* foo() { yield } //// [YieldExpression13_es6.js] -function foo() { - ; -} +function foo() { ; } diff --git a/tests/baselines/reference/YieldExpression17_es6.js b/tests/baselines/reference/YieldExpression17_es6.js index 6fd39844d80..cefe4ca28df 100644 --- a/tests/baselines/reference/YieldExpression17_es6.js +++ b/tests/baselines/reference/YieldExpression17_es6.js @@ -2,6 +2,4 @@ var v = { get foo() { yield foo; } } //// [YieldExpression17_es6.js] -var v = { get foo() { - ; -} }; +var v = { get foo() { ; } }; diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers.js index af1832d9340..ebc801ac136 100644 --- a/tests/baselines/reference/accessibilityModifiers.js +++ b/tests/baselines/reference/accessibilityModifiers.js @@ -52,9 +52,7 @@ var C = (function () { } C.privateMethod = function () { }; Object.defineProperty(C, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -65,9 +63,7 @@ var C = (function () { }); C.protectedMethod = function () { }; Object.defineProperty(C, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -78,9 +74,7 @@ var C = (function () { }); C.publicMethod = function () { }; Object.defineProperty(C, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -97,9 +91,7 @@ var D = (function () { } D.privateMethod = function () { }; Object.defineProperty(D, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -110,9 +102,7 @@ var D = (function () { }); D.protectedMethod = function () { }; Object.defineProperty(D, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -123,9 +113,7 @@ var D = (function () { }); D.publicMethod = function () { }; Object.defineProperty(D, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -142,9 +130,7 @@ var E = (function () { } E.prototype.method = function () { }; Object.defineProperty(E.prototype, "getter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js index 8c0d353b310..1eecaa68d64 100644 --- a/tests/baselines/reference/accessorWithES3.js +++ b/tests/baselines/reference/accessorWithES3.js @@ -47,9 +47,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithES5.js b/tests/baselines/reference/accessorWithES5.js index d51f5e7713b..746703bce52 100644 --- a/tests/baselines/reference/accessorWithES5.js +++ b/tests/baselines/reference/accessorWithES5.js @@ -44,9 +44,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithoutBody1.js b/tests/baselines/reference/accessorWithoutBody1.js index 37f0ecbcfee..e06e305e161 100644 --- a/tests/baselines/reference/accessorWithoutBody1.js +++ b/tests/baselines/reference/accessorWithoutBody1.js @@ -2,5 +2,4 @@ var v = { get foo() } //// [accessorWithoutBody1.js] -var v = { get foo() { -} }; +var v = { get foo() { } }; diff --git a/tests/baselines/reference/accessorWithoutBody2.js b/tests/baselines/reference/accessorWithoutBody2.js index 9dc34c1e744..3b5a821d580 100644 --- a/tests/baselines/reference/accessorWithoutBody2.js +++ b/tests/baselines/reference/accessorWithoutBody2.js @@ -2,5 +2,4 @@ var v = { set foo(a) } //// [accessorWithoutBody2.js] -var v = { set foo(a) { -} }; +var v = { set foo(a) { } }; diff --git a/tests/baselines/reference/accessorsNotAllowedInES3.js b/tests/baselines/reference/accessorsNotAllowedInES3.js index 5cb5a5dc47a..0843a39191c 100644 --- a/tests/baselines/reference/accessorsNotAllowedInES3.js +++ b/tests/baselines/reference/accessorsNotAllowedInES3.js @@ -11,14 +11,10 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); return C; })(); -var y = { get foo() { - return 3; -} }; +var y = { get foo() { return 3; } }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js index 11590f6d068..5e527aef3e9 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js @@ -18,38 +18,26 @@ var LanguageSpec_section_4_5_error_cases = (function () { function LanguageSpec_section_4_5_error_cases() { } Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 6ad452f2a5a..9aa7ce2f408 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -47,49 +47,37 @@ var LanguageSpec_section_4_5_inference = (function () { function LanguageSpec_section_4_5_inference() { } Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 49d4ea66ba8..26a77e917d9 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -84,6 +84,4 @@ var r16 = a + M; var r17 = a + ''; var r18 = a + 123; var r19 = a + { a: '' }; -var r20 = a + (function (a) { - return a; -}); +var r20 = a + (function (a) { return a; }); diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 20ac1350ef3..79d3c0b9b8d 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -25,9 +25,7 @@ var r11 = null + (() => { }); //// [additionOperatorWithNullValueAndInvalidOperator.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index 2cf0ce22259..98935db2b86 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -25,9 +25,7 @@ var r11 = undefined + (() => { }); //// [additionOperatorWithUndefinedValueAndInvalidOperands.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 4b6debf4c98..fb909181529 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -21,9 +21,7 @@ export var a = function () { //// [aliasUsedAsNameValue_0.js] exports.id; //// [aliasUsedAsNameValue_1.js] -function b(a) { - return null; -} +function b(a) { return null; } exports.b = b; //// [aliasUsedAsNameValue_2.js] /// diff --git a/tests/baselines/reference/ambientClassOverloadForFunction.js b/tests/baselines/reference/ambientClassOverloadForFunction.js index cf3a59a465d..402eca63381 100644 --- a/tests/baselines/reference/ambientClassOverloadForFunction.js +++ b/tests/baselines/reference/ambientClassOverloadForFunction.js @@ -5,6 +5,4 @@ function foo() { return null; } //// [ambientClassOverloadForFunction.js] ; -function foo() { - return null; -} +function foo() { return null; } diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js index 40bbbee6dd2..8d40873036c 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.js +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -6,9 +6,7 @@ var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operatio //// [ambiguousGenericAssertion1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; var r2 = f; // valid var r3 = << T > (x), T; diff --git a/tests/baselines/reference/ambiguousOverload.js b/tests/baselines/reference/ambiguousOverload.js index fd373c075a2..642f09dca16 100644 --- a/tests/baselines/reference/ambiguousOverload.js +++ b/tests/baselines/reference/ambiguousOverload.js @@ -12,15 +12,11 @@ var x2: string = foof2("s", null); var y2: number = foof2("s", null); //// [ambiguousOverload.js] -function foof(bar) { - return bar; -} +function foof(bar) { return bar; } ; var x = foof("s", null); var y = foof("s", null); -function foof2(bar) { - return bar; -} +function foof2(bar) { return bar; } ; var x2 = foof2("s", null); var y2 = foof2("s", null); diff --git a/tests/baselines/reference/anonterface.js b/tests/baselines/reference/anonterface.js index 59d055b29d7..12bfbc4ec9d 100644 --- a/tests/baselines/reference/anonterface.js +++ b/tests/baselines/reference/anonterface.js @@ -28,6 +28,4 @@ var M; M.C = C; })(M || (M = {})); var c = new M.C(); -c.m(function (n) { - return "hello: " + n; -}, 18); +c.m(function (n) { return "hello: " + n; }, 18); diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.js b/tests/baselines/reference/anyInferenceAnonymousFunctions.js index e232ec29593..df921965994 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.js +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.js @@ -27,6 +27,4 @@ paired.reduce(function (b1, b2) { }, []); paired.reduce(function (b3, b4) { return b3.concat({}); }, []); paired.map(function (c1) { return c1.count; }); -paired.map(function (c2) { - return c2.count; -}); +paired.map(function (c2) { return c2.count; }); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 2a82d436596..0abfa889bed 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -95,12 +95,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -108,17 +104,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -138,9 +130,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index a62e0eec9ac..977862866ed 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -69,12 +69,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -82,17 +78,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -112,9 +104,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; @@ -128,9 +118,7 @@ arr_c3 = arr_c2_2; // should be an error - is arr_c3 = arr_c1_2; // should be an error - is arr_c3 = arr_i1_2; // should be an error - is arr_any = f1; // should be an error - is -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = o1; // should be an error - is arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is diff --git a/tests/baselines/reference/arrayAssignmentTest4.js b/tests/baselines/reference/arrayAssignmentTest4.js index 7ac0ccde77f..c38cdebc06c 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -30,9 +30,7 @@ arr_any = c3; // should be an error - is var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -49,7 +47,5 @@ Type 1 of any[]: var c3 = new C3(); var o1 = { one: 1 }; var arr_any = []; -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = c3; // should be an error - is diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index cdf902a6c37..a10e3955ae0 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -184,14 +184,10 @@ var M2; // (ParamList) => { ... } is a generic arrow function var generic1 = function (n) { return [n]; }; var generic1; // Incorrect error, Bug 829597 -var generic2 = function (n) { - return [n]; -}; +var generic2 = function (n) { return [n]; }; var generic2; // ((ParamList) => { ... } ) is a type assertion to an arrow function var asserted1 = (function (n) { return [n]; }); var asserted1; -var asserted2 = (function (n) { - return n; -}); +var asserted2 = (function (n) { return n; }); var asserted2; diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index a828da6cffc..68516b52cb2 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -91,16 +91,10 @@ function tryCatchFn() { //// [arrowFunctionExpressions.js] // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function (p) { return p.length; }; -var a = function (p) { - return p.length; -}; +var a = function (p) { return p.length; }; // Identifier => Block is equivalent to(Identifier) => Block -var b = function (j) { - return 0; -}; -var b = function (j) { - return 0; -}; +var b = function (j) { return 0; }; +var b = function (j) { return 0; }; // Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression var c; var d = function (n) { return c = n; }; diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index 3cfc18d2cf7..0f9c3f81b3b 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -11,6 +11,4 @@ var C = (function () { } return C; })(); -var c = new C(function () { - return asdf; -}); // should error +var c = new C(function () { return asdf; }); // should error diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js index 3ea21232ac4..e0e22578ac6 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -79,24 +79,12 @@ var missingCurliesWithArrow; (function (missingCurliesWithArrow) { var withStatement; (function (withStatement) { - var a = function () { - var k = 10; - }; - var b = function () { - var k = 10; - }; - var c = function (x) { - var k = 10; - }; - var d = function (x, y) { - var k = 10; - }; - var e = function (x, y) { - var k = 10; - }; - var f = function () { - var k = 10; - }; + var a = function () { var k = 10; }; + var b = function () { var k = 10; }; + var c = function (x) { var k = 10; }; + var d = function (x, y) { var k = 10; }; + var e = function (x, y) { var k = 10; }; + var f = function () { var k = 10; }; })(withStatement || (withStatement = {})); var withoutStatement; (function (withoutStatement) { diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index 6d7b964c8d0..ac739bbd767 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -37,7 +37,9 @@ y //// [asiArith.js] var x = 1; var y = 1; -var z = x + + +y; +var z = x + ++ +y; var a = 1; var b = 1; -var c = x - - -y; +var c = x - +- -y; diff --git a/tests/baselines/reference/assignEveryTypeToAny.js b/tests/baselines/reference/assignEveryTypeToAny.js index c88fc2edc17..15aa6bcdd91 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -91,12 +91,8 @@ var h; x = h; var i; x = i; -x = { f: function () { - return 1; -} }; -x = { f: function (x) { - return x; -} }; +x = { f: function () { return 1; } }; +x = { f: function (x) { return x; } }; function j(a) { x = a; } diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js index 513a2080dd4..fe6142cafe0 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js @@ -12,6 +12,4 @@ fn(function (a, b) { return true; }) //// [assignLambdaToNominalSubtypeOfFunction.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/assignToFn.js b/tests/baselines/reference/assignToFn.js index 620753e4941..2ff8ceedfa6 100644 --- a/tests/baselines/reference/assignToFn.js +++ b/tests/baselines/reference/assignToFn.js @@ -13,8 +13,6 @@ module M { //// [assignToFn.js] var M; (function (M) { - var x = { f: function (n) { - return true; - } }; + var x = { f: function (n) { return true; } }; x.f = "hello"; })(M || (M = {})); diff --git a/tests/baselines/reference/assignmentCompatBug2.js b/tests/baselines/reference/assignmentCompatBug2.js index 77d1e1b7d16..5545cc7d19c 100644 --- a/tests/baselines/reference/assignmentCompatBug2.js +++ b/tests/baselines/reference/assignmentCompatBug2.js @@ -44,50 +44,28 @@ b2 = { a: 0 }; // error b2 = { b: 0, a: 0 }; var b3; b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0 }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - } + f: function (n) { return 0; }, + g: function (s) { return 0; } }; // error b3 = { - f: function (n) { - return 0; - }, + f: function (n) { return 0; }, m: 0 }; // error b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // error diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js index da21ac17c9d..049e7090335 100644 --- a/tests/baselines/reference/assignmentCompatBug3.js +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -28,12 +28,8 @@ foo(x + y); //// [assignmentCompatBug3.js] function makePoint(x, y) { return { - get x() { - return x; - }, - get y() { - return y; - }, + get x() { return x; }, + get y() { return y; }, //x: "yo", //y: "boo", dist: function () { diff --git a/tests/baselines/reference/assignmentCompatBug5.js b/tests/baselines/reference/assignmentCompatBug5.js index d4f82584bec..ae444c3dad6 100644 --- a/tests/baselines/reference/assignmentCompatBug5.js +++ b/tests/baselines/reference/assignmentCompatBug5.js @@ -19,6 +19,4 @@ foo2(["s", "t"]); function foo3(x) { } ; foo3(function (s) { }); -foo3(function (n) { - return; -}); +foo3(function (n) { return; }); diff --git a/tests/baselines/reference/assignmentCompatForEnums.js b/tests/baselines/reference/assignmentCompatForEnums.js index 4bca6a514d2..8db85399fa8 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.js +++ b/tests/baselines/reference/assignmentCompatForEnums.js @@ -22,9 +22,7 @@ var TokenType; })(TokenType || (TokenType = {})); ; var list = {}; -function returnType() { - return null; -} +function returnType() { return null; } function foo() { var x = returnType(); var x = list['one']; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.js b/tests/baselines/reference/assignmentCompatWithCallSignatures.js index 0539463ddb1..12fc6159fac 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.js @@ -57,26 +57,18 @@ a = s; a = a2; t = function (x) { return 1; }; t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function (x) { return 1; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js index 6fabe9b6af7..6bfc1b6c0d6 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js @@ -64,38 +64,24 @@ a = s; a = a2; t = { f: function () { return 1; } }; t = { f: function (x) { return 1; } }; -t = { f: function f() { - return 1; -} }; -t = { f: function (x) { - return ''; -} }; +t = { f: function f() { return 1; } }; +t = { f: function (x) { return ''; } }; a = { f: function () { return 1; } }; a = { f: function (x) { return 1; } }; -a = { f: function (x) { - return ''; -} }; +a = { f: function (x) { return ''; } }; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js index 3dc7511fec0..c00aa121712 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js @@ -54,12 +54,8 @@ var a3; t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js index 7f173224bc9..d00762aa1c5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js @@ -56,25 +56,17 @@ a = s; a = a2; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.js b/tests/baselines/reference/assignmentCompatWithOverloads.js index 472ebec2967..ca3dc0e2294 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.js +++ b/tests/baselines/reference/assignmentCompatWithOverloads.js @@ -31,18 +31,10 @@ var d: new(x: number) => void; d = C; // Error //// [assignmentCompatWithOverloads.js] -function f1(x) { - return null; -} -function f2(x) { - return null; -} -function f3(x) { - return null; -} -function f4(x) { - return undefined; -} +function f1(x) { return null; } +function f2(x) { return null; } +function f3(x) { return null; } +function f4(x) { return undefined; } var g; g = f1; // OK g = f2; // Error diff --git a/tests/baselines/reference/assignmentCompatability24.js b/tests/baselines/reference/assignmentCompatability24.js index 7eda1e61266..e6961264de8 100644 --- a/tests/baselines/reference/assignmentCompatability24.js +++ b/tests/baselines/reference/assignmentCompatability24.js @@ -19,9 +19,7 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.obj = function f(a) { - return a; - }; + __test2__.obj = function f(a) { return a; }; ; __test2__.__val__obj = __test2__.obj; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 15bc7b9acfd..4b17f855171 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -84,17 +84,11 @@ var C = (function () { function C() { this = value; } - C.prototype.foo = function () { - this = value; - }; - C.sfoo = function () { - this = value; - }; + C.prototype.foo = function () { this = value; }; + C.sfoo = function () { this = value; }; return C; })(); -function foo() { - this = value; -} +function foo() { this = value; } this = value; // identifiers: module, class, enum, function var M; @@ -129,12 +123,8 @@ var Derived = (function (_super) { _super.call(this); _super.prototype. = value; } - Derived.prototype.foo = function () { - _super.prototype. = value; - }; - Derived.sfoo = function () { - _super. = value; - }; + Derived.prototype.foo = function () { _super.prototype. = value; }; + Derived.sfoo = function () { _super. = value; }; return Derived; })(C); // function expression diff --git a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt index eca303ff72c..28e66844696 100644 --- a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt +++ b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. - Named properties 'm' of types 'X' and 'Y' are not identical. + Named property 'm' of types 'X' and 'Y' are not identical. ==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ==== @@ -13,4 +13,4 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interfac interface Z extends X, Y { } ~ !!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. -!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file +!!! error TS2320: Named property 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js index 752523317b5..f78f8990db0 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -26,15 +26,9 @@ 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; -} +function f1(x) { return "foo"; } +function f2(x) { return 10; } +function f3(x) { return true; } var E1; (function (E1) { E1[E1["one"] = 0] = "one"; diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.js b/tests/baselines/reference/bestCommonTypeReturnStatement.js index 232ffc07c54..f4ab98ed1c6 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.js +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.js @@ -18,9 +18,5 @@ function f() { return b(); return d(); } -function b() { - return null; -} -function d() { - return null; -} +function b() { return null; } +function d() { return null; } diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index 9416e7b1a06..fb573a7523f 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsNumber8 = ~~BOOLEAN; //// [bitwiseNotOperatorWithBooleanType.js] // ~ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index 2f9703ae669..ac439f02903 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -48,15 +48,11 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); // ~ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsNumber2 = ~NUMBER1; // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; -var ResultIsNumber5 = ~{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index fbd77c6119a..a553712e16b 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -47,15 +47,11 @@ var ResultIsNumber14 = ~~~(STRING + STRING); // ~ operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -69,9 +65,7 @@ var ResultIsNumber2 = ~STRING1; // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; -var ResultIsNumber5 = ~{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js index 59bfabd21d6..f1028956e16 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -47,14 +47,10 @@ var r7b = i2.f(1, ''); //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.js] // type parameter lists must exactly match type argument lists // all of these invocations are errors -function f(x, y) { - return null; -} +function f(x, y) { return null; } var r1 = f(1, ''); var r1b = f(1, ''); -var f2 = function (x, y) { - return null; -}; +var f2 = function (x, y) { return null; }; var r2 = f2(1, ''); var r2b = f2(1, ''); var f3; diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js index 04edc93f5d9..26b9d33a55d 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -38,13 +38,9 @@ var r7 = i2.f(1); //// [callGenericFunctionWithZeroTypeArguments.js] // valid invocations of generic functions with no explicit type arguments provided -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js index 306b4c70362..7b0355533e3 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -46,13 +46,9 @@ var r8 = a2(); //// [callNonGenericFunctionWithTypeArguments.js] // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index 94397c4ef8e..b1148c12420 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -25,9 +25,7 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(a) { - return a; -} +function F1(a) { return a; } var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index ed1b9cfcac3..b336911eeb0 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -33,12 +33,8 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(s) { - return s; -} // error -function F1(a) { - return a; -} // error +function F1(s) { return s; } // error +function F1(a) { return a; } // error var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index c048c5c56de..0e78aac2b1b 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -202,9 +202,7 @@ function foo12() { return i2; } var r12 = foo12(); -function m1() { - return 1; -} +function m1() { return 1; } var m1; (function (m1) { m1.y = 2; diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt index 5fabfd0b7ad..4ff65843eba 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. - Named properties 'foo' of types 'I' and 'I' are not identical. + Named property 'foo' of types 'I' and 'I' are not identical. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. @@ -14,7 +14,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha interface A extends I, I { } ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. -!!! error TS2320: Named properties 'foo' of types 'I' and 'I' are not identical. +!!! error TS2320: Named property 'foo' of types 'I' and 'I' are not identical. var x: A; // BUG 822524 diff --git a/tests/baselines/reference/callWithSpread.errors.txt b/tests/baselines/reference/callWithSpread.errors.txt index 7ea026f4346..a28d4c8b1a1 100644 --- a/tests/baselines/reference/callWithSpread.errors.txt +++ b/tests/baselines/reference/callWithSpread.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts (1 errors) ==== @@ -55,5 +55,5 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): erro // Only supported in when target is ES6 var c = new C(1, 2, ...a); ~~~~ -!!! error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/callbacksDontShareTypes.js b/tests/baselines/reference/callbacksDontShareTypes.js index 649ed1cb6ca..e6483638058 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.js +++ b/tests/baselines/reference/callbacksDontShareTypes.js @@ -21,14 +21,8 @@ var r5b = _.map(c2, rf1); //// [callbacksDontShareTypes.js] var _; var c2; -var rf1 = function (x) { - return x.toFixed(); -}; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); +var rf1 = function (x) { return x.toFixed(); }; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors -var r5a = _.map(c2, function (x) { - return x.toFixed(); -}); +var r5a = _.map(c2, function (x) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/castTest.js b/tests/baselines/reference/castTest.js index 5afa67026b9..ef9ef084d98 100644 --- a/tests/baselines/reference/castTest.js +++ b/tests/baselines/reference/castTest.js @@ -47,7 +47,5 @@ var p_cast = ({ add: function (dx, dy) { return new Point(this.x + dx, this.y + dy); }, - mult: function (p) { - return p; - } + mult: function (p) { return p; } }); diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js index e6995a04aca..1884967aa9e 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js @@ -14,6 +14,4 @@ var s3 = s2.each(x => { x.key /* Type is K, should be number */ }); //// [chainedSpecializationToObjectTypeLiteral.js] var s; var s2 = s.groupBy(function (s) { return s.length; }); -var s3 = s2.each(function (x) { - x.key; /* Type is K, should be number */ -}); +var s3 = s2.each(function (x) { x.key; /* Type is K, should be number */ }); diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 9d902abbf52..6bcf0f46f74 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -20,9 +20,7 @@ var C = (function () { return C; })(); var y = { - foo: , - class: C2 -}, _a = void 0; + foo: , class: C2 }, _a = void 0; var M; (function (M) { var z = ; diff --git a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js index ed6e3138b07..907b6bd6fd2 100644 --- a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js +++ b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js @@ -19,20 +19,14 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D2 = (function () { function D2() { this.x = 3; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; return D2; })(); diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 98554944bc9..bc4f6b6748c 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 9dbfc4388e9..450263d00c9 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -24,9 +24,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 0e08e508fb5..ac5c899bbbf 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -27,9 +27,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 46e826683e7..a0971904cc3 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -28,9 +28,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 386cd6685ae..931218e2bea 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -34,9 +34,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 0ba1e016bc8..4bc1c3f790c 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -31,9 +31,7 @@ var A = (function (_super) { function A() { _super.apply(this, arguments); } - A.prototype.foo = function () { - this.bar(); - }; + A.prototype.foo = function () { this.bar(); }; return A; })(B); var B = (function () { diff --git a/tests/baselines/reference/classPropertyAsPrivate.js b/tests/baselines/reference/classPropertyAsPrivate.js index fdb16620fac..51d08b48ec5 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.js +++ b/tests/baselines/reference/classPropertyAsPrivate.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyAsProtected.js b/tests/baselines/reference/classPropertyAsProtected.js index d036319fe8f..1cd74089816 100644 --- a/tests/baselines/reference/classPropertyAsProtected.js +++ b/tests/baselines/reference/classPropertyAsProtected.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyIsPublicByDefault.js b/tests/baselines/reference/classPropertyIsPublicByDefault.js index fefa48be10a..a0b61a08922 100644 --- a/tests/baselines/reference/classPropertyIsPublicByDefault.js +++ b/tests/baselines/reference/classPropertyIsPublicByDefault.js @@ -27,18 +27,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 38b84b77bd3..74df624a78c 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -28,9 +28,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C2 = (function (_super) { diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js index e39391be68d..1c07449c994 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js @@ -30,13 +30,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js index b7aa9d52332..78e5cb05861 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js @@ -32,13 +32,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithPrivateProperty.js b/tests/baselines/reference/classWithPrivateProperty.js index 224fc432b64..0529fd8d694 100644 --- a/tests/baselines/reference/classWithPrivateProperty.js +++ b/tests/baselines/reference/classWithPrivateProperty.js @@ -30,12 +30,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index c0dde0d3237..4de87229ad0 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -41,12 +41,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithPublicProperty.js b/tests/baselines/reference/classWithPublicProperty.js index 97b3f46ab49..cc1b0aad64f 100644 --- a/tests/baselines/reference/classWithPublicProperty.js +++ b/tests/baselines/reference/classWithPublicProperty.js @@ -28,12 +28,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 0d3747dc313..36b8bd0af64 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -31,13 +31,9 @@ var C = (function () { this.a = a; this.b = b; } - C.fn = function () { - return this; - }; + C.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.js b/tests/baselines/reference/cloduleWithDuplicateMember1.js index d64da830598..e3cb8f83fed 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember1.js +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.js @@ -20,9 +20,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index f249a7d5589..b4b31e59d3e 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -38,9 +38,7 @@ var Shape; (function (Shape) { var Utils; (function (Utils) { - function convert() { - return null; - } + function convert() { return null; } Utils.convert = convert; })(Utils = Shape.Utils || (Shape.Utils = {})); })(Shape || (Shape = {})); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js index 967d01819ec..879dd83d778 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js @@ -12,7 +12,5 @@ var console; function x() { var _this = this; var _this = 5; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/collisionThisExpressionAndParameter.js b/tests/baselines/reference/collisionThisExpressionAndParameter.js index 7c11cab769f..3a19cf20d5a 100644 --- a/tests/baselines/reference/collisionThisExpressionAndParameter.js +++ b/tests/baselines/reference/collisionThisExpressionAndParameter.js @@ -144,9 +144,7 @@ var Foo1 = (function () { })(); function f1(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } var Foo3 = (function () { function Foo3(_this) { @@ -167,7 +165,5 @@ var Foo3 = (function () { })(); function f3(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/commentOnClassAccessor1.js b/tests/baselines/reference/commentOnClassAccessor1.js index cdd14a829fc..428e500da55 100644 --- a/tests/baselines/reference/commentOnClassAccessor1.js +++ b/tests/baselines/reference/commentOnClassAccessor1.js @@ -14,9 +14,7 @@ var C = (function () { /** * @type {number} */ - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/commentOnClassAccessor2.js b/tests/baselines/reference/commentOnClassAccessor2.js index e75431a7280..22a6b69f6c3 100644 --- a/tests/baselines/reference/commentOnClassAccessor2.js +++ b/tests/baselines/reference/commentOnClassAccessor2.js @@ -19,9 +19,7 @@ var C = (function () { /** * Getter. */ - get: function () { - return 1; - }, + get: function () { return 1; }, /** * Setter. */ diff --git a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js index dc9bac84fa5..39f967555bf 100644 --- a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js +++ b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js @@ -11,4 +11,7 @@ Foo(() => //// [commentOnSimpleArrowFunctionBody1.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index a2a863cf54b..e8dc954e14c 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -68,9 +68,7 @@ var Derived = (function (_super) { })(Base); var BaseCollection = (function () { function BaseCollection(f) { - (function (item) { - return [item.Components]; - }); + (function (item) { return [item.Components]; }); } return BaseCollection; })(); @@ -83,9 +81,7 @@ var Thing = (function () { function Thing() { } Object.defineProperty(Thing.prototype, "Components", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/compositeGenericFunction.js b/tests/baselines/reference/compositeGenericFunction.js index 0fe2e7d6f41..106c724ea24 100644 --- a/tests/baselines/reference/compositeGenericFunction.js +++ b/tests/baselines/reference/compositeGenericFunction.js @@ -7,12 +7,8 @@ var z: number = h(f); var z: number = h(f); //// [compositeGenericFunction.js] -function f(value) { - return value; -} +function f(value) { return value; } ; -function h(func) { - return null; -} +function h(func) { return null; } var z = h(f); var z = h(f); diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js new file mode 100644 index 00000000000..ececb28b8cc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames10_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames10_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames10.types b/tests/baselines/reference/computedPropertyNames10_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames10.types rename to tests/baselines/reference/computedPropertyNames10_ES5.types index 29bf6c43bef..cb49d5c3384 100644 --- a/tests/baselines/reference/computedPropertyNames10.types +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames10.js b/tests/baselines/reference/computedPropertyNames10_ES6.js similarity index 83% rename from tests/baselines/reference/computedPropertyNames10.js rename to tests/baselines/reference/computedPropertyNames10_ES6.js index eb8db65dba5..0a55fabecd8 100644 --- a/tests/baselines/reference/computedPropertyNames10.js +++ b/tests/baselines/reference/computedPropertyNames10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames10.ts] +//// [computedPropertyNames10_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]() { } } -//// [computedPropertyNames10.js] +//// [computedPropertyNames10_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.types b/tests/baselines/reference/computedPropertyNames10_ES6.types new file mode 100644 index 00000000000..5dcc4783b5e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} + + [s]() { }, +>s : string + + [n]() { }, +>n : number + + [s + s]() { }, +>s + s : string +>s : string +>s : string + + [s + n]() { }, +>s + n : string +>s : string +>n : number + + [+s]() { }, +>+s : number +>s : string + + [""]() { }, + [0]() { }, + [a]() { }, +>a : any + + [true]() { }, +>true : any + + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js new file mode 100644 index 00000000000..d8450deb765 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames11_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames11_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames11.types b/tests/baselines/reference/computedPropertyNames11_ES5.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames11.types rename to tests/baselines/reference/computedPropertyNames11_ES5.types index ee0796320d6..ed3c51302b7 100644 --- a/tests/baselines/reference/computedPropertyNames11.types +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNames11.js rename to tests/baselines/reference/computedPropertyNames11_ES6.js index 206fce0d76f..f1a774b88fe 100644 --- a/tests/baselines/reference/computedPropertyNames11.js +++ b/tests/baselines/reference/computedPropertyNames11_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames11.ts] +//// [computedPropertyNames11_ES6.ts] var s: string; var n: number; var a: any; @@ -16,32 +16,20 @@ var v = { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames11.js] +//// [computedPropertyNames11_ES6.js] var s; var n; var a; var v = { - get [s]() { - return 0; - }, + get [s]() { return 0; }, set [n](v) { }, - get [s + s]() { - return 0; - }, + get [s + s]() { return 0; }, set [s + n](v) { }, - get [+s]() { - return 0; - }, + get [+s]() { return 0; }, set [""](v) { }, - get [0]() { - return 0; - }, + get [0]() { return 0; }, set [a](v) { }, - get [true]() { - return 0; - }, + get [true]() { return 0; }, set [`hello bye`](v) { }, - get [`hello ${a} bye`]() { - return 0; - } + get [`hello ${a} bye`]() { return 0; } }; diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.types b/tests/baselines/reference/computedPropertyNames11_ES6.types new file mode 100644 index 00000000000..a0b9e6eb99e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {} + + get [s]() { return 0; }, +>s : string + + set [n](v) { }, +>n : number +>v : any + + get [s + s]() { return 0; }, +>s + s : string +>s : string +>s : string + + set [s + n](v) { }, +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; }, +>+s : number +>s : string + + set [""](v) { }, +>v : any + + get [0]() { return 0; }, + set [a](v) { }, +>a : any +>v : any + + get [true]() { return 0; }, +>true : any + + set [`hello bye`](v) { }, +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt deleted file mode 100644 index 56774fe8dae..00000000000 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== - var s: string; - var n: number; - var a: any; - class C { - [s]: number; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [n] = n; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [s + s]: string; - ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [s + n] = 2; - ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [+s]: typeof s; - ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [""]: number; - ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [0]: number; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [a]: number; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [true]: number; - ~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [`hello bye`] = 0; - ~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [`hello ${a} bye`] = 0 - ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt new file mode 100644 index 00000000000..9d07f34f3c4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [n] = n; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [+s]: typeof s; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [""]: number; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [0]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [a]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js new file mode 100644 index 00000000000..c73ea11286f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames12_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} + +//// [computedPropertyNames12_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + this[n] = n; + this[s + n] = 2; + this["hello bye"] = 0; + } + C["hello " + a + " bye"] = 0; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt new file mode 100644 index 00000000000..f0a2267f8b3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [n] = n; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [+s]: typeof s; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [""]: number; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [0]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [a]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12.js b/tests/baselines/reference/computedPropertyNames12_ES6.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames12.js rename to tests/baselines/reference/computedPropertyNames12_ES6.js index 5e5dec0c549..5ab6e4c09b3 100644 --- a/tests/baselines/reference/computedPropertyNames12.js +++ b/tests/baselines/reference/computedPropertyNames12_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames12.ts] +//// [computedPropertyNames12_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`] = 0 } -//// [computedPropertyNames12.js] +//// [computedPropertyNames12_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.js b/tests/baselines/reference/computedPropertyNames13_ES5.js new file mode 100644 index 00000000000..89562162911 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.js @@ -0,0 +1,38 @@ +//// [computedPropertyNames13_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames13_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + C.prototype[s] = function () { }; + C.prototype[n] = function () { }; + C[s + s] = function () { }; + C.prototype[s + n] = function () { }; + C.prototype[+s] = function () { }; + C[""] = function () { }; + C.prototype[0] = function () { }; + C.prototype[a] = function () { }; + C[true] = function () { }; + C.prototype["hello bye"] = function () { }; + C["hello " + a + " bye"] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13.types b/tests/baselines/reference/computedPropertyNames13_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames13.types rename to tests/baselines/reference/computedPropertyNames13_ES5.types index 4f267f2e893..ff98a3189a7 100644 --- a/tests/baselines/reference/computedPropertyNames13.types +++ b/tests/baselines/reference/computedPropertyNames13_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames13.js b/tests/baselines/reference/computedPropertyNames13_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames13.js rename to tests/baselines/reference/computedPropertyNames13_ES6.js index 0456e32602f..b18ef3fb3e2 100644 --- a/tests/baselines/reference/computedPropertyNames13.js +++ b/tests/baselines/reference/computedPropertyNames13_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames13.ts] +//// [computedPropertyNames13_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`]() { } } -//// [computedPropertyNames13.js] +//// [computedPropertyNames13_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13_ES6.types b/tests/baselines/reference/computedPropertyNames13_ES6.types new file mode 100644 index 00000000000..78b2f3afc4a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES6.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + [s]() {} +>s : string + + [n]() { } +>n : number + + static [s + s]() { } +>s + s : string +>s : string +>s : string + + [s + n]() { } +>s + n : string +>s : string +>n : number + + [+s]() { } +>+s : number +>s : string + + static [""]() { } + [0]() { } + [a]() { } +>a : any + + static [true]() { } +>true : any + + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt similarity index 53% rename from tests/baselines/reference/computedPropertyNames14.errors.txt rename to tests/baselines/reference/computedPropertyNames14_ES5.errors.txt index 1cf5b1445f2..0ca77380e41 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (6 errors) ==== var b: boolean; class C { [b]() {} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [true]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [{}]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [null]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14.js b/tests/baselines/reference/computedPropertyNames14_ES5.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames14.js rename to tests/baselines/reference/computedPropertyNames14_ES5.js index a0b39a5e143..5db5e842a2a 100644 --- a/tests/baselines/reference/computedPropertyNames14.js +++ b/tests/baselines/reference/computedPropertyNames14_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames14.ts] +//// [computedPropertyNames14_ES5.ts] var b: boolean; class C { [b]() {} @@ -9,7 +9,7 @@ class C { static [null]() { } } -//// [computedPropertyNames14.js] +//// [computedPropertyNames14_ES5.js] var b; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt new file mode 100644 index 00000000000..97525a783aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts (6 errors) ==== + var b: boolean; + class C { + [b]() {} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [true]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [[]]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [{}]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [undefined]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [null]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14_ES6.js b/tests/baselines/reference/computedPropertyNames14_ES6.js new file mode 100644 index 00000000000..94b4196a606 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES6.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames14_ES6.ts] +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} + +//// [computedPropertyNames14_ES6.js] +var b; +var C = (function () { + function C() { + } + C.prototype[b] = function () { }; + C[true] = function () { }; + C.prototype[[]] = function () { }; + C[{}] = function () { }; + C.prototype[undefined] = function () { }; + C[null] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames15.errors.txt rename to tests/baselines/reference/computedPropertyNames15_ES5.errors.txt index 0e759668a95..649c438e47e 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): [p1]() { } [p2]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15.js b/tests/baselines/reference/computedPropertyNames15_ES5.js similarity index 79% rename from tests/baselines/reference/computedPropertyNames15.js rename to tests/baselines/reference/computedPropertyNames15_ES5.js index 429b23614ab..93258b64c75 100644 --- a/tests/baselines/reference/computedPropertyNames15.js +++ b/tests/baselines/reference/computedPropertyNames15_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames15.ts] +//// [computedPropertyNames15_ES5.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ class C { [p3]() { } } -//// [computedPropertyNames15.js] +//// [computedPropertyNames15_ES5.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt new file mode 100644 index 00000000000..e35e8f645c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + class C { + [p1]() { } + [p2]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [p3]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.js b/tests/baselines/reference/computedPropertyNames15_ES6.js new file mode 100644 index 00000000000..ab7bf4552d6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES6.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames15_ES6.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} + +//// [computedPropertyNames15_ES6.js] +var p1; +var p2; +var p3; +var C = (function () { + function C() { + } + C.prototype[p1] = function () { }; + C.prototype[p2] = function () { }; + C.prototype[p3] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js new file mode 100644 index 00000000000..2c7316e1398 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -0,0 +1,82 @@ +//// [computedPropertyNames16_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames16_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, n, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, s + s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, s + n, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, +s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 0, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, a, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello bye", { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello " + a + " bye", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16.types b/tests/baselines/reference/computedPropertyNames16_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames16.types rename to tests/baselines/reference/computedPropertyNames16_ES5.types index ccfa7996066..3914093c766 100644 --- a/tests/baselines/reference/computedPropertyNames16.types +++ b/tests/baselines/reference/computedPropertyNames16_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16_ES6.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames16.js rename to tests/baselines/reference/computedPropertyNames16_ES6.js index 9a55c3f9ed5..369040e7e22 100644 --- a/tests/baselines/reference/computedPropertyNames16.js +++ b/tests/baselines/reference/computedPropertyNames16_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames16.ts] +//// [computedPropertyNames16_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames16.js] +//// [computedPropertyNames16_ES6.js] var s; var n; var a; @@ -24,9 +24,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -36,9 +34,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, s + s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -48,9 +44,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, +s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -60,9 +54,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, 0, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -72,9 +64,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, true, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -84,9 +74,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, `hello ${a} bye`, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames16_ES6.types b/tests/baselines/reference/computedPropertyNames16_ES6.types new file mode 100644 index 00000000000..6503c75037d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES6.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + get [s]() { return 0;} +>s : string + + set [n](v) { } +>n : number +>v : any + + static get [s + s]() { return 0; } +>s + s : string +>s : string +>s : string + + set [s + n](v) { } +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; } +>+s : number +>s : string + + static set [""](v) { } +>v : any + + get [0]() { return 0; } + set [a](v) { } +>a : any +>v : any + + static get [true]() { return 0; } +>true : any + + set [`hello bye`](v) { } +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt similarity index 55% rename from tests/baselines/reference/computedPropertyNames17.errors.txt rename to tests/baselines/reference/computedPropertyNames17_ES5.errors.txt index b236ae3245e..31a9d341dc4 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (6 errors) ==== var b: boolean; class C { get [b]() { return 0;} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [true](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [[]]() { return 0; } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [{}](v) { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [undefined]() { return 0; } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [null](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17_ES5.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames17.js rename to tests/baselines/reference/computedPropertyNames17_ES5.js index 026671ed8a6..3b5c100694d 100644 --- a/tests/baselines/reference/computedPropertyNames17.js +++ b/tests/baselines/reference/computedPropertyNames17_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames17.ts] +//// [computedPropertyNames17_ES5.ts] var b: boolean; class C { get [b]() { return 0;} @@ -9,15 +9,13 @@ class C { set [null](v) { } } -//// [computedPropertyNames17.js] +//// [computedPropertyNames17_ES5.js] var b; var C = (function () { function C() { } Object.defineProperty(C.prototype, b, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -27,9 +25,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, [], { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -39,9 +35,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, undefined, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt new file mode 100644 index 00000000000..4c1566f032b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts (6 errors) ==== + var b: boolean; + class C { + get [b]() { return 0;} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static set [true](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [[]]() { return 0; } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [{}](v) { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static get [undefined]() { return 0; } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [null](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.js b/tests/baselines/reference/computedPropertyNames17_ES6.js new file mode 100644 index 00000000000..38012efbb14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES6.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames17_ES6.ts] +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} + +//// [computedPropertyNames17_ES6.js] +var b; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, b, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [], { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, {}, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, undefined, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, null, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js new file mode 100644 index 00000000000..0ccc0fb4e00 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames18_ES5.ts] +function foo() { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames18_ES5.js] +function foo() { + var obj = (_a = {}, _a[this.bar] = + 0, + _a); + var _a; +} diff --git a/tests/baselines/reference/computedPropertyNames18.types b/tests/baselines/reference/computedPropertyNames18_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames18.types rename to tests/baselines/reference/computedPropertyNames18_ES5.types index 0976e5fc3ca..732de08e2d6 100644 --- a/tests/baselines/reference/computedPropertyNames18.types +++ b/tests/baselines/reference/computedPropertyNames18_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts === function foo() { >foo : () => void diff --git a/tests/baselines/reference/computedPropertyNames18.js b/tests/baselines/reference/computedPropertyNames18_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNames18.js rename to tests/baselines/reference/computedPropertyNames18_ES6.js index af2d68b3095..fbf840feb31 100644 --- a/tests/baselines/reference/computedPropertyNames18.js +++ b/tests/baselines/reference/computedPropertyNames18_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames18.ts] +//// [computedPropertyNames18_ES6.ts] function foo() { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames18.js] +//// [computedPropertyNames18_ES6.js] function foo() { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames18_ES6.types b/tests/baselines/reference/computedPropertyNames18_ES6.types new file mode 100644 index 00000000000..af7081fa2ad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts === +function foo() { +>foo : () => void + + var obj = { +>obj : {} +>{ [this.bar]: 0 } : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any + } +} diff --git a/tests/baselines/reference/computedPropertyNames19.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames19.errors.txt rename to tests/baselines/reference/computedPropertyNames19_ES5.errors.txt index 2037008992f..49a1f008a05 100644 --- a/tests/baselines/reference/computedPropertyNames19.errors.txt +++ b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (1 errors) ==== module M { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js new file mode 100644 index 00000000000..a18cb7b95c3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNames19_ES5.ts] +module M { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames19_ES5.js] +var M; +(function (M) { + var obj = (_a = {}, _a[this.bar] = + 0, + _a); + var _a; +})(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt new file mode 100644 index 00000000000..9e2d1afbe74 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts (1 errors) ==== + module M { + var obj = { + [this.bar]: 0 + ~~~~ +!!! error TS2331: 'this' cannot be referenced in a module body. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames19.js b/tests/baselines/reference/computedPropertyNames19_ES6.js similarity index 62% rename from tests/baselines/reference/computedPropertyNames19.js rename to tests/baselines/reference/computedPropertyNames19_ES6.js index 3fd2f99eea6..99ebde491ec 100644 --- a/tests/baselines/reference/computedPropertyNames19.js +++ b/tests/baselines/reference/computedPropertyNames19_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames19.ts] +//// [computedPropertyNames19_ES6.ts] module M { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames19.js] +//// [computedPropertyNames19_ES6.js] var M; (function (M) { var obj = { diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js new file mode 100644 index 00000000000..36a7fd6052d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames1_ES5.ts] +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} + +//// [computedPropertyNames1_ES5.js] +var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames1.types rename to tests/baselines/reference/computedPropertyNames1_ES5.types index b44aa3c69d0..6627d53d1da 100644 --- a/tests/baselines/reference/computedPropertyNames1.types +++ b/tests/baselines/reference/computedPropertyNames1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts === var v = { >v : {} >{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1_ES6.js similarity index 52% rename from tests/baselines/reference/computedPropertyNames1.js rename to tests/baselines/reference/computedPropertyNames1_ES6.js index 4f0bcb3a8f4..80a7d2ecdd2 100644 --- a/tests/baselines/reference/computedPropertyNames1.js +++ b/tests/baselines/reference/computedPropertyNames1_ES6.js @@ -1,13 +1,11 @@ -//// [computedPropertyNames1.ts] +//// [computedPropertyNames1_ES6.ts] var v = { get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error } -//// [computedPropertyNames1.js] +//// [computedPropertyNames1_ES6.js] var v = { - get [0 + 1]() { - return 0; - }, + get [0 + 1]() { return 0; }, set [0 + 1](v) { } //No error }; diff --git a/tests/baselines/reference/computedPropertyNames1_ES6.types b/tests/baselines/reference/computedPropertyNames1_ES6.types new file mode 100644 index 00000000000..966cfef579d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES6.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts === +var v = { +>v : {} +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} + + get [0 + 1]() { return 0 }, +>0 + 1 : number + + set [0 + 1](v: string) { } //No error +>0 + 1 : number +>v : string +} diff --git a/tests/baselines/reference/computedPropertyNames20.js b/tests/baselines/reference/computedPropertyNames20.js deleted file mode 100644 index 2a1edf06142..00000000000 --- a/tests/baselines/reference/computedPropertyNames20.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames20.ts] -var obj = { - [this.bar]: 0 -} - -//// [computedPropertyNames20.js] -var obj = { - [this.bar]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js new file mode 100644 index 00000000000..21af64d7e41 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames20_ES5.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES5.js] +var obj = (_a = {}, _a[this.bar] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames20.types b/tests/baselines/reference/computedPropertyNames20_ES5.types similarity index 84% rename from tests/baselines/reference/computedPropertyNames20.types rename to tests/baselines/reference/computedPropertyNames20_ES5.types index abd1b203e87..eb2bbf34b7e 100644 --- a/tests/baselines/reference/computedPropertyNames20.types +++ b/tests/baselines/reference/computedPropertyNames20_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts === var obj = { >obj : {} >{ [this.bar]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.js b/tests/baselines/reference/computedPropertyNames20_ES6.js new file mode 100644 index 00000000000..c128d8c0f85 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20_ES6.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES6.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.types b/tests/baselines/reference/computedPropertyNames20_ES6.types new file mode 100644 index 00000000000..2280c7c4820 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts === +var obj = { +>obj : {} +>{ [this.bar]: 0} : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any +} diff --git a/tests/baselines/reference/computedPropertyNames21.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames21.errors.txt rename to tests/baselines/reference/computedPropertyNames21_ES5.errors.txt index a44c8d60ee8..cb794d3865a 100644 --- a/tests/baselines/reference/computedPropertyNames21.errors.txt +++ b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames21.js b/tests/baselines/reference/computedPropertyNames21_ES5.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames21.js rename to tests/baselines/reference/computedPropertyNames21_ES5.js index d5ca1422a5e..81f95cd824d 100644 --- a/tests/baselines/reference/computedPropertyNames21.js +++ b/tests/baselines/reference/computedPropertyNames21_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames21.ts] +//// [computedPropertyNames21_ES5.ts] class C { bar() { return 0; @@ -6,7 +6,7 @@ class C { [this.bar()]() { } } -//// [computedPropertyNames21.js] +//// [computedPropertyNames21_ES5.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt new file mode 100644 index 00000000000..064e086cd5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [this.bar()]() { } + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames21_ES6.js b/tests/baselines/reference/computedPropertyNames21_ES6.js new file mode 100644 index 00000000000..34a1878f689 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES6.js @@ -0,0 +1,18 @@ +//// [computedPropertyNames21_ES6.ts] +class C { + bar() { + return 0; + } + [this.bar()]() { } +} + +//// [computedPropertyNames21_ES6.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[this.bar()] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js new file mode 100644 index 00000000000..e3e685aa54b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames22_ES5.ts] +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames22_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = (_a = {}, _a[this.bar()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22.types b/tests/baselines/reference/computedPropertyNames22_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames22.types rename to tests/baselines/reference/computedPropertyNames22_ES5.types index d23546192c0..7afeeb75fa3 100644 --- a/tests/baselines/reference/computedPropertyNames22.types +++ b/tests/baselines/reference/computedPropertyNames22_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames22.js b/tests/baselines/reference/computedPropertyNames22_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames22.js rename to tests/baselines/reference/computedPropertyNames22_ES6.js index dc6a53ff91a..c5d58939fc8 100644 --- a/tests/baselines/reference/computedPropertyNames22.js +++ b/tests/baselines/reference/computedPropertyNames22_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames22.ts] +//// [computedPropertyNames22_ES6.ts] class C { bar() { var obj = { @@ -8,7 +8,7 @@ class C { } } -//// [computedPropertyNames22.js] +//// [computedPropertyNames22_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames22_ES6.types b/tests/baselines/reference/computedPropertyNames22_ES6.types new file mode 100644 index 00000000000..b65f276881f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES6.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts === +class C { +>C : C + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [this.bar()]() { } } : {} + + [this.bar()]() { } +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames23.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt similarity index 71% rename from tests/baselines/reference/computedPropertyNames23.errors.txt rename to tests/baselines/reference/computedPropertyNames23_ES5.errors.txt index 0846ba4d6c6..ba827b91375 100644 --- a/tests/baselines/reference/computedPropertyNames23.errors.txt +++ b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js new file mode 100644 index 00000000000..7b5a5a101a5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames23_ES5.ts] +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames23_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[(_a = {}, _a[this.bar()] = + 1, + _a)[0]] = function () { }; + return C; +})(); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt new file mode 100644 index 00000000000..0af5504f22a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames23.js b/tests/baselines/reference/computedPropertyNames23_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames23.js rename to tests/baselines/reference/computedPropertyNames23_ES6.js index bd94501b577..ad3e35dbb25 100644 --- a/tests/baselines/reference/computedPropertyNames23.js +++ b/tests/baselines/reference/computedPropertyNames23_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames23.ts] +//// [computedPropertyNames23_ES6.ts] class C { bar() { return 0; @@ -8,7 +8,7 @@ class C { ]() { } } -//// [computedPropertyNames23.js] +//// [computedPropertyNames23_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames24.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt similarity index 77% rename from tests/baselines/reference/computedPropertyNames24.errors.txt rename to tests/baselines/reference/computedPropertyNames24_ES5.errors.txt index 938fb64b82e..a1290e06956 100644 --- a/tests/baselines/reference/computedPropertyNames24.errors.txt +++ b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames24.js b/tests/baselines/reference/computedPropertyNames24_ES5.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames24.js rename to tests/baselines/reference/computedPropertyNames24_ES5.js index 389743497a9..5b9fcbca992 100644 --- a/tests/baselines/reference/computedPropertyNames24.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames24.ts] +//// [computedPropertyNames24_ES5.ts] class Base { bar() { return 0; @@ -10,7 +10,7 @@ class C extends Base { [super.bar()]() { } } -//// [computedPropertyNames24.js] +//// [computedPropertyNames24_ES5.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; } diff --git a/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt new file mode 100644 index 00000000000..cab0ba6a85c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24_ES6.js b/tests/baselines/reference/computedPropertyNames24_ES6.js new file mode 100644 index 00000000000..58eb07cfb8d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES6.js @@ -0,0 +1,37 @@ +//// [computedPropertyNames24_ES6.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} + +//// [computedPropertyNames24_ES6.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 Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[super.bar.call(this)] = function () { }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js new file mode 100644 index 00000000000..bd2212b72b3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -0,0 +1,43 @@ +//// [computedPropertyNames25_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames25_ES5.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 Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25.types b/tests/baselines/reference/computedPropertyNames25_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames25.types rename to tests/baselines/reference/computedPropertyNames25_ES5.types index d8567dc86ad..6f34ce35b44 100644 --- a/tests/baselines/reference/computedPropertyNames25.types +++ b/tests/baselines/reference/computedPropertyNames25_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames25.js b/tests/baselines/reference/computedPropertyNames25_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames25.js rename to tests/baselines/reference/computedPropertyNames25_ES6.js index 8252fdce7f2..020582c9497 100644 --- a/tests/baselines/reference/computedPropertyNames25.js +++ b/tests/baselines/reference/computedPropertyNames25_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames25.ts] +//// [computedPropertyNames25_ES6.ts] class Base { bar() { return 0; @@ -13,7 +13,7 @@ class C extends Base { } } -//// [computedPropertyNames25.js] +//// [computedPropertyNames25_ES6.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; } diff --git a/tests/baselines/reference/computedPropertyNames25_ES6.types b/tests/baselines/reference/computedPropertyNames25_ES6.types new file mode 100644 index 00000000000..c008a6173cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES6.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + var obj = { +>obj : {} +>{ [super.bar()]() { } } : {} + + [super.bar()]() { } +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames26.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNames26.errors.txt rename to tests/baselines/reference/computedPropertyNames26_ES5.errors.txt index bbe51c6a0c8..77408f0a9f8 100644 --- a/tests/baselines/reference/computedPropertyNames26.errors.txt +++ b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js new file mode 100644 index 00000000000..5df2f6dc1b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames26_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames26_ES5.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 Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[(_a = {}, _a[super.bar.call(this)] = + 1, + _a)[0]] = function () { }; + return C; +})(Base); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt new file mode 100644 index 00000000000..d7e2b5ce7c5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames26.js b/tests/baselines/reference/computedPropertyNames26_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames26.js rename to tests/baselines/reference/computedPropertyNames26_ES6.js index c19137ce32b..dadc6a29e80 100644 --- a/tests/baselines/reference/computedPropertyNames26.js +++ b/tests/baselines/reference/computedPropertyNames26_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames26.ts] +//// [computedPropertyNames26_ES6.ts] class Base { bar() { return 0; @@ -12,7 +12,7 @@ class C extends Base { ]() { } } -//// [computedPropertyNames26.js] +//// [computedPropertyNames26_ES6.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; } diff --git a/tests/baselines/reference/computedPropertyNames27.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames27.errors.txt rename to tests/baselines/reference/computedPropertyNames27_ES5.errors.txt index c2872197363..1fbc7b37543 100644 --- a/tests/baselines/reference/computedPropertyNames27.errors.txt +++ b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames27.js b/tests/baselines/reference/computedPropertyNames27_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames27.js rename to tests/baselines/reference/computedPropertyNames27_ES5.js index 1cae552689b..df1fed09724 100644 --- a/tests/baselines/reference/computedPropertyNames27.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames27.ts] +//// [computedPropertyNames27_ES5.ts] class Base { } class C extends Base { [(super(), "prop")]() { } } -//// [computedPropertyNames27.js] +//// [computedPropertyNames27_ES5.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; } diff --git a/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt new file mode 100644 index 00000000000..edf84201647 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts (1 errors) ==== + class Base { + } + class C extends Base { + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27_ES6.js b/tests/baselines/reference/computedPropertyNames27_ES6.js new file mode 100644 index 00000000000..a78f13cda20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES6.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames27_ES6.ts] +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} + +//// [computedPropertyNames27_ES6.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 Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype[(_super.call(this), "prop")] = function () { }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js new file mode 100644 index 00000000000..7e548d4d6d3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -0,0 +1,34 @@ +//// [computedPropertyNames28_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} + +//// [computedPropertyNames28_ES5.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 Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); + var _a; + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28.types b/tests/baselines/reference/computedPropertyNames28_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames28.types rename to tests/baselines/reference/computedPropertyNames28_ES5.types index 2adf52f8c5f..278576ab1ca 100644 --- a/tests/baselines/reference/computedPropertyNames28.types +++ b/tests/baselines/reference/computedPropertyNames28_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts === class Base { >Base : Base } diff --git a/tests/baselines/reference/computedPropertyNames28.js b/tests/baselines/reference/computedPropertyNames28_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames28.js rename to tests/baselines/reference/computedPropertyNames28_ES6.js index 0a3985a640c..5656d96de87 100644 --- a/tests/baselines/reference/computedPropertyNames28.js +++ b/tests/baselines/reference/computedPropertyNames28_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames28.ts] +//// [computedPropertyNames28_ES6.ts] class Base { } class C extends Base { @@ -10,7 +10,7 @@ class C extends Base { } } -//// [computedPropertyNames28.js] +//// [computedPropertyNames28_ES6.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; } diff --git a/tests/baselines/reference/computedPropertyNames28_ES6.types b/tests/baselines/reference/computedPropertyNames28_ES6.types new file mode 100644 index 00000000000..842cdbd32e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES6.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts === +class Base { +>Base : Base +} +class C extends Base { +>C : C +>Base : Base + + constructor() { + super(); +>super() : void +>super : typeof Base + + var obj = { +>obj : {} +>{ [(super(), "prop")]() { } } : {} + + [(super(), "prop")]() { } +>(super(), "prop") : string +>super(), "prop" : string +>super() : void +>super : typeof Base + + }; + } +} diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js new file mode 100644 index 00000000000..27c7cd97988 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames29_ES5.ts] +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames29_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var _this = this; + (function () { + var obj = (_a = {}, _a[_this.bar()] = function () { }, + _a); + var _a; + }); + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames29.types b/tests/baselines/reference/computedPropertyNames29_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames29.types rename to tests/baselines/reference/computedPropertyNames29_ES5.types index ed4db5862e9..e0da4b10da8 100644 --- a/tests/baselines/reference/computedPropertyNames29.types +++ b/tests/baselines/reference/computedPropertyNames29_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames29.js b/tests/baselines/reference/computedPropertyNames29_ES6.js similarity index 81% rename from tests/baselines/reference/computedPropertyNames29.js rename to tests/baselines/reference/computedPropertyNames29_ES6.js index 50d050d888e..d01b6fd3b7f 100644 --- a/tests/baselines/reference/computedPropertyNames29.js +++ b/tests/baselines/reference/computedPropertyNames29_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames29.ts] +//// [computedPropertyNames29_ES6.ts] class C { bar() { () => { @@ -10,7 +10,7 @@ class C { } } -//// [computedPropertyNames29.js] +//// [computedPropertyNames29_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames29_ES6.types b/tests/baselines/reference/computedPropertyNames29_ES6.types new file mode 100644 index 00000000000..d520418749e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts === +class C { +>C : C + + bar() { +>bar : () => number + + () => { +>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [this.bar()]() { } // needs capture } : {} + + [this.bar()]() { } // needs capture +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt similarity index 72% rename from tests/baselines/reference/computedPropertyNames2.errors.txt rename to tests/baselines/reference/computedPropertyNames2_ES5.errors.txt index d0fd1de4576..2fbf68b4437 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2_ES5.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames2.js rename to tests/baselines/reference/computedPropertyNames2_ES5.js index 737ec08c207..581b581d87b 100644 --- a/tests/baselines/reference/computedPropertyNames2.js +++ b/tests/baselines/reference/computedPropertyNames2_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames2.ts] +//// [computedPropertyNames2_ES5.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -10,7 +10,7 @@ class C { static set [accessorName](v) { } } -//// [computedPropertyNames2.js] +//// [computedPropertyNames2_ES5.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt new file mode 100644 index 00000000000..3f18a8764b4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + set [accessorName](v) { } + static get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + static set [accessorName](v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.js b/tests/baselines/reference/computedPropertyNames2_ES6.js new file mode 100644 index 00000000000..b58b1a6f077 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES6.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames2_ES6.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} + +//// [computedPropertyNames2_ES6.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function () { }; + C[methodName] = function () { }; + Object.defineProperty(C.prototype, accessorName, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, accessorName, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames30.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNames30.errors.txt rename to tests/baselines/reference/computedPropertyNames30_ES5.errors.txt index f7b6411f867..1dfb605db33 100644 --- a/tests/baselines/reference/computedPropertyNames30.errors.txt +++ b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js new file mode 100644 index 00000000000..505b149f62d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -0,0 +1,41 @@ +//// [computedPropertyNames30_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} + +//// [computedPropertyNames30_ES5.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 Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + (function () { + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); + var _a; + }); + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt new file mode 100644 index 00000000000..dc8892fd326 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts (1 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + }; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30.js b/tests/baselines/reference/computedPropertyNames30_ES6.js similarity index 91% rename from tests/baselines/reference/computedPropertyNames30.js rename to tests/baselines/reference/computedPropertyNames30_ES6.js index ae2b24385f4..0c4f259fe48 100644 --- a/tests/baselines/reference/computedPropertyNames30.js +++ b/tests/baselines/reference/computedPropertyNames30_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames30.ts] +//// [computedPropertyNames30_ES6.ts] class Base { } class C extends Base { @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames30.js] +//// [computedPropertyNames30_ES6.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; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js new file mode 100644 index 00000000000..0c8cbac455f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames31_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames31_ES5.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 Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var _this = this; + (function () { + var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, + _a); + var _a; + }); + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31.types b/tests/baselines/reference/computedPropertyNames31_ES5.types similarity index 92% rename from tests/baselines/reference/computedPropertyNames31.types rename to tests/baselines/reference/computedPropertyNames31_ES5.types index 90e73bc3dcb..eb14b223ed3 100644 --- a/tests/baselines/reference/computedPropertyNames31.types +++ b/tests/baselines/reference/computedPropertyNames31_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames31.js b/tests/baselines/reference/computedPropertyNames31_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames31.js rename to tests/baselines/reference/computedPropertyNames31_ES6.js index 227f10e3bd4..0f7d72818fe 100644 --- a/tests/baselines/reference/computedPropertyNames31.js +++ b/tests/baselines/reference/computedPropertyNames31_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames31.ts] +//// [computedPropertyNames31_ES6.ts] class Base { bar() { return 0; @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames31.js] +//// [computedPropertyNames31_ES6.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; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES6.types b/tests/baselines/reference/computedPropertyNames31_ES6.types new file mode 100644 index 00000000000..9d835a1fac1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES6.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + () => { +>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [super.bar()]() { } // needs capture } : {} + + [super.bar()]() { } // needs capture +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt similarity index 57% rename from tests/baselines/reference/computedPropertyNames32.errors.txt rename to tests/baselines/reference/computedPropertyNames32_ES5.errors.txt index e2f08c79fc9..8305a2c0758 100644 --- a/tests/baselines/reference/computedPropertyNames32.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (1 errors) ==== function foo() { return '' } class C { bar() { @@ -9,5 +9,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): } [foo()]() { } ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32_ES5.js similarity index 69% rename from tests/baselines/reference/computedPropertyNames32.js rename to tests/baselines/reference/computedPropertyNames32_ES5.js index 9bc723581ef..a0d8b066b5c 100644 --- a/tests/baselines/reference/computedPropertyNames32.js +++ b/tests/baselines/reference/computedPropertyNames32_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames32.ts] +//// [computedPropertyNames32_ES5.ts] function foo() { return '' } class C { bar() { @@ -7,10 +7,8 @@ class C { [foo()]() { } } -//// [computedPropertyNames32.js] -function foo() { - return ''; -} +//// [computedPropertyNames32_ES5.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt new file mode 100644 index 00000000000..36763fa6405 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts (1 errors) ==== + function foo() { return '' } + class C { + bar() { + return 0; + } + [foo()]() { } + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.js b/tests/baselines/reference/computedPropertyNames32_ES6.js new file mode 100644 index 00000000000..69d2a40edce --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES6.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames32_ES6.ts] +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} + +//// [computedPropertyNames32_ES6.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[foo()] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js new file mode 100644 index 00000000000..84df68fcc10 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames33_ES5.ts] +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames33_ES5.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = (_a = {}, _a[foo()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33.types b/tests/baselines/reference/computedPropertyNames33_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames33.types rename to tests/baselines/reference/computedPropertyNames33_ES5.types index 8cbe8e93ef2..a0d99ec8615 100644 --- a/tests/baselines/reference/computedPropertyNames33.types +++ b/tests/baselines/reference/computedPropertyNames33_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts === function foo() { return '' } >foo : () => string >T : T diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames33.js rename to tests/baselines/reference/computedPropertyNames33_ES6.js index 43ceeb2b2fb..768af6fd403 100644 --- a/tests/baselines/reference/computedPropertyNames33.js +++ b/tests/baselines/reference/computedPropertyNames33_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames33.ts] +//// [computedPropertyNames33_ES6.ts] function foo() { return '' } class C { bar() { @@ -9,10 +9,8 @@ class C { } } -//// [computedPropertyNames33.js] -function foo() { - return ''; -} +//// [computedPropertyNames33_ES6.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames33_ES6.types b/tests/baselines/reference/computedPropertyNames33_ES6.types new file mode 100644 index 00000000000..331bd2b3e09 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts === +function foo() { return '' } +>foo : () => string +>T : T + +class C { +>C : C +>T : T + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [foo()]() { } } : {} + + [foo()]() { } +>foo() : string +>foo : () => string +>T : T + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames34.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames34.errors.txt rename to tests/baselines/reference/computedPropertyNames34_ES5.errors.txt index c6d4a9aa4eb..30fa6642cbc 100644 --- a/tests/baselines/reference/computedPropertyNames34.errors.txt +++ b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts(5,18): error TS2302: Static members cannot reference class type parameters. +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (1 errors) ==== function foo() { return '' } class C { static bar() { diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js new file mode 100644 index 00000000000..9e1de33be7c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames34_ES5.ts] +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames34_ES5.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.bar = function () { + var obj = (_a = {}, _a[foo()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt new file mode 100644 index 00000000000..b7f3e37b124 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts(5,18): error TS2302: Static members cannot reference class type parameters. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts (1 errors) ==== + function foo() { return '' } + class C { + static bar() { + var obj = { + [foo()]() { } + ~ +!!! error TS2302: Static members cannot reference class type parameters. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34_ES6.js similarity index 72% rename from tests/baselines/reference/computedPropertyNames34.js rename to tests/baselines/reference/computedPropertyNames34_ES6.js index 12892eefe4f..09cccb0e7f4 100644 --- a/tests/baselines/reference/computedPropertyNames34.js +++ b/tests/baselines/reference/computedPropertyNames34_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames34.ts] +//// [computedPropertyNames34_ES6.ts] function foo() { return '' } class C { static bar() { @@ -9,10 +9,8 @@ class C { } } -//// [computedPropertyNames34.js] -function foo() { - return ''; -} +//// [computedPropertyNames34_ES6.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt deleted file mode 100644 index 01c4614e84a..00000000000 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== - function foo() { return '' } - interface I { - bar(): string; - [foo()](): void; - ~~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. - ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35.js b/tests/baselines/reference/computedPropertyNames35.js deleted file mode 100644 index 5a731fd8bda..00000000000 --- a/tests/baselines/reference/computedPropertyNames35.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [computedPropertyNames35.ts] -function foo() { return '' } -interface I { - bar(): string; - [foo()](): void; -} - -//// [computedPropertyNames35.js] -function foo() { - return ''; -} diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt new file mode 100644 index 00000000000..aaf56487028 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.js b/tests/baselines/reference/computedPropertyNames35_ES5.js new file mode 100644 index 00000000000..0804c946f1f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames35_ES5.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES5.js] +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt new file mode 100644 index 00000000000..c8ef5efac31 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.js b/tests/baselines/reference/computedPropertyNames35_ES6.js new file mode 100644 index 00000000000..2d3f4088315 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames35_ES6.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES6.js] +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames36.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames36.errors.txt rename to tests/baselines/reference/computedPropertyNames36_ES5.errors.txt index a473ebfba8e..6c38043c8e0 100644 --- a/tests/baselines/reference/computedPropertyNames36.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames36.js rename to tests/baselines/reference/computedPropertyNames36_ES5.js index 5df5c503911..5519a6d284c 100644 --- a/tests/baselines/reference/computedPropertyNames36.js +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames36.ts] +//// [computedPropertyNames36_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames36.js] +//// [computedPropertyNames36_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt new file mode 100644 index 00000000000..8127898fde4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.js b/tests/baselines/reference/computedPropertyNames36_ES6.js new file mode 100644 index 00000000000..09bab9a2630 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames36_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames36_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames37.js rename to tests/baselines/reference/computedPropertyNames37_ES5.js index 540dfa27e1e..54a7243f3fa 100644 --- a/tests/baselines/reference/computedPropertyNames37.js +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames37.ts] +//// [computedPropertyNames37_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames37.js] +//// [computedPropertyNames37_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames37.types b/tests/baselines/reference/computedPropertyNames37_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames37.types rename to tests/baselines/reference/computedPropertyNames37_ES5.types index b50e0590b79..a12324003bf 100644 --- a/tests/baselines/reference/computedPropertyNames37.types +++ b/tests/baselines/reference/computedPropertyNames37_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.js b/tests/baselines/reference/computedPropertyNames37_ES6.js new file mode 100644 index 00000000000..c824f15ef54 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames37_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames37_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.types b/tests/baselines/reference/computedPropertyNames37_ES6.types new file mode 100644 index 00000000000..288685f0e02 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES6.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: number]: Foo2; +>s : number +>Foo2 : Foo2 + + // Computed properties + get ["get1"]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo + + set ["set1"](p: Foo2) { } +>p : Foo2 +>Foo2 : Foo2 +} diff --git a/tests/baselines/reference/computedPropertyNames38.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames38.errors.txt rename to tests/baselines/reference/computedPropertyNames38_ES5.errors.txt index fc5f31f1329..acc08ee5527 100644 --- a/tests/baselines/reference/computedPropertyNames38.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames38.js rename to tests/baselines/reference/computedPropertyNames38_ES5.js index fbbbe83ddc6..49af4d00d51 100644 --- a/tests/baselines/reference/computedPropertyNames38.js +++ b/tests/baselines/reference/computedPropertyNames38_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames38.ts] +//// [computedPropertyNames38_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames38.js] +//// [computedPropertyNames38_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt new file mode 100644 index 00000000000..0a95b37f9a9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.js b/tests/baselines/reference/computedPropertyNames38_ES6.js new file mode 100644 index 00000000000..9dde7da09de --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames38_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames38_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames39.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames39.errors.txt rename to tests/baselines/reference/computedPropertyNames39_ES5.errors.txt index 573ef726241..669314676f9 100644 --- a/tests/baselines/reference/computedPropertyNames39.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames39.js rename to tests/baselines/reference/computedPropertyNames39_ES5.js index 1d367c8d856..1b8d3aab2ff 100644 --- a/tests/baselines/reference/computedPropertyNames39.js +++ b/tests/baselines/reference/computedPropertyNames39_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames39.ts] +//// [computedPropertyNames39_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames39.js] +//// [computedPropertyNames39_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt new file mode 100644 index 00000000000..38f432162d5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.js b/tests/baselines/reference/computedPropertyNames39_ES6.js new file mode 100644 index 00000000000..d0d21f201bb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames39_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames39_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames3.errors.txt rename to tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index 080bff1ab9a..82e4b71b33b 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (6 errors) ==== var id; class C { [0 + 1]() { } static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [id.toString()](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.js b/tests/baselines/reference/computedPropertyNames3_ES5.js new file mode 100644 index 00000000000..f5a063f91e6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.js @@ -0,0 +1,40 @@ +//// [computedPropertyNames3_ES5.ts] +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} + +//// [computedPropertyNames3_ES5.js] +var id; +var C = (function () { + function C() { + } + C.prototype[0 + 1] = function () { }; + C[function () { }] = function () { }; + Object.defineProperty(C.prototype, delete id, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [0, 1], { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, id.toString(), { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt new file mode 100644 index 00000000000..3df6d6d9744 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (6 errors) ==== + var id; + class C { + [0 + 1]() { } + static [() => { }]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [delete id]() { } + ~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [[0, 1]](v) { } + ~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static get [""]() { } + ~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static set [id.toString()](v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames3.js rename to tests/baselines/reference/computedPropertyNames3_ES6.js index 19f938e32ad..672d90d7b45 100644 --- a/tests/baselines/reference/computedPropertyNames3.js +++ b/tests/baselines/reference/computedPropertyNames3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames3.ts] +//// [computedPropertyNames3_ES6.ts] var id; class C { [0 + 1]() { } @@ -9,7 +9,7 @@ class C { static set [id.toString()](v) { } } -//// [computedPropertyNames3.js] +//// [computedPropertyNames3_ES6.js] var id; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames40.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt similarity index 73% rename from tests/baselines/reference/computedPropertyNames40.errors.txt rename to tests/baselines/reference/computedPropertyNames40_ES5.errors.txt index c5bda4ed999..e8ceef0d581 100644 --- a/tests/baselines/reference/computedPropertyNames40.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40_ES5.js similarity index 64% rename from tests/baselines/reference/computedPropertyNames40.js rename to tests/baselines/reference/computedPropertyNames40_ES5.js index 1c9b5d3bfa8..e8063762026 100644 --- a/tests/baselines/reference/computedPropertyNames40.js +++ b/tests/baselines/reference/computedPropertyNames40_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames40.ts] +//// [computedPropertyNames40_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { [""]() { return new Foo2 } } -//// [computedPropertyNames40.js] +//// [computedPropertyNames40_ES5.js] var Foo = (function () { function Foo() { } @@ -25,11 +25,7 @@ var C = (function () { function C() { } // Computed properties - C.prototype[""] = function () { - return new Foo; - }; - C.prototype[""] = function () { - return new Foo2; - }; + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt new file mode 100644 index 00000000000..1a032a87b2b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + [""]() { return new Foo2 } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.js b/tests/baselines/reference/computedPropertyNames40_ES6.js new file mode 100644 index 00000000000..208be7760a9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES6.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames40_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} + +//// [computedPropertyNames40_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41_ES5.js similarity index 72% rename from tests/baselines/reference/computedPropertyNames41.js rename to tests/baselines/reference/computedPropertyNames41_ES5.js index 34fe2d33df7..7d7c390bf3e 100644 --- a/tests/baselines/reference/computedPropertyNames41.js +++ b/tests/baselines/reference/computedPropertyNames41_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames41.ts] +//// [computedPropertyNames41_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { static [""]() { return new Foo } } -//// [computedPropertyNames41.js] +//// [computedPropertyNames41_ES5.js] var Foo = (function () { function Foo() { } @@ -24,8 +24,6 @@ var C = (function () { function C() { } // Computed properties - C[""] = function () { - return new Foo; - }; + C[""] = function () { return new Foo; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames41.types b/tests/baselines/reference/computedPropertyNames41_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames41.types rename to tests/baselines/reference/computedPropertyNames41_ES5.types index 1fb0af282ca..aac087ee958 100644 --- a/tests/baselines/reference/computedPropertyNames41.types +++ b/tests/baselines/reference/computedPropertyNames41_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.js b/tests/baselines/reference/computedPropertyNames41_ES6.js new file mode 100644 index 00000000000..050079017c0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNames41_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} + +//// [computedPropertyNames41_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C[""] = function () { return new Foo; }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.types b/tests/baselines/reference/computedPropertyNames41_ES6.types new file mode 100644 index 00000000000..ffb3387d161 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: string]: () => Foo2; +>s : string +>Foo2 : Foo2 + + // Computed properties + static [""]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo +} diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt similarity index 53% rename from tests/baselines/reference/computedPropertyNames42.errors.txt rename to tests/baselines/reference/computedPropertyNames42_ES5.errors.txt index 059b3117a43..94153c47aa5 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): // Computed properties [""]: Foo; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42.js b/tests/baselines/reference/computedPropertyNames42_ES5.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames42.js rename to tests/baselines/reference/computedPropertyNames42_ES5.js index c9f24a1c708..f4fda8fc829 100644 --- a/tests/baselines/reference/computedPropertyNames42.js +++ b/tests/baselines/reference/computedPropertyNames42_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames42.ts] +//// [computedPropertyNames42_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { [""]: Foo; } -//// [computedPropertyNames42.js] +//// [computedPropertyNames42_ES5.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt new file mode 100644 index 00000000000..1f4e27d6e81 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + ~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.js b/tests/baselines/reference/computedPropertyNames42_ES6.js new file mode 100644 index 00000000000..8538088f450 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES6.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames42_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} + +//// [computedPropertyNames42_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames43.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt similarity index 75% rename from tests/baselines/reference/computedPropertyNames43.errors.txt rename to tests/baselines/reference/computedPropertyNames43_ES5.errors.txt index d38dcca9216..62c239a5a54 100644 --- a/tests/baselines/reference/computedPropertyNames43.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames43.js rename to tests/baselines/reference/computedPropertyNames43_ES5.js index 0e7c3b5dac1..b689f02ee98 100644 --- a/tests/baselines/reference/computedPropertyNames43.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames43.ts] +//// [computedPropertyNames43_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames43.js] +//// [computedPropertyNames43_ES5.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; } @@ -41,9 +41,7 @@ var D = (function (_super) { } Object.defineProperty(D.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt new file mode 100644 index 00000000000..0efe0ba39ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + } + + class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.js b/tests/baselines/reference/computedPropertyNames43_ES6.js new file mode 100644 index 00000000000..4b64a4c803b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES6.js @@ -0,0 +1,54 @@ +//// [computedPropertyNames43_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames43_ES6.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 Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "get1", { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames44.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt similarity index 70% rename from tests/baselines/reference/computedPropertyNames44.errors.txt rename to tests/baselines/reference/computedPropertyNames44_ES5.errors.txt index bf1de6687e1..35ab422e093 100644 --- a/tests/baselines/reference/computedPropertyNames44.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44_ES5.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames44.js rename to tests/baselines/reference/computedPropertyNames44_ES5.js index 37466dad602..32d3505e252 100644 --- a/tests/baselines/reference/computedPropertyNames44.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames44.ts] +//// [computedPropertyNames44_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -11,7 +11,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames44.js] +//// [computedPropertyNames44_ES5.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; } @@ -32,9 +32,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt new file mode 100644 index 00000000000..5170746395c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } + + class D extends C { + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.js b/tests/baselines/reference/computedPropertyNames44_ES6.js new file mode 100644 index 00000000000..9cf11f3b337 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames44_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames44_ES6.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 Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames45.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt similarity index 76% rename from tests/baselines/reference/computedPropertyNames45.errors.txt rename to tests/baselines/reference/computedPropertyNames45_ES5.errors.txt index 7ad29340b25..83855c5f0b7 100644 --- a/tests/baselines/reference/computedPropertyNames45.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames45.js rename to tests/baselines/reference/computedPropertyNames45_ES5.js index 69e0df349ca..3d924b00b73 100644 --- a/tests/baselines/reference/computedPropertyNames45.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames45.ts] +//// [computedPropertyNames45_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames45.js] +//// [computedPropertyNames45_ES5.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; } @@ -33,9 +33,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt new file mode 100644 index 00000000000..963e01ed86b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + get ["get1"]() { return new Foo } + } + + class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.js b/tests/baselines/reference/computedPropertyNames45_ES6.js new file mode 100644 index 00000000000..2e7992fe260 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES6.js @@ -0,0 +1,53 @@ +//// [computedPropertyNames45_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames45_ES6.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 Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames46.js b/tests/baselines/reference/computedPropertyNames46.js deleted file mode 100644 index e2ef2b2e729..00000000000 --- a/tests/baselines/reference/computedPropertyNames46.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames46.ts] -var o = { - ["" || 0]: 0 -}; - -//// [computedPropertyNames46.js] -var o = { - ["" || 0]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js new file mode 100644 index 00000000000..3e4329b8a20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames46_ES5.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES5.js] +var o = (_a = {}, _a["" || 0] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames46.types b/tests/baselines/reference/computedPropertyNames46_ES5.types similarity index 83% rename from tests/baselines/reference/computedPropertyNames46.types rename to tests/baselines/reference/computedPropertyNames46_ES5.types index cf8585828f4..bdc2f2cf644 100644 --- a/tests/baselines/reference/computedPropertyNames46.types +++ b/tests/baselines/reference/computedPropertyNames46_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts === var o = { >o : {} >{ ["" || 0]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.js b/tests/baselines/reference/computedPropertyNames46_ES6.js new file mode 100644 index 00000000000..421c301d67a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46_ES6.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES6.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.types b/tests/baselines/reference/computedPropertyNames46_ES6.types new file mode 100644 index 00000000000..7abb10f1ba5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts === +var o = { +>o : {} +>{ ["" || 0]: 0} : {} + + ["" || 0]: 0 +>"" || 0 : string | number + +}; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js new file mode 100644 index 00000000000..7874a25976f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames47_ES5.ts] +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; + +//// [computedPropertyNames47_ES5.js] +var E1; +(function (E1) { + E1[E1["x"] = 0] = "x"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["x"] = 0] = "x"; +})(E2 || (E2 = {})); +var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames47.types b/tests/baselines/reference/computedPropertyNames47_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames47.types rename to tests/baselines/reference/computedPropertyNames47_ES5.types index 20d7ab1d31e..c79f2b20946 100644 --- a/tests/baselines/reference/computedPropertyNames47.types +++ b/tests/baselines/reference/computedPropertyNames47_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts === enum E1 { x } >E1 : E1 >x : E1 diff --git a/tests/baselines/reference/computedPropertyNames47.js b/tests/baselines/reference/computedPropertyNames47_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames47.js rename to tests/baselines/reference/computedPropertyNames47_ES6.js index 88e28e54239..e104d33e7d3 100644 --- a/tests/baselines/reference/computedPropertyNames47.js +++ b/tests/baselines/reference/computedPropertyNames47_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames47.ts] +//// [computedPropertyNames47_ES6.ts] enum E1 { x } enum E2 { x } var o = { [E1.x || E2.x]: 0 }; -//// [computedPropertyNames47.js] +//// [computedPropertyNames47_ES6.js] var E1; (function (E1) { E1[E1["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames47_ES6.types b/tests/baselines/reference/computedPropertyNames47_ES6.types new file mode 100644 index 00000000000..840d77754cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES6.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts === +enum E1 { x } +>E1 : E1 +>x : E1 + +enum E2 { x } +>E2 : E2 +>x : E2 + +var o = { +>o : {} +>{ [E1.x || E2.x]: 0} : {} + + [E1.x || E2.x]: 0 +>E1.x || E2.x : E1 | E2 +>E1.x : E1 +>E1 : typeof E1 +>x : E1 +>E2.x : E2 +>E2 : typeof E2 +>x : E2 + +}; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js new file mode 100644 index 00000000000..f3f9941aeae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames48_ES5.ts] +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) + +//// [computedPropertyNames48_ES5.js] +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +var a; +extractIndexer((_a = {}, _a[a] = +"", +_a)); // Should return string +extractIndexer((_b = {}, _b[0 /* x */] = +"", +_b)); // Should return string +extractIndexer((_c = {}, _c["" || 0] = +"", +_c)); // Should return any (widened form of undefined) +var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames48.types b/tests/baselines/reference/computedPropertyNames48_ES5.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames48.types rename to tests/baselines/reference/computedPropertyNames48_ES5.types index 78755d5d5d7..3ff4c966e89 100644 --- a/tests/baselines/reference/computedPropertyNames48.types +++ b/tests/baselines/reference/computedPropertyNames48_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts === declare function extractIndexer(p: { [n: number]: T }): T; >extractIndexer : (p: { [n: number]: T; }) => T >T : T diff --git a/tests/baselines/reference/computedPropertyNames48.js b/tests/baselines/reference/computedPropertyNames48_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames48.js rename to tests/baselines/reference/computedPropertyNames48_ES6.js index 9f8e0442ebe..27821647565 100644 --- a/tests/baselines/reference/computedPropertyNames48.js +++ b/tests/baselines/reference/computedPropertyNames48_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames48.ts] +//// [computedPropertyNames48_ES6.ts] declare function extractIndexer(p: { [n: number]: T }): T; enum E { x } @@ -17,7 +17,7 @@ extractIndexer({ ["" || 0]: "" }); // Should return any (widened form of undefined) -//// [computedPropertyNames48.js] +//// [computedPropertyNames48_ES6.js] var E; (function (E) { E[E["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames48_ES6.types b/tests/baselines/reference/computedPropertyNames48_ES6.types new file mode 100644 index 00000000000..e10f078d11f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES6.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts === +declare function extractIndexer(p: { [n: number]: T }): T; +>extractIndexer : (p: { [n: number]: T; }) => T +>T : T +>p : { [n: number]: T; } +>n : number +>T : T +>T : T + +enum E { x } +>E : E +>x : E + +var a: any; +>a : any + +extractIndexer({ +>extractIndexer({ [a]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [a]: ""} : { [x: number]: string; } + + [a]: "" +>a : any + +}); // Should return string + +extractIndexer({ +>extractIndexer({ [E.x]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [E.x]: ""} : { [x: number]: string; } + + [E.x]: "" +>E.x : E +>E : typeof E +>x : E + +}); // Should return string + +extractIndexer({ +>extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer : (p: { [n: number]: T; }) => T +>{ ["" || 0]: ""} : { [x: number]: undefined; } + + ["" || 0]: "" +>"" || 0 : string | number + +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt new file mode 100644 index 00000000000..cb4034d3bad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js new file mode 100644 index 00000000000..a64d9431a9a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -0,0 +1,46 @@ +//// [computedPropertyNames49_ES5.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES5.js] +var x = (_a = { + p1: 10 +}, _a.p1 = +10, _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a.p2 = +20, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt new file mode 100644 index 00000000000..276f7fb17be --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(10,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.js b/tests/baselines/reference/computedPropertyNames49_ES6.js new file mode 100644 index 00000000000..d1b5fe26e9d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames49_ES6.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES6.js] +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js new file mode 100644 index 00000000000..255b14eb970 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -0,0 +1,36 @@ +//// [computedPropertyNames4_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} + +//// [computedPropertyNames4_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = +0, _a[n] = +n, _a[s + s] = +1, _a[s + n] = +2, _a[+s] = +s, _a[""] = +0, _a[0] = +0, _a[a] = +1, _a[true] = +0, _a["hello bye"] = +0, _a["hello " + a + " bye"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames4.types b/tests/baselines/reference/computedPropertyNames4_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames4.types rename to tests/baselines/reference/computedPropertyNames4_ES5.types index 968cc86b598..7c26cae6444 100644 --- a/tests/baselines/reference/computedPropertyNames4.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames4.js b/tests/baselines/reference/computedPropertyNames4_ES6.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames4.js rename to tests/baselines/reference/computedPropertyNames4_ES6.js index 5acb6d957da..55143ca9e10 100644 --- a/tests/baselines/reference/computedPropertyNames4.js +++ b/tests/baselines/reference/computedPropertyNames4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames4.ts] +//// [computedPropertyNames4_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]: 0 } -//// [computedPropertyNames4.js] +//// [computedPropertyNames4_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types new file mode 100644 index 00000000000..973dfbec3a5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {} + + [s]: 0, +>s : string + + [n]: n, +>n : number +>n : number + + [s + s]: 1, +>s + s : string +>s : string +>s : string + + [s + n]: 2, +>s + n : string +>s : string +>n : number + + [+s]: s, +>+s : number +>s : string +>s : string + + [""]: 0, + [0]: 0, + [a]: 1, +>a : any + + [true]: 0, +>true : any + + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt new file mode 100644 index 00000000000..63832dbed0c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js new file mode 100644 index 00000000000..a0703eeac05 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -0,0 +1,51 @@ +//// [computedPropertyNames50_ES5.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES5.js] +var x = (_a = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + } +}, _a.p1 = +10, _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; + }, enumerable: true, configurable: true }), _a.p2 = +20, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt new file mode 100644 index 00000000000..db61444a697 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(12,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.js b/tests/baselines/reference/computedPropertyNames50_ES6.js new file mode 100644 index 00000000000..24b0c8af1f5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames50_ES6.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES6.js] +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt similarity index 53% rename from tests/baselines/reference/computedPropertyNames5.errors.txt rename to tests/baselines/reference/computedPropertyNames5_ES5.errors.txt index 2b8cf5503b8..f6d06758f23 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (6 errors) ==== var b: boolean; var v = { [b]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [true]: 1, ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [{}]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]: undefined, ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [null]: null ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js new file mode 100644 index 00000000000..722c0f3a74d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames5_ES5.ts] +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} + +//// [computedPropertyNames5_ES5.js] +var b; +var v = (_a = {}, _a[b] = +0, _a[true] = +1, _a[[]] = +0, _a[{}] = +0, _a[undefined] = +undefined, _a[null] = +null, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt new file mode 100644 index 00000000000..04675431c5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts (6 errors) ==== + var b: boolean; + var v = { + [b]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [true]: 1, + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [[]]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [{}]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [undefined]: undefined, + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [null]: null + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.js b/tests/baselines/reference/computedPropertyNames5_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames5.js rename to tests/baselines/reference/computedPropertyNames5_ES6.js index d0158da6400..0ac309b8ed0 100644 --- a/tests/baselines/reference/computedPropertyNames5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames5.ts] +//// [computedPropertyNames5_ES6.ts] var b: boolean; var v = { [b]: 0, @@ -9,7 +9,7 @@ var v = { [null]: null } -//// [computedPropertyNames5.js] +//// [computedPropertyNames5_ES6.js] var b; var v = { [b]: 0, diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames6.errors.txt rename to tests/baselines/reference/computedPropertyNames6_ES5.errors.txt index 57798e9f6b6..1780af80d87 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e [p1]: 0, [p2]: 1, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]: 2 ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js new file mode 100644 index 00000000000..4e3ed1b2e9f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames6_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} + +//// [computedPropertyNames6_ES5.js] +var p1; +var p2; +var p3; +var v = (_a = {}, _a[p1] = +0, _a[p2] = +1, _a[p3] = +2, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt new file mode 100644 index 00000000000..7f73ea97fa7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + var v = { + [p1]: 0, + [p2]: 1, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [p3]: 2 + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.js b/tests/baselines/reference/computedPropertyNames6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames6.js rename to tests/baselines/reference/computedPropertyNames6_ES6.js index e131ef4417f..1efc6fe004c 100644 --- a/tests/baselines/reference/computedPropertyNames6.js +++ b/tests/baselines/reference/computedPropertyNames6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames6.ts] +//// [computedPropertyNames6_ES6.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ var v = { [p3]: 2 } -//// [computedPropertyNames6.js] +//// [computedPropertyNames6_ES6.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js new file mode 100644 index 00000000000..3e1bcc1151c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNames7_ES5.ts] +enum E { + member +} +var v = { + [E.member]: 0 +} + +//// [computedPropertyNames7_ES5.js] +var E; +(function (E) { + E[E["member"] = 0] = "member"; +})(E || (E = {})); +var v = (_a = {}, _a[0 /* member */] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames7.types b/tests/baselines/reference/computedPropertyNames7_ES5.types similarity index 85% rename from tests/baselines/reference/computedPropertyNames7.types rename to tests/baselines/reference/computedPropertyNames7_ES5.types index 0b5f26614fc..209e07769c0 100644 --- a/tests/baselines/reference/computedPropertyNames7.types +++ b/tests/baselines/reference/computedPropertyNames7_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts === enum E { >E : E diff --git a/tests/baselines/reference/computedPropertyNames7.js b/tests/baselines/reference/computedPropertyNames7_ES6.js similarity index 66% rename from tests/baselines/reference/computedPropertyNames7.js rename to tests/baselines/reference/computedPropertyNames7_ES6.js index 075b149522b..5714fb747a6 100644 --- a/tests/baselines/reference/computedPropertyNames7.js +++ b/tests/baselines/reference/computedPropertyNames7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames7.ts] +//// [computedPropertyNames7_ES6.ts] enum E { member } @@ -6,7 +6,7 @@ var v = { [E.member]: 0 } -//// [computedPropertyNames7.js] +//// [computedPropertyNames7_ES6.js] var E; (function (E) { E[E["member"] = 0] = "member"; diff --git a/tests/baselines/reference/computedPropertyNames7_ES6.types b/tests/baselines/reference/computedPropertyNames7_ES6.types new file mode 100644 index 00000000000..371176acc16 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES6.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts === +enum E { +>E : E + + member +>member : E +} +var v = { +>v : {} +>{ [E.member]: 0} : {} + + [E.member]: 0 +>E.member : E +>E : typeof E +>member : E +} diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames8.errors.txt rename to tests/baselines/reference/computedPropertyNames8_ES5.errors.txt index 515af1f4fc4..9fbd14a92fb 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (2 errors) ==== function f() { var t: T; var u: U; var v = { [t]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [u]: 1 ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js new file mode 100644 index 00000000000..4db9ed2ec13 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames8_ES5.ts] +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} + +//// [computedPropertyNames8_ES5.js] +function f() { + var t; + var u; + var v = (_a = {}, _a[t] = + 0, _a[u] = + 1, + _a); + var _a; +} diff --git a/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt new file mode 100644 index 00000000000..22674a3992c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts (2 errors) ==== + function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [u]: 1 + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.js b/tests/baselines/reference/computedPropertyNames8_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames8.js rename to tests/baselines/reference/computedPropertyNames8_ES6.js index 44a21d79a1c..2290de66c71 100644 --- a/tests/baselines/reference/computedPropertyNames8.js +++ b/tests/baselines/reference/computedPropertyNames8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames8.ts] +//// [computedPropertyNames8_ES6.ts] function f() { var t: T; var u: U; @@ -8,7 +8,7 @@ function f() { }; } -//// [computedPropertyNames8.js] +//// [computedPropertyNames8_ES6.js] function f() { var t; var u; diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt similarity index 68% rename from tests/baselines/reference/computedPropertyNames9.errors.txt rename to tests/baselines/reference/computedPropertyNames9_ES5.errors.txt index d87576f1f77..f58dfbc3166 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (1 errors) ==== function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e [f(0)]: 0, [f(true)]: 0 ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js new file mode 100644 index 00000000000..a7c4a74d5ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames9_ES5.ts] +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} + +//// [computedPropertyNames9_ES5.js] +function f(x) { } +var v = (_a = {}, _a[f("")] = +0, _a[f(0)] = +0, _a[f(true)] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt new file mode 100644 index 00000000000..70dd526b85a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts (1 errors) ==== + function f(s: string): string; + function f(n: number): number; + function f(x: T): T; + function f(x): any { } + + var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.js b/tests/baselines/reference/computedPropertyNames9_ES6.js similarity index 74% rename from tests/baselines/reference/computedPropertyNames9.js rename to tests/baselines/reference/computedPropertyNames9_ES6.js index c2e89cd3133..b0e66c81cbd 100644 --- a/tests/baselines/reference/computedPropertyNames9.js +++ b/tests/baselines/reference/computedPropertyNames9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames9.ts] +//// [computedPropertyNames9_ES6.ts] function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -10,7 +10,7 @@ var v = { [f(true)]: 0 } -//// [computedPropertyNames9.js] +//// [computedPropertyNames9_ES6.js] function f(x) { } var v = { [f("")]: 0, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt index 5e9fbe7b45b..7fa95fe9426 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (1 errors) ==== interface I { [s: number]: boolean; } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js new file mode 100644 index 00000000000..5ea05124674 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType10_ES5.ts] +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType10_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt new file mode 100644 index 00000000000..116cd1a2531 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts (1 errors) ==== + interface I { + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType10.js rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js index 125a014852e..fa08b5db3d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType10.ts] +//// [computedPropertyNamesContextualType10_ES6.ts] interface I { [s: number]: boolean; } @@ -8,7 +8,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType10.js] +//// [computedPropertyNamesContextualType10_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js new file mode 100644 index 00000000000..a7994495411 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType1_ES5.ts] +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} + +//// [computedPropertyNamesContextualType1_ES5.js] +var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType1.types rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types index 1697542fba6..ad7ddc30567 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType1.js rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js index 82429be9c40..f23a1a19e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType1.ts] +//// [computedPropertyNamesContextualType1_ES6.ts] interface I { [s: string]: (x: string) => number; [s: number]: (x: any) => number; // Doesn't get hit @@ -9,10 +9,8 @@ var o: I = { ["" + 1]: y => y.length } -//// [computedPropertyNamesContextualType1.js] +//// [computedPropertyNamesContextualType1_ES6.js] var o = { - ["" + 0](y) { - return y.length; - }, + ["" + 0](y) { return y.length; }, ["" + 1]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types new file mode 100644 index 00000000000..44bc8a51113 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string + + [s: number]: (x: any) => number; // Doesn't get hit +>s : number +>x : any +} + +var o: I = { +>o : I +>I : I +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } + + ["" + 0](y) { return y.length; }, +>"" + 0 : string +>y : string +>y.length : number +>y : string +>length : number + + ["" + 1]: y => y.length +>"" + 1 : string +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js new file mode 100644 index 00000000000..0c6b80bbabb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType2_ES5.ts] +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType2_ES5.js] +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType2.types rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types index 408fd6a5062..0c1b9490abe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType2.js rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js index 028e797be18..6a3fb653138 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType2.ts] +//// [computedPropertyNamesContextualType2_ES6.ts] interface I { [s: string]: (x: any) => number; // Doesn't get hit [s: number]: (x: string) => number; @@ -9,10 +9,8 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType2.js] +//// [computedPropertyNamesContextualType2_ES6.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types new file mode 100644 index 00000000000..222004cf8e3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts === +interface I { +>I : I + + [s: string]: (x: any) => number; // Doesn't get hit +>s : string +>x : any + + [s: number]: (x: string) => number; +>s : number +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js new file mode 100644 index 00000000000..4336808c558 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNamesContextualType3_ES5.ts] +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType3_ES5.js] +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNamesContextualType3.types rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types index a1a36c1b7e9..482d58c3ee0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType3.js rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js index 944bb3595d4..9bf7dec1dd0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType3.ts] +//// [computedPropertyNamesContextualType3_ES6.ts] interface I { [s: string]: (x: string) => number; } @@ -8,10 +8,8 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType3.js] +//// [computedPropertyNamesContextualType3_ES6.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types new file mode 100644 index 00000000000..bc36ad8ae2c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js new file mode 100644 index 00000000000..b813da30496 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType4_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType4_ES5.js] +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType4.types rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types index d22f56f24fe..c1662397527 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType4.js rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js index 6ddd22baf6e..87cc54b4a59 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType4.ts] +//// [computedPropertyNamesContextualType4_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType4.js] +//// [computedPropertyNamesContextualType4_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types new file mode 100644 index 00000000000..82424f9410c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } + + [""+"foo"]: "", +>""+"foo" : string + + [""+"bar"]: 0 +>""+"bar" : string +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js new file mode 100644 index 00000000000..f75389de3e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType5_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType5_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType5.types rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types index 12c3332acfa..bb382ca136e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNamesContextualType5.js rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js index f2bd79644a0..775e8931efe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType5.ts] +//// [computedPropertyNamesContextualType5_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType5.js] +//// [computedPropertyNamesContextualType5_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types new file mode 100644 index 00000000000..6ab28f9583d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } + + [+"foo"]: "", +>+"foo" : number + + [+"bar"]: 0 +>+"bar" : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js new file mode 100644 index 00000000000..bc724320d14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNamesContextualType6_ES5.ts] +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType6_ES5.js] +foo((_a = { + p: "", + 0: function () { } +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index acbae75ad4c..2e16c7cb140 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types.pull rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull index a7a65d6618d..ce7a4c0d026 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNamesContextualType6.js rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js index 20678a60658..1360cc20028 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType6.ts] +//// [computedPropertyNamesContextualType6_ES6.ts] interface I { [s: string]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType6.js] +//// [computedPropertyNamesContextualType6_ES6.js] foo({ p: "", 0: () => { }, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types new file mode 100644 index 00000000000..1684bfc573f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull new file mode 100644 index 00000000000..6722edacd64 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js new file mode 100644 index 00000000000..8d2386a1d14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNamesContextualType7_ES5.ts] +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType7_ES5.js] +foo((_a = { + p: "", + 0: function () { } +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types index da059d490b0..80ba2b9224f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types.pull rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull index ff68ec8d0b0..3511e913585 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNamesContextualType7.js rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js index a948c31d750..185ccd72ead 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType7.ts] +//// [computedPropertyNamesContextualType7_ES6.ts] interface I { [s: number]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType7.js] +//// [computedPropertyNamesContextualType7_ES6.js] foo({ p: "", 0: () => { }, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types new file mode 100644 index 00000000000..c9ed4437760 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull new file mode 100644 index 00000000000..c548aed2bae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt index 07b55b799e4..3376243e370 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js new file mode 100644 index 00000000000..626f3d1a8e2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType8_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType8_ES5.js] +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt new file mode 100644 index 00000000000..e4540337ed4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [""+"foo"]: "", + [""+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType8.js rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js index d98538c40c1..6a18fa0b92b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType8.ts] +//// [computedPropertyNamesContextualType8_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType8.js] +//// [computedPropertyNamesContextualType8_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt index 6a1d9316fd7..d4085a37e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js new file mode 100644 index 00000000000..c28db4ded97 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType9_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType9_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt new file mode 100644 index 00000000000..eca1360c26f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType9.js rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js index ed8791a51e0..e94ded1a47a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType9.ts] +//// [computedPropertyNamesContextualType9_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType9.js] +//// [computedPropertyNamesContextualType9_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js similarity index 67% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js index bbdb6cd7baf..84b92f6c92d 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js @@ -1,19 +1,17 @@ -//// [computedPropertyNamesDeclarationEmit1.ts] +//// [computedPropertyNamesDeclarationEmit1_ES5.ts] class C { ["" + ""]() { } get ["" + ""]() { return 0; } set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit1.js] +//// [computedPropertyNamesDeclarationEmit1_ES5.js] var C = (function () { function C() { } C.prototype["" + ""] = function () { }; Object.defineProperty(C.prototype, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -26,6 +24,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit1.d.ts] +//// [computedPropertyNamesDeclarationEmit1_ES5.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types similarity index 82% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types index e8e184a652e..a5fe3dc0fa1 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js new file mode 100644 index 00000000000..b7505212baf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNamesDeclarationEmit1_ES6.ts] +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit1_ES6.js] +var C = (function () { + function C() { + } + C.prototype["" + ""] = function () { }; + Object.defineProperty(C.prototype, "" + "", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "" + "", { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit1_ES6.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types new file mode 100644 index 00000000000..a48c85f8602 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts === +class C { +>C : C + + ["" + ""]() { } +>"" + "" : string + + get ["" + ""]() { return 0; } +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js similarity index 66% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js index 10313841c4f..9847ea8b7ef 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js @@ -1,19 +1,17 @@ -//// [computedPropertyNamesDeclarationEmit2.ts] +//// [computedPropertyNamesDeclarationEmit2_ES5.ts] class C { static ["" + ""]() { } static get ["" + ""]() { return 0; } static set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit2.js] +//// [computedPropertyNamesDeclarationEmit2_ES5.js] var C = (function () { function C() { } C["" + ""] = function () { }; Object.defineProperty(C, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -26,6 +24,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit2.d.ts] +//// [computedPropertyNamesDeclarationEmit2_ES5.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types similarity index 83% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types index df1da17abea..949d82596c7 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js new file mode 100644 index 00000000000..9cd90493ea6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNamesDeclarationEmit2_ES6.ts] +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit2_ES6.js] +var C = (function () { + function C() { + } + C["" + ""] = function () { }; + Object.defineProperty(C, "" + "", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "" + "", { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit2_ES6.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types new file mode 100644 index 00000000000..eec55608a08 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts === +class C { +>C : C + + static ["" + ""]() { } +>"" + "" : string + + static get ["" + ""]() { return 0; } +>"" + "" : string + + static set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt deleted file mode 100644 index 69ff2b9e452..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== - interface I { - ["" + ""](): void; - ~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js deleted file mode 100644 index affe949797e..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit3.ts] -interface I { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit3.js] - - -//// [computedPropertyNamesDeclarationEmit3.d.ts] -interface I { -} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt new file mode 100644 index 00000000000..b6effe98a91 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js new file mode 100644 index 00000000000..c24eaf68a6f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3_ES5.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES5.js] + + +//// [computedPropertyNamesDeclarationEmit3_ES5.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt new file mode 100644 index 00000000000..99832a42e37 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js new file mode 100644 index 00000000000..dc54ff2cbb2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3_ES6.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES6.js] + + +//// [computedPropertyNamesDeclarationEmit3_ES6.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt deleted file mode 100644 index 53eb057f8a1..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== - var v: { - ["" + ""](): void; - ~~~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js deleted file mode 100644 index f68c1633ef9..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit4.ts] -var v: { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit4.js] -var v; - - -//// [computedPropertyNamesDeclarationEmit4.d.ts] -declare var v: { -}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt new file mode 100644 index 00000000000..fd84ac72270 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js new file mode 100644 index 00000000000..c57c0384afc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4_ES5.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES5.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4_ES5.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt new file mode 100644 index 00000000000..7cdd26576cb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js new file mode 100644 index 00000000000..903687d0780 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4_ES6.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES6.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4_ES6.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js new file mode 100644 index 00000000000..a0666f166d4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesDeclarationEmit5_ES5.ts] +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit5_ES5.js] +var v = (_a = {}, _a["" + ""] = +0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), +_a); +var _a; + + +//// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] +declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types similarity index 87% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types index c63d6d0d5c3..3f5a7355a20 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts === var v = { >v : {} >{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js similarity index 50% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js index d59d84b9e72..e19ac43656e 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesDeclarationEmit5.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.ts] var v = { ["" + ""]: 0, ["" + ""]() { }, @@ -6,16 +6,14 @@ var v = { set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit5.js] +//// [computedPropertyNamesDeclarationEmit5_ES6.js] var v = { ["" + ""]: 0, ["" + ""]() { }, - get ["" + ""]() { - return 0; - }, + get ["" + ""]() { return 0; }, set ["" + ""](x) { } }; -//// [computedPropertyNamesDeclarationEmit5.d.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.d.ts] declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types new file mode 100644 index 00000000000..10b70587e32 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts === +var v = { +>v : {} +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} + + ["" + ""]: 0, +>"" + "" : string + + ["" + ""]() { }, +>"" + "" : string + + get ["" + ""]() { return 0; }, +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt deleted file mode 100644 index b3c2957a13f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== - var methodName = "method"; - var accessorName = "accessor"; - class C { - [methodName](v: string); - ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. - [methodName](); - ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. - [methodName](v?: string) { } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt new file mode 100644 index 00000000000..2a17d7da815 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](v?: string) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js similarity index 75% rename from tests/baselines/reference/computedPropertyNamesOnOverloads.js rename to tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js index 4312e533318..1470605413a 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.js +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesOnOverloads.ts] +//// [computedPropertyNamesOnOverloads_ES5.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -7,7 +7,7 @@ class C { [methodName](v?: string) { } } -//// [computedPropertyNamesOnOverloads.js] +//// [computedPropertyNamesOnOverloads_ES5.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt new file mode 100644 index 00000000000..381ee7c17ba --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](v?: string) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js new file mode 100644 index 00000000000..1cbddb58dc2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesOnOverloads_ES6.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} + +//// [computedPropertyNamesOnOverloads_ES6.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function (v) { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map deleted file mode 100644 index 5833df72f7f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap1.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap1.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js similarity index 53% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.js rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js index b65e3f0ce5b..5b99f534002 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js @@ -1,11 +1,11 @@ -//// [computedPropertyNamesSourceMap1.ts] +//// [computedPropertyNamesSourceMap1_ES5.ts] class C { ["hello"]() { debugger; } } -//// [computedPropertyNamesSourceMap1.js] +//// [computedPropertyNamesSourceMap1_ES5.js] var C = (function () { function C() { } @@ -14,4 +14,4 @@ var C = (function () { }; return C; })(); -//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map new file mode 100644 index 00000000000..f3881a54bd5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt similarity index 85% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt index e806eee1aa7..607d51ca5dc 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap1.js -mapUrl: computedPropertyNamesSourceMap1.js.map +JsFile: computedPropertyNamesSourceMap1_ES5.js +mapUrl: computedPropertyNamesSourceMap1_ES5.js.map sourceRoot: -sources: computedPropertyNamesSourceMap1.ts +sources: computedPropertyNamesSourceMap1_ES5.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.js -sourceFile:computedPropertyNamesSourceMap1.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.js +sourceFile:computedPropertyNamesSourceMap1_ES5.ts ------------------------------------------------------------------- >>>var C = (function () { 1 > @@ -97,7 +97,7 @@ sourceFile:computedPropertyNamesSourceMap1.ts 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >} 3 > @@ -111,4 +111,4 @@ sourceFile:computedPropertyNamesSourceMap1.ts 3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) 4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types similarity index 76% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.types rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types index 54a2a9f19d0..1c57d97a7e8 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js new file mode 100644 index 00000000000..f7dc9e17836 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesSourceMap1_ES6.ts] +class C { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap1_ES6.js] +var C = (function () { + function C() { + } + C.prototype["hello"] = function () { + debugger; + }; + return C; +})(); +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map new file mode 100644 index 00000000000..51154cc4676 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt new file mode 100644 index 00000000000..bb482f68cba --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap1_ES6.js +mapUrl: computedPropertyNamesSourceMap1_ES6.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap1_ES6.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.js +sourceFile:computedPropertyNamesSourceMap1_ES6.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^-> +1 > +2 >class +3 > C +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 C() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +1-> +2 > class +3 > C +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C) +3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > ["hello"]() { + > debugger; + > } + > +2 > } +1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor) +--- +>>> C.prototype["hello"] = function () { +1->^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^ +1-> +2 > [ +3 > "hello" +4 > ] +5 > +1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C) +2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C) +3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C) +4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C) +5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >["hello"]() { + > +2 > debugger +3 > ; +1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"]) +2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"]) +3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"]) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"]) +2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"]) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > ["hello"]() { + > debugger; + > } + > } +1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C) +3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types new file mode 100644 index 00000000000..d5dc8a857a0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts === +class C { +>C : C + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js b/tests/baselines/reference/computedPropertyNamesSourceMap2.js deleted file mode 100644 index d967cb0d468..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js +++ /dev/null @@ -1,14 +0,0 @@ -//// [computedPropertyNamesSourceMap2.ts] -var v = { - ["hello"]() { - debugger; - } -} - -//// [computedPropertyNamesSourceMap2.js] -var v = { - ["hello"]() { - debugger; - } -}; -//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map deleted file mode 100644 index 6c485c24f6f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap2.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js new file mode 100644 index 00000000000..c5af22ef398 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES5.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES5.js] +var v = (_a = {}, _a["hello"] = function () { + debugger; +}, +_a); +var _a; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map new file mode 100644 index 00000000000..82a729df957 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt new file mode 100644 index 00000000000..33a3a2b4c2c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -0,0 +1,160 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap2_ES5.js +mapUrl: computedPropertyNamesSourceMap2_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap2_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js +sourceFile:computedPropertyNamesSourceMap2_ES5.ts +------------------------------------------------------------------- +>>>var v = (_a = {}, _a["hello"] = function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > +6 > ^ +7 > ^^ +8 > ^^^ +9 > ^^ +10> ^^ +11> ^^ +12> ^ +13> ^^^^^^^ +14> ^ +15> ^^^ +1 > +2 >var +3 > v +4 > = +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +8 > +9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +9 > +10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 19) Source(1, 1) + SourceIndex(0) nameIndex (-1) +10> +11> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 21) Source(1, 1) + SourceIndex(0) nameIndex (-1) +11> +12> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 22) Source(2, 6) + SourceIndex(0) nameIndex (-1) +12> var v = { + > [ +13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 19) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 29) Source(2, 13) + SourceIndex(0) nameIndex (-1) +13> "hello" +14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 21) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +14> +15> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 22) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 33) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +15> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0) +6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) +7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) +8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0) +9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0) +10>Emitted(1, 19) Source(1, 1) + SourceIndex(0) +11>Emitted(1, 21) Source(1, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(2, 6) + SourceIndex(0) +13>Emitted(1, 29) Source(2, 13) + SourceIndex(0) +14>Emitted(1, 30) Source(0, NaN) + SourceIndex(0) +15>Emitted(1, 33) Source(0, NaN) + SourceIndex(0) +--- +>>> debugger; +1 >^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 29) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(3, 9) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 13) Source(3, 17) + SourceIndex(0) nameIndex (-1) +2 > debugger +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 14) Source(3, 18) + SourceIndex(0) nameIndex (-1) +3 > ; +1 >Emitted(2, 5) Source(3, 9) + SourceIndex(0) +2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) +3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) +--- +>>>}, +1 > +2 >^ +3 > +4 > ^^^^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) +1 > + > +2 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(4, 6) + SourceIndex(0) nameIndex (-1) +2 >} +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0) +2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) +3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) +--- +>>>_a); +1-> +2 >^^ +3 > +4 > ^ +5 > ^ +6 > ^^^^-> +1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1) +5 > +1->Emitted(4, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0) +3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0) +4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0) +5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0) +--- +>>>var _a; +1->^^^^ +2 > ^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) +--- +!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded +!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types similarity index 81% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.types rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types index 972259eb3e2..1dcc49a8fae 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts === var v = { >v : {} >{ ["hello"]() { debugger; }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js new file mode 100644 index 00000000000..3d0274e65c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES6.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES6.js] +var v = { + ["hello"]() { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map new file mode 100644 index 00000000000..251171232e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt index 29f11b95e1f..48149aee0b5 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap2.js -mapUrl: computedPropertyNamesSourceMap2.js.map +JsFile: computedPropertyNamesSourceMap2_ES6.js +mapUrl: computedPropertyNamesSourceMap2_ES6.js.map sourceRoot: -sources: computedPropertyNamesSourceMap2.ts +sources: computedPropertyNamesSourceMap2_ES6.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.js -sourceFile:computedPropertyNamesSourceMap2.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.js +sourceFile:computedPropertyNamesSourceMap2_ES6.ts ------------------------------------------------------------------- >>>var v = { 1 > @@ -63,11 +63,11 @@ sourceFile:computedPropertyNamesSourceMap2.ts >>>}; 1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > 1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) 2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types new file mode 100644 index 00000000000..9a1c71364a2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts === +var v = { +>v : {} +>{ ["hello"]() { debugger; }} : {} + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/conditionalExpressions2.js b/tests/baselines/reference/conditionalExpressions2.js index b8870b564ec..6749a2c0ac0 100644 --- a/tests/baselines/reference/conditionalExpressions2.js +++ b/tests/baselines/reference/conditionalExpressions2.js @@ -18,11 +18,9 @@ var e = false ? "foo" : "bar"; var f = false ? null : undefined; var g = true ? { g: 5 } : null; var h = [{ h: 5 }, null]; -function i() { - if (true) { - return { x: 5 }; - } - else { - return null; - } +function i() { if (true) { + return { x: 5 }; } +else { + return null; +} } diff --git a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js index 46a04169e93..f8fbe708e1a 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js +++ b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js @@ -91,9 +91,7 @@ condNumber ? exprString1 : exprBoolean1; // Union 1000000000000 ? exprIsObject1 : exprIsObject2; 10000 ? exprString1 : exprBoolean1; // Union //Cond is a number type expression -function foo() { - return 1; -} +function foo() { return 1; } ; var array = [1, 2, 3]; 1 * 0 ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js index 02c398e89e1..dbd68d9f009 100644 --- a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js +++ b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js @@ -92,9 +92,7 @@ condString ? exprString1 : exprBoolean1; // union " " ? exprIsObject1 : exprIsObject2; "hello " ? exprString1 : exprBoolean1; // union //Cond is a string type expression -function foo() { - return "string"; -} +function foo() { return "string"; } ; var array = ["1", "2", "3"]; typeof condString ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt index 58fdcb4c7ae..07e7a64ec1f 100644 --- a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt +++ b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. - Named properties 'm' of types 'B' and 'D' are not identical. + Named property 'm' of types 'B' and 'D' are not identical. ==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ==== @@ -17,6 +17,6 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Inte interface E extends B { } // Error here for extending B and D ~ !!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. -!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical. +!!! error TS2320: Named property 'm' of types 'B' and 'D' are not identical. interface E extends D { } // No duplicate error here \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt index 99c02d87f45..24af601139f 100644 --- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS4090: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS4090: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. ==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS var x = 0; ~ -!!! error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } @@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS { var y = 0; ~ -!!! error TS4090: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +!!! error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. } } @@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS const z = 0; var z = 0 ~ -!!! error TS4090: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +!!! error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. } \ No newline at end of file diff --git a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt index 7cccf86b1c8..f2330617dea 100644 --- a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt +++ b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS4088: Property 'B' does not exist on 'const' enum 'E'. +tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2479: Property 'B' does not exist on 'const' enum 'E'. ==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ==== const enum E { A } var x = E["B"] ~~~ -!!! error TS4088: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file +!!! error TS2479: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/constEnumErrors.errors.txt b/tests/baselines/reference/constEnumErrors.errors.txt index 53fed12f382..be7dad54eeb 100644 --- a/tests/baselines/reference/constEnumErrors.errors.txt +++ b/tests/baselines/reference/constEnumErrors.errors.txt @@ -1,16 +1,16 @@ tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'. tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'. -tests/cases/compiler/constEnumErrors.ts(12,9): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(14,9): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(15,10): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(22,13): error TS4085: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(24,13): error TS4085: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(26,9): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(27,10): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(32,5): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(40,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(41,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +tests/cases/compiler/constEnumErrors.ts(12,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(24,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(26,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(27,10): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(32,5): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(40,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(41,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. ==== tests/cases/compiler/constEnumErrors.ts (13 errors) ==== @@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member // forward reference to the element of the same enum X = Y, ~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. // forward reference to the element of the same enum Y = E1.Z, ~~~~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. Y1 = E1["Z"] ~~~~~~~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. } const enum E2 { @@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member var y0 = E2[1] ~ -!!! error TS4085: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var name = "A"; var y1 = E2[name]; ~~~~ -!!! error TS4085: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var x = E2; ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. var y = [E2]; ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. function foo(t: any): void { } foo(E2); ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. const enum NaNOrInfinity { A = 9007199254740992, @@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member E = D * D, F = E * E, // overflow ~~~~~ -!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. G = 1 / 0, // overflow ~~~~~ -!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. H = 0 / 0 // NaN ~~~~~ -!!! error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +!!! error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. } \ No newline at end of file diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.js b/tests/baselines/reference/constraintSatisfactionWithAny.js index 924c2ab1700..06d8b17690a 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.js +++ b/tests/baselines/reference/constraintSatisfactionWithAny.js @@ -54,16 +54,10 @@ var c8 = new C4(b); //// [constraintSatisfactionWithAny.js] // any is not a valid type argument unless there is no constraint, or the constraint is any -function foo(x) { - return null; -} -function foo2(x) { - return null; -} +function foo(x) { return null; } +function foo2(x) { return null; } //function foo3(x: T): T { return null; } -function foo4(x) { - return null; -} +function foo4(x) { return null; } var a; foo(a); foo2(a); diff --git a/tests/baselines/reference/constructorAsType.js b/tests/baselines/reference/constructorAsType.js index 1f48f214dd4..9f8c14ce743 100644 --- a/tests/baselines/reference/constructorAsType.js +++ b/tests/baselines/reference/constructorAsType.js @@ -6,8 +6,6 @@ var Person2:{new() : {name:string;};}; Person = Person2; //// [constructorAsType.js] -var Person = function () { - return { name: "joe" }; -}; +var Person = function () { return { name: "joe" }; }; var Person2; Person = Person2; diff --git a/tests/baselines/reference/constructorOverloads7.js b/tests/baselines/reference/constructorOverloads7.js index b7e152c66e1..5b7e407e806 100644 --- a/tests/baselines/reference/constructorOverloads7.js +++ b/tests/baselines/reference/constructorOverloads7.js @@ -34,6 +34,4 @@ function Point(x, y) { this.y = y; return this; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 86338c1d913..cd31308311b 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -314,10 +314,12 @@ var TypeScriptAllInOne; Program.prototype.if = function (retValue) { if (retValue === void 0) { retValue = != 0; } return 1; - ^ retValue; + ^ + retValue; bfs.TYPES(); if (retValue != 0) { - return 1 && ; + return 1 && + ; } retValue = bfs.OPERATOR; ' );; @@ -348,7 +350,8 @@ var BasicFeatures = (function () { BasicFeatures.prototype.VARIABLES = function () { var local = Number.MAX_VALUE; var min = Number.MIN_VALUE; - var inf = Number.NEGATIVE_INFINITY - ; + var inf = Number.NEGATIVE_INFINITY - + ; var nan = Number.NaN; var undef = undefined; var _\uD4A5\u7204\uC316, uE59F = local; @@ -357,16 +360,16 @@ var BasicFeatures = (function () { var local6 = local5 instanceof fs.File; var hex = 0xBADC0DE, Hex = 0XDEADBEEF; var float = 6.02e23, float2 = 6.02E-23; - var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ; + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != + ; var quoted = '"', quoted2 = "'"; var reg = /\w*/; - var objLit = { "var": number = 42, equals: function (x) { - return x["var"] === 42; - }, instanceof: function () { return 'objLit{42}'; } }; + var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof: function () { return 'objLit{42}'; } }; var weekday = 0 /* Monday */; var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; // - var any = 0 ^= ; + var any = 0 ^= + ; var bool = 0; var declare = 0; var constructor = 0; @@ -382,7 +385,8 @@ var BasicFeatures = (function () { var public = 0; var set = 0; var static = 0; - var string = 0 / > ; + var string = 0 / > + ; var yield = 0; var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; return 0; @@ -483,15 +487,10 @@ var BasicFeatures = (function () { })(); var CLASS = (function () { function CLASS() { - this.d = function () { - yield; - 0; - }; + this.d = function () { yield; 0; }; } Object.defineProperty(CLASS.prototype, "Property", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -499,9 +498,7 @@ var CLASS = (function () { return 0; }; CLASS.prototype.Foo = function () { - var myEvent = function () { - return 1; - }; + var myEvent = function () { return 1; }; if (myEvent() == 1) return true ? : ; else @@ -545,7 +542,8 @@ while () : string, ; rest: string[]; { - & public; + & + public; DefaultValue(value ? : string = "Hello"); { } } diff --git a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js index bd76a746ac9..726d45bffe5 100644 --- a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js +++ b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js @@ -8,9 +8,7 @@ var x = h("", f()); // Call should succeed and x should be string. All t //// [contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js] function f() { - function g(u) { - return null; - } + function g(u) { return null; } return g; } var h; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js index b04c804ad7e..10672d86796 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js @@ -150,26 +150,27 @@ var i1Ori2 = { propertyOnlyInI2: "Hello" }; var arrayI1OrI2 = [i1, i2, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello", - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}]; + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello" + }, + { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }, { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello", + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }]; var i11; var i21; var i11Ori21 = i11; @@ -191,17 +192,17 @@ var i11Ori21 = { commonPropertyDifferentType: 10 }; var arrayOrI11OrI21 = [i11, i21, i11 || i21, { - // Like i1 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charAt(b); - return z; - }, - commonPropertyDifferentType: "hello" -}, { - // Like i2 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charCodeAt(b); - return z; - }, - commonPropertyDifferentType: 10 -}]; + // Like i1 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello" + }, { + // Like i2 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10 + }]; diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 46e09d7f9e5..75b98b16c33 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -249,40 +249,24 @@ var C2T5; }; })(C2T5 || (C2T5 = {})); // CONTEXT: Variable declaration -var c3t1 = (function (s) { - return s; -}); +var c3t1 = (function (s) { return s; }); var c3t2 = ({ n: 1 }); var c3t3 = []; -var c3t4 = function () { - return ({}); -}; -var c3t5 = function (n) { - return ({}); -}; -var c3t6 = function (n, s) { - return ({}); -}; -var c3t7 = function (n) { - return n; -}; -var c3t8 = function (n) { - return n; -}; +var c3t4 = function () { return ({}); }; +var c3t5 = function (n) { return ({}); }; +var c3t6 = function (n, s) { return ({}); }; +var c3t7 = function (n) { return n; }; +var c3t8 = function (n) { return n; }; var c3t9 = [[], []]; var c3t10 = [({}), ({})]; -var c3t11 = [function (n, s) { - return s; -}]; +var c3t11 = [function (n, s) { return s; }]; var c3t12 = { foo: ({}) }; var c3t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c3t14 = ({ a: [] @@ -306,47 +290,29 @@ var C5T5; })(C5T5 || (C5T5 = {})); // CONTEXT: Variable assignment var c6t5; -c6t5 = function (n) { - return ({}); -}; +c6t5 = function (n) { return ({}); }; // CONTEXT: Array index assignment var c7t2; c7t2[0] = ({ n: 1 }); var objc8 = ({}); -objc8.t1 = (function (s) { - return s; -}); +objc8.t1 = (function (s) { return s; }); objc8.t2 = ({ n: 1 }); objc8.t3 = []; -objc8.t4 = function () { - return ({}); -}; -objc8.t5 = function (n) { - return ({}); -}; -objc8.t6 = function (n, s) { - return ({}); -}; -objc8.t7 = function (n) { - return n; -}; -objc8.t8 = function (n) { - return n; -}; +objc8.t4 = function () { return ({}); }; +objc8.t5 = function (n) { return ({}); }; +objc8.t6 = function (n, s) { return ({}); }; +objc8.t7 = function (n) { return n; }; +objc8.t8 = function (n) { return n; }; objc8.t9 = [[], []]; objc8.t10 = [({}), ({})]; -objc8.t11 = [function (n, s) { - return s; -}]; +objc8.t11 = [function (n, s) { return s; }]; objc8.t12 = { foo: ({}) }; objc8.t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); objc8.t14 = ({ a: [] @@ -358,11 +324,7 @@ c9t5(function (n) { return ({}); }); // CONTEXT: Return statement -var c10t5 = function () { - return function (n) { - return ({}); - }; -}; +var c10t5 = function () { return function (n) { return ({}); }; }; // CONTEXT: Newing a class var C11t5 = (function () { function C11t5(f) { @@ -370,51 +332,31 @@ var C11t5 = (function () { return C11t5; })(); ; -var i = new C11t5(function (n) { - return ({}); -}); +var i = new C11t5(function (n) { return ({}); }); // CONTEXT: Type annotated expression -var c12t1 = (function (s) { - return s; -}); +var c12t1 = (function (s) { return s; }); var c12t2 = ({ n: 1 }); var c12t3 = []; -var c12t4 = function () { - return ({}); -}; -var c12t5 = function (n) { - return ({}); -}; -var c12t6 = function (n, s) { - return ({}); -}; -var c12t7 = function (n) { - return n; -}; -var c12t8 = function (n) { - return n; -}; +var c12t4 = function () { return ({}); }; +var c12t5 = function (n) { return ({}); }; +var c12t6 = function (n, s) { return ({}); }; +var c12t7 = function (n) { return n; }; +var c12t8 = function (n) { return n; }; var c12t9 = [[], []]; var c12t10 = [({}), ({})]; -var c12t11 = [function (n, s) { - return s; -}]; +var c12t11 = [function (n, s) { return s; }]; var c12t12 = { foo: ({}) }; var c12t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c12t14 = ({ a: [] }); -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var efv = EF1(1, 2); function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index 98c41439762..ba71b082ada 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B;IAAa,MAAM,CAAC,UAAS,CAAC;QAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;IAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC;IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA;AAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 6f9c9d2c1ec..5843e0f3f24 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -273,6 +273,7 @@ sourceFile:contextualTyping.ts 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^-> 1-> > >// CONTEXT: Variable declaration @@ -283,76 +284,71 @@ sourceFile:contextualTyping.ts 2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0) 3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) --- ->>>var c3t1 = (function (s) { -1 >^^^^ +>>>var c3t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c3t1 3 > : (s: string) => string = 4 > ( 5 > function( 6 > s -1 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(18, 5) Source(28, 5) + SourceIndex(0) 2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0) 3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0) 4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0) 5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0) 6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(19, 5) Source(28, 50) + SourceIndex(0) -2 >Emitted(19, 11) Source(28, 56) + SourceIndex(0) -3 >Emitted(19, 12) Source(28, 57) + SourceIndex(0) -4 >Emitted(19, 13) Source(28, 58) + SourceIndex(0) -5 >Emitted(19, 14) Source(28, 58) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(20, 1) Source(28, 59) + SourceIndex(0) -2 >Emitted(20, 2) Source(28, 60) + SourceIndex(0) -3 >Emitted(20, 3) Source(28, 61) + SourceIndex(0) -4 >Emitted(20, 4) Source(28, 62) + SourceIndex(0) +7 >Emitted(18, 28) Source(28, 50) + SourceIndex(0) +8 >Emitted(18, 34) Source(28, 56) + SourceIndex(0) +9 >Emitted(18, 35) Source(28, 57) + SourceIndex(0) +10>Emitted(18, 36) Source(28, 58) + SourceIndex(0) +11>Emitted(18, 37) Source(28, 58) + SourceIndex(0) +12>Emitted(18, 38) Source(28, 59) + SourceIndex(0) +13>Emitted(18, 39) Source(28, 60) + SourceIndex(0) +14>Emitted(18, 40) Source(28, 61) + SourceIndex(0) +15>Emitted(18, 41) Source(28, 62) + SourceIndex(0) --- >>>var c3t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c3t2 4 > = 5 > ( -1->Emitted(21, 1) Source(29, 1) + SourceIndex(0) -2 >Emitted(21, 5) Source(29, 5) + SourceIndex(0) -3 >Emitted(21, 9) Source(29, 9) + SourceIndex(0) -4 >Emitted(21, 12) Source(29, 18) + SourceIndex(0) -5 >Emitted(21, 13) Source(29, 19) + SourceIndex(0) +1 >Emitted(19, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(19, 9) Source(29, 9) + SourceIndex(0) +4 >Emitted(19, 12) Source(29, 18) + SourceIndex(0) +5 >Emitted(19, 13) Source(29, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -364,10 +360,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) -2 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) -3 >Emitted(22, 8) Source(30, 8) + SourceIndex(0) -4 >Emitted(22, 9) Source(30, 9) + SourceIndex(0) +1 >Emitted(20, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(20, 6) Source(30, 6) + SourceIndex(0) +3 >Emitted(20, 8) Source(30, 8) + SourceIndex(0) +4 >Emitted(20, 9) Source(30, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -378,9 +374,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(23, 2) Source(31, 2) + SourceIndex(0) -2 >Emitted(23, 3) Source(31, 3) + SourceIndex(0) -3 >Emitted(23, 4) Source(31, 3) + SourceIndex(0) +1 >Emitted(21, 2) Source(31, 2) + SourceIndex(0) +2 >Emitted(21, 3) Source(31, 3) + SourceIndex(0) +3 >Emitted(21, 4) Source(31, 3) + SourceIndex(0) --- >>>var c3t3 = []; 1-> @@ -389,7 +385,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -397,71 +393,77 @@ sourceFile:contextualTyping.ts 4 > : number[] = 5 > [] 6 > ; -1->Emitted(24, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) -3 >Emitted(24, 9) Source(32, 9) + SourceIndex(0) -4 >Emitted(24, 12) Source(32, 22) + SourceIndex(0) -5 >Emitted(24, 14) Source(32, 24) + SourceIndex(0) -6 >Emitted(24, 15) Source(32, 25) + SourceIndex(0) +1->Emitted(22, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(22, 9) Source(32, 9) + SourceIndex(0) +4 >Emitted(22, 12) Source(32, 22) + SourceIndex(0) +5 >Emitted(22, 14) Source(32, 24) + SourceIndex(0) +6 >Emitted(22, 15) Source(32, 25) + SourceIndex(0) --- ->>>var c3t4 = function () { +>>>var c3t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ -5 > ^^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c3t4 4 > : () => IFoo = -1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) -2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) -3 >Emitted(25, 9) Source(33, 9) + SourceIndex(0) -4 >Emitted(25, 12) Source(33, 24) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(23, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(23, 9) Source(33, 9) + SourceIndex(0) +4 >Emitted(23, 12) Source(33, 24) + SourceIndex(0) +5 >Emitted(23, 26) Source(33, 37) + SourceIndex(0) +6 >Emitted(23, 32) Source(33, 43) + SourceIndex(0) +7 >Emitted(23, 33) Source(33, 50) + SourceIndex(0) +8 >Emitted(23, 34) Source(33, 51) + SourceIndex(0) +9 >Emitted(23, 36) Source(33, 53) + SourceIndex(0) +10>Emitted(23, 37) Source(33, 54) + SourceIndex(0) +11>Emitted(23, 38) Source(33, 54) + SourceIndex(0) +12>Emitted(23, 39) Source(33, 55) + SourceIndex(0) +13>Emitted(23, 40) Source(33, 56) + SourceIndex(0) +14>Emitted(23, 41) Source(33, 57) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(26, 5) Source(33, 37) + SourceIndex(0) -2 >Emitted(26, 11) Source(33, 43) + SourceIndex(0) -3 >Emitted(26, 12) Source(33, 50) + SourceIndex(0) -4 >Emitted(26, 13) Source(33, 51) + SourceIndex(0) -5 >Emitted(26, 15) Source(33, 53) + SourceIndex(0) -6 >Emitted(26, 16) Source(33, 54) + SourceIndex(0) -7 >Emitted(26, 17) Source(33, 54) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(27, 1) Source(33, 55) + SourceIndex(0) -2 >Emitted(27, 2) Source(33, 56) + SourceIndex(0) -3 >Emitted(27, 3) Source(33, 57) + SourceIndex(0) ---- ->>>var c3t5 = function (n) { +>>>var c3t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -469,49 +471,34 @@ sourceFile:contextualTyping.ts 4 > : (n: number) => IFoo = 5 > function( 6 > n -1->Emitted(28, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(28, 5) Source(34, 5) + SourceIndex(0) -3 >Emitted(28, 9) Source(34, 9) + SourceIndex(0) -4 >Emitted(28, 12) Source(34, 33) + SourceIndex(0) -5 >Emitted(28, 22) Source(34, 42) + SourceIndex(0) -6 >Emitted(28, 23) Source(34, 43) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(24, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(34, 5) + SourceIndex(0) +3 >Emitted(24, 9) Source(34, 9) + SourceIndex(0) +4 >Emitted(24, 12) Source(34, 33) + SourceIndex(0) +5 >Emitted(24, 22) Source(34, 42) + SourceIndex(0) +6 >Emitted(24, 23) Source(34, 43) + SourceIndex(0) +7 >Emitted(24, 27) Source(34, 47) + SourceIndex(0) +8 >Emitted(24, 33) Source(34, 53) + SourceIndex(0) +9 >Emitted(24, 34) Source(34, 60) + SourceIndex(0) +10>Emitted(24, 35) Source(34, 61) + SourceIndex(0) +11>Emitted(24, 37) Source(34, 63) + SourceIndex(0) +12>Emitted(24, 38) Source(34, 64) + SourceIndex(0) +13>Emitted(24, 39) Source(34, 64) + SourceIndex(0) +14>Emitted(24, 40) Source(34, 65) + SourceIndex(0) +15>Emitted(24, 41) Source(34, 66) + SourceIndex(0) +16>Emitted(24, 42) Source(34, 67) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(29, 5) Source(34, 47) + SourceIndex(0) -2 >Emitted(29, 11) Source(34, 53) + SourceIndex(0) -3 >Emitted(29, 12) Source(34, 60) + SourceIndex(0) -4 >Emitted(29, 13) Source(34, 61) + SourceIndex(0) -5 >Emitted(29, 15) Source(34, 63) + SourceIndex(0) -6 >Emitted(29, 16) Source(34, 64) + SourceIndex(0) -7 >Emitted(29, 17) Source(34, 64) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(30, 1) Source(34, 65) + SourceIndex(0) -2 >Emitted(30, 2) Source(34, 66) + SourceIndex(0) -3 >Emitted(30, 3) Source(34, 67) + SourceIndex(0) ---- ->>>var c3t6 = function (n, s) { +>>>var c3t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ @@ -520,6 +507,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -529,58 +526,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(31, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(31, 5) Source(35, 5) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 9) + SourceIndex(0) -4 >Emitted(31, 12) Source(35, 44) + SourceIndex(0) -5 >Emitted(31, 22) Source(35, 53) + SourceIndex(0) -6 >Emitted(31, 23) Source(35, 54) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 56) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 57) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(25, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(35, 5) + SourceIndex(0) +3 >Emitted(25, 9) Source(35, 9) + SourceIndex(0) +4 >Emitted(25, 12) Source(35, 44) + SourceIndex(0) +5 >Emitted(25, 22) Source(35, 53) + SourceIndex(0) +6 >Emitted(25, 23) Source(35, 54) + SourceIndex(0) +7 >Emitted(25, 25) Source(35, 56) + SourceIndex(0) +8 >Emitted(25, 26) Source(35, 57) + SourceIndex(0) +9 >Emitted(25, 30) Source(35, 61) + SourceIndex(0) +10>Emitted(25, 36) Source(35, 67) + SourceIndex(0) +11>Emitted(25, 37) Source(35, 74) + SourceIndex(0) +12>Emitted(25, 38) Source(35, 75) + SourceIndex(0) +13>Emitted(25, 40) Source(35, 77) + SourceIndex(0) +14>Emitted(25, 41) Source(35, 78) + SourceIndex(0) +15>Emitted(25, 42) Source(35, 78) + SourceIndex(0) +16>Emitted(25, 43) Source(35, 79) + SourceIndex(0) +17>Emitted(25, 44) Source(35, 80) + SourceIndex(0) +18>Emitted(25, 45) Source(35, 81) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(32, 5) Source(35, 61) + SourceIndex(0) -2 >Emitted(32, 11) Source(35, 67) + SourceIndex(0) -3 >Emitted(32, 12) Source(35, 74) + SourceIndex(0) -4 >Emitted(32, 13) Source(35, 75) + SourceIndex(0) -5 >Emitted(32, 15) Source(35, 77) + SourceIndex(0) -6 >Emitted(32, 16) Source(35, 78) + SourceIndex(0) -7 >Emitted(32, 17) Source(35, 78) + SourceIndex(0) ---- ->>>}; +>>>var c3t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(33, 1) Source(35, 79) + SourceIndex(0) -2 >Emitted(33, 2) Source(35, 80) + SourceIndex(0) -3 >Emitted(33, 3) Source(35, 81) + SourceIndex(0) ---- ->>>var c3t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c3t7 @@ -590,49 +581,44 @@ sourceFile:contextualTyping.ts > } = 5 > function( 6 > n -1->Emitted(34, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(34, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(34, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(34, 12) Source(39, 5) + SourceIndex(0) -5 >Emitted(34, 22) Source(39, 14) + SourceIndex(0) -6 >Emitted(34, 23) Source(39, 15) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1 >Emitted(26, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(26, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(26, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(26, 12) Source(39, 5) + SourceIndex(0) +5 >Emitted(26, 22) Source(39, 14) + SourceIndex(0) +6 >Emitted(26, 23) Source(39, 15) + SourceIndex(0) +7 >Emitted(26, 27) Source(39, 19) + SourceIndex(0) +8 >Emitted(26, 33) Source(39, 25) + SourceIndex(0) +9 >Emitted(26, 34) Source(39, 26) + SourceIndex(0) +10>Emitted(26, 35) Source(39, 27) + SourceIndex(0) +11>Emitted(26, 36) Source(39, 28) + SourceIndex(0) +12>Emitted(26, 37) Source(39, 29) + SourceIndex(0) +13>Emitted(26, 38) Source(39, 30) + SourceIndex(0) +14>Emitted(26, 39) Source(39, 31) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(35, 5) Source(39, 19) + SourceIndex(0) -2 >Emitted(35, 11) Source(39, 25) + SourceIndex(0) -3 >Emitted(35, 12) Source(39, 26) + SourceIndex(0) -4 >Emitted(35, 13) Source(39, 27) + SourceIndex(0) -5 >Emitted(35, 14) Source(39, 28) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(36, 1) Source(39, 29) + SourceIndex(0) -2 >Emitted(36, 2) Source(39, 30) + SourceIndex(0) -3 >Emitted(36, 3) Source(39, 31) + SourceIndex(0) ---- ->>>var c3t8 = function (n) { +>>>var c3t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -641,44 +627,31 @@ sourceFile:contextualTyping.ts 4 > : (n: number, s: string) => number = 5 > function( 6 > n -1->Emitted(37, 1) Source(41, 1) + SourceIndex(0) -2 >Emitted(37, 5) Source(41, 5) + SourceIndex(0) -3 >Emitted(37, 9) Source(41, 9) + SourceIndex(0) -4 >Emitted(37, 12) Source(41, 46) + SourceIndex(0) -5 >Emitted(37, 22) Source(41, 55) + SourceIndex(0) -6 >Emitted(37, 23) Source(41, 56) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(38, 5) Source(41, 60) + SourceIndex(0) -2 >Emitted(38, 11) Source(41, 66) + SourceIndex(0) -3 >Emitted(38, 12) Source(41, 67) + SourceIndex(0) -4 >Emitted(38, 13) Source(41, 68) + SourceIndex(0) -5 >Emitted(38, 14) Source(41, 69) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(39, 1) Source(41, 70) + SourceIndex(0) -2 >Emitted(39, 2) Source(41, 71) + SourceIndex(0) -3 >Emitted(39, 3) Source(41, 72) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(27, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(27, 5) Source(41, 5) + SourceIndex(0) +3 >Emitted(27, 9) Source(41, 9) + SourceIndex(0) +4 >Emitted(27, 12) Source(41, 46) + SourceIndex(0) +5 >Emitted(27, 22) Source(41, 55) + SourceIndex(0) +6 >Emitted(27, 23) Source(41, 56) + SourceIndex(0) +7 >Emitted(27, 27) Source(41, 60) + SourceIndex(0) +8 >Emitted(27, 33) Source(41, 66) + SourceIndex(0) +9 >Emitted(27, 34) Source(41, 67) + SourceIndex(0) +10>Emitted(27, 35) Source(41, 68) + SourceIndex(0) +11>Emitted(27, 36) Source(41, 69) + SourceIndex(0) +12>Emitted(27, 37) Source(41, 70) + SourceIndex(0) +13>Emitted(27, 38) Source(41, 71) + SourceIndex(0) +14>Emitted(27, 39) Source(41, 72) + SourceIndex(0) --- >>>var c3t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ @@ -689,7 +662,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c3t9 @@ -700,16 +673,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(40, 1) Source(42, 1) + SourceIndex(0) -2 >Emitted(40, 5) Source(42, 5) + SourceIndex(0) -3 >Emitted(40, 9) Source(42, 9) + SourceIndex(0) -4 >Emitted(40, 12) Source(42, 24) + SourceIndex(0) -5 >Emitted(40, 13) Source(42, 25) + SourceIndex(0) -6 >Emitted(40, 15) Source(42, 27) + SourceIndex(0) -7 >Emitted(40, 17) Source(42, 28) + SourceIndex(0) -8 >Emitted(40, 19) Source(42, 30) + SourceIndex(0) -9 >Emitted(40, 20) Source(42, 31) + SourceIndex(0) -10>Emitted(40, 21) Source(42, 32) + SourceIndex(0) +1 >Emitted(28, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(28, 5) Source(42, 5) + SourceIndex(0) +3 >Emitted(28, 9) Source(42, 9) + SourceIndex(0) +4 >Emitted(28, 12) Source(42, 24) + SourceIndex(0) +5 >Emitted(28, 13) Source(42, 25) + SourceIndex(0) +6 >Emitted(28, 15) Source(42, 27) + SourceIndex(0) +7 >Emitted(28, 17) Source(42, 28) + SourceIndex(0) +8 >Emitted(28, 19) Source(42, 30) + SourceIndex(0) +9 >Emitted(28, 20) Source(42, 31) + SourceIndex(0) +10>Emitted(28, 21) Source(42, 32) + SourceIndex(0) --- >>>var c3t10 = [({}), ({})]; 1-> @@ -726,7 +699,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -742,22 +715,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(41, 1) Source(43, 1) + SourceIndex(0) -2 >Emitted(41, 5) Source(43, 5) + SourceIndex(0) -3 >Emitted(41, 10) Source(43, 10) + SourceIndex(0) -4 >Emitted(41, 13) Source(43, 21) + SourceIndex(0) -5 >Emitted(41, 14) Source(43, 28) + SourceIndex(0) -6 >Emitted(41, 15) Source(43, 29) + SourceIndex(0) -7 >Emitted(41, 17) Source(43, 31) + SourceIndex(0) -8 >Emitted(41, 18) Source(43, 32) + SourceIndex(0) -9 >Emitted(41, 20) Source(43, 39) + SourceIndex(0) -10>Emitted(41, 21) Source(43, 40) + SourceIndex(0) -11>Emitted(41, 23) Source(43, 42) + SourceIndex(0) -12>Emitted(41, 24) Source(43, 43) + SourceIndex(0) -13>Emitted(41, 25) Source(43, 44) + SourceIndex(0) -14>Emitted(41, 26) Source(43, 45) + SourceIndex(0) +1->Emitted(29, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(29, 5) Source(43, 5) + SourceIndex(0) +3 >Emitted(29, 10) Source(43, 10) + SourceIndex(0) +4 >Emitted(29, 13) Source(43, 21) + SourceIndex(0) +5 >Emitted(29, 14) Source(43, 28) + SourceIndex(0) +6 >Emitted(29, 15) Source(43, 29) + SourceIndex(0) +7 >Emitted(29, 17) Source(43, 31) + SourceIndex(0) +8 >Emitted(29, 18) Source(43, 32) + SourceIndex(0) +9 >Emitted(29, 20) Source(43, 39) + SourceIndex(0) +10>Emitted(29, 21) Source(43, 40) + SourceIndex(0) +11>Emitted(29, 23) Source(43, 42) + SourceIndex(0) +12>Emitted(29, 24) Source(43, 43) + SourceIndex(0) +13>Emitted(29, 25) Source(43, 44) + SourceIndex(0) +14>Emitted(29, 26) Source(43, 45) + SourceIndex(0) --- ->>>var c3t11 = [function (n, s) { +>>>var c3t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^ @@ -767,6 +740,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -777,63 +759,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(42, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(42, 5) Source(44, 5) + SourceIndex(0) -3 >Emitted(42, 10) Source(44, 10) + SourceIndex(0) -4 >Emitted(42, 13) Source(44, 50) + SourceIndex(0) -5 >Emitted(42, 14) Source(44, 51) + SourceIndex(0) -6 >Emitted(42, 24) Source(44, 60) + SourceIndex(0) -7 >Emitted(42, 25) Source(44, 61) + SourceIndex(0) -8 >Emitted(42, 27) Source(44, 63) + SourceIndex(0) -9 >Emitted(42, 28) Source(44, 64) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(43, 5) Source(44, 68) + SourceIndex(0) -2 >Emitted(43, 11) Source(44, 74) + SourceIndex(0) -3 >Emitted(43, 12) Source(44, 75) + SourceIndex(0) -4 >Emitted(43, 13) Source(44, 76) + SourceIndex(0) -5 >Emitted(43, 14) Source(44, 77) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(44, 1) Source(44, 78) + SourceIndex(0) -2 >Emitted(44, 2) Source(44, 79) + SourceIndex(0) -3 >Emitted(44, 3) Source(44, 80) + SourceIndex(0) -4 >Emitted(44, 4) Source(44, 81) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(44, 5) + SourceIndex(0) +3 >Emitted(30, 10) Source(44, 10) + SourceIndex(0) +4 >Emitted(30, 13) Source(44, 50) + SourceIndex(0) +5 >Emitted(30, 14) Source(44, 51) + SourceIndex(0) +6 >Emitted(30, 24) Source(44, 60) + SourceIndex(0) +7 >Emitted(30, 25) Source(44, 61) + SourceIndex(0) +8 >Emitted(30, 27) Source(44, 63) + SourceIndex(0) +9 >Emitted(30, 28) Source(44, 64) + SourceIndex(0) +10>Emitted(30, 32) Source(44, 68) + SourceIndex(0) +11>Emitted(30, 38) Source(44, 74) + SourceIndex(0) +12>Emitted(30, 39) Source(44, 75) + SourceIndex(0) +13>Emitted(30, 40) Source(44, 76) + SourceIndex(0) +14>Emitted(30, 41) Source(44, 77) + SourceIndex(0) +15>Emitted(30, 42) Source(44, 78) + SourceIndex(0) +16>Emitted(30, 43) Source(44, 79) + SourceIndex(0) +17>Emitted(30, 44) Source(44, 80) + SourceIndex(0) +18>Emitted(30, 45) Source(44, 81) + SourceIndex(0) --- >>>var c3t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^-> -1-> +1 > > 2 >var 3 > c3t12 4 > : IBar = -1->Emitted(45, 1) Source(45, 1) + SourceIndex(0) -2 >Emitted(45, 5) Source(45, 5) + SourceIndex(0) -3 >Emitted(45, 10) Source(45, 10) + SourceIndex(0) -4 >Emitted(45, 13) Source(45, 19) + SourceIndex(0) +1 >Emitted(31, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(45, 5) + SourceIndex(0) +3 >Emitted(31, 10) Source(45, 10) + SourceIndex(0) +4 >Emitted(31, 13) Source(45, 19) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -849,12 +817,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(46, 5) Source(46, 5) + SourceIndex(0) -2 >Emitted(46, 8) Source(46, 8) + SourceIndex(0) -3 >Emitted(46, 10) Source(46, 16) + SourceIndex(0) -4 >Emitted(46, 11) Source(46, 17) + SourceIndex(0) -5 >Emitted(46, 13) Source(46, 19) + SourceIndex(0) -6 >Emitted(46, 14) Source(46, 20) + SourceIndex(0) +1->Emitted(32, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(32, 8) Source(46, 8) + SourceIndex(0) +3 >Emitted(32, 10) Source(46, 16) + SourceIndex(0) +4 >Emitted(32, 11) Source(46, 17) + SourceIndex(0) +5 >Emitted(32, 13) Source(46, 19) + SourceIndex(0) +6 >Emitted(32, 14) Source(46, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -863,8 +831,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(47, 2) Source(47, 2) + SourceIndex(0) -2 >Emitted(47, 3) Source(47, 2) + SourceIndex(0) +1 >Emitted(33, 2) Source(47, 2) + SourceIndex(0) +2 >Emitted(33, 3) Source(47, 2) + SourceIndex(0) --- >>>var c3t13 = ({ 1-> @@ -872,20 +840,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c3t13 4 > = 5 > ( -1->Emitted(48, 1) Source(48, 1) + SourceIndex(0) -2 >Emitted(48, 5) Source(48, 5) + SourceIndex(0) -3 >Emitted(48, 10) Source(48, 10) + SourceIndex(0) -4 >Emitted(48, 13) Source(48, 19) + SourceIndex(0) -5 >Emitted(48, 14) Source(48, 20) + SourceIndex(0) +1->Emitted(34, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(34, 5) Source(48, 5) + SourceIndex(0) +3 >Emitted(34, 10) Source(48, 10) + SourceIndex(0) +4 >Emitted(34, 13) Source(48, 19) + SourceIndex(0) +5 >Emitted(34, 14) Source(48, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -893,6 +861,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -901,38 +876,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(49, 5) Source(49, 5) + SourceIndex(0) -2 >Emitted(49, 6) Source(49, 6) + SourceIndex(0) -3 >Emitted(49, 8) Source(49, 8) + SourceIndex(0) -4 >Emitted(49, 18) Source(49, 17) + SourceIndex(0) -5 >Emitted(49, 19) Source(49, 18) + SourceIndex(0) -6 >Emitted(49, 21) Source(49, 20) + SourceIndex(0) -7 >Emitted(49, 22) Source(49, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(50, 9) Source(49, 25) + SourceIndex(0) -2 >Emitted(50, 15) Source(49, 31) + SourceIndex(0) -3 >Emitted(50, 16) Source(49, 32) + SourceIndex(0) -4 >Emitted(50, 17) Source(49, 33) + SourceIndex(0) -5 >Emitted(50, 18) Source(49, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(51, 5) Source(49, 35) + SourceIndex(0) -2 >Emitted(51, 6) Source(49, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(35, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(35, 6) Source(49, 6) + SourceIndex(0) +3 >Emitted(35, 8) Source(49, 8) + SourceIndex(0) +4 >Emitted(35, 18) Source(49, 17) + SourceIndex(0) +5 >Emitted(35, 19) Source(49, 18) + SourceIndex(0) +6 >Emitted(35, 21) Source(49, 20) + SourceIndex(0) +7 >Emitted(35, 22) Source(49, 21) + SourceIndex(0) +8 >Emitted(35, 26) Source(49, 25) + SourceIndex(0) +9 >Emitted(35, 32) Source(49, 31) + SourceIndex(0) +10>Emitted(35, 33) Source(49, 32) + SourceIndex(0) +11>Emitted(35, 34) Source(49, 33) + SourceIndex(0) +12>Emitted(35, 35) Source(49, 34) + SourceIndex(0) +13>Emitted(35, 36) Source(49, 35) + SourceIndex(0) +14>Emitted(35, 37) Source(49, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -943,9 +907,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(52, 2) Source(50, 2) + SourceIndex(0) -2 >Emitted(52, 3) Source(50, 3) + SourceIndex(0) -3 >Emitted(52, 4) Source(50, 3) + SourceIndex(0) +1 >Emitted(36, 2) Source(50, 2) + SourceIndex(0) +2 >Emitted(36, 3) Source(50, 3) + SourceIndex(0) +3 >Emitted(36, 4) Source(50, 3) + SourceIndex(0) --- >>>var c3t14 = ({ 1-> @@ -959,11 +923,11 @@ sourceFile:contextualTyping.ts 3 > c3t14 4 > = 5 > ( -1->Emitted(53, 1) Source(51, 1) + SourceIndex(0) -2 >Emitted(53, 5) Source(51, 5) + SourceIndex(0) -3 >Emitted(53, 10) Source(51, 10) + SourceIndex(0) -4 >Emitted(53, 13) Source(51, 19) + SourceIndex(0) -5 >Emitted(53, 14) Source(51, 20) + SourceIndex(0) +1->Emitted(37, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(37, 5) Source(51, 5) + SourceIndex(0) +3 >Emitted(37, 10) Source(51, 10) + SourceIndex(0) +4 >Emitted(37, 13) Source(51, 19) + SourceIndex(0) +5 >Emitted(37, 14) Source(51, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -975,10 +939,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(54, 5) Source(52, 5) + SourceIndex(0) -2 >Emitted(54, 6) Source(52, 6) + SourceIndex(0) -3 >Emitted(54, 8) Source(52, 8) + SourceIndex(0) -4 >Emitted(54, 10) Source(52, 10) + SourceIndex(0) +1 >Emitted(38, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(38, 6) Source(52, 6) + SourceIndex(0) +3 >Emitted(38, 8) Source(52, 8) + SourceIndex(0) +4 >Emitted(38, 10) Source(52, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -989,9 +953,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(55, 2) Source(53, 2) + SourceIndex(0) -2 >Emitted(55, 3) Source(53, 3) + SourceIndex(0) -3 >Emitted(55, 4) Source(53, 3) + SourceIndex(0) +1 >Emitted(39, 2) Source(53, 2) + SourceIndex(0) +2 >Emitted(39, 3) Source(53, 3) + SourceIndex(0) +3 >Emitted(39, 4) Source(53, 3) + SourceIndex(0) --- >>>// CONTEXT: Class property assignment 1-> @@ -1003,9 +967,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Class property assignment -1->Emitted(56, 1) Source(56, 1) + SourceIndex(0) -2 >Emitted(56, 1) Source(55, 1) + SourceIndex(0) -3 >Emitted(56, 38) Source(55, 38) + SourceIndex(0) +1->Emitted(40, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(40, 1) Source(55, 1) + SourceIndex(0) +3 >Emitted(40, 38) Source(55, 38) + SourceIndex(0) --- >>>var C4T5 = (function () { 1 >^^^^ @@ -1014,8 +978,8 @@ sourceFile:contextualTyping.ts 1 > >class 2 > C4T5 -1 >Emitted(57, 5) Source(56, 7) + SourceIndex(0) -2 >Emitted(57, 9) Source(56, 11) + SourceIndex(0) +1 >Emitted(41, 5) Source(56, 7) + SourceIndex(0) +2 >Emitted(41, 9) Source(56, 11) + SourceIndex(0) --- >>> function C4T5() { 1->^^^^ @@ -1027,9 +991,9 @@ sourceFile:contextualTyping.ts > 2 > 3 > C4T5 -1->Emitted(58, 5) Source(58, 5) + SourceIndex(0) name (C4T5) -2 >Emitted(58, 14) Source(56, 7) + SourceIndex(0) name (C4T5) -3 >Emitted(58, 18) Source(56, 11) + SourceIndex(0) name (C4T5) +1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5) +2 >Emitted(42, 14) Source(56, 7) + SourceIndex(0) name (C4T5) +3 >Emitted(42, 18) Source(56, 11) + SourceIndex(0) name (C4T5) --- >>> this.foo = function (i, s) { 1->^^^^^^^^ @@ -1053,15 +1017,15 @@ sourceFile:contextualTyping.ts 7 > i 8 > , 9 > s -1->Emitted(59, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(59, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) -3 >Emitted(59, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) -4 >Emitted(59, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) -5 >Emitted(59, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) -6 >Emitted(59, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) -7 >Emitted(59, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) -8 >Emitted(59, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) -9 >Emitted(59, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) +1->Emitted(43, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(43, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) +3 >Emitted(43, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) +4 >Emitted(43, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) +5 >Emitted(43, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) +6 >Emitted(43, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) +7 >Emitted(43, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) +8 >Emitted(43, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) +9 >Emitted(43, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) --- >>> return s; 1 >^^^^^^^^^^^^ @@ -1075,11 +1039,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(60, 13) Source(60, 13) + SourceIndex(0) -2 >Emitted(60, 19) Source(60, 19) + SourceIndex(0) -3 >Emitted(60, 20) Source(60, 20) + SourceIndex(0) -4 >Emitted(60, 21) Source(60, 21) + SourceIndex(0) -5 >Emitted(60, 22) Source(60, 22) + SourceIndex(0) +1 >Emitted(44, 13) Source(60, 13) + SourceIndex(0) +2 >Emitted(44, 19) Source(60, 19) + SourceIndex(0) +3 >Emitted(44, 20) Source(60, 20) + SourceIndex(0) +4 >Emitted(44, 21) Source(60, 21) + SourceIndex(0) +5 >Emitted(44, 22) Source(60, 22) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^ @@ -1089,9 +1053,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(61, 9) Source(61, 9) + SourceIndex(0) -2 >Emitted(61, 10) Source(61, 10) + SourceIndex(0) -3 >Emitted(61, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(45, 9) Source(61, 9) + SourceIndex(0) +2 >Emitted(45, 10) Source(61, 10) + SourceIndex(0) +3 >Emitted(45, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) --- >>> } 1 >^^^^ @@ -1100,8 +1064,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(62, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(62, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(46, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(46, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) --- >>> return C4T5; 1->^^^^ @@ -1109,8 +1073,8 @@ sourceFile:contextualTyping.ts 1-> > 2 > } -1->Emitted(63, 5) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(63, 16) Source(63, 2) + SourceIndex(0) name (C4T5) +1->Emitted(47, 5) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(47, 16) Source(63, 2) + SourceIndex(0) name (C4T5) --- >>>})(); 1 > @@ -1129,10 +1093,10 @@ sourceFile:contextualTyping.ts > } > } > } -1 >Emitted(64, 1) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(64, 2) Source(63, 2) + SourceIndex(0) name (C4T5) -3 >Emitted(64, 2) Source(56, 1) + SourceIndex(0) -4 >Emitted(64, 6) Source(63, 2) + SourceIndex(0) +1 >Emitted(48, 1) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(48, 2) Source(63, 2) + SourceIndex(0) name (C4T5) +3 >Emitted(48, 2) Source(56, 1) + SourceIndex(0) +4 >Emitted(48, 6) Source(63, 2) + SourceIndex(0) --- >>>// CONTEXT: Module property assignment 1-> @@ -1144,9 +1108,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Module property assignment -1->Emitted(65, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(65, 1) Source(65, 1) + SourceIndex(0) -3 >Emitted(65, 39) Source(65, 39) + SourceIndex(0) +1->Emitted(49, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(49, 1) Source(65, 1) + SourceIndex(0) +3 >Emitted(49, 39) Source(65, 39) + SourceIndex(0) --- >>>var C5T5; 1 > @@ -1164,10 +1128,10 @@ sourceFile:contextualTyping.ts > return s; > } > } -1 >Emitted(66, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(66, 5) Source(66, 8) + SourceIndex(0) -3 >Emitted(66, 9) Source(66, 12) + SourceIndex(0) -4 >Emitted(66, 10) Source(71, 2) + SourceIndex(0) +1 >Emitted(50, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(50, 5) Source(66, 8) + SourceIndex(0) +3 >Emitted(50, 9) Source(66, 12) + SourceIndex(0) +4 >Emitted(50, 10) Source(71, 2) + SourceIndex(0) --- >>>(function (C5T5) { 1-> @@ -1180,11 +1144,11 @@ sourceFile:contextualTyping.ts 3 > C5T5 4 > 5 > { -1->Emitted(67, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(67, 12) Source(66, 8) + SourceIndex(0) -3 >Emitted(67, 16) Source(66, 12) + SourceIndex(0) -4 >Emitted(67, 18) Source(66, 13) + SourceIndex(0) -5 >Emitted(67, 19) Source(66, 14) + SourceIndex(0) +1->Emitted(51, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(51, 12) Source(66, 8) + SourceIndex(0) +3 >Emitted(51, 16) Source(66, 12) + SourceIndex(0) +4 >Emitted(51, 18) Source(66, 13) + SourceIndex(0) +5 >Emitted(51, 19) Source(66, 14) + SourceIndex(0) --- >>> C5T5.foo; 1 >^^^^ @@ -1195,9 +1159,9 @@ sourceFile:contextualTyping.ts > export var 2 > foo: (i: number, s: string) => string 3 > ; -1 >Emitted(68, 5) Source(67, 16) + SourceIndex(0) name (C5T5) -2 >Emitted(68, 13) Source(67, 53) + SourceIndex(0) name (C5T5) -3 >Emitted(68, 14) Source(67, 54) + SourceIndex(0) name (C5T5) +1 >Emitted(52, 5) Source(67, 16) + SourceIndex(0) name (C5T5) +2 >Emitted(52, 13) Source(67, 53) + SourceIndex(0) name (C5T5) +3 >Emitted(52, 14) Source(67, 54) + SourceIndex(0) name (C5T5) --- >>> C5T5.foo = function (i, s) { 1->^^^^ @@ -1215,13 +1179,13 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(69, 5) Source(68, 5) + SourceIndex(0) name (C5T5) -2 >Emitted(69, 13) Source(68, 8) + SourceIndex(0) name (C5T5) -3 >Emitted(69, 16) Source(68, 11) + SourceIndex(0) name (C5T5) -4 >Emitted(69, 26) Source(68, 20) + SourceIndex(0) name (C5T5) -5 >Emitted(69, 27) Source(68, 21) + SourceIndex(0) name (C5T5) -6 >Emitted(69, 29) Source(68, 23) + SourceIndex(0) name (C5T5) -7 >Emitted(69, 30) Source(68, 24) + SourceIndex(0) name (C5T5) +1->Emitted(53, 5) Source(68, 5) + SourceIndex(0) name (C5T5) +2 >Emitted(53, 13) Source(68, 8) + SourceIndex(0) name (C5T5) +3 >Emitted(53, 16) Source(68, 11) + SourceIndex(0) name (C5T5) +4 >Emitted(53, 26) Source(68, 20) + SourceIndex(0) name (C5T5) +5 >Emitted(53, 27) Source(68, 21) + SourceIndex(0) name (C5T5) +6 >Emitted(53, 29) Source(68, 23) + SourceIndex(0) name (C5T5) +7 >Emitted(53, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- >>> return s; 1 >^^^^^^^^ @@ -1235,11 +1199,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(70, 9) Source(69, 9) + SourceIndex(0) -2 >Emitted(70, 15) Source(69, 15) + SourceIndex(0) -3 >Emitted(70, 16) Source(69, 16) + SourceIndex(0) -4 >Emitted(70, 17) Source(69, 17) + SourceIndex(0) -5 >Emitted(70, 18) Source(69, 18) + SourceIndex(0) +1 >Emitted(54, 9) Source(69, 9) + SourceIndex(0) +2 >Emitted(54, 15) Source(69, 15) + SourceIndex(0) +3 >Emitted(54, 16) Source(69, 16) + SourceIndex(0) +4 >Emitted(54, 17) Source(69, 17) + SourceIndex(0) +5 >Emitted(54, 18) Source(69, 18) + SourceIndex(0) --- >>> }; 1 >^^^^ @@ -1250,9 +1214,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(71, 5) Source(70, 5) + SourceIndex(0) -2 >Emitted(71, 6) Source(70, 6) + SourceIndex(0) -3 >Emitted(71, 7) Source(70, 6) + SourceIndex(0) name (C5T5) +1 >Emitted(55, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(55, 6) Source(70, 6) + SourceIndex(0) +3 >Emitted(55, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- >>>})(C5T5 || (C5T5 = {})); 1-> @@ -1276,13 +1240,13 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(72, 1) Source(71, 1) + SourceIndex(0) name (C5T5) -2 >Emitted(72, 2) Source(71, 2) + SourceIndex(0) name (C5T5) -3 >Emitted(72, 4) Source(66, 8) + SourceIndex(0) -4 >Emitted(72, 8) Source(66, 12) + SourceIndex(0) -5 >Emitted(72, 13) Source(66, 8) + SourceIndex(0) -6 >Emitted(72, 17) Source(66, 12) + SourceIndex(0) -7 >Emitted(72, 25) Source(71, 2) + SourceIndex(0) +1->Emitted(56, 1) Source(71, 1) + SourceIndex(0) name (C5T5) +2 >Emitted(56, 2) Source(71, 2) + SourceIndex(0) name (C5T5) +3 >Emitted(56, 4) Source(66, 8) + SourceIndex(0) +4 >Emitted(56, 8) Source(66, 12) + SourceIndex(0) +5 >Emitted(56, 13) Source(66, 8) + SourceIndex(0) +6 >Emitted(56, 17) Source(66, 12) + SourceIndex(0) +7 >Emitted(56, 25) Source(71, 2) + SourceIndex(0) --- >>>// CONTEXT: Variable assignment 1-> @@ -1294,89 +1258,84 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Variable assignment -1->Emitted(73, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(73, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(73, 32) Source(73, 32) + SourceIndex(0) +1->Emitted(57, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(57, 1) Source(73, 1) + SourceIndex(0) +3 >Emitted(57, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; 1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >var 2 > c6t5: (n: number) => IFoo 3 > ; -1 >Emitted(74, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(74, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(74, 10) Source(74, 31) + SourceIndex(0) +1 >Emitted(58, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(58, 9) Source(74, 30) + SourceIndex(0) +3 >Emitted(58, 10) Source(74, 31) + SourceIndex(0) --- ->>>c6t5 = function (n) { +>>>c6t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > 2 >c6t5 3 > = <(n: number) => IFoo> 4 > function( 5 > n -1->Emitted(75, 1) Source(75, 1) + SourceIndex(0) -2 >Emitted(75, 5) Source(75, 5) + SourceIndex(0) -3 >Emitted(75, 8) Source(75, 29) + SourceIndex(0) -4 >Emitted(75, 18) Source(75, 38) + SourceIndex(0) -5 >Emitted(75, 19) Source(75, 39) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(76, 5) Source(75, 43) + SourceIndex(0) -2 >Emitted(76, 11) Source(75, 49) + SourceIndex(0) -3 >Emitted(76, 12) Source(75, 56) + SourceIndex(0) -4 >Emitted(76, 13) Source(75, 57) + SourceIndex(0) -5 >Emitted(76, 15) Source(75, 59) + SourceIndex(0) -6 >Emitted(76, 16) Source(75, 60) + SourceIndex(0) -7 >Emitted(76, 17) Source(75, 60) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(77, 1) Source(75, 61) + SourceIndex(0) -2 >Emitted(77, 2) Source(75, 62) + SourceIndex(0) -3 >Emitted(77, 3) Source(75, 63) + SourceIndex(0) +6 > ) { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(59, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(59, 5) Source(75, 5) + SourceIndex(0) +3 >Emitted(59, 8) Source(75, 29) + SourceIndex(0) +4 >Emitted(59, 18) Source(75, 38) + SourceIndex(0) +5 >Emitted(59, 19) Source(75, 39) + SourceIndex(0) +6 >Emitted(59, 23) Source(75, 43) + SourceIndex(0) +7 >Emitted(59, 29) Source(75, 49) + SourceIndex(0) +8 >Emitted(59, 30) Source(75, 56) + SourceIndex(0) +9 >Emitted(59, 31) Source(75, 57) + SourceIndex(0) +10>Emitted(59, 33) Source(75, 59) + SourceIndex(0) +11>Emitted(59, 34) Source(75, 60) + SourceIndex(0) +12>Emitted(59, 35) Source(75, 60) + SourceIndex(0) +13>Emitted(59, 36) Source(75, 61) + SourceIndex(0) +14>Emitted(59, 37) Source(75, 62) + SourceIndex(0) +15>Emitted(59, 38) Source(75, 63) + SourceIndex(0) --- >>>// CONTEXT: Array index assignment -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +1 > > >// CONTEXT: Array index assignment > 2 > 3 >// CONTEXT: Array index assignment -1->Emitted(78, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(78, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(78, 35) Source(77, 35) + SourceIndex(0) +1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(60, 1) Source(77, 1) + SourceIndex(0) +3 >Emitted(60, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; 1 >^^^^ @@ -1387,9 +1346,9 @@ sourceFile:contextualTyping.ts >var 2 > c7t2: IFoo[] 3 > ; -1 >Emitted(79, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(79, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(79, 10) Source(78, 18) + SourceIndex(0) +1 >Emitted(61, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(61, 9) Source(78, 17) + SourceIndex(0) +3 >Emitted(61, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -1421,20 +1380,20 @@ sourceFile:contextualTyping.ts 12> } 13> ) 14> ; -1->Emitted(80, 1) Source(79, 1) + SourceIndex(0) -2 >Emitted(80, 5) Source(79, 5) + SourceIndex(0) -3 >Emitted(80, 6) Source(79, 6) + SourceIndex(0) -4 >Emitted(80, 7) Source(79, 7) + SourceIndex(0) -5 >Emitted(80, 8) Source(79, 8) + SourceIndex(0) -6 >Emitted(80, 11) Source(79, 17) + SourceIndex(0) -7 >Emitted(80, 12) Source(79, 18) + SourceIndex(0) -8 >Emitted(80, 14) Source(79, 19) + SourceIndex(0) -9 >Emitted(80, 15) Source(79, 20) + SourceIndex(0) -10>Emitted(80, 17) Source(79, 22) + SourceIndex(0) -11>Emitted(80, 18) Source(79, 23) + SourceIndex(0) -12>Emitted(80, 20) Source(79, 24) + SourceIndex(0) -13>Emitted(80, 21) Source(79, 25) + SourceIndex(0) -14>Emitted(80, 22) Source(79, 26) + SourceIndex(0) +1->Emitted(62, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(62, 5) Source(79, 5) + SourceIndex(0) +3 >Emitted(62, 6) Source(79, 6) + SourceIndex(0) +4 >Emitted(62, 7) Source(79, 7) + SourceIndex(0) +5 >Emitted(62, 8) Source(79, 8) + SourceIndex(0) +6 >Emitted(62, 11) Source(79, 17) + SourceIndex(0) +7 >Emitted(62, 12) Source(79, 18) + SourceIndex(0) +8 >Emitted(62, 14) Source(79, 19) + SourceIndex(0) +9 >Emitted(62, 15) Source(79, 20) + SourceIndex(0) +10>Emitted(62, 17) Source(79, 22) + SourceIndex(0) +11>Emitted(62, 18) Source(79, 23) + SourceIndex(0) +12>Emitted(62, 20) Source(79, 24) + SourceIndex(0) +13>Emitted(62, 21) Source(79, 25) + SourceIndex(0) +14>Emitted(62, 22) Source(79, 26) + SourceIndex(0) --- >>>var objc8 = ({}); 1 > @@ -1445,7 +1404,7 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 8 > ^ -9 > ^^^^^^^^^^-> +9 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > >// CONTEXT: Object property assignment @@ -1495,16 +1454,16 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1 >Emitted(81, 1) Source(102, 1) + SourceIndex(0) -2 >Emitted(81, 5) Source(102, 5) + SourceIndex(0) -3 >Emitted(81, 10) Source(102, 10) + SourceIndex(0) -4 >Emitted(81, 13) Source(120, 19) + SourceIndex(0) -5 >Emitted(81, 14) Source(120, 20) + SourceIndex(0) -6 >Emitted(81, 16) Source(120, 22) + SourceIndex(0) -7 >Emitted(81, 17) Source(120, 23) + SourceIndex(0) -8 >Emitted(81, 18) Source(120, 24) + SourceIndex(0) +1 >Emitted(63, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(63, 5) Source(102, 5) + SourceIndex(0) +3 >Emitted(63, 10) Source(102, 10) + SourceIndex(0) +4 >Emitted(63, 13) Source(120, 19) + SourceIndex(0) +5 >Emitted(63, 14) Source(120, 20) + SourceIndex(0) +6 >Emitted(63, 16) Source(120, 22) + SourceIndex(0) +7 >Emitted(63, 17) Source(120, 23) + SourceIndex(0) +8 >Emitted(63, 18) Source(120, 24) + SourceIndex(0) --- ->>>objc8.t1 = (function (s) { +>>>objc8.t1 = (function (s) { return s; }); 1-> 2 >^^^^^ 3 > ^ @@ -1513,6 +1472,15 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^^^^^^^^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ 1-> > > @@ -1523,67 +1491,53 @@ sourceFile:contextualTyping.ts 6 > ( 7 > function( 8 > s -1->Emitted(82, 1) Source(122, 1) + SourceIndex(0) -2 >Emitted(82, 6) Source(122, 6) + SourceIndex(0) -3 >Emitted(82, 7) Source(122, 7) + SourceIndex(0) -4 >Emitted(82, 9) Source(122, 9) + SourceIndex(0) -5 >Emitted(82, 12) Source(122, 12) + SourceIndex(0) -6 >Emitted(82, 13) Source(122, 13) + SourceIndex(0) -7 >Emitted(82, 23) Source(122, 22) + SourceIndex(0) -8 >Emitted(82, 24) Source(122, 23) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(83, 5) Source(122, 27) + SourceIndex(0) -2 >Emitted(83, 11) Source(122, 33) + SourceIndex(0) -3 >Emitted(83, 12) Source(122, 34) + SourceIndex(0) -4 >Emitted(83, 13) Source(122, 35) + SourceIndex(0) -5 >Emitted(83, 14) Source(122, 35) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(84, 1) Source(122, 36) + SourceIndex(0) -2 >Emitted(84, 2) Source(122, 37) + SourceIndex(0) -3 >Emitted(84, 3) Source(122, 38) + SourceIndex(0) -4 >Emitted(84, 4) Source(122, 39) + SourceIndex(0) +9 > ) { +10> return +11> +12> s +13> +14> +15> } +16> ) +17> ; +1->Emitted(64, 1) Source(122, 1) + SourceIndex(0) +2 >Emitted(64, 6) Source(122, 6) + SourceIndex(0) +3 >Emitted(64, 7) Source(122, 7) + SourceIndex(0) +4 >Emitted(64, 9) Source(122, 9) + SourceIndex(0) +5 >Emitted(64, 12) Source(122, 12) + SourceIndex(0) +6 >Emitted(64, 13) Source(122, 13) + SourceIndex(0) +7 >Emitted(64, 23) Source(122, 22) + SourceIndex(0) +8 >Emitted(64, 24) Source(122, 23) + SourceIndex(0) +9 >Emitted(64, 28) Source(122, 27) + SourceIndex(0) +10>Emitted(64, 34) Source(122, 33) + SourceIndex(0) +11>Emitted(64, 35) Source(122, 34) + SourceIndex(0) +12>Emitted(64, 36) Source(122, 35) + SourceIndex(0) +13>Emitted(64, 37) Source(122, 35) + SourceIndex(0) +14>Emitted(64, 38) Source(122, 36) + SourceIndex(0) +15>Emitted(64, 39) Source(122, 37) + SourceIndex(0) +16>Emitted(64, 40) Source(122, 38) + SourceIndex(0) +17>Emitted(64, 41) Source(122, 39) + SourceIndex(0) --- >>>objc8.t2 = ({ -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^ -1-> +1 > > 2 >objc8 3 > . 4 > t2 5 > = 6 > ( -1->Emitted(85, 1) Source(123, 1) + SourceIndex(0) -2 >Emitted(85, 6) Source(123, 6) + SourceIndex(0) -3 >Emitted(85, 7) Source(123, 7) + SourceIndex(0) -4 >Emitted(85, 9) Source(123, 9) + SourceIndex(0) -5 >Emitted(85, 12) Source(123, 18) + SourceIndex(0) -6 >Emitted(85, 13) Source(123, 19) + SourceIndex(0) +1 >Emitted(65, 1) Source(123, 1) + SourceIndex(0) +2 >Emitted(65, 6) Source(123, 6) + SourceIndex(0) +3 >Emitted(65, 7) Source(123, 7) + SourceIndex(0) +4 >Emitted(65, 9) Source(123, 9) + SourceIndex(0) +5 >Emitted(65, 12) Source(123, 18) + SourceIndex(0) +6 >Emitted(65, 13) Source(123, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -1595,10 +1549,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(86, 5) Source(124, 5) + SourceIndex(0) -2 >Emitted(86, 6) Source(124, 6) + SourceIndex(0) -3 >Emitted(86, 8) Source(124, 8) + SourceIndex(0) -4 >Emitted(86, 9) Source(124, 9) + SourceIndex(0) +1 >Emitted(66, 5) Source(124, 5) + SourceIndex(0) +2 >Emitted(66, 6) Source(124, 6) + SourceIndex(0) +3 >Emitted(66, 8) Source(124, 8) + SourceIndex(0) +4 >Emitted(66, 9) Source(124, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -1609,9 +1563,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(87, 2) Source(125, 2) + SourceIndex(0) -2 >Emitted(87, 3) Source(125, 3) + SourceIndex(0) -3 >Emitted(87, 4) Source(125, 4) + SourceIndex(0) +1 >Emitted(67, 2) Source(125, 2) + SourceIndex(0) +2 >Emitted(67, 3) Source(125, 3) + SourceIndex(0) +3 >Emitted(67, 4) Source(125, 4) + SourceIndex(0) --- >>>objc8.t3 = []; 1-> @@ -1621,7 +1575,7 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^-> +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1630,69 +1584,64 @@ sourceFile:contextualTyping.ts 5 > = 6 > [] 7 > ; -1->Emitted(88, 1) Source(126, 1) + SourceIndex(0) -2 >Emitted(88, 6) Source(126, 6) + SourceIndex(0) -3 >Emitted(88, 7) Source(126, 7) + SourceIndex(0) -4 >Emitted(88, 9) Source(126, 9) + SourceIndex(0) -5 >Emitted(88, 12) Source(126, 12) + SourceIndex(0) -6 >Emitted(88, 14) Source(126, 14) + SourceIndex(0) -7 >Emitted(88, 15) Source(126, 15) + SourceIndex(0) +1->Emitted(68, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(68, 6) Source(126, 6) + SourceIndex(0) +3 >Emitted(68, 7) Source(126, 7) + SourceIndex(0) +4 >Emitted(68, 9) Source(126, 9) + SourceIndex(0) +5 >Emitted(68, 12) Source(126, 12) + SourceIndex(0) +6 >Emitted(68, 14) Source(126, 14) + SourceIndex(0) +7 >Emitted(68, 15) Source(126, 15) + SourceIndex(0) --- ->>>objc8.t4 = function () { +>>>objc8.t4 = function () { return ({}); }; 1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ -6 > ^^^^^^-> +6 > ^^^^^^^^^^^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^^-> 1-> > 2 >objc8 3 > . 4 > t4 5 > = -1->Emitted(89, 1) Source(127, 1) + SourceIndex(0) -2 >Emitted(89, 6) Source(127, 6) + SourceIndex(0) -3 >Emitted(89, 7) Source(127, 7) + SourceIndex(0) -4 >Emitted(89, 9) Source(127, 9) + SourceIndex(0) -5 >Emitted(89, 12) Source(127, 12) + SourceIndex(0) +6 > function() { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(69, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(69, 6) Source(127, 6) + SourceIndex(0) +3 >Emitted(69, 7) Source(127, 7) + SourceIndex(0) +4 >Emitted(69, 9) Source(127, 9) + SourceIndex(0) +5 >Emitted(69, 12) Source(127, 12) + SourceIndex(0) +6 >Emitted(69, 26) Source(127, 25) + SourceIndex(0) +7 >Emitted(69, 32) Source(127, 31) + SourceIndex(0) +8 >Emitted(69, 33) Source(127, 38) + SourceIndex(0) +9 >Emitted(69, 34) Source(127, 39) + SourceIndex(0) +10>Emitted(69, 36) Source(127, 41) + SourceIndex(0) +11>Emitted(69, 37) Source(127, 42) + SourceIndex(0) +12>Emitted(69, 38) Source(127, 42) + SourceIndex(0) +13>Emitted(69, 39) Source(127, 43) + SourceIndex(0) +14>Emitted(69, 40) Source(127, 44) + SourceIndex(0) +15>Emitted(69, 41) Source(127, 45) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(90, 5) Source(127, 25) + SourceIndex(0) -2 >Emitted(90, 11) Source(127, 31) + SourceIndex(0) -3 >Emitted(90, 12) Source(127, 38) + SourceIndex(0) -4 >Emitted(90, 13) Source(127, 39) + SourceIndex(0) -5 >Emitted(90, 15) Source(127, 41) + SourceIndex(0) -6 >Emitted(90, 16) Source(127, 42) + SourceIndex(0) -7 >Emitted(90, 17) Source(127, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(91, 1) Source(127, 43) + SourceIndex(0) -2 >Emitted(91, 2) Source(127, 44) + SourceIndex(0) -3 >Emitted(91, 3) Source(127, 45) + SourceIndex(0) ---- ->>>objc8.t5 = function (n) { +>>>objc8.t5 = function (n) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1700,6 +1649,17 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^^^-> 1-> > 2 >objc8 @@ -1708,50 +1668,35 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(92, 1) Source(128, 1) + SourceIndex(0) -2 >Emitted(92, 6) Source(128, 6) + SourceIndex(0) -3 >Emitted(92, 7) Source(128, 7) + SourceIndex(0) -4 >Emitted(92, 9) Source(128, 9) + SourceIndex(0) -5 >Emitted(92, 12) Source(128, 12) + SourceIndex(0) -6 >Emitted(92, 22) Source(128, 21) + SourceIndex(0) -7 >Emitted(92, 23) Source(128, 22) + SourceIndex(0) +8 > ) { +9 > return +10> +11> ( +12> {} +13> ) +14> +15> +16> } +17> ; +1->Emitted(70, 1) Source(128, 1) + SourceIndex(0) +2 >Emitted(70, 6) Source(128, 6) + SourceIndex(0) +3 >Emitted(70, 7) Source(128, 7) + SourceIndex(0) +4 >Emitted(70, 9) Source(128, 9) + SourceIndex(0) +5 >Emitted(70, 12) Source(128, 12) + SourceIndex(0) +6 >Emitted(70, 22) Source(128, 21) + SourceIndex(0) +7 >Emitted(70, 23) Source(128, 22) + SourceIndex(0) +8 >Emitted(70, 27) Source(128, 26) + SourceIndex(0) +9 >Emitted(70, 33) Source(128, 32) + SourceIndex(0) +10>Emitted(70, 34) Source(128, 39) + SourceIndex(0) +11>Emitted(70, 35) Source(128, 40) + SourceIndex(0) +12>Emitted(70, 37) Source(128, 42) + SourceIndex(0) +13>Emitted(70, 38) Source(128, 43) + SourceIndex(0) +14>Emitted(70, 39) Source(128, 43) + SourceIndex(0) +15>Emitted(70, 40) Source(128, 44) + SourceIndex(0) +16>Emitted(70, 41) Source(128, 45) + SourceIndex(0) +17>Emitted(70, 42) Source(128, 46) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(93, 5) Source(128, 26) + SourceIndex(0) -2 >Emitted(93, 11) Source(128, 32) + SourceIndex(0) -3 >Emitted(93, 12) Source(128, 39) + SourceIndex(0) -4 >Emitted(93, 13) Source(128, 40) + SourceIndex(0) -5 >Emitted(93, 15) Source(128, 42) + SourceIndex(0) -6 >Emitted(93, 16) Source(128, 43) + SourceIndex(0) -7 >Emitted(93, 17) Source(128, 43) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(94, 1) Source(128, 44) + SourceIndex(0) -2 >Emitted(94, 2) Source(128, 45) + SourceIndex(0) -3 >Emitted(94, 3) Source(128, 46) + SourceIndex(0) ---- ->>>objc8.t6 = function (n, s) { +>>>objc8.t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1761,6 +1706,16 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -1771,60 +1726,54 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(95, 1) Source(129, 1) + SourceIndex(0) -2 >Emitted(95, 6) Source(129, 6) + SourceIndex(0) -3 >Emitted(95, 7) Source(129, 7) + SourceIndex(0) -4 >Emitted(95, 9) Source(129, 9) + SourceIndex(0) -5 >Emitted(95, 12) Source(129, 12) + SourceIndex(0) -6 >Emitted(95, 22) Source(129, 21) + SourceIndex(0) -7 >Emitted(95, 23) Source(129, 22) + SourceIndex(0) -8 >Emitted(95, 25) Source(129, 24) + SourceIndex(0) -9 >Emitted(95, 26) Source(129, 25) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ; +1->Emitted(71, 1) Source(129, 1) + SourceIndex(0) +2 >Emitted(71, 6) Source(129, 6) + SourceIndex(0) +3 >Emitted(71, 7) Source(129, 7) + SourceIndex(0) +4 >Emitted(71, 9) Source(129, 9) + SourceIndex(0) +5 >Emitted(71, 12) Source(129, 12) + SourceIndex(0) +6 >Emitted(71, 22) Source(129, 21) + SourceIndex(0) +7 >Emitted(71, 23) Source(129, 22) + SourceIndex(0) +8 >Emitted(71, 25) Source(129, 24) + SourceIndex(0) +9 >Emitted(71, 26) Source(129, 25) + SourceIndex(0) +10>Emitted(71, 30) Source(129, 29) + SourceIndex(0) +11>Emitted(71, 36) Source(129, 35) + SourceIndex(0) +12>Emitted(71, 37) Source(129, 42) + SourceIndex(0) +13>Emitted(71, 38) Source(129, 43) + SourceIndex(0) +14>Emitted(71, 40) Source(129, 45) + SourceIndex(0) +15>Emitted(71, 41) Source(129, 46) + SourceIndex(0) +16>Emitted(71, 42) Source(129, 46) + SourceIndex(0) +17>Emitted(71, 43) Source(129, 47) + SourceIndex(0) +18>Emitted(71, 44) Source(129, 48) + SourceIndex(0) +19>Emitted(71, 45) Source(129, 49) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(96, 5) Source(129, 29) + SourceIndex(0) -2 >Emitted(96, 11) Source(129, 35) + SourceIndex(0) -3 >Emitted(96, 12) Source(129, 42) + SourceIndex(0) -4 >Emitted(96, 13) Source(129, 43) + SourceIndex(0) -5 >Emitted(96, 15) Source(129, 45) + SourceIndex(0) -6 >Emitted(96, 16) Source(129, 46) + SourceIndex(0) -7 >Emitted(96, 17) Source(129, 46) + SourceIndex(0) ---- ->>>}; +>>>objc8.t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(97, 1) Source(129, 47) + SourceIndex(0) -2 >Emitted(97, 2) Source(129, 48) + SourceIndex(0) -3 >Emitted(97, 3) Source(129, 49) + SourceIndex(0) ---- ->>>objc8.t7 = function (n) { -1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ -1-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^-> +1 > > 2 >objc8 3 > . @@ -1832,44 +1781,31 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n: number -1->Emitted(98, 1) Source(130, 1) + SourceIndex(0) -2 >Emitted(98, 6) Source(130, 6) + SourceIndex(0) -3 >Emitted(98, 7) Source(130, 7) + SourceIndex(0) -4 >Emitted(98, 9) Source(130, 9) + SourceIndex(0) -5 >Emitted(98, 12) Source(130, 12) + SourceIndex(0) -6 >Emitted(98, 22) Source(130, 21) + SourceIndex(0) -7 >Emitted(98, 23) Source(130, 30) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> +13> +14> } +15> ; +1 >Emitted(72, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(72, 6) Source(130, 6) + SourceIndex(0) +3 >Emitted(72, 7) Source(130, 7) + SourceIndex(0) +4 >Emitted(72, 9) Source(130, 9) + SourceIndex(0) +5 >Emitted(72, 12) Source(130, 12) + SourceIndex(0) +6 >Emitted(72, 22) Source(130, 21) + SourceIndex(0) +7 >Emitted(72, 23) Source(130, 30) + SourceIndex(0) +8 >Emitted(72, 27) Source(130, 34) + SourceIndex(0) +9 >Emitted(72, 33) Source(130, 40) + SourceIndex(0) +10>Emitted(72, 34) Source(130, 41) + SourceIndex(0) +11>Emitted(72, 35) Source(130, 42) + SourceIndex(0) +12>Emitted(72, 36) Source(130, 42) + SourceIndex(0) +13>Emitted(72, 37) Source(130, 43) + SourceIndex(0) +14>Emitted(72, 38) Source(130, 44) + SourceIndex(0) +15>Emitted(72, 39) Source(130, 45) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(99, 5) Source(130, 34) + SourceIndex(0) -2 >Emitted(99, 11) Source(130, 40) + SourceIndex(0) -3 >Emitted(99, 12) Source(130, 41) + SourceIndex(0) -4 >Emitted(99, 13) Source(130, 42) + SourceIndex(0) -5 >Emitted(99, 14) Source(130, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(100, 1) Source(130, 43) + SourceIndex(0) -2 >Emitted(100, 2) Source(130, 44) + SourceIndex(0) -3 >Emitted(100, 3) Source(130, 45) + SourceIndex(0) ---- ->>>objc8.t8 = function (n) { +>>>objc8.t8 = function (n) { return n; }; 1-> 2 >^^^^^ 3 > ^ @@ -1877,6 +1813,14 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > > @@ -1886,45 +1830,32 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(101, 1) Source(132, 1) + SourceIndex(0) -2 >Emitted(101, 6) Source(132, 6) + SourceIndex(0) -3 >Emitted(101, 7) Source(132, 7) + SourceIndex(0) -4 >Emitted(101, 9) Source(132, 9) + SourceIndex(0) -5 >Emitted(101, 12) Source(132, 12) + SourceIndex(0) -6 >Emitted(101, 22) Source(132, 21) + SourceIndex(0) -7 >Emitted(101, 23) Source(132, 22) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(102, 5) Source(132, 26) + SourceIndex(0) -2 >Emitted(102, 11) Source(132, 32) + SourceIndex(0) -3 >Emitted(102, 12) Source(132, 33) + SourceIndex(0) -4 >Emitted(102, 13) Source(132, 34) + SourceIndex(0) -5 >Emitted(102, 14) Source(132, 35) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(103, 1) Source(132, 36) + SourceIndex(0) -2 >Emitted(103, 2) Source(132, 37) + SourceIndex(0) -3 >Emitted(103, 3) Source(132, 38) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> ; +13> +14> } +15> ; +1->Emitted(73, 1) Source(132, 1) + SourceIndex(0) +2 >Emitted(73, 6) Source(132, 6) + SourceIndex(0) +3 >Emitted(73, 7) Source(132, 7) + SourceIndex(0) +4 >Emitted(73, 9) Source(132, 9) + SourceIndex(0) +5 >Emitted(73, 12) Source(132, 12) + SourceIndex(0) +6 >Emitted(73, 22) Source(132, 21) + SourceIndex(0) +7 >Emitted(73, 23) Source(132, 22) + SourceIndex(0) +8 >Emitted(73, 27) Source(132, 26) + SourceIndex(0) +9 >Emitted(73, 33) Source(132, 32) + SourceIndex(0) +10>Emitted(73, 34) Source(132, 33) + SourceIndex(0) +11>Emitted(73, 35) Source(132, 34) + SourceIndex(0) +12>Emitted(73, 36) Source(132, 35) + SourceIndex(0) +13>Emitted(73, 37) Source(132, 36) + SourceIndex(0) +14>Emitted(73, 38) Source(132, 37) + SourceIndex(0) +15>Emitted(73, 39) Source(132, 38) + SourceIndex(0) --- >>>objc8.t9 = [[], []]; -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ @@ -1936,7 +1867,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^^^^-> -1-> +1 > > 2 >objc8 3 > . @@ -1948,17 +1879,17 @@ sourceFile:contextualTyping.ts 9 > [] 10> ] 11> ; -1->Emitted(104, 1) Source(133, 1) + SourceIndex(0) -2 >Emitted(104, 6) Source(133, 6) + SourceIndex(0) -3 >Emitted(104, 7) Source(133, 7) + SourceIndex(0) -4 >Emitted(104, 9) Source(133, 9) + SourceIndex(0) -5 >Emitted(104, 12) Source(133, 12) + SourceIndex(0) -6 >Emitted(104, 13) Source(133, 13) + SourceIndex(0) -7 >Emitted(104, 15) Source(133, 15) + SourceIndex(0) -8 >Emitted(104, 17) Source(133, 16) + SourceIndex(0) -9 >Emitted(104, 19) Source(133, 18) + SourceIndex(0) -10>Emitted(104, 20) Source(133, 19) + SourceIndex(0) -11>Emitted(104, 21) Source(133, 20) + SourceIndex(0) +1 >Emitted(74, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(74, 6) Source(133, 6) + SourceIndex(0) +3 >Emitted(74, 7) Source(133, 7) + SourceIndex(0) +4 >Emitted(74, 9) Source(133, 9) + SourceIndex(0) +5 >Emitted(74, 12) Source(133, 12) + SourceIndex(0) +6 >Emitted(74, 13) Source(133, 13) + SourceIndex(0) +7 >Emitted(74, 15) Source(133, 15) + SourceIndex(0) +8 >Emitted(74, 17) Source(133, 16) + SourceIndex(0) +9 >Emitted(74, 19) Source(133, 18) + SourceIndex(0) +10>Emitted(74, 20) Source(133, 19) + SourceIndex(0) +11>Emitted(74, 21) Source(133, 20) + SourceIndex(0) --- >>>objc8.t10 = [({}), ({})]; 1-> @@ -1976,7 +1907,7 @@ sourceFile:contextualTyping.ts 13> ^ 14> ^ 15> ^ -16> ^^^^^^-> +16> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1993,23 +1924,23 @@ sourceFile:contextualTyping.ts 13> ) 14> ] 15> ; -1->Emitted(105, 1) Source(134, 1) + SourceIndex(0) -2 >Emitted(105, 6) Source(134, 6) + SourceIndex(0) -3 >Emitted(105, 7) Source(134, 7) + SourceIndex(0) -4 >Emitted(105, 10) Source(134, 10) + SourceIndex(0) -5 >Emitted(105, 13) Source(134, 13) + SourceIndex(0) -6 >Emitted(105, 14) Source(134, 20) + SourceIndex(0) -7 >Emitted(105, 15) Source(134, 21) + SourceIndex(0) -8 >Emitted(105, 17) Source(134, 23) + SourceIndex(0) -9 >Emitted(105, 18) Source(134, 24) + SourceIndex(0) -10>Emitted(105, 20) Source(134, 31) + SourceIndex(0) -11>Emitted(105, 21) Source(134, 32) + SourceIndex(0) -12>Emitted(105, 23) Source(134, 34) + SourceIndex(0) -13>Emitted(105, 24) Source(134, 35) + SourceIndex(0) -14>Emitted(105, 25) Source(134, 36) + SourceIndex(0) -15>Emitted(105, 26) Source(134, 37) + SourceIndex(0) +1->Emitted(75, 1) Source(134, 1) + SourceIndex(0) +2 >Emitted(75, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(75, 7) Source(134, 7) + SourceIndex(0) +4 >Emitted(75, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(75, 13) Source(134, 13) + SourceIndex(0) +6 >Emitted(75, 14) Source(134, 20) + SourceIndex(0) +7 >Emitted(75, 15) Source(134, 21) + SourceIndex(0) +8 >Emitted(75, 17) Source(134, 23) + SourceIndex(0) +9 >Emitted(75, 18) Source(134, 24) + SourceIndex(0) +10>Emitted(75, 20) Source(134, 31) + SourceIndex(0) +11>Emitted(75, 21) Source(134, 32) + SourceIndex(0) +12>Emitted(75, 23) Source(134, 34) + SourceIndex(0) +13>Emitted(75, 24) Source(134, 35) + SourceIndex(0) +14>Emitted(75, 25) Source(134, 36) + SourceIndex(0) +15>Emitted(75, 26) Source(134, 37) + SourceIndex(0) --- ->>>objc8.t11 = [function (n, s) { +>>>objc8.t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^^ 3 > ^ @@ -2020,6 +1951,15 @@ sourceFile:contextualTyping.ts 8 > ^ 9 > ^^ 10> ^ +11> ^^^^ +12> ^^^^^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -2031,67 +1971,53 @@ sourceFile:contextualTyping.ts 8 > n 9 > , 10> s -1->Emitted(106, 1) Source(135, 1) + SourceIndex(0) -2 >Emitted(106, 6) Source(135, 6) + SourceIndex(0) -3 >Emitted(106, 7) Source(135, 7) + SourceIndex(0) -4 >Emitted(106, 10) Source(135, 10) + SourceIndex(0) -5 >Emitted(106, 13) Source(135, 13) + SourceIndex(0) -6 >Emitted(106, 14) Source(135, 14) + SourceIndex(0) -7 >Emitted(106, 24) Source(135, 23) + SourceIndex(0) -8 >Emitted(106, 25) Source(135, 24) + SourceIndex(0) -9 >Emitted(106, 27) Source(135, 26) + SourceIndex(0) -10>Emitted(106, 28) Source(135, 27) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(107, 5) Source(135, 31) + SourceIndex(0) -2 >Emitted(107, 11) Source(135, 37) + SourceIndex(0) -3 >Emitted(107, 12) Source(135, 38) + SourceIndex(0) -4 >Emitted(107, 13) Source(135, 39) + SourceIndex(0) -5 >Emitted(107, 14) Source(135, 40) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(108, 1) Source(135, 41) + SourceIndex(0) -2 >Emitted(108, 2) Source(135, 42) + SourceIndex(0) -3 >Emitted(108, 3) Source(135, 43) + SourceIndex(0) -4 >Emitted(108, 4) Source(135, 44) + SourceIndex(0) +11> ) { +12> return +13> +14> s +15> ; +16> +17> } +18> ] +19> ; +1->Emitted(76, 1) Source(135, 1) + SourceIndex(0) +2 >Emitted(76, 6) Source(135, 6) + SourceIndex(0) +3 >Emitted(76, 7) Source(135, 7) + SourceIndex(0) +4 >Emitted(76, 10) Source(135, 10) + SourceIndex(0) +5 >Emitted(76, 13) Source(135, 13) + SourceIndex(0) +6 >Emitted(76, 14) Source(135, 14) + SourceIndex(0) +7 >Emitted(76, 24) Source(135, 23) + SourceIndex(0) +8 >Emitted(76, 25) Source(135, 24) + SourceIndex(0) +9 >Emitted(76, 27) Source(135, 26) + SourceIndex(0) +10>Emitted(76, 28) Source(135, 27) + SourceIndex(0) +11>Emitted(76, 32) Source(135, 31) + SourceIndex(0) +12>Emitted(76, 38) Source(135, 37) + SourceIndex(0) +13>Emitted(76, 39) Source(135, 38) + SourceIndex(0) +14>Emitted(76, 40) Source(135, 39) + SourceIndex(0) +15>Emitted(76, 41) Source(135, 40) + SourceIndex(0) +16>Emitted(76, 42) Source(135, 41) + SourceIndex(0) +17>Emitted(76, 43) Source(135, 42) + SourceIndex(0) +18>Emitted(76, 44) Source(135, 43) + SourceIndex(0) +19>Emitted(76, 45) Source(135, 44) + SourceIndex(0) --- >>>objc8.t12 = { -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ 6 > ^^-> -1-> +1 > > 2 >objc8 3 > . 4 > t12 5 > = -1->Emitted(109, 1) Source(136, 1) + SourceIndex(0) -2 >Emitted(109, 6) Source(136, 6) + SourceIndex(0) -3 >Emitted(109, 7) Source(136, 7) + SourceIndex(0) -4 >Emitted(109, 10) Source(136, 10) + SourceIndex(0) -5 >Emitted(109, 13) Source(136, 13) + SourceIndex(0) +1 >Emitted(77, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(77, 6) Source(136, 6) + SourceIndex(0) +3 >Emitted(77, 7) Source(136, 7) + SourceIndex(0) +4 >Emitted(77, 10) Source(136, 10) + SourceIndex(0) +5 >Emitted(77, 13) Source(136, 13) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -2107,12 +2033,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(110, 5) Source(137, 5) + SourceIndex(0) -2 >Emitted(110, 8) Source(137, 8) + SourceIndex(0) -3 >Emitted(110, 10) Source(137, 16) + SourceIndex(0) -4 >Emitted(110, 11) Source(137, 17) + SourceIndex(0) -5 >Emitted(110, 13) Source(137, 19) + SourceIndex(0) -6 >Emitted(110, 14) Source(137, 20) + SourceIndex(0) +1->Emitted(78, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(78, 8) Source(137, 8) + SourceIndex(0) +3 >Emitted(78, 10) Source(137, 16) + SourceIndex(0) +4 >Emitted(78, 11) Source(137, 17) + SourceIndex(0) +5 >Emitted(78, 13) Source(137, 19) + SourceIndex(0) +6 >Emitted(78, 14) Source(137, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -2121,8 +2047,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(111, 2) Source(138, 2) + SourceIndex(0) -2 >Emitted(111, 3) Source(138, 2) + SourceIndex(0) +1 >Emitted(79, 2) Source(138, 2) + SourceIndex(0) +2 >Emitted(79, 3) Source(138, 2) + SourceIndex(0) --- >>>objc8.t13 = ({ 1-> @@ -2131,7 +2057,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^^ 6 > ^ -7 > ^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -2139,14 +2065,14 @@ sourceFile:contextualTyping.ts 4 > t13 5 > = 6 > ( -1->Emitted(112, 1) Source(139, 1) + SourceIndex(0) -2 >Emitted(112, 6) Source(139, 6) + SourceIndex(0) -3 >Emitted(112, 7) Source(139, 7) + SourceIndex(0) -4 >Emitted(112, 10) Source(139, 10) + SourceIndex(0) -5 >Emitted(112, 13) Source(139, 19) + SourceIndex(0) -6 >Emitted(112, 14) Source(139, 20) + SourceIndex(0) +1->Emitted(80, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(80, 6) Source(139, 6) + SourceIndex(0) +3 >Emitted(80, 7) Source(139, 7) + SourceIndex(0) +4 >Emitted(80, 10) Source(139, 10) + SourceIndex(0) +5 >Emitted(80, 13) Source(139, 19) + SourceIndex(0) +6 >Emitted(80, 14) Source(139, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -2154,6 +2080,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -2162,38 +2095,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(113, 5) Source(140, 5) + SourceIndex(0) -2 >Emitted(113, 6) Source(140, 6) + SourceIndex(0) -3 >Emitted(113, 8) Source(140, 8) + SourceIndex(0) -4 >Emitted(113, 18) Source(140, 17) + SourceIndex(0) -5 >Emitted(113, 19) Source(140, 18) + SourceIndex(0) -6 >Emitted(113, 21) Source(140, 20) + SourceIndex(0) -7 >Emitted(113, 22) Source(140, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(114, 9) Source(140, 25) + SourceIndex(0) -2 >Emitted(114, 15) Source(140, 31) + SourceIndex(0) -3 >Emitted(114, 16) Source(140, 32) + SourceIndex(0) -4 >Emitted(114, 17) Source(140, 33) + SourceIndex(0) -5 >Emitted(114, 18) Source(140, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(115, 5) Source(140, 35) + SourceIndex(0) -2 >Emitted(115, 6) Source(140, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(81, 5) Source(140, 5) + SourceIndex(0) +2 >Emitted(81, 6) Source(140, 6) + SourceIndex(0) +3 >Emitted(81, 8) Source(140, 8) + SourceIndex(0) +4 >Emitted(81, 18) Source(140, 17) + SourceIndex(0) +5 >Emitted(81, 19) Source(140, 18) + SourceIndex(0) +6 >Emitted(81, 21) Source(140, 20) + SourceIndex(0) +7 >Emitted(81, 22) Source(140, 21) + SourceIndex(0) +8 >Emitted(81, 26) Source(140, 25) + SourceIndex(0) +9 >Emitted(81, 32) Source(140, 31) + SourceIndex(0) +10>Emitted(81, 33) Source(140, 32) + SourceIndex(0) +11>Emitted(81, 34) Source(140, 33) + SourceIndex(0) +12>Emitted(81, 35) Source(140, 34) + SourceIndex(0) +13>Emitted(81, 36) Source(140, 35) + SourceIndex(0) +14>Emitted(81, 37) Source(140, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -2204,9 +2126,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(116, 2) Source(141, 2) + SourceIndex(0) -2 >Emitted(116, 3) Source(141, 3) + SourceIndex(0) -3 >Emitted(116, 4) Source(141, 3) + SourceIndex(0) +1 >Emitted(82, 2) Source(141, 2) + SourceIndex(0) +2 >Emitted(82, 3) Source(141, 3) + SourceIndex(0) +3 >Emitted(82, 4) Source(141, 3) + SourceIndex(0) --- >>>objc8.t14 = ({ 1-> @@ -2222,12 +2144,12 @@ sourceFile:contextualTyping.ts 4 > t14 5 > = 6 > ( -1->Emitted(117, 1) Source(142, 1) + SourceIndex(0) -2 >Emitted(117, 6) Source(142, 6) + SourceIndex(0) -3 >Emitted(117, 7) Source(142, 7) + SourceIndex(0) -4 >Emitted(117, 10) Source(142, 10) + SourceIndex(0) -5 >Emitted(117, 13) Source(142, 19) + SourceIndex(0) -6 >Emitted(117, 14) Source(142, 20) + SourceIndex(0) +1->Emitted(83, 1) Source(142, 1) + SourceIndex(0) +2 >Emitted(83, 6) Source(142, 6) + SourceIndex(0) +3 >Emitted(83, 7) Source(142, 7) + SourceIndex(0) +4 >Emitted(83, 10) Source(142, 10) + SourceIndex(0) +5 >Emitted(83, 13) Source(142, 19) + SourceIndex(0) +6 >Emitted(83, 14) Source(142, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -2239,10 +2161,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(118, 5) Source(143, 5) + SourceIndex(0) -2 >Emitted(118, 6) Source(143, 6) + SourceIndex(0) -3 >Emitted(118, 8) Source(143, 8) + SourceIndex(0) -4 >Emitted(118, 10) Source(143, 10) + SourceIndex(0) +1 >Emitted(84, 5) Source(143, 5) + SourceIndex(0) +2 >Emitted(84, 6) Source(143, 6) + SourceIndex(0) +3 >Emitted(84, 8) Source(143, 8) + SourceIndex(0) +4 >Emitted(84, 10) Source(143, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -2253,9 +2175,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(119, 2) Source(144, 2) + SourceIndex(0) -2 >Emitted(119, 3) Source(144, 3) + SourceIndex(0) -3 >Emitted(119, 4) Source(144, 3) + SourceIndex(0) +1 >Emitted(85, 2) Source(144, 2) + SourceIndex(0) +2 >Emitted(85, 3) Source(144, 3) + SourceIndex(0) +3 >Emitted(85, 4) Source(144, 3) + SourceIndex(0) --- >>>// CONTEXT: Function call 1-> @@ -2266,9 +2188,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Function call -1->Emitted(120, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(120, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(120, 26) Source(145, 26) + SourceIndex(0) +1->Emitted(86, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(86, 1) Source(145, 1) + SourceIndex(0) +3 >Emitted(86, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } 1 >^^^^^^^^^ @@ -2282,11 +2204,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > f: (n: number) => IFoo 5 > ) {} -1 >Emitted(121, 10) Source(146, 10) + SourceIndex(0) -2 >Emitted(121, 14) Source(146, 14) + SourceIndex(0) -3 >Emitted(121, 15) Source(146, 15) + SourceIndex(0) -4 >Emitted(121, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(121, 21) Source(146, 41) + SourceIndex(0) +1 >Emitted(87, 10) Source(146, 10) + SourceIndex(0) +2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) +3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) +4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) +5 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) --- >>>; 1 > @@ -2294,8 +2216,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(122, 1) Source(146, 41) + SourceIndex(0) -2 >Emitted(122, 2) Source(146, 42) + SourceIndex(0) +1 >Emitted(88, 1) Source(146, 41) + SourceIndex(0) +2 >Emitted(88, 2) Source(146, 42) + SourceIndex(0) --- >>>c9t5(function (n) { 1-> @@ -2310,11 +2232,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > function( 5 > n -1->Emitted(123, 1) Source(147, 1) + SourceIndex(0) -2 >Emitted(123, 5) Source(147, 5) + SourceIndex(0) -3 >Emitted(123, 6) Source(147, 6) + SourceIndex(0) -4 >Emitted(123, 16) Source(147, 15) + SourceIndex(0) -5 >Emitted(123, 17) Source(147, 16) + SourceIndex(0) +1->Emitted(89, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(89, 5) Source(147, 5) + SourceIndex(0) +3 >Emitted(89, 6) Source(147, 6) + SourceIndex(0) +4 >Emitted(89, 16) Source(147, 15) + SourceIndex(0) +5 >Emitted(89, 17) Source(147, 16) + SourceIndex(0) --- >>> return ({}); 1->^^^^ @@ -2332,13 +2254,13 @@ sourceFile:contextualTyping.ts 5 > {} 6 > ) 7 > ; -1->Emitted(124, 5) Source(148, 5) + SourceIndex(0) -2 >Emitted(124, 11) Source(148, 11) + SourceIndex(0) -3 >Emitted(124, 12) Source(148, 18) + SourceIndex(0) -4 >Emitted(124, 13) Source(148, 19) + SourceIndex(0) -5 >Emitted(124, 15) Source(148, 21) + SourceIndex(0) -6 >Emitted(124, 16) Source(148, 22) + SourceIndex(0) -7 >Emitted(124, 17) Source(148, 23) + SourceIndex(0) +1->Emitted(90, 5) Source(148, 5) + SourceIndex(0) +2 >Emitted(90, 11) Source(148, 11) + SourceIndex(0) +3 >Emitted(90, 12) Source(148, 18) + SourceIndex(0) +4 >Emitted(90, 13) Source(148, 19) + SourceIndex(0) +5 >Emitted(90, 15) Source(148, 21) + SourceIndex(0) +6 >Emitted(90, 16) Source(148, 22) + SourceIndex(0) +7 >Emitted(90, 17) Source(148, 23) + SourceIndex(0) --- >>>}); 1 > @@ -2351,115 +2273,106 @@ sourceFile:contextualTyping.ts 2 >} 3 > ) 4 > ; -1 >Emitted(125, 1) Source(149, 1) + SourceIndex(0) -2 >Emitted(125, 2) Source(149, 2) + SourceIndex(0) -3 >Emitted(125, 3) Source(149, 3) + SourceIndex(0) -4 >Emitted(125, 4) Source(149, 4) + SourceIndex(0) +1 >Emitted(91, 1) Source(149, 1) + SourceIndex(0) +2 >Emitted(91, 2) Source(149, 2) + SourceIndex(0) +3 >Emitted(91, 3) Source(149, 3) + SourceIndex(0) +4 >Emitted(91, 4) Source(149, 4) + SourceIndex(0) --- >>>// CONTEXT: Return statement 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Return statement > 2 > 3 >// CONTEXT: Return statement -1->Emitted(126, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(126, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(126, 29) Source(151, 29) + SourceIndex(0) +1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(92, 1) Source(151, 1) + SourceIndex(0) +3 >Emitted(92, 29) Source(151, 29) + SourceIndex(0) --- ->>>var c10t5 = function () { -1 >^^^^ +>>>var c10t5 = function () { return function (n) { return ({}); }; }; +1->^^^^ 2 > ^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^-> -1 > +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^^^^^ +8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ +21> ^ +1-> >var 2 > c10t5 3 > : () => (n: number) => IFoo = -1 >Emitted(127, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(127, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(127, 13) Source(152, 40) + SourceIndex(0) ---- ->>> return function (n) { -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^ -5 > ^ -1->function() { -2 > return -3 > -4 > function( -5 > n -1->Emitted(128, 5) Source(152, 53) + SourceIndex(0) -2 >Emitted(128, 11) Source(152, 59) + SourceIndex(0) -3 >Emitted(128, 12) Source(152, 60) + SourceIndex(0) -4 >Emitted(128, 22) Source(152, 69) + SourceIndex(0) -5 >Emitted(128, 23) Source(152, 70) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(129, 9) Source(152, 74) + SourceIndex(0) -2 >Emitted(129, 15) Source(152, 80) + SourceIndex(0) -3 >Emitted(129, 16) Source(152, 87) + SourceIndex(0) -4 >Emitted(129, 17) Source(152, 88) + SourceIndex(0) -5 >Emitted(129, 19) Source(152, 90) + SourceIndex(0) -6 >Emitted(129, 20) Source(152, 91) + SourceIndex(0) -7 >Emitted(129, 21) Source(152, 91) + SourceIndex(0) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^ -1 > -2 > } -3 > -1 >Emitted(130, 5) Source(152, 92) + SourceIndex(0) -2 >Emitted(130, 6) Source(152, 93) + SourceIndex(0) -3 >Emitted(130, 7) Source(152, 93) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(131, 1) Source(152, 94) + SourceIndex(0) -2 >Emitted(131, 2) Source(152, 95) + SourceIndex(0) -3 >Emitted(131, 3) Source(152, 96) + SourceIndex(0) +4 > function() { +5 > return +6 > +7 > function( +8 > n +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> +19> +20> } +21> ; +1->Emitted(93, 5) Source(152, 5) + SourceIndex(0) +2 >Emitted(93, 10) Source(152, 10) + SourceIndex(0) +3 >Emitted(93, 13) Source(152, 40) + SourceIndex(0) +4 >Emitted(93, 27) Source(152, 53) + SourceIndex(0) +5 >Emitted(93, 33) Source(152, 59) + SourceIndex(0) +6 >Emitted(93, 34) Source(152, 60) + SourceIndex(0) +7 >Emitted(93, 44) Source(152, 69) + SourceIndex(0) +8 >Emitted(93, 45) Source(152, 70) + SourceIndex(0) +9 >Emitted(93, 49) Source(152, 74) + SourceIndex(0) +10>Emitted(93, 55) Source(152, 80) + SourceIndex(0) +11>Emitted(93, 56) Source(152, 87) + SourceIndex(0) +12>Emitted(93, 57) Source(152, 88) + SourceIndex(0) +13>Emitted(93, 59) Source(152, 90) + SourceIndex(0) +14>Emitted(93, 60) Source(152, 91) + SourceIndex(0) +15>Emitted(93, 61) Source(152, 91) + SourceIndex(0) +16>Emitted(93, 62) Source(152, 92) + SourceIndex(0) +17>Emitted(93, 63) Source(152, 93) + SourceIndex(0) +18>Emitted(93, 64) Source(152, 93) + SourceIndex(0) +19>Emitted(93, 65) Source(152, 94) + SourceIndex(0) +20>Emitted(93, 66) Source(152, 95) + SourceIndex(0) +21>Emitted(93, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^-> -1-> +1 > > >// CONTEXT: Newing a class > 2 > 3 >// CONTEXT: Newing a class -1->Emitted(132, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(132, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(132, 27) Source(154, 27) + SourceIndex(0) +1 >Emitted(94, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(94, 1) Source(154, 1) + SourceIndex(0) +3 >Emitted(94, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { 1->^^^^ @@ -2468,8 +2381,8 @@ sourceFile:contextualTyping.ts 1-> >class 2 > C11t5 -1->Emitted(133, 5) Source(155, 7) + SourceIndex(0) -2 >Emitted(133, 10) Source(155, 12) + SourceIndex(0) +1->Emitted(95, 5) Source(155, 7) + SourceIndex(0) +2 >Emitted(95, 10) Source(155, 12) + SourceIndex(0) --- >>> function C11t5(f) { 1->^^^^ @@ -2482,11 +2395,11 @@ sourceFile:contextualTyping.ts 3 > C11t5 4 > { constructor( 5 > f: (n: number) => IFoo -1->Emitted(134, 5) Source(155, 15) + SourceIndex(0) name (C11t5) -2 >Emitted(134, 14) Source(155, 7) + SourceIndex(0) name (C11t5) -3 >Emitted(134, 19) Source(155, 12) + SourceIndex(0) name (C11t5) -4 >Emitted(134, 20) Source(155, 27) + SourceIndex(0) name (C11t5) -5 >Emitted(134, 21) Source(155, 49) + SourceIndex(0) name (C11t5) +1->Emitted(96, 5) Source(155, 15) + SourceIndex(0) name (C11t5) +2 >Emitted(96, 14) Source(155, 7) + SourceIndex(0) name (C11t5) +3 >Emitted(96, 19) Source(155, 12) + SourceIndex(0) name (C11t5) +4 >Emitted(96, 20) Source(155, 27) + SourceIndex(0) name (C11t5) +5 >Emitted(96, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- >>> } 1 >^^^^ @@ -2494,16 +2407,16 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(135, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) -2 >Emitted(135, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(97, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +2 >Emitted(97, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- >>> return C11t5; 1->^^^^ 2 > ^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(136, 5) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(136, 17) Source(155, 56) + SourceIndex(0) name (C11t5) +1->Emitted(98, 5) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(98, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- >>>})(); 1 > @@ -2514,21 +2427,21 @@ sourceFile:contextualTyping.ts 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1 >Emitted(137, 1) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(137, 2) Source(155, 56) + SourceIndex(0) name (C11t5) -3 >Emitted(137, 2) Source(155, 1) + SourceIndex(0) -4 >Emitted(137, 6) Source(155, 56) + SourceIndex(0) +1 >Emitted(99, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(99, 2) Source(155, 56) + SourceIndex(0) name (C11t5) +3 >Emitted(99, 2) Source(155, 1) + SourceIndex(0) +4 >Emitted(99, 6) Source(155, 56) + SourceIndex(0) --- >>>; 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(138, 1) Source(155, 56) + SourceIndex(0) -2 >Emitted(138, 2) Source(155, 57) + SourceIndex(0) +1 >Emitted(100, 1) Source(155, 56) + SourceIndex(0) +2 >Emitted(100, 2) Source(155, 57) + SourceIndex(0) --- ->>>var i = new C11t5(function (n) { +>>>var i = new C11t5(function (n) { return ({}); }); 1-> 2 >^^^^ 3 > ^ @@ -2538,6 +2451,17 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^^^^^^^^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ 1-> > 2 >var @@ -2548,138 +2472,118 @@ sourceFile:contextualTyping.ts 7 > ( 8 > function( 9 > n -1->Emitted(139, 1) Source(156, 1) + SourceIndex(0) -2 >Emitted(139, 5) Source(156, 5) + SourceIndex(0) -3 >Emitted(139, 6) Source(156, 6) + SourceIndex(0) -4 >Emitted(139, 9) Source(156, 9) + SourceIndex(0) -5 >Emitted(139, 13) Source(156, 13) + SourceIndex(0) -6 >Emitted(139, 18) Source(156, 18) + SourceIndex(0) -7 >Emitted(139, 19) Source(156, 19) + SourceIndex(0) -8 >Emitted(139, 29) Source(156, 28) + SourceIndex(0) -9 >Emitted(139, 30) Source(156, 29) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(140, 5) Source(156, 33) + SourceIndex(0) -2 >Emitted(140, 11) Source(156, 39) + SourceIndex(0) -3 >Emitted(140, 12) Source(156, 46) + SourceIndex(0) -4 >Emitted(140, 13) Source(156, 47) + SourceIndex(0) -5 >Emitted(140, 15) Source(156, 49) + SourceIndex(0) -6 >Emitted(140, 16) Source(156, 50) + SourceIndex(0) -7 >Emitted(140, 17) Source(156, 50) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(141, 1) Source(156, 51) + SourceIndex(0) -2 >Emitted(141, 2) Source(156, 52) + SourceIndex(0) -3 >Emitted(141, 3) Source(156, 53) + SourceIndex(0) -4 >Emitted(141, 4) Source(156, 54) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ) +20> ; +1->Emitted(101, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(101, 5) Source(156, 5) + SourceIndex(0) +3 >Emitted(101, 6) Source(156, 6) + SourceIndex(0) +4 >Emitted(101, 9) Source(156, 9) + SourceIndex(0) +5 >Emitted(101, 13) Source(156, 13) + SourceIndex(0) +6 >Emitted(101, 18) Source(156, 18) + SourceIndex(0) +7 >Emitted(101, 19) Source(156, 19) + SourceIndex(0) +8 >Emitted(101, 29) Source(156, 28) + SourceIndex(0) +9 >Emitted(101, 30) Source(156, 29) + SourceIndex(0) +10>Emitted(101, 34) Source(156, 33) + SourceIndex(0) +11>Emitted(101, 40) Source(156, 39) + SourceIndex(0) +12>Emitted(101, 41) Source(156, 46) + SourceIndex(0) +13>Emitted(101, 42) Source(156, 47) + SourceIndex(0) +14>Emitted(101, 44) Source(156, 49) + SourceIndex(0) +15>Emitted(101, 45) Source(156, 50) + SourceIndex(0) +16>Emitted(101, 46) Source(156, 50) + SourceIndex(0) +17>Emitted(101, 47) Source(156, 51) + SourceIndex(0) +18>Emitted(101, 48) Source(156, 52) + SourceIndex(0) +19>Emitted(101, 49) Source(156, 53) + SourceIndex(0) +20>Emitted(101, 50) Source(156, 54) + SourceIndex(0) --- >>>// CONTEXT: Type annotated expression -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +4 > ^^^^^-> +1 > > >// CONTEXT: Type annotated expression > 2 > 3 >// CONTEXT: Type annotated expression -1->Emitted(142, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(142, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(142, 38) Source(158, 38) + SourceIndex(0) +1 >Emitted(102, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(102, 1) Source(158, 1) + SourceIndex(0) +3 >Emitted(102, 38) Source(158, 38) + SourceIndex(0) --- ->>>var c12t1 = (function (s) { -1 >^^^^ +>>>var c12t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c12t1 3 > = <(s: string) => string> 4 > ( 5 > function( 6 > s -1 >Emitted(143, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(143, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(143, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(143, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(143, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(143, 25) Source(159, 48) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(144, 5) Source(159, 52) + SourceIndex(0) -2 >Emitted(144, 11) Source(159, 58) + SourceIndex(0) -3 >Emitted(144, 12) Source(159, 59) + SourceIndex(0) -4 >Emitted(144, 13) Source(159, 60) + SourceIndex(0) -5 >Emitted(144, 14) Source(159, 60) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(145, 1) Source(159, 61) + SourceIndex(0) -2 >Emitted(145, 2) Source(159, 62) + SourceIndex(0) -3 >Emitted(145, 3) Source(159, 63) + SourceIndex(0) -4 >Emitted(145, 4) Source(159, 64) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(103, 5) Source(159, 5) + SourceIndex(0) +2 >Emitted(103, 10) Source(159, 10) + SourceIndex(0) +3 >Emitted(103, 13) Source(159, 37) + SourceIndex(0) +4 >Emitted(103, 14) Source(159, 38) + SourceIndex(0) +5 >Emitted(103, 24) Source(159, 47) + SourceIndex(0) +6 >Emitted(103, 25) Source(159, 48) + SourceIndex(0) +7 >Emitted(103, 29) Source(159, 52) + SourceIndex(0) +8 >Emitted(103, 35) Source(159, 58) + SourceIndex(0) +9 >Emitted(103, 36) Source(159, 59) + SourceIndex(0) +10>Emitted(103, 37) Source(159, 60) + SourceIndex(0) +11>Emitted(103, 38) Source(159, 60) + SourceIndex(0) +12>Emitted(103, 39) Source(159, 61) + SourceIndex(0) +13>Emitted(103, 40) Source(159, 62) + SourceIndex(0) +14>Emitted(103, 41) Source(159, 63) + SourceIndex(0) +15>Emitted(103, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c12t2 4 > = 5 > ( -1->Emitted(146, 1) Source(160, 1) + SourceIndex(0) -2 >Emitted(146, 5) Source(160, 5) + SourceIndex(0) -3 >Emitted(146, 10) Source(160, 10) + SourceIndex(0) -4 >Emitted(146, 13) Source(160, 20) + SourceIndex(0) -5 >Emitted(146, 14) Source(160, 21) + SourceIndex(0) +1 >Emitted(104, 1) Source(160, 1) + SourceIndex(0) +2 >Emitted(104, 5) Source(160, 5) + SourceIndex(0) +3 >Emitted(104, 10) Source(160, 10) + SourceIndex(0) +4 >Emitted(104, 13) Source(160, 20) + SourceIndex(0) +5 >Emitted(104, 14) Source(160, 21) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -2691,10 +2595,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(147, 5) Source(161, 5) + SourceIndex(0) -2 >Emitted(147, 6) Source(161, 6) + SourceIndex(0) -3 >Emitted(147, 8) Source(161, 8) + SourceIndex(0) -4 >Emitted(147, 9) Source(161, 9) + SourceIndex(0) +1 >Emitted(105, 5) Source(161, 5) + SourceIndex(0) +2 >Emitted(105, 6) Source(161, 6) + SourceIndex(0) +3 >Emitted(105, 8) Source(161, 8) + SourceIndex(0) +4 >Emitted(105, 9) Source(161, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -2705,9 +2609,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(148, 2) Source(162, 2) + SourceIndex(0) -2 >Emitted(148, 3) Source(162, 3) + SourceIndex(0) -3 >Emitted(148, 4) Source(162, 4) + SourceIndex(0) +1 >Emitted(106, 2) Source(162, 2) + SourceIndex(0) +2 >Emitted(106, 3) Source(162, 3) + SourceIndex(0) +3 >Emitted(106, 4) Source(162, 4) + SourceIndex(0) --- >>>var c12t3 = []; 1-> @@ -2716,7 +2620,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2724,71 +2628,77 @@ sourceFile:contextualTyping.ts 4 > = 5 > [] 6 > ; -1->Emitted(149, 1) Source(163, 1) + SourceIndex(0) -2 >Emitted(149, 5) Source(163, 5) + SourceIndex(0) -3 >Emitted(149, 10) Source(163, 10) + SourceIndex(0) -4 >Emitted(149, 13) Source(163, 24) + SourceIndex(0) -5 >Emitted(149, 15) Source(163, 26) + SourceIndex(0) -6 >Emitted(149, 16) Source(163, 27) + SourceIndex(0) +1->Emitted(107, 1) Source(163, 1) + SourceIndex(0) +2 >Emitted(107, 5) Source(163, 5) + SourceIndex(0) +3 >Emitted(107, 10) Source(163, 10) + SourceIndex(0) +4 >Emitted(107, 13) Source(163, 24) + SourceIndex(0) +5 >Emitted(107, 15) Source(163, 26) + SourceIndex(0) +6 >Emitted(107, 16) Source(163, 27) + SourceIndex(0) --- ->>>var c12t4 = function () { +>>>var c12t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ -5 > ^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c12t4 4 > = <() => IFoo> -1->Emitted(150, 1) Source(164, 1) + SourceIndex(0) -2 >Emitted(150, 5) Source(164, 5) + SourceIndex(0) -3 >Emitted(150, 10) Source(164, 10) + SourceIndex(0) -4 >Emitted(150, 13) Source(164, 26) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(108, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(108, 5) Source(164, 5) + SourceIndex(0) +3 >Emitted(108, 10) Source(164, 10) + SourceIndex(0) +4 >Emitted(108, 13) Source(164, 26) + SourceIndex(0) +5 >Emitted(108, 27) Source(164, 39) + SourceIndex(0) +6 >Emitted(108, 33) Source(164, 45) + SourceIndex(0) +7 >Emitted(108, 34) Source(164, 52) + SourceIndex(0) +8 >Emitted(108, 35) Source(164, 53) + SourceIndex(0) +9 >Emitted(108, 37) Source(164, 55) + SourceIndex(0) +10>Emitted(108, 38) Source(164, 56) + SourceIndex(0) +11>Emitted(108, 39) Source(164, 56) + SourceIndex(0) +12>Emitted(108, 40) Source(164, 57) + SourceIndex(0) +13>Emitted(108, 41) Source(164, 58) + SourceIndex(0) +14>Emitted(108, 42) Source(164, 59) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(151, 5) Source(164, 39) + SourceIndex(0) -2 >Emitted(151, 11) Source(164, 45) + SourceIndex(0) -3 >Emitted(151, 12) Source(164, 52) + SourceIndex(0) -4 >Emitted(151, 13) Source(164, 53) + SourceIndex(0) -5 >Emitted(151, 15) Source(164, 55) + SourceIndex(0) -6 >Emitted(151, 16) Source(164, 56) + SourceIndex(0) -7 >Emitted(151, 17) Source(164, 56) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(152, 1) Source(164, 57) + SourceIndex(0) -2 >Emitted(152, 2) Source(164, 58) + SourceIndex(0) -3 >Emitted(152, 3) Source(164, 59) + SourceIndex(0) ---- ->>>var c12t5 = function (n) { +>>>var c12t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -2796,49 +2706,34 @@ sourceFile:contextualTyping.ts 4 > = <(n: number) => IFoo> 5 > function( 6 > n -1->Emitted(153, 1) Source(165, 1) + SourceIndex(0) -2 >Emitted(153, 5) Source(165, 5) + SourceIndex(0) -3 >Emitted(153, 10) Source(165, 10) + SourceIndex(0) -4 >Emitted(153, 13) Source(165, 35) + SourceIndex(0) -5 >Emitted(153, 23) Source(165, 44) + SourceIndex(0) -6 >Emitted(153, 24) Source(165, 45) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(109, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(109, 5) Source(165, 5) + SourceIndex(0) +3 >Emitted(109, 10) Source(165, 10) + SourceIndex(0) +4 >Emitted(109, 13) Source(165, 35) + SourceIndex(0) +5 >Emitted(109, 23) Source(165, 44) + SourceIndex(0) +6 >Emitted(109, 24) Source(165, 45) + SourceIndex(0) +7 >Emitted(109, 28) Source(165, 49) + SourceIndex(0) +8 >Emitted(109, 34) Source(165, 55) + SourceIndex(0) +9 >Emitted(109, 35) Source(165, 62) + SourceIndex(0) +10>Emitted(109, 36) Source(165, 63) + SourceIndex(0) +11>Emitted(109, 38) Source(165, 65) + SourceIndex(0) +12>Emitted(109, 39) Source(165, 66) + SourceIndex(0) +13>Emitted(109, 40) Source(165, 66) + SourceIndex(0) +14>Emitted(109, 41) Source(165, 67) + SourceIndex(0) +15>Emitted(109, 42) Source(165, 68) + SourceIndex(0) +16>Emitted(109, 43) Source(165, 69) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(154, 5) Source(165, 49) + SourceIndex(0) -2 >Emitted(154, 11) Source(165, 55) + SourceIndex(0) -3 >Emitted(154, 12) Source(165, 62) + SourceIndex(0) -4 >Emitted(154, 13) Source(165, 63) + SourceIndex(0) -5 >Emitted(154, 15) Source(165, 65) + SourceIndex(0) -6 >Emitted(154, 16) Source(165, 66) + SourceIndex(0) -7 >Emitted(154, 17) Source(165, 66) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(155, 1) Source(165, 67) + SourceIndex(0) -2 >Emitted(155, 2) Source(165, 68) + SourceIndex(0) -3 >Emitted(155, 3) Source(165, 69) + SourceIndex(0) ---- ->>>var c12t6 = function (n, s) { +>>>var c12t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ @@ -2847,6 +2742,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -2856,58 +2761,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(156, 1) Source(166, 1) + SourceIndex(0) -2 >Emitted(156, 5) Source(166, 5) + SourceIndex(0) -3 >Emitted(156, 10) Source(166, 10) + SourceIndex(0) -4 >Emitted(156, 13) Source(166, 46) + SourceIndex(0) -5 >Emitted(156, 23) Source(166, 55) + SourceIndex(0) -6 >Emitted(156, 24) Source(166, 56) + SourceIndex(0) -7 >Emitted(156, 26) Source(166, 58) + SourceIndex(0) -8 >Emitted(156, 27) Source(166, 59) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(110, 1) Source(166, 1) + SourceIndex(0) +2 >Emitted(110, 5) Source(166, 5) + SourceIndex(0) +3 >Emitted(110, 10) Source(166, 10) + SourceIndex(0) +4 >Emitted(110, 13) Source(166, 46) + SourceIndex(0) +5 >Emitted(110, 23) Source(166, 55) + SourceIndex(0) +6 >Emitted(110, 24) Source(166, 56) + SourceIndex(0) +7 >Emitted(110, 26) Source(166, 58) + SourceIndex(0) +8 >Emitted(110, 27) Source(166, 59) + SourceIndex(0) +9 >Emitted(110, 31) Source(166, 63) + SourceIndex(0) +10>Emitted(110, 37) Source(166, 69) + SourceIndex(0) +11>Emitted(110, 38) Source(166, 76) + SourceIndex(0) +12>Emitted(110, 39) Source(166, 77) + SourceIndex(0) +13>Emitted(110, 41) Source(166, 79) + SourceIndex(0) +14>Emitted(110, 42) Source(166, 80) + SourceIndex(0) +15>Emitted(110, 43) Source(166, 80) + SourceIndex(0) +16>Emitted(110, 44) Source(166, 81) + SourceIndex(0) +17>Emitted(110, 45) Source(166, 82) + SourceIndex(0) +18>Emitted(110, 46) Source(166, 83) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(157, 5) Source(166, 63) + SourceIndex(0) -2 >Emitted(157, 11) Source(166, 69) + SourceIndex(0) -3 >Emitted(157, 12) Source(166, 76) + SourceIndex(0) -4 >Emitted(157, 13) Source(166, 77) + SourceIndex(0) -5 >Emitted(157, 15) Source(166, 79) + SourceIndex(0) -6 >Emitted(157, 16) Source(166, 80) + SourceIndex(0) -7 >Emitted(157, 17) Source(166, 80) + SourceIndex(0) ---- ->>>}; +>>>var c12t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(158, 1) Source(166, 81) + SourceIndex(0) -2 >Emitted(158, 2) Source(166, 82) + SourceIndex(0) -3 >Emitted(158, 3) Source(166, 83) + SourceIndex(0) ---- ->>>var c12t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c12t7 @@ -2917,49 +2816,44 @@ sourceFile:contextualTyping.ts > }> 5 > function( 6 > n:number -1->Emitted(159, 1) Source(167, 1) + SourceIndex(0) -2 >Emitted(159, 5) Source(167, 5) + SourceIndex(0) -3 >Emitted(159, 10) Source(167, 10) + SourceIndex(0) -4 >Emitted(159, 13) Source(170, 4) + SourceIndex(0) -5 >Emitted(159, 23) Source(170, 13) + SourceIndex(0) -6 >Emitted(159, 24) Source(170, 21) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> +12> +13> } +14> ; +1 >Emitted(111, 1) Source(167, 1) + SourceIndex(0) +2 >Emitted(111, 5) Source(167, 5) + SourceIndex(0) +3 >Emitted(111, 10) Source(167, 10) + SourceIndex(0) +4 >Emitted(111, 13) Source(170, 4) + SourceIndex(0) +5 >Emitted(111, 23) Source(170, 13) + SourceIndex(0) +6 >Emitted(111, 24) Source(170, 21) + SourceIndex(0) +7 >Emitted(111, 28) Source(170, 25) + SourceIndex(0) +8 >Emitted(111, 34) Source(170, 31) + SourceIndex(0) +9 >Emitted(111, 35) Source(170, 32) + SourceIndex(0) +10>Emitted(111, 36) Source(170, 33) + SourceIndex(0) +11>Emitted(111, 37) Source(170, 33) + SourceIndex(0) +12>Emitted(111, 38) Source(170, 34) + SourceIndex(0) +13>Emitted(111, 39) Source(170, 35) + SourceIndex(0) +14>Emitted(111, 40) Source(170, 36) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(160, 5) Source(170, 25) + SourceIndex(0) -2 >Emitted(160, 11) Source(170, 31) + SourceIndex(0) -3 >Emitted(160, 12) Source(170, 32) + SourceIndex(0) -4 >Emitted(160, 13) Source(170, 33) + SourceIndex(0) -5 >Emitted(160, 14) Source(170, 33) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(161, 1) Source(170, 34) + SourceIndex(0) -2 >Emitted(161, 2) Source(170, 35) + SourceIndex(0) -3 >Emitted(161, 3) Source(170, 36) + SourceIndex(0) ---- ->>>var c12t8 = function (n) { +>>>var c12t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -2968,44 +2862,31 @@ sourceFile:contextualTyping.ts 4 > = <(n: number, s: string) => number> 5 > function( 6 > n -1->Emitted(162, 1) Source(172, 1) + SourceIndex(0) -2 >Emitted(162, 5) Source(172, 5) + SourceIndex(0) -3 >Emitted(162, 10) Source(172, 10) + SourceIndex(0) -4 >Emitted(162, 13) Source(172, 48) + SourceIndex(0) -5 >Emitted(162, 23) Source(172, 57) + SourceIndex(0) -6 >Emitted(162, 24) Source(172, 58) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(163, 5) Source(172, 62) + SourceIndex(0) -2 >Emitted(163, 11) Source(172, 68) + SourceIndex(0) -3 >Emitted(163, 12) Source(172, 69) + SourceIndex(0) -4 >Emitted(163, 13) Source(172, 70) + SourceIndex(0) -5 >Emitted(163, 14) Source(172, 71) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(164, 1) Source(172, 72) + SourceIndex(0) -2 >Emitted(164, 2) Source(172, 73) + SourceIndex(0) -3 >Emitted(164, 3) Source(172, 74) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(112, 1) Source(172, 1) + SourceIndex(0) +2 >Emitted(112, 5) Source(172, 5) + SourceIndex(0) +3 >Emitted(112, 10) Source(172, 10) + SourceIndex(0) +4 >Emitted(112, 13) Source(172, 48) + SourceIndex(0) +5 >Emitted(112, 23) Source(172, 57) + SourceIndex(0) +6 >Emitted(112, 24) Source(172, 58) + SourceIndex(0) +7 >Emitted(112, 28) Source(172, 62) + SourceIndex(0) +8 >Emitted(112, 34) Source(172, 68) + SourceIndex(0) +9 >Emitted(112, 35) Source(172, 69) + SourceIndex(0) +10>Emitted(112, 36) Source(172, 70) + SourceIndex(0) +11>Emitted(112, 37) Source(172, 71) + SourceIndex(0) +12>Emitted(112, 38) Source(172, 72) + SourceIndex(0) +13>Emitted(112, 39) Source(172, 73) + SourceIndex(0) +14>Emitted(112, 40) Source(172, 74) + SourceIndex(0) --- >>>var c12t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -3016,7 +2897,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c12t9 @@ -3027,16 +2908,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(165, 1) Source(173, 1) + SourceIndex(0) -2 >Emitted(165, 5) Source(173, 5) + SourceIndex(0) -3 >Emitted(165, 10) Source(173, 10) + SourceIndex(0) -4 >Emitted(165, 13) Source(173, 26) + SourceIndex(0) -5 >Emitted(165, 14) Source(173, 27) + SourceIndex(0) -6 >Emitted(165, 16) Source(173, 29) + SourceIndex(0) -7 >Emitted(165, 18) Source(173, 30) + SourceIndex(0) -8 >Emitted(165, 20) Source(173, 32) + SourceIndex(0) -9 >Emitted(165, 21) Source(173, 33) + SourceIndex(0) -10>Emitted(165, 22) Source(173, 34) + SourceIndex(0) +1 >Emitted(113, 1) Source(173, 1) + SourceIndex(0) +2 >Emitted(113, 5) Source(173, 5) + SourceIndex(0) +3 >Emitted(113, 10) Source(173, 10) + SourceIndex(0) +4 >Emitted(113, 13) Source(173, 26) + SourceIndex(0) +5 >Emitted(113, 14) Source(173, 27) + SourceIndex(0) +6 >Emitted(113, 16) Source(173, 29) + SourceIndex(0) +7 >Emitted(113, 18) Source(173, 30) + SourceIndex(0) +8 >Emitted(113, 20) Source(173, 32) + SourceIndex(0) +9 >Emitted(113, 21) Source(173, 33) + SourceIndex(0) +10>Emitted(113, 22) Source(173, 34) + SourceIndex(0) --- >>>var c12t10 = [({}), ({})]; 1-> @@ -3053,7 +2934,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -3069,22 +2950,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(166, 1) Source(174, 1) + SourceIndex(0) -2 >Emitted(166, 5) Source(174, 5) + SourceIndex(0) -3 >Emitted(166, 11) Source(174, 11) + SourceIndex(0) -4 >Emitted(166, 14) Source(174, 23) + SourceIndex(0) -5 >Emitted(166, 15) Source(174, 30) + SourceIndex(0) -6 >Emitted(166, 16) Source(174, 31) + SourceIndex(0) -7 >Emitted(166, 18) Source(174, 33) + SourceIndex(0) -8 >Emitted(166, 19) Source(174, 34) + SourceIndex(0) -9 >Emitted(166, 21) Source(174, 41) + SourceIndex(0) -10>Emitted(166, 22) Source(174, 42) + SourceIndex(0) -11>Emitted(166, 24) Source(174, 44) + SourceIndex(0) -12>Emitted(166, 25) Source(174, 45) + SourceIndex(0) -13>Emitted(166, 26) Source(174, 46) + SourceIndex(0) -14>Emitted(166, 27) Source(174, 47) + SourceIndex(0) +1->Emitted(114, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(114, 5) Source(174, 5) + SourceIndex(0) +3 >Emitted(114, 11) Source(174, 11) + SourceIndex(0) +4 >Emitted(114, 14) Source(174, 23) + SourceIndex(0) +5 >Emitted(114, 15) Source(174, 30) + SourceIndex(0) +6 >Emitted(114, 16) Source(174, 31) + SourceIndex(0) +7 >Emitted(114, 18) Source(174, 33) + SourceIndex(0) +8 >Emitted(114, 19) Source(174, 34) + SourceIndex(0) +9 >Emitted(114, 21) Source(174, 41) + SourceIndex(0) +10>Emitted(114, 22) Source(174, 42) + SourceIndex(0) +11>Emitted(114, 24) Source(174, 44) + SourceIndex(0) +12>Emitted(114, 25) Source(174, 45) + SourceIndex(0) +13>Emitted(114, 26) Source(174, 46) + SourceIndex(0) +14>Emitted(114, 27) Source(174, 47) + SourceIndex(0) --- ->>>var c12t11 = [function (n, s) { +>>>var c12t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^^ @@ -3094,6 +2975,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -3104,63 +2994,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(167, 1) Source(175, 1) + SourceIndex(0) -2 >Emitted(167, 5) Source(175, 5) + SourceIndex(0) -3 >Emitted(167, 11) Source(175, 11) + SourceIndex(0) -4 >Emitted(167, 14) Source(175, 52) + SourceIndex(0) -5 >Emitted(167, 15) Source(175, 53) + SourceIndex(0) -6 >Emitted(167, 25) Source(175, 62) + SourceIndex(0) -7 >Emitted(167, 26) Source(175, 63) + SourceIndex(0) -8 >Emitted(167, 28) Source(175, 65) + SourceIndex(0) -9 >Emitted(167, 29) Source(175, 66) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(168, 5) Source(175, 70) + SourceIndex(0) -2 >Emitted(168, 11) Source(175, 76) + SourceIndex(0) -3 >Emitted(168, 12) Source(175, 77) + SourceIndex(0) -4 >Emitted(168, 13) Source(175, 78) + SourceIndex(0) -5 >Emitted(168, 14) Source(175, 79) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(169, 1) Source(175, 80) + SourceIndex(0) -2 >Emitted(169, 2) Source(175, 81) + SourceIndex(0) -3 >Emitted(169, 3) Source(175, 82) + SourceIndex(0) -4 >Emitted(169, 4) Source(175, 83) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(115, 1) Source(175, 1) + SourceIndex(0) +2 >Emitted(115, 5) Source(175, 5) + SourceIndex(0) +3 >Emitted(115, 11) Source(175, 11) + SourceIndex(0) +4 >Emitted(115, 14) Source(175, 52) + SourceIndex(0) +5 >Emitted(115, 15) Source(175, 53) + SourceIndex(0) +6 >Emitted(115, 25) Source(175, 62) + SourceIndex(0) +7 >Emitted(115, 26) Source(175, 63) + SourceIndex(0) +8 >Emitted(115, 28) Source(175, 65) + SourceIndex(0) +9 >Emitted(115, 29) Source(175, 66) + SourceIndex(0) +10>Emitted(115, 33) Source(175, 70) + SourceIndex(0) +11>Emitted(115, 39) Source(175, 76) + SourceIndex(0) +12>Emitted(115, 40) Source(175, 77) + SourceIndex(0) +13>Emitted(115, 41) Source(175, 78) + SourceIndex(0) +14>Emitted(115, 42) Source(175, 79) + SourceIndex(0) +15>Emitted(115, 43) Source(175, 80) + SourceIndex(0) +16>Emitted(115, 44) Source(175, 81) + SourceIndex(0) +17>Emitted(115, 45) Source(175, 82) + SourceIndex(0) +18>Emitted(115, 46) Source(175, 83) + SourceIndex(0) --- >>>var c12t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ 5 > ^-> -1-> +1 > > 2 >var 3 > c12t12 4 > = -1->Emitted(170, 1) Source(176, 1) + SourceIndex(0) -2 >Emitted(170, 5) Source(176, 5) + SourceIndex(0) -3 >Emitted(170, 11) Source(176, 11) + SourceIndex(0) -4 >Emitted(170, 14) Source(176, 21) + SourceIndex(0) +1 >Emitted(116, 1) Source(176, 1) + SourceIndex(0) +2 >Emitted(116, 5) Source(176, 5) + SourceIndex(0) +3 >Emitted(116, 11) Source(176, 11) + SourceIndex(0) +4 >Emitted(116, 14) Source(176, 21) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -3176,12 +3052,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(171, 5) Source(177, 5) + SourceIndex(0) -2 >Emitted(171, 8) Source(177, 8) + SourceIndex(0) -3 >Emitted(171, 10) Source(177, 16) + SourceIndex(0) -4 >Emitted(171, 11) Source(177, 17) + SourceIndex(0) -5 >Emitted(171, 13) Source(177, 19) + SourceIndex(0) -6 >Emitted(171, 14) Source(177, 20) + SourceIndex(0) +1->Emitted(117, 5) Source(177, 5) + SourceIndex(0) +2 >Emitted(117, 8) Source(177, 8) + SourceIndex(0) +3 >Emitted(117, 10) Source(177, 16) + SourceIndex(0) +4 >Emitted(117, 11) Source(177, 17) + SourceIndex(0) +5 >Emitted(117, 13) Source(177, 19) + SourceIndex(0) +6 >Emitted(117, 14) Source(177, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -3190,8 +3066,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(172, 2) Source(178, 2) + SourceIndex(0) -2 >Emitted(172, 3) Source(178, 2) + SourceIndex(0) +1 >Emitted(118, 2) Source(178, 2) + SourceIndex(0) +2 >Emitted(118, 3) Source(178, 2) + SourceIndex(0) --- >>>var c12t13 = ({ 1-> @@ -3199,20 +3075,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c12t13 4 > = 5 > ( -1->Emitted(173, 1) Source(179, 1) + SourceIndex(0) -2 >Emitted(173, 5) Source(179, 5) + SourceIndex(0) -3 >Emitted(173, 11) Source(179, 11) + SourceIndex(0) -4 >Emitted(173, 14) Source(179, 21) + SourceIndex(0) -5 >Emitted(173, 15) Source(179, 22) + SourceIndex(0) +1->Emitted(119, 1) Source(179, 1) + SourceIndex(0) +2 >Emitted(119, 5) Source(179, 5) + SourceIndex(0) +3 >Emitted(119, 11) Source(179, 11) + SourceIndex(0) +4 >Emitted(119, 14) Source(179, 21) + SourceIndex(0) +5 >Emitted(119, 15) Source(179, 22) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -3220,6 +3096,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -3228,38 +3111,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(174, 5) Source(180, 5) + SourceIndex(0) -2 >Emitted(174, 6) Source(180, 6) + SourceIndex(0) -3 >Emitted(174, 8) Source(180, 8) + SourceIndex(0) -4 >Emitted(174, 18) Source(180, 17) + SourceIndex(0) -5 >Emitted(174, 19) Source(180, 18) + SourceIndex(0) -6 >Emitted(174, 21) Source(180, 20) + SourceIndex(0) -7 >Emitted(174, 22) Source(180, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(175, 9) Source(180, 25) + SourceIndex(0) -2 >Emitted(175, 15) Source(180, 31) + SourceIndex(0) -3 >Emitted(175, 16) Source(180, 32) + SourceIndex(0) -4 >Emitted(175, 17) Source(180, 33) + SourceIndex(0) -5 >Emitted(175, 18) Source(180, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(176, 5) Source(180, 35) + SourceIndex(0) -2 >Emitted(176, 6) Source(180, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(120, 5) Source(180, 5) + SourceIndex(0) +2 >Emitted(120, 6) Source(180, 6) + SourceIndex(0) +3 >Emitted(120, 8) Source(180, 8) + SourceIndex(0) +4 >Emitted(120, 18) Source(180, 17) + SourceIndex(0) +5 >Emitted(120, 19) Source(180, 18) + SourceIndex(0) +6 >Emitted(120, 21) Source(180, 20) + SourceIndex(0) +7 >Emitted(120, 22) Source(180, 21) + SourceIndex(0) +8 >Emitted(120, 26) Source(180, 25) + SourceIndex(0) +9 >Emitted(120, 32) Source(180, 31) + SourceIndex(0) +10>Emitted(120, 33) Source(180, 32) + SourceIndex(0) +11>Emitted(120, 34) Source(180, 33) + SourceIndex(0) +12>Emitted(120, 35) Source(180, 34) + SourceIndex(0) +13>Emitted(120, 36) Source(180, 35) + SourceIndex(0) +14>Emitted(120, 37) Source(180, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -3270,9 +3142,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(177, 2) Source(181, 2) + SourceIndex(0) -2 >Emitted(177, 3) Source(181, 3) + SourceIndex(0) -3 >Emitted(177, 4) Source(181, 3) + SourceIndex(0) +1 >Emitted(121, 2) Source(181, 2) + SourceIndex(0) +2 >Emitted(121, 3) Source(181, 3) + SourceIndex(0) +3 >Emitted(121, 4) Source(181, 3) + SourceIndex(0) --- >>>var c12t14 = ({ 1-> @@ -3286,11 +3158,11 @@ sourceFile:contextualTyping.ts 3 > c12t14 4 > = 5 > ( -1->Emitted(178, 1) Source(182, 1) + SourceIndex(0) -2 >Emitted(178, 5) Source(182, 5) + SourceIndex(0) -3 >Emitted(178, 11) Source(182, 11) + SourceIndex(0) -4 >Emitted(178, 14) Source(182, 21) + SourceIndex(0) -5 >Emitted(178, 15) Source(182, 22) + SourceIndex(0) +1->Emitted(122, 1) Source(182, 1) + SourceIndex(0) +2 >Emitted(122, 5) Source(182, 5) + SourceIndex(0) +3 >Emitted(122, 11) Source(182, 11) + SourceIndex(0) +4 >Emitted(122, 14) Source(182, 21) + SourceIndex(0) +5 >Emitted(122, 15) Source(182, 22) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -3302,25 +3174,25 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(179, 5) Source(183, 5) + SourceIndex(0) -2 >Emitted(179, 6) Source(183, 6) + SourceIndex(0) -3 >Emitted(179, 8) Source(183, 8) + SourceIndex(0) -4 >Emitted(179, 10) Source(183, 10) + SourceIndex(0) +1 >Emitted(123, 5) Source(183, 5) + SourceIndex(0) +2 >Emitted(123, 6) Source(183, 6) + SourceIndex(0) +3 >Emitted(123, 8) Source(183, 8) + SourceIndex(0) +4 >Emitted(123, 10) Source(183, 10) + SourceIndex(0) --- >>>}); 1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > ) 3 > -1 >Emitted(180, 2) Source(184, 2) + SourceIndex(0) -2 >Emitted(180, 3) Source(184, 3) + SourceIndex(0) -3 >Emitted(180, 4) Source(184, 3) + SourceIndex(0) +1 >Emitted(124, 2) Source(184, 2) + SourceIndex(0) +2 >Emitted(124, 3) Source(184, 3) + SourceIndex(0) +3 >Emitted(124, 4) Source(184, 3) + SourceIndex(0) --- ->>>function EF1(a, b) { +>>>function EF1(a, b) { return a + b; } 1-> 2 >^^^^^^^^^ 3 > ^^^ @@ -3328,7 +3200,15 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ -8 > ^-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^ +15> ^ +16> ^ 1-> > >// CONTEXT: Contextual typing declarations @@ -3343,48 +3223,34 @@ sourceFile:contextualTyping.ts 5 > a 6 > , 7 > b -1->Emitted(181, 1) Source(191, 1) + SourceIndex(0) -2 >Emitted(181, 10) Source(191, 10) + SourceIndex(0) -3 >Emitted(181, 13) Source(191, 13) + SourceIndex(0) -4 >Emitted(181, 14) Source(191, 14) + SourceIndex(0) -5 >Emitted(181, 15) Source(191, 15) + SourceIndex(0) -6 >Emitted(181, 17) Source(191, 16) + SourceIndex(0) -7 >Emitted(181, 18) Source(191, 17) + SourceIndex(0) ---- ->>> return a + b; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -1->) { -2 > return -3 > -4 > a -5 > + -6 > b -7 > ; -1->Emitted(182, 5) Source(191, 21) + SourceIndex(0) name (EF1) -2 >Emitted(182, 11) Source(191, 27) + SourceIndex(0) name (EF1) -3 >Emitted(182, 12) Source(191, 28) + SourceIndex(0) name (EF1) -4 >Emitted(182, 13) Source(191, 29) + SourceIndex(0) name (EF1) -5 >Emitted(182, 16) Source(191, 30) + SourceIndex(0) name (EF1) -6 >Emitted(182, 17) Source(191, 31) + SourceIndex(0) name (EF1) -7 >Emitted(182, 18) Source(191, 32) + SourceIndex(0) name (EF1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -1 >Emitted(183, 1) Source(191, 33) + SourceIndex(0) name (EF1) -2 >Emitted(183, 2) Source(191, 34) + SourceIndex(0) name (EF1) +8 > ) { +9 > return +10> +11> a +12> + +13> b +14> ; +15> +16> } +1->Emitted(125, 1) Source(191, 1) + SourceIndex(0) +2 >Emitted(125, 10) Source(191, 10) + SourceIndex(0) +3 >Emitted(125, 13) Source(191, 13) + SourceIndex(0) +4 >Emitted(125, 14) Source(191, 14) + SourceIndex(0) +5 >Emitted(125, 15) Source(191, 15) + SourceIndex(0) +6 >Emitted(125, 17) Source(191, 16) + SourceIndex(0) +7 >Emitted(125, 18) Source(191, 17) + SourceIndex(0) +8 >Emitted(125, 22) Source(191, 21) + SourceIndex(0) name (EF1) +9 >Emitted(125, 28) Source(191, 27) + SourceIndex(0) name (EF1) +10>Emitted(125, 29) Source(191, 28) + SourceIndex(0) name (EF1) +11>Emitted(125, 30) Source(191, 29) + SourceIndex(0) name (EF1) +12>Emitted(125, 33) Source(191, 30) + SourceIndex(0) name (EF1) +13>Emitted(125, 34) Source(191, 31) + SourceIndex(0) name (EF1) +14>Emitted(125, 35) Source(191, 32) + SourceIndex(0) name (EF1) +15>Emitted(125, 36) Source(191, 33) + SourceIndex(0) name (EF1) +16>Emitted(125, 37) Source(191, 34) + SourceIndex(0) name (EF1) --- >>>var efv = EF1(1, 2); -1-> +1 > 2 >^^^^ 3 > ^^^ 4 > ^^^ @@ -3396,7 +3262,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^-> -1-> +1 > > > 2 >var @@ -3409,17 +3275,17 @@ sourceFile:contextualTyping.ts 9 > 2 10> ) 11> ; -1->Emitted(184, 1) Source(193, 1) + SourceIndex(0) -2 >Emitted(184, 5) Source(193, 5) + SourceIndex(0) -3 >Emitted(184, 8) Source(193, 8) + SourceIndex(0) -4 >Emitted(184, 11) Source(193, 11) + SourceIndex(0) -5 >Emitted(184, 14) Source(193, 14) + SourceIndex(0) -6 >Emitted(184, 15) Source(193, 15) + SourceIndex(0) -7 >Emitted(184, 16) Source(193, 16) + SourceIndex(0) -8 >Emitted(184, 18) Source(193, 17) + SourceIndex(0) -9 >Emitted(184, 19) Source(193, 18) + SourceIndex(0) -10>Emitted(184, 20) Source(193, 19) + SourceIndex(0) -11>Emitted(184, 21) Source(193, 20) + SourceIndex(0) +1 >Emitted(126, 1) Source(193, 1) + SourceIndex(0) +2 >Emitted(126, 5) Source(193, 5) + SourceIndex(0) +3 >Emitted(126, 8) Source(193, 8) + SourceIndex(0) +4 >Emitted(126, 11) Source(193, 11) + SourceIndex(0) +5 >Emitted(126, 14) Source(193, 14) + SourceIndex(0) +6 >Emitted(126, 15) Source(193, 15) + SourceIndex(0) +7 >Emitted(126, 16) Source(193, 16) + SourceIndex(0) +8 >Emitted(126, 18) Source(193, 17) + SourceIndex(0) +9 >Emitted(126, 19) Source(193, 18) + SourceIndex(0) +10>Emitted(126, 20) Source(193, 19) + SourceIndex(0) +11>Emitted(126, 21) Source(193, 20) + SourceIndex(0) --- >>>function Point(x, y) { 1-> @@ -3450,13 +3316,13 @@ sourceFile:contextualTyping.ts 5 > x 6 > , 7 > y -1->Emitted(185, 1) Source(207, 1) + SourceIndex(0) -2 >Emitted(185, 10) Source(207, 10) + SourceIndex(0) -3 >Emitted(185, 15) Source(207, 15) + SourceIndex(0) -4 >Emitted(185, 16) Source(207, 16) + SourceIndex(0) -5 >Emitted(185, 17) Source(207, 17) + SourceIndex(0) -6 >Emitted(185, 19) Source(207, 19) + SourceIndex(0) -7 >Emitted(185, 20) Source(207, 20) + SourceIndex(0) +1->Emitted(127, 1) Source(207, 1) + SourceIndex(0) +2 >Emitted(127, 10) Source(207, 10) + SourceIndex(0) +3 >Emitted(127, 15) Source(207, 15) + SourceIndex(0) +4 >Emitted(127, 16) Source(207, 16) + SourceIndex(0) +5 >Emitted(127, 17) Source(207, 17) + SourceIndex(0) +6 >Emitted(127, 19) Source(207, 19) + SourceIndex(0) +7 >Emitted(127, 20) Source(207, 20) + SourceIndex(0) --- >>> this.x = x; 1 >^^^^ @@ -3475,13 +3341,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > x 7 > ; -1 >Emitted(186, 5) Source(208, 5) + SourceIndex(0) name (Point) -2 >Emitted(186, 9) Source(208, 9) + SourceIndex(0) name (Point) -3 >Emitted(186, 10) Source(208, 10) + SourceIndex(0) name (Point) -4 >Emitted(186, 11) Source(208, 11) + SourceIndex(0) name (Point) -5 >Emitted(186, 14) Source(208, 14) + SourceIndex(0) name (Point) -6 >Emitted(186, 15) Source(208, 15) + SourceIndex(0) name (Point) -7 >Emitted(186, 16) Source(208, 16) + SourceIndex(0) name (Point) +1 >Emitted(128, 5) Source(208, 5) + SourceIndex(0) name (Point) +2 >Emitted(128, 9) Source(208, 9) + SourceIndex(0) name (Point) +3 >Emitted(128, 10) Source(208, 10) + SourceIndex(0) name (Point) +4 >Emitted(128, 11) Source(208, 11) + SourceIndex(0) name (Point) +5 >Emitted(128, 14) Source(208, 14) + SourceIndex(0) name (Point) +6 >Emitted(128, 15) Source(208, 15) + SourceIndex(0) name (Point) +7 >Emitted(128, 16) Source(208, 16) + SourceIndex(0) name (Point) --- >>> this.y = y; 1->^^^^ @@ -3500,13 +3366,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > y 7 > ; -1->Emitted(187, 5) Source(209, 5) + SourceIndex(0) name (Point) -2 >Emitted(187, 9) Source(209, 9) + SourceIndex(0) name (Point) -3 >Emitted(187, 10) Source(209, 10) + SourceIndex(0) name (Point) -4 >Emitted(187, 11) Source(209, 11) + SourceIndex(0) name (Point) -5 >Emitted(187, 14) Source(209, 14) + SourceIndex(0) name (Point) -6 >Emitted(187, 15) Source(209, 15) + SourceIndex(0) name (Point) -7 >Emitted(187, 16) Source(209, 16) + SourceIndex(0) name (Point) +1->Emitted(129, 5) Source(209, 5) + SourceIndex(0) name (Point) +2 >Emitted(129, 9) Source(209, 9) + SourceIndex(0) name (Point) +3 >Emitted(129, 10) Source(209, 10) + SourceIndex(0) name (Point) +4 >Emitted(129, 11) Source(209, 11) + SourceIndex(0) name (Point) +5 >Emitted(129, 14) Source(209, 14) + SourceIndex(0) name (Point) +6 >Emitted(129, 15) Source(209, 15) + SourceIndex(0) name (Point) +7 >Emitted(129, 16) Source(209, 16) + SourceIndex(0) name (Point) --- >>> return this; 1->^^^^ @@ -3521,11 +3387,11 @@ sourceFile:contextualTyping.ts 3 > 4 > this 5 > ; -1->Emitted(188, 5) Source(211, 5) + SourceIndex(0) name (Point) -2 >Emitted(188, 11) Source(211, 11) + SourceIndex(0) name (Point) -3 >Emitted(188, 12) Source(211, 12) + SourceIndex(0) name (Point) -4 >Emitted(188, 16) Source(211, 16) + SourceIndex(0) name (Point) -5 >Emitted(188, 17) Source(211, 17) + SourceIndex(0) name (Point) +1->Emitted(130, 5) Source(211, 5) + SourceIndex(0) name (Point) +2 >Emitted(130, 11) Source(211, 11) + SourceIndex(0) name (Point) +3 >Emitted(130, 12) Source(211, 12) + SourceIndex(0) name (Point) +4 >Emitted(130, 16) Source(211, 16) + SourceIndex(0) name (Point) +5 >Emitted(130, 17) Source(211, 17) + SourceIndex(0) name (Point) --- >>>} 1 > @@ -3534,8 +3400,8 @@ sourceFile:contextualTyping.ts 1 > > 2 >} -1 >Emitted(189, 1) Source(212, 1) + SourceIndex(0) name (Point) -2 >Emitted(189, 2) Source(212, 2) + SourceIndex(0) name (Point) +1 >Emitted(131, 1) Source(212, 1) + SourceIndex(0) name (Point) +2 >Emitted(131, 2) Source(212, 2) + SourceIndex(0) name (Point) --- >>>Point.origin = new Point(0, 0); 1-> @@ -3567,19 +3433,19 @@ sourceFile:contextualTyping.ts 11> 0 12> ) 13> ; -1->Emitted(190, 1) Source(214, 1) + SourceIndex(0) -2 >Emitted(190, 6) Source(214, 6) + SourceIndex(0) -3 >Emitted(190, 7) Source(214, 7) + SourceIndex(0) -4 >Emitted(190, 13) Source(214, 13) + SourceIndex(0) -5 >Emitted(190, 16) Source(214, 16) + SourceIndex(0) -6 >Emitted(190, 20) Source(214, 20) + SourceIndex(0) -7 >Emitted(190, 25) Source(214, 25) + SourceIndex(0) -8 >Emitted(190, 26) Source(214, 26) + SourceIndex(0) -9 >Emitted(190, 27) Source(214, 27) + SourceIndex(0) -10>Emitted(190, 29) Source(214, 29) + SourceIndex(0) -11>Emitted(190, 30) Source(214, 30) + SourceIndex(0) -12>Emitted(190, 31) Source(214, 31) + SourceIndex(0) -13>Emitted(190, 32) Source(214, 32) + SourceIndex(0) +1->Emitted(132, 1) Source(214, 1) + SourceIndex(0) +2 >Emitted(132, 6) Source(214, 6) + SourceIndex(0) +3 >Emitted(132, 7) Source(214, 7) + SourceIndex(0) +4 >Emitted(132, 13) Source(214, 13) + SourceIndex(0) +5 >Emitted(132, 16) Source(214, 16) + SourceIndex(0) +6 >Emitted(132, 20) Source(214, 20) + SourceIndex(0) +7 >Emitted(132, 25) Source(214, 25) + SourceIndex(0) +8 >Emitted(132, 26) Source(214, 26) + SourceIndex(0) +9 >Emitted(132, 27) Source(214, 27) + SourceIndex(0) +10>Emitted(132, 29) Source(214, 29) + SourceIndex(0) +11>Emitted(132, 30) Source(214, 30) + SourceIndex(0) +12>Emitted(132, 31) Source(214, 31) + SourceIndex(0) +13>Emitted(132, 32) Source(214, 32) + SourceIndex(0) --- >>>Point.prototype.add = function (dx, dy) { 1-> @@ -3607,17 +3473,17 @@ sourceFile:contextualTyping.ts 9 > dx 10> , 11> dy -1->Emitted(191, 1) Source(216, 1) + SourceIndex(0) -2 >Emitted(191, 6) Source(216, 6) + SourceIndex(0) -3 >Emitted(191, 7) Source(216, 7) + SourceIndex(0) -4 >Emitted(191, 16) Source(216, 16) + SourceIndex(0) -5 >Emitted(191, 17) Source(216, 17) + SourceIndex(0) -6 >Emitted(191, 20) Source(216, 20) + SourceIndex(0) -7 >Emitted(191, 23) Source(216, 23) + SourceIndex(0) -8 >Emitted(191, 33) Source(216, 32) + SourceIndex(0) -9 >Emitted(191, 35) Source(216, 34) + SourceIndex(0) -10>Emitted(191, 37) Source(216, 36) + SourceIndex(0) -11>Emitted(191, 39) Source(216, 38) + SourceIndex(0) +1->Emitted(133, 1) Source(216, 1) + SourceIndex(0) +2 >Emitted(133, 6) Source(216, 6) + SourceIndex(0) +3 >Emitted(133, 7) Source(216, 7) + SourceIndex(0) +4 >Emitted(133, 16) Source(216, 16) + SourceIndex(0) +5 >Emitted(133, 17) Source(216, 17) + SourceIndex(0) +6 >Emitted(133, 20) Source(216, 20) + SourceIndex(0) +7 >Emitted(133, 23) Source(216, 23) + SourceIndex(0) +8 >Emitted(133, 33) Source(216, 32) + SourceIndex(0) +9 >Emitted(133, 35) Source(216, 34) + SourceIndex(0) +10>Emitted(133, 37) Source(216, 36) + SourceIndex(0) +11>Emitted(133, 39) Source(216, 38) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^ @@ -3659,25 +3525,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(192, 5) Source(217, 5) + SourceIndex(0) -2 >Emitted(192, 11) Source(217, 11) + SourceIndex(0) -3 >Emitted(192, 12) Source(217, 12) + SourceIndex(0) -4 >Emitted(192, 16) Source(217, 16) + SourceIndex(0) -5 >Emitted(192, 21) Source(217, 21) + SourceIndex(0) -6 >Emitted(192, 22) Source(217, 22) + SourceIndex(0) -7 >Emitted(192, 26) Source(217, 26) + SourceIndex(0) -8 >Emitted(192, 27) Source(217, 27) + SourceIndex(0) -9 >Emitted(192, 28) Source(217, 28) + SourceIndex(0) -10>Emitted(192, 31) Source(217, 31) + SourceIndex(0) -11>Emitted(192, 33) Source(217, 33) + SourceIndex(0) -12>Emitted(192, 35) Source(217, 35) + SourceIndex(0) -13>Emitted(192, 39) Source(217, 39) + SourceIndex(0) -14>Emitted(192, 40) Source(217, 40) + SourceIndex(0) -15>Emitted(192, 41) Source(217, 41) + SourceIndex(0) -16>Emitted(192, 44) Source(217, 44) + SourceIndex(0) -17>Emitted(192, 46) Source(217, 46) + SourceIndex(0) -18>Emitted(192, 47) Source(217, 47) + SourceIndex(0) -19>Emitted(192, 48) Source(217, 48) + SourceIndex(0) +1->Emitted(134, 5) Source(217, 5) + SourceIndex(0) +2 >Emitted(134, 11) Source(217, 11) + SourceIndex(0) +3 >Emitted(134, 12) Source(217, 12) + SourceIndex(0) +4 >Emitted(134, 16) Source(217, 16) + SourceIndex(0) +5 >Emitted(134, 21) Source(217, 21) + SourceIndex(0) +6 >Emitted(134, 22) Source(217, 22) + SourceIndex(0) +7 >Emitted(134, 26) Source(217, 26) + SourceIndex(0) +8 >Emitted(134, 27) Source(217, 27) + SourceIndex(0) +9 >Emitted(134, 28) Source(217, 28) + SourceIndex(0) +10>Emitted(134, 31) Source(217, 31) + SourceIndex(0) +11>Emitted(134, 33) Source(217, 33) + SourceIndex(0) +12>Emitted(134, 35) Source(217, 35) + SourceIndex(0) +13>Emitted(134, 39) Source(217, 39) + SourceIndex(0) +14>Emitted(134, 40) Source(217, 40) + SourceIndex(0) +15>Emitted(134, 41) Source(217, 41) + SourceIndex(0) +16>Emitted(134, 44) Source(217, 44) + SourceIndex(0) +17>Emitted(134, 46) Source(217, 46) + SourceIndex(0) +18>Emitted(134, 47) Source(217, 47) + SourceIndex(0) +19>Emitted(134, 48) Source(217, 48) + SourceIndex(0) --- >>>}; 1 > @@ -3688,9 +3554,9 @@ sourceFile:contextualTyping.ts > 2 >} 3 > ; -1 >Emitted(193, 1) Source(218, 1) + SourceIndex(0) -2 >Emitted(193, 2) Source(218, 2) + SourceIndex(0) -3 >Emitted(193, 3) Source(218, 3) + SourceIndex(0) +1 >Emitted(135, 1) Source(218, 1) + SourceIndex(0) +2 >Emitted(135, 2) Source(218, 2) + SourceIndex(0) +3 >Emitted(135, 3) Source(218, 3) + SourceIndex(0) --- >>>Point.prototype = { 1-> @@ -3705,11 +3571,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > prototype 5 > = -1->Emitted(194, 1) Source(220, 1) + SourceIndex(0) -2 >Emitted(194, 6) Source(220, 6) + SourceIndex(0) -3 >Emitted(194, 7) Source(220, 7) + SourceIndex(0) -4 >Emitted(194, 16) Source(220, 16) + SourceIndex(0) -5 >Emitted(194, 19) Source(220, 19) + SourceIndex(0) +1->Emitted(136, 1) Source(220, 1) + SourceIndex(0) +2 >Emitted(136, 6) Source(220, 6) + SourceIndex(0) +3 >Emitted(136, 7) Source(220, 7) + SourceIndex(0) +4 >Emitted(136, 16) Source(220, 16) + SourceIndex(0) +5 >Emitted(136, 19) Source(220, 19) + SourceIndex(0) --- >>> x: 0, 1 >^^^^ @@ -3722,10 +3588,10 @@ sourceFile:contextualTyping.ts 2 > x 3 > : 4 > 0 -1 >Emitted(195, 5) Source(221, 5) + SourceIndex(0) -2 >Emitted(195, 6) Source(221, 6) + SourceIndex(0) -3 >Emitted(195, 8) Source(221, 8) + SourceIndex(0) -4 >Emitted(195, 9) Source(221, 9) + SourceIndex(0) +1 >Emitted(137, 5) Source(221, 5) + SourceIndex(0) +2 >Emitted(137, 6) Source(221, 6) + SourceIndex(0) +3 >Emitted(137, 8) Source(221, 8) + SourceIndex(0) +4 >Emitted(137, 9) Source(221, 9) + SourceIndex(0) --- >>> y: 0, 1->^^^^ @@ -3738,10 +3604,10 @@ sourceFile:contextualTyping.ts 2 > y 3 > : 4 > 0 -1->Emitted(196, 5) Source(222, 5) + SourceIndex(0) -2 >Emitted(196, 6) Source(222, 6) + SourceIndex(0) -3 >Emitted(196, 8) Source(222, 8) + SourceIndex(0) -4 >Emitted(196, 9) Source(222, 9) + SourceIndex(0) +1->Emitted(138, 5) Source(222, 5) + SourceIndex(0) +2 >Emitted(138, 6) Source(222, 6) + SourceIndex(0) +3 >Emitted(138, 8) Source(222, 8) + SourceIndex(0) +4 >Emitted(138, 9) Source(222, 9) + SourceIndex(0) --- >>> add: function (dx, dy) { 1->^^^^ @@ -3760,13 +3626,13 @@ sourceFile:contextualTyping.ts 5 > dx 6 > , 7 > dy -1->Emitted(197, 5) Source(223, 5) + SourceIndex(0) -2 >Emitted(197, 8) Source(223, 8) + SourceIndex(0) -3 >Emitted(197, 10) Source(223, 10) + SourceIndex(0) -4 >Emitted(197, 20) Source(223, 19) + SourceIndex(0) -5 >Emitted(197, 22) Source(223, 21) + SourceIndex(0) -6 >Emitted(197, 24) Source(223, 23) + SourceIndex(0) -7 >Emitted(197, 26) Source(223, 25) + SourceIndex(0) +1->Emitted(139, 5) Source(223, 5) + SourceIndex(0) +2 >Emitted(139, 8) Source(223, 8) + SourceIndex(0) +3 >Emitted(139, 10) Source(223, 10) + SourceIndex(0) +4 >Emitted(139, 20) Source(223, 19) + SourceIndex(0) +5 >Emitted(139, 22) Source(223, 21) + SourceIndex(0) +6 >Emitted(139, 24) Source(223, 23) + SourceIndex(0) +7 >Emitted(139, 26) Source(223, 25) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^^^^^ @@ -3808,25 +3674,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(198, 9) Source(224, 9) + SourceIndex(0) -2 >Emitted(198, 15) Source(224, 15) + SourceIndex(0) -3 >Emitted(198, 16) Source(224, 16) + SourceIndex(0) -4 >Emitted(198, 20) Source(224, 20) + SourceIndex(0) -5 >Emitted(198, 25) Source(224, 25) + SourceIndex(0) -6 >Emitted(198, 26) Source(224, 26) + SourceIndex(0) -7 >Emitted(198, 30) Source(224, 30) + SourceIndex(0) -8 >Emitted(198, 31) Source(224, 31) + SourceIndex(0) -9 >Emitted(198, 32) Source(224, 32) + SourceIndex(0) -10>Emitted(198, 35) Source(224, 35) + SourceIndex(0) -11>Emitted(198, 37) Source(224, 37) + SourceIndex(0) -12>Emitted(198, 39) Source(224, 39) + SourceIndex(0) -13>Emitted(198, 43) Source(224, 43) + SourceIndex(0) -14>Emitted(198, 44) Source(224, 44) + SourceIndex(0) -15>Emitted(198, 45) Source(224, 45) + SourceIndex(0) -16>Emitted(198, 48) Source(224, 48) + SourceIndex(0) -17>Emitted(198, 50) Source(224, 50) + SourceIndex(0) -18>Emitted(198, 51) Source(224, 51) + SourceIndex(0) -19>Emitted(198, 52) Source(224, 52) + SourceIndex(0) +1->Emitted(140, 9) Source(224, 9) + SourceIndex(0) +2 >Emitted(140, 15) Source(224, 15) + SourceIndex(0) +3 >Emitted(140, 16) Source(224, 16) + SourceIndex(0) +4 >Emitted(140, 20) Source(224, 20) + SourceIndex(0) +5 >Emitted(140, 25) Source(224, 25) + SourceIndex(0) +6 >Emitted(140, 26) Source(224, 26) + SourceIndex(0) +7 >Emitted(140, 30) Source(224, 30) + SourceIndex(0) +8 >Emitted(140, 31) Source(224, 31) + SourceIndex(0) +9 >Emitted(140, 32) Source(224, 32) + SourceIndex(0) +10>Emitted(140, 35) Source(224, 35) + SourceIndex(0) +11>Emitted(140, 37) Source(224, 37) + SourceIndex(0) +12>Emitted(140, 39) Source(224, 39) + SourceIndex(0) +13>Emitted(140, 43) Source(224, 43) + SourceIndex(0) +14>Emitted(140, 44) Source(224, 44) + SourceIndex(0) +15>Emitted(140, 45) Source(224, 45) + SourceIndex(0) +16>Emitted(140, 48) Source(224, 48) + SourceIndex(0) +17>Emitted(140, 50) Source(224, 50) + SourceIndex(0) +18>Emitted(140, 51) Source(224, 51) + SourceIndex(0) +19>Emitted(140, 52) Source(224, 52) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -3834,8 +3700,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(199, 5) Source(225, 5) + SourceIndex(0) -2 >Emitted(199, 6) Source(225, 6) + SourceIndex(0) +1 >Emitted(141, 5) Source(225, 5) + SourceIndex(0) +2 >Emitted(141, 6) Source(225, 6) + SourceIndex(0) --- >>>}; 1 >^ @@ -3844,8 +3710,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > ; -1 >Emitted(200, 2) Source(226, 2) + SourceIndex(0) -2 >Emitted(200, 3) Source(226, 3) + SourceIndex(0) +1 >Emitted(142, 2) Source(226, 2) + SourceIndex(0) +2 >Emitted(142, 3) Source(226, 3) + SourceIndex(0) --- >>>var x = {}; 1-> @@ -3865,11 +3731,11 @@ sourceFile:contextualTyping.ts 4 > : B = 5 > { } 6 > ; -1->Emitted(201, 1) Source(230, 1) + SourceIndex(0) -2 >Emitted(201, 5) Source(230, 5) + SourceIndex(0) -3 >Emitted(201, 6) Source(230, 6) + SourceIndex(0) -4 >Emitted(201, 9) Source(230, 12) + SourceIndex(0) -5 >Emitted(201, 11) Source(230, 15) + SourceIndex(0) -6 >Emitted(201, 12) Source(230, 16) + SourceIndex(0) +1->Emitted(143, 1) Source(230, 1) + SourceIndex(0) +2 >Emitted(143, 5) Source(230, 5) + SourceIndex(0) +3 >Emitted(143, 6) Source(230, 6) + SourceIndex(0) +4 >Emitted(143, 9) Source(230, 12) + SourceIndex(0) +5 >Emitted(143, 11) Source(230, 15) + SourceIndex(0) +6 >Emitted(143, 12) Source(230, 16) + SourceIndex(0) --- >>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping13.js b/tests/baselines/reference/contextualTyping13.js index c035434342e..7965745b943 100644 --- a/tests/baselines/reference/contextualTyping13.js +++ b/tests/baselines/reference/contextualTyping13.js @@ -2,6 +2,4 @@ var foo:(a:number)=>number = function(a){return a}; //// [contextualTyping13.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping14.js b/tests/baselines/reference/contextualTyping14.js index ea9539ef41e..5bae8c948a2 100644 --- a/tests/baselines/reference/contextualTyping14.js +++ b/tests/baselines/reference/contextualTyping14.js @@ -4,9 +4,7 @@ class foo { public bar:(a:number)=>number = function(a){return a}; } //// [contextualTyping14.js] var foo = (function () { function foo() { - this.bar = function (a) { - return a; - }; + this.bar = function (a) { return a; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping15.js b/tests/baselines/reference/contextualTyping15.js index 99855681571..250076ec4d5 100644 --- a/tests/baselines/reference/contextualTyping15.js +++ b/tests/baselines/reference/contextualTyping15.js @@ -4,9 +4,7 @@ class foo { public bar: { (): number; (i: number): number; } = function() { retu //// [contextualTyping15.js] var foo = (function () { function foo() { - this.bar = function () { - return 1; - }; + this.bar = function () { return 1; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping22.js b/tests/baselines/reference/contextualTyping22.js index b8ebfd3ecb7..3c9a5cb4d3e 100644 --- a/tests/baselines/reference/contextualTyping22.js +++ b/tests/baselines/reference/contextualTyping22.js @@ -2,9 +2,5 @@ var foo:(a:number)=>number = function(a){return a}; foo = function(b){return b}; //// [contextualTyping22.js] -var foo = function (a) { - return a; -}; -foo = function (b) { - return b; -}; +var foo = function (a) { return a; }; +foo = function (b) { return b; }; diff --git a/tests/baselines/reference/contextualTyping23.js b/tests/baselines/reference/contextualTyping23.js index 187fd3f86d3..0207f6af15d 100644 --- a/tests/baselines/reference/contextualTyping23.js +++ b/tests/baselines/reference/contextualTyping23.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5 //// [contextualTyping23.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping24.js b/tests/baselines/reference/contextualTyping24.js index 170a6983b9f..04c4ecba21b 100644 --- a/tests/baselines/reference/contextualTyping24.js +++ b/tests/baselines/reference/contextualTyping24.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){r //// [contextualTyping24.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping32.js b/tests/baselines/reference/contextualTyping32.js index 992724d4130..bbbafa70796 100644 --- a/tests/baselines/reference/contextualTyping32.js +++ b/tests/baselines/reference/contextualTyping32.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping32.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return 4; -}]); +foo([function () { return 1; }, function () { return 4; }]); diff --git a/tests/baselines/reference/contextualTyping33.js b/tests/baselines/reference/contextualTyping33.js index 0ca0c965b8b..1d800b1d113 100644 --- a/tests/baselines/reference/contextualTyping33.js +++ b/tests/baselines/reference/contextualTyping33.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping33.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return "foo"; -}]); +foo([function () { return 1; }, function () { return "foo"; }]); diff --git a/tests/baselines/reference/contextualTyping38.js b/tests/baselines/reference/contextualTyping38.js index 71ed8ece57d..9bed543ff7f 100644 --- a/tests/baselines/reference/contextualTyping38.js +++ b/tests/baselines/reference/contextualTyping38.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function(a) { return a }; //// [contextualTyping38.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping39.js b/tests/baselines/reference/contextualTyping39.js index 9a97b7eb3cc..89d045830a3 100644 --- a/tests/baselines/reference/contextualTyping39.js +++ b/tests/baselines/reference/contextualTyping39.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function() { return "err"; }; //// [contextualTyping39.js] -var foo = function () { - return "err"; -}; +var foo = function () { return "err"; }; diff --git a/tests/baselines/reference/contextualTyping40.js b/tests/baselines/reference/contextualTyping40.js index ba2c447b10f..0b98f8e45c6 100644 --- a/tests/baselines/reference/contextualTyping40.js +++ b/tests/baselines/reference/contextualTyping40.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> function(){return 1;}; //// [contextualTyping40.js] -var foo = function () { - return 1; -}; +var foo = function () { return 1; }; diff --git a/tests/baselines/reference/contextualTyping41.js b/tests/baselines/reference/contextualTyping41.js index 720f1d178f6..8bce7918dd2 100644 --- a/tests/baselines/reference/contextualTyping41.js +++ b/tests/baselines/reference/contextualTyping41.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> (function(){return "err";}); //// [contextualTyping41.js] -var foo = (function () { - return "err"; -}); +var foo = (function () { return "err"; }); diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js index b2a8bf0dba1..8142b51dcdd 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js @@ -22,10 +22,6 @@ var r6 = _.forEach(c2, (x) => { return x.toFixed() }); var c2; var _; // errors on all 3 lines, bug was that r5 was the only line with errors -var f = function (x) { - return x.toFixed(); -}; +var f = function (x) { return x.toFixed(); }; var r5 = _.forEach(c2, f); -var r6 = _.forEach(c2, function (x) { - return x.toFixed(); -}); +var r6 = _.forEach(c2, function (x) { return x.toFixed(); }); diff --git a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js index 220e06da59d..67670bf872e 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js +++ b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js @@ -9,6 +9,4 @@ callb((a) => { a.length; }); // Error, we picked the first overload and errored //// [contextualTypingOfLambdaReturnExpression.js] function callb(a) { } callb(function (a) { return a.length; }); // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type -callb(function (a) { - a.length; -}); // Error, we picked the first overload and errored when type checking the lambda body +callb(function (a) { a.length; }); // Error, we picked the first overload and errored when type checking the lambda body diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js index 415fc3acd2e..442ded4ba75 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js @@ -8,6 +8,4 @@ f = (a) => { return a.asdf } //// [contextualTypingOfLambdaWithMultipleSignatures2.js] var f; -f = function (a) { - return a.asdf; -}; +f = function (a) { return a.asdf; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js index f548b6daaad..5ee0c758022 100644 --- a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js @@ -19,10 +19,6 @@ f3 = (x, y) => { return x } //// [contextualTypingWithGenericAndNonGenericSignature.js] //• If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; var f3; -f3 = function (x, y) { - return x; -}; +f3 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericSignature.js index a1417e90b43..611a35f38ac 100644 --- a/tests/baselines/reference/contextualTypingWithGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericSignature.js @@ -10,6 +10,4 @@ f2 = (x, y) => { return x } //// [contextualTypingWithGenericSignature.js] // If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator.js b/tests/baselines/reference/contextuallyTypingOrOperator.js index 8d7babbbe6b..6dc3e09bf89 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator.js @@ -8,12 +8,6 @@ var v4 = (s: number) => 1 || function (s: string) { return s.length }; //// [contextuallyTypingOrOperator.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.length; -}; }; -var v3 = function (s) { return s.length || function (s) { - return 1; -}; }; -var v4 = function (s) { return 1 || function (s) { - return s.length; -}; }; +var v2 = function (s) { return s.length || function (s) { s.length; }; }; +var v3 = function (s) { return s.length || function (s) { return 1; }; }; +var v4 = function (s) { return 1 || function (s) { return s.length; }; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator2.js b/tests/baselines/reference/contextuallyTypingOrOperator2.js index 9aa2c778345..fa850929b3e 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator2.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator2.js @@ -5,6 +5,4 @@ var v2 = (s: string) => s.length || function (s) { s.aaa }; //// [contextuallyTypingOrOperator2.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.aaa; -}; }; +var v2 = function (s) { return s.length || function (s) { s.aaa; }; }; diff --git a/tests/baselines/reference/couldNotSelectGenericOverload.js b/tests/baselines/reference/couldNotSelectGenericOverload.js index 45ce1c42274..996ebde8448 100644 --- a/tests/baselines/reference/couldNotSelectGenericOverload.js +++ b/tests/baselines/reference/couldNotSelectGenericOverload.js @@ -9,13 +9,9 @@ var b3G = makeArray2(1, ""); // error //// [couldNotSelectGenericOverload.js] -function makeArray(items) { - return items; -} +function makeArray(items) { return items; } var b = [1, ""]; var b1G = makeArray(1, ""); // any, no error var b2G = makeArray(b); // any[] -function makeArray2(items) { - return items; -} +function makeArray2(items) { return items; } var b3G = makeArray2(1, ""); // error diff --git a/tests/baselines/reference/debuggerEmit.js b/tests/baselines/reference/debuggerEmit.js index c2f730271be..8cf5dc69cd0 100644 --- a/tests/baselines/reference/debuggerEmit.js +++ b/tests/baselines/reference/debuggerEmit.js @@ -3,7 +3,5 @@ var x = function () { debugger; } x(); //// [debuggerEmit.js] -var x = function () { - debugger; -}; +var x = function () { debugger; }; x(); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index d6d63e3443a..e01626a7ead 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -60,29 +60,17 @@ var C; return B; })(); C.B = B; - function F(x) { - return null; - } + function F(x) { return null; } C.F = F; - function F2(x) { - return null; - } + function F2(x) { return null; } C.F2 = F2; - function F3(x) { - return null; - } + function F3(x) { return null; } C.F3 = F3; - function F4(x) { - return null; - } + function F4(x) { return null; } C.F4 = F4; - function F5() { - return null; - } + function F5() { return null; } C.F5 = F5; - function F6(x) { - return null; - } + function F6(x) { return null; } C.F6 = F6; var D = (function () { function D(val) { diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js index 7d7c6ee73d3..85897bc2c9d 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js @@ -15,12 +15,8 @@ point./*3*/x = 30; function makePoint(x) { return { b: 10, - get x() { - return x; - }, - set x(a) { - this.b = a; - } + get x() { return x; }, + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js index b3d41829637..dd39a30f7a2 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -12,9 +12,7 @@ var /*2*/x = point./*3*/x; //// [declFileObjectLiteralWithOnlyGetter.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js index dae362caf36..e219e885053 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js @@ -13,9 +13,7 @@ point./*2*/x = 30; function makePoint(x) { return { b: 10, - set x(a) { - this.b = a; - } + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js index 38efa8255a7..326ce62171d 100644 --- a/tests/baselines/reference/declFilePrivateStatic.js +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -21,16 +21,12 @@ var C = (function () { C.a = function () { }; C.b = function () { }; Object.defineProperty(C, "c", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); Object.defineProperty(C, "d", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js index 3cea09c8c26..0150c3f9d42 100644 --- a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js @@ -16,9 +16,7 @@ function f2(x) { } function f3(x) { } function f4() { } function f5() { } -var f6 = function () { - return [10]; -}; +var f6 = function () { return [10]; }; //// [declFileRestParametersOfFunctionAndFunctionType.d.ts] diff --git a/tests/baselines/reference/declFileTypeofFunction.js b/tests/baselines/reference/declFileTypeofFunction.js index 2af519f411d..656e02b8ddd 100644 --- a/tests/baselines/reference/declFileTypeofFunction.js +++ b/tests/baselines/reference/declFileTypeofFunction.js @@ -34,12 +34,8 @@ function foo5(x: number) { } //// [declFileTypeofFunction.js] -function f() { - return undefined; -} -function g() { - return undefined; -} +function f() { return undefined; } +function g() { return undefined; } var b; function b1() { return b1; diff --git a/tests/baselines/reference/declInput-2.js b/tests/baselines/reference/declInput-2.js index 30a306c09f8..dcd37454ef0 100644 --- a/tests/baselines/reference/declInput-2.js +++ b/tests/baselines/reference/declInput-2.js @@ -38,20 +38,12 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; - D.prototype.m252 = function () { - return null; - }; // don't generate + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; + D.prototype.m252 = function () { return null; }; // don't generate D.prototype.m26 = function (i) { }; D.prototype.m262 = function (i) { }; - D.prototype.m3 = function () { - return new C(); - }; + D.prototype.m3 = function () { return new C(); }; return D; })(); M.D = D; diff --git a/tests/baselines/reference/declInput.js b/tests/baselines/reference/declInput.js index 39d466498fa..cd558c93403 100644 --- a/tests/baselines/reference/declInput.js +++ b/tests/baselines/reference/declInput.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput3.js b/tests/baselines/reference/declInput3.js index fa577a90645..3be31de3de0 100644 --- a/tests/baselines/reference/declInput3.js +++ b/tests/baselines/reference/declInput3.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput4.js b/tests/baselines/reference/declInput4.js index cce9127eddc..07b6f091a14 100644 --- a/tests/baselines/reference/declInput4.js +++ b/tests/baselines/reference/declInput4.js @@ -32,12 +32,8 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; D.prototype.m26 = function (i) { }; return D; })(); diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js index ff4323ce542..61a4ebdfcab 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.js +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -65,9 +65,7 @@ var C1 = (function () { return this.x; }; Object.defineProperty(C1.prototype, "accessor", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (a) { }, enumerable: true, configurable: true @@ -81,9 +79,7 @@ var C1 = (function () { configurable: true }); Object.defineProperty(C1, "staticGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -116,9 +112,7 @@ var C3 = (function (_super) { return _super.sf.call(this); }; Object.defineProperty(C3, "staticGetter", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js index 8fc1c601982..34e862063ce 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()--; // -- operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1--; // number type literal var ResultIsNumber3 = --1; var ResultIsNumber4 = --{ x: 1, y: 2 }; -var ResultIsNumber5 = --{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1--; var ResultIsNumber7 = { x: 1, y: 2 }--; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }--; // number type expressions var ResultIsNumber9 = --foo(); var ResultIsNumber10 = --A.foo(); diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js index 22c86aa8450..2be74a64d8f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a--, M.n--; //// [decrementOperatorWithUnsupportedBooleanType.js] // -- operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN--; // boolean type literal var ResultIsNumber3 = --true; var ResultIsNumber4 = --{ x: true, y: false }; -var ResultIsNumber5 = --{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true--; var ResultIsNumber7 = { x: true, y: false }--; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }--; // boolean type expressions var ResultIsNumber9 = --objA.a; var ResultIsNumber10 = --M.n; diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js index 1747b1648d6..430f9af963f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a--, M.n--; // -- operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1--; // string type literal var ResultIsNumber5 = --""; var ResultIsNumber6 = --{ x: "", y: "" }; -var ResultIsNumber7 = --{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = --{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""--; var ResultIsNumber9 = { x: "", y: "" }--; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }--; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }--; // string type expressions var ResultIsNumber11 = --objA.a; var ResultIsNumber12 = --M.n; diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js index 98e135cc712..ad6181ba7c5 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js @@ -20,13 +20,9 @@ var obj1; obj1.length; var obj2; obj2.length; -function concat(x, y) { - return null; -} +function concat(x, y) { return null; } var result = concat(1, ""); // error var elementCount = result.length; -function concat2(x, y) { - return null; -} +function concat2(x, y) { return null; } var result2 = concat2(1, ""); // result2 will be number|string var elementCount2 = result.length; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.js b/tests/baselines/reference/deleteOperatorWithBooleanType.js index cab9cba2c95..b0a60a23744 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.js +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.js @@ -41,15 +41,11 @@ delete M.n; //// [deleteOperatorWithBooleanType.js] // delete operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.js b/tests/baselines/reference/deleteOperatorWithNumberType.js index d19ae045805..bb70c55024d 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.js +++ b/tests/baselines/reference/deleteOperatorWithNumberType.js @@ -49,15 +49,11 @@ delete objA.a, M.n; // delete operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = delete NUMBER1; // number type literal var ResultIsBoolean3 = delete 1; var ResultIsBoolean4 = delete { x: 1, y: 2 }; -var ResultIsBoolean5 = delete { x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = delete { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/deleteOperatorWithStringType.js b/tests/baselines/reference/deleteOperatorWithStringType.js index ad27e8f84ad..79246e27725 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.js +++ b/tests/baselines/reference/deleteOperatorWithStringType.js @@ -48,15 +48,11 @@ delete objA.a,M.n; // delete operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = delete STRING1; // string type literal var ResultIsBoolean3 = delete ""; var ResultIsBoolean4 = delete { x: "", y: "" }; -var ResultIsBoolean5 = delete { x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = delete { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 1c56819b200..32e8cf4199e 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -66,9 +66,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - var r = function () { - _super.call(this); - }; // error + var r = function () { _super.call(this); }; // error } return Derived3; })(Base2); diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index bdfa31cb04f..f2e816604d2 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -52,18 +52,14 @@ var Base = (function () { } Base.prototype.b = function () { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function () { }; Object.defineProperty(Base, "t", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index af725e9b7bd..b66d356a73e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -50,18 +50,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -75,18 +71,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index b1f5de00fb5..80f7456ab9a 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -77,18 +77,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -103,18 +99,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index d6b93addbd3..cfb6116ee85 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -85,18 +85,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -126,9 +122,7 @@ var Derived3 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived3.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); @@ -174,9 +168,7 @@ var Derived8 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived8, "t", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index a1df28586d9..9d7df0eee40 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -76,18 +76,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -101,18 +97,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 7e61be1c1c9..1902b6f4068 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -67,9 +67,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(a) { - _super.call(this, function () { - return this; - }); // ok + _super.call(this, function () { return this; }); // ok this.a = a; } return Derived4; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 0b568eaec9b..8070e689bd0 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -70,9 +70,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -125,9 +123,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - }, + get: function () { return ''; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 63c33f87836..8b00c632058 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -36,9 +36,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -55,9 +53,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 692ae1569ec..4ac57d159e6 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -46,9 +46,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -65,9 +63,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 56ce444de0b..1037d3faaae 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -35,9 +35,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -54,9 +52,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 7ae518eeedf..c5bfea288bd 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -47,9 +47,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -67,9 +65,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index a0d6de6a819..e256313d27b 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -44,9 +44,7 @@ var Red = (function (_super) { } Red.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " red"; }; return Red; @@ -54,12 +52,8 @@ var Red = (function (_super) { var Color = (function () { function Color() { } - Color.prototype.shade = function () { - return "some shade"; - }; - Color.prototype.hue = function () { - return "some hue"; - }; + Color.prototype.shade = function () { return "some shade"; }; + Color.prototype.hue = function () { return "some hue"; }; return Color; })(); var Blue = (function (_super) { @@ -69,9 +63,7 @@ var Blue = (function (_super) { } Blue.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " blue"; }; return Blue; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 677fadf3876..4d1f0452be4 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -53,9 +53,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); @@ -98,9 +96,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - } // error + get: function () { return ''; } // error , enumerable: true, configurable: true diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index cace580eea1..e77a38c5be8 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -361,9 +361,7 @@ var TestRunner = (function () { this.tests = []; } TestRunner.arrayCompare = function (arg1, arg2) { - return (arg1.every(function (val, index) { - return val === arg2[index]; - })); + return (arg1.every(function (val, index) { return val === arg2[index]; })); }; TestRunner.prototype.addTest = function (test) { this.tests.push(test); @@ -410,23 +408,11 @@ exports.TestRunner = TestRunner; exports.tests = (function () { var testRunner = new TestRunner(); // First 3 are for simple harness validation - testRunner.addTest(new TestCase("Basic test", function () { - return true; - })); - testRunner.addTest(new TestCase("Test for any error", function () { - throw new Error(); - return false; - }, "")); - testRunner.addTest(new TestCase("Test RegEx error message match", function () { - throw new Error("Should also pass"); - return false; - }, "Should [also]+ pass")); - testRunner.addTest(new TestCase("Test array compare true", function () { - return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); - })); - testRunner.addTest(new TestCase("Test array compare false", function () { - return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); - })); + testRunner.addTest(new TestCase("Basic test", function () { return true; })); + testRunner.addTest(new TestCase("Test for any error", function () { throw new Error(); return false; }, "")); + testRunner.addTest(new TestCase("Test RegEx error message match", function () { throw new Error("Should also pass"); return false; }, "Should [also]+ pass")); + testRunner.addTest(new TestCase("Test array compare true", function () { return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); })); + testRunner.addTest(new TestCase("Test array compare false", function () { return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); })); // File detection tests testRunner.addTest(new TestCase("Check file exists", function () { return FileManager.DirectoryManager.fileExists(TestFileDir + "\\Test.txt"); @@ -436,22 +422,38 @@ exports.tests = (function () { })); // File pattern matching tests testRunner.addTest(new TestCase("Check text file match", function () { - return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); + return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && + FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && + FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); })); testRunner.addTest(new TestCase("Check makefile match", function () { return FileManager.FileBuffer.isTextFile("C:\\some dir\\makefile"); })); testRunner.addTest(new TestCase("Check binary file doesn't match", function () { - return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); + return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && + !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); })); // Command-line parameter tests testRunner.addTest(new TestCase("Check App defaults", function () { var app = new App.App([]); - return (app.fixLines === false && app.recurse === true && app.lineEndings === "CRLF" && app.matchPattern === undefined && app.rootDirectory === ".\\" && app.encodings[0] === "ascii" && app.encodings[1] === "utf8nobom"); + return (app.fixLines === false && + app.recurse === true && + app.lineEndings === "CRLF" && + app.matchPattern === undefined && + app.rootDirectory === ".\\" && + app.encodings[0] === "ascii" && + app.encodings[1] === "utf8nobom"); })); testRunner.addTest(new TestCase("Check App params", function () { var app = new App.App(["-dir=C:\\test dir", "-lineEndings=LF", "-encodings=utf16be,ascii", "-recurse=false", "-fixlines"]); - return (app.fixLines === true && app.lineEndings === "LF" && app.recurse === false && app.matchPattern === undefined && app.rootDirectory === "C:\\test dir" && app.encodings[0] === "utf16be" && app.encodings[1] === "ascii" && app.encodings.length === 2); + return (app.fixLines === true && + app.lineEndings === "LF" && + app.recurse === false && + app.matchPattern === undefined && + app.rootDirectory === "C:\\test dir" && + app.encodings[0] === "utf16be" && + app.encodings[1] === "ascii" && + app.encodings.length === 2); })); // File BOM detection tests testRunner.addTest(new TestCase("Check encoding detection no BOM", function () { @@ -516,9 +518,7 @@ exports.tests = (function () { var fb = new FileManager.FileBuffer(14); fb.writeUtf16leBom(); var chars = [0x0054, 0x00E8, 0x1D23, 0x2020, 0x000D, 0x000A]; - chars.forEach(function (val) { - fb.writeUtf16CodePoint(val, false); - }); + chars.forEach(function (val) { fb.writeUtf16CodePoint(val, false); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf16le') { @@ -573,9 +573,7 @@ exports.tests = (function () { var filename = TestFileDir + "\\tmpUTF8nonBmp.txt"; var fb = new FileManager.FileBuffer(15); var chars = [0x10480, 0x10481, 0x10482, 0x54, 0x68, 0x69]; - chars.forEach(function (val) { - fb.writeUtf8CodePoint(val); - }); + chars.forEach(function (val) { fb.writeUtf8CodePoint(val); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf8') { diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.js b/tests/baselines/reference/duplicateObjectLiteralProperty.js index 5fd2d1177f8..9c629b211cf 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.js +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.js @@ -30,11 +30,7 @@ var x = { } }; var y = { - get a() { - return 0; - }, + get a() { return 0; }, set a(v) { }, - get a() { - return 0; - } + get a() { return 0; } }; diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 41c52cbfefc..9c50c4776b1 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -14,6 +14,4 @@ var f3 = function (x, y) { }; var f4 = function (x, y, z) { }; function foo(func) { } foo(function () { return true; }); -foo(function () { - return false; -}); +foo(function () { return false; }); diff --git a/tests/baselines/reference/emitArrowFunctionES6.js b/tests/baselines/reference/emitArrowFunctionES6.js index 39d69cc1f0e..35078502ef7 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.js +++ b/tests/baselines/reference/emitArrowFunctionES6.js @@ -15,6 +15,4 @@ var f3 = (x, y, ...rest) => { }; var f4 = (x, y, z = 10) => { }; function foo(func) { } foo(() => { return true; }); -foo(() => { - return false; -}); +foo(() => { return false; }); diff --git a/tests/baselines/reference/enumBasics.js b/tests/baselines/reference/enumBasics.js index 6f1a039ca6e..eca92215fb6 100644 --- a/tests/baselines/reference/enumBasics.js +++ b/tests/baselines/reference/enumBasics.js @@ -150,21 +150,9 @@ var E9; // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ - E8.B, - E7.A, - E4.Z, - E3.X, - E3.Y, - E3.Z + E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z ]; // Enum computed members are not propagated var doPropagate = [ - 0 /* A */, - E9.B, - 0 /* B */, - 1 /* C */, - 0 /* A */, - 0 /* A */, - 3 /* B */, - 4 /* C */ + 0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */ ]; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 845bc9834f7..79ba631afed 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -209,9 +209,7 @@ var SomeDerived1 = (function (_super) { super.publicFunc.call(this); } var x = { - test: function () { - return super.publicFunc.call(this); - } + test: function () { return super.publicFunc.call(this); } }; }; return SomeDerived1; diff --git a/tests/baselines/reference/errorSupression1.js b/tests/baselines/reference/errorSupression1.js index 059530be452..53e40e585f0 100644 --- a/tests/baselines/reference/errorSupression1.js +++ b/tests/baselines/reference/errorSupression1.js @@ -12,9 +12,7 @@ baz.concat("y"); var Foo = (function () { function Foo() { } - Foo.bar = function () { - return "x"; - }; + Foo.bar = function () { return "x"; }; return Foo; })(); var baz = Foo.b; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 1a27a681e59..03bf31a6a6b 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -104,12 +104,8 @@ var tc2 = new testClass2(); // error: could not find symbol V var testClass3 = (function () { function testClass3() { } - testClass3.prototype.testMethod1 = function () { - return null; - }; // error: could not find symbol V - testClass3.testMethod2 = function () { - return null; - }; // error: could not find symbol V + testClass3.prototype.testMethod1 = function () { return null; }; // error: could not find symbol V + testClass3.testMethod2 = function () { return null; }; // error: could not find symbol V Object.defineProperty(testClass3.prototype, "a", { set: function (value) { } // error: could not find symbol V , @@ -119,9 +115,7 @@ var testClass3 = (function () { return testClass3; })(); // in function return type annotation -function testFunction1() { - return null; -} // error: could not find symbol V +function testFunction1() { return null; } // error: could not find symbol V // in paramter types function testFunction2(p) { } // error: could not find symbol V // in var type annotation diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 5fd9f0e9b7f..08c184a0df2 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -112,12 +112,8 @@ var Foo = (function (_super) { this.x = x; this.gar = 5; } - Foo.prototype.bar = function () { - return 0; - }; - Foo.prototype.boo = function (x) { - return x; - }; + Foo.prototype.bar = function () { return 0; }; + Foo.prototype.boo = function (x) { return x; }; Foo.statVal = 0; return Foo; })(Bar); diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index f4854644079..fb0349c9044 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -243,9 +243,7 @@ var SplatMonster = (function () { SplatMonster.prototype.roar = function (name) { }; return SplatMonster; })(); -function foo() { - return true; -} +function foo() { return true; } var PrototypeMonster = (function () { function PrototypeMonster() { this.age = 1; diff --git a/tests/baselines/reference/es6ClassTest8.js b/tests/baselines/reference/es6ClassTest8.js index 3c616e5e893..f96bbd16b0b 100644 --- a/tests/baselines/reference/es6ClassTest8.js +++ b/tests/baselines/reference/es6ClassTest8.js @@ -41,9 +41,7 @@ class Camera { //// [es6ClassTest8.js] -function f1(x) { - return x; -} +function f1(x) { return x; } var C = (function () { function C() { var bar = (function () { @@ -59,21 +57,11 @@ var Vector = (function () { this.y = y; this.z = z; } - Vector.norm = function (v) { - return null; - }; - Vector.minus = function (v1, v2) { - return null; - }; - Vector.times = function (v1, v2) { - return null; - }; - Vector.cross = function (v1, v2) { - return null; - }; - Vector.dot = function (v1, v2) { - return null; - }; + Vector.norm = function (v) { return null; }; + Vector.minus = function (v1, v2) { return null; }; + Vector.times = function (v1, v2) { return null; }; + Vector.cross = function (v1, v2) { return null; }; + Vector.dot = function (v1, v2) { return null; }; return Vector; })(); var Camera = (function () { diff --git a/tests/baselines/reference/es6MemberScoping.js b/tests/baselines/reference/es6MemberScoping.js index 85f76a93934..7e70045ceb3 100644 --- a/tests/baselines/reference/es6MemberScoping.js +++ b/tests/baselines/reference/es6MemberScoping.js @@ -30,8 +30,6 @@ var Foo = (function () { var Foo2 = (function () { function Foo2() { } - Foo2.Foo2 = function () { - return 0; - }; // should not be an error + Foo2.Foo2 = function () { return 0; }; // should not be an error return Foo2; })(); diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js index 291bcfcb68f..707801dc4ee 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js @@ -59,9 +59,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -70,9 +68,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js index 7191aef20bf..40e45bf7ec0 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js @@ -65,12 +65,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -79,9 +75,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -92,9 +86,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); var aNumber = 'this is a string'; diff --git a/tests/baselines/reference/everyTypeWithInitializer.js b/tests/baselines/reference/everyTypeWithInitializer.js index 74904a5ea30..aae0a9fe291 100644 --- a/tests/baselines/reference/everyTypeWithInitializer.js +++ b/tests/baselines/reference/everyTypeWithInitializer.js @@ -60,9 +60,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -71,9 +69,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/exportAssignmentFunction.js b/tests/baselines/reference/exportAssignmentFunction.js index 6d4336bd4bd..825d0f983ea 100644 --- a/tests/baselines/reference/exportAssignmentFunction.js +++ b/tests/baselines/reference/exportAssignmentFunction.js @@ -12,9 +12,7 @@ var n: number = fooFunc(); //// [exportAssignmentFunction_A.js] define(["require", "exports"], function (require, exports) { - function foo() { - return 0; - } + function foo() { return 0; } return foo; }); //// [exportAssignmentFunction_B.js] diff --git a/tests/baselines/reference/exportImportMultipleFiles.js b/tests/baselines/reference/exportImportMultipleFiles.js index 225b605f689..10909808ffc 100644 --- a/tests/baselines/reference/exportImportMultipleFiles.js +++ b/tests/baselines/reference/exportImportMultipleFiles.js @@ -14,9 +14,7 @@ lib.math.add(3, 4); // Shouldnt be error //// [exportImportMultipleFiles_math.js] define(["require", "exports"], function (require, exports) { - function add(a, b) { - return a + b; - } + function add(a, b) { return a + b; } exports.add = add; }); //// [exportImportMultipleFiles_library.js] diff --git a/tests/baselines/reference/exportPrivateType.js b/tests/baselines/reference/exportPrivateType.js index 96acc83edb5..11ccc037ef6 100644 --- a/tests/baselines/reference/exportPrivateType.js +++ b/tests/baselines/reference/exportPrivateType.js @@ -41,9 +41,7 @@ var foo; var C2 = (function () { function C2() { } - C2.prototype.test = function () { - return true; - }; + C2.prototype.test = function () { return true; }; return C2; })(); // None of the types are exported, so per section 10.3, should all be errors diff --git a/tests/baselines/reference/fatArrowfunctionAsType.js b/tests/baselines/reference/fatArrowfunctionAsType.js index bd2dc4310d9..894267580c6 100644 --- a/tests/baselines/reference/fatArrowfunctionAsType.js +++ b/tests/baselines/reference/fatArrowfunctionAsType.js @@ -7,7 +7,5 @@ b = c; //// [fatArrowfunctionAsType.js] -var c = function (x) { - return 42; -}; +var c = function (x) { return 42; }; b = c; diff --git a/tests/baselines/reference/fatarrowfunctions.js b/tests/baselines/reference/fatarrowfunctions.js index 1ad00820990..eb57d1a9817 100644 --- a/tests/baselines/reference/fatarrowfunctions.js +++ b/tests/baselines/reference/fatarrowfunctions.js @@ -49,56 +49,30 @@ var messenger = { function foo(x) { return x(); } -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); foo(function (x, y, z) { return x + y + z; }); foo(function (x, y, z) { return x + y + z; }); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); foo((function (x) { return x; })); foo(function (x) { return x * x; }); var y = function (x) { return x * x; }; var z = function (x) { return x * x; }; var w = function () { return 3; }; function ternaryTest(isWhile) { - var f = isWhile ? function (n) { - return n > 0; - } : function (n) { - return n === 0; - }; + var f = isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; }; } var messenger = { message: "Hello World", start: function () { var _this = this; - setTimeout(function () { - _this.message.toString(); - }, 3000); + setTimeout(function () { _this.message.toString(); }, 3000); } }; diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js index 59baa802c9f..7b7a8f30f05 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.js +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -21,9 +21,7 @@ foo(function () { return 0; }); foo((1), { return: 0 }); -foo(function (x) { - return x; -}); +foo(function (x) { return x; }); foo(function (x) { if (x === void 0) { x = 0; } return x; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js index 6d6e3013fbb..9052b894337 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -208,9 +208,7 @@ foo( return 28; }); // in multiple paren -((((function (arg) { - return 32; -})))); +((((function (arg) { return 32; })))); // in ternary exression false ? function () { return 41; } : null; false ? function (arg) { return 42; } : null; @@ -275,17 +273,9 @@ false ? null : function () { return 68; }; // nested ternary expressions -(function (a) { - return a; -}) ? function (b) { - return b; -} : function (c) { - return c; -}; +(function (a) { return a; }) ? function (b) { return b; } : function (c) { return c; }; //multiple levels -(function (a) { - return a; -}); +(function (a) { return a; }); (function (b) { return function (c) { return 81; }; }); (function (c) { return function (d) { return 82; }; }); // In Expressions diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.js b/tests/baselines/reference/fieldAndGetterWithSameName.js index 64129ff9365..ddd95b9e8f2 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.js +++ b/tests/baselines/reference/fieldAndGetterWithSameName.js @@ -10,9 +10,7 @@ define(["require", "exports"], function (require, exports) { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 00f1a64a8d6..32e1389232d 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -106,9 +106,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[d]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index fc43665e99e..6d42a550a01 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -87,9 +87,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[23]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/forStatements.js b/tests/baselines/reference/forStatements.js index 1755ff51fdc..39fdb6c8871 100644 --- a/tests/baselines/reference/forStatements.js +++ b/tests/baselines/reference/forStatements.js @@ -57,9 +57,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -68,9 +66,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); for (var aNumber = 9.9;;) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 5c856398be2..2282136be3a 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.js b/tests/baselines/reference/forStatementsMultipleValidDecl.js index 76571ce1ff4..e95e37d63ac 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.js @@ -49,9 +49,7 @@ for (var p = { x: 1, y: undefined };;) { } for (var p = { x: 1, y: 2 };;) { } for (var p = { x: 0, y: undefined };;) { } for (var p;;) { } -for (var fn = function (s) { - return 42; -};;) { } +for (var fn = function (s) { return 42; };;) { } for (var fn = function (s) { return 3; };;) { } for (var fn;;) { } for (var fn;;) { } diff --git a/tests/baselines/reference/functionAssignment.js b/tests/baselines/reference/functionAssignment.js index 5a3e07c9e8d..3237f53bf9a 100644 --- a/tests/baselines/reference/functionAssignment.js +++ b/tests/baselines/reference/functionAssignment.js @@ -53,6 +53,4 @@ f2(function () { function f3(a) { } f3({ a: 0, b: 0 }); function callb(a) { } -callb(function (a) { - a.length; -}); +callb(function (a) { a.length; }); diff --git a/tests/baselines/reference/functionAssignmentError.js b/tests/baselines/reference/functionAssignmentError.js index e19547096b8..dd35ccb271a 100644 --- a/tests/baselines/reference/functionAssignmentError.js +++ b/tests/baselines/reference/functionAssignmentError.js @@ -3,9 +3,5 @@ var func = function (){return "ONE";}; func = function (){return "ONE";}; //// [functionAssignmentError.js] -var func = function () { - return "ONE"; -}; -func = function () { - return "ONE"; -}; +var func = function () { return "ONE"; }; +func = function () { return "ONE"; }; diff --git a/tests/baselines/reference/functionCall1.js b/tests/baselines/reference/functionCall1.js index 8025ad5a6f5..cb8c1a46a23 100644 --- a/tests/baselines/reference/functionCall1.js +++ b/tests/baselines/reference/functionCall1.js @@ -3,8 +3,6 @@ function foo():any{return ""}; var x = foo(); //// [functionCall1.js] -function foo() { - return ""; -} +function foo() { return ""; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall2.js b/tests/baselines/reference/functionCall2.js index 5b6da378103..5351dc116ff 100644 --- a/tests/baselines/reference/functionCall2.js +++ b/tests/baselines/reference/functionCall2.js @@ -3,8 +3,6 @@ function foo():number{return 1}; var x = foo(); //// [functionCall2.js] -function foo() { - return 1; -} +function foo() { return 1; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall3.js b/tests/baselines/reference/functionCall3.js index db29b44db7a..74540c2ccf6 100644 --- a/tests/baselines/reference/functionCall3.js +++ b/tests/baselines/reference/functionCall3.js @@ -3,7 +3,5 @@ function foo():any[]{return [1];} var x = foo(); //// [functionCall3.js] -function foo() { - return [1]; -} +function foo() { return [1]; } var x = foo(); diff --git a/tests/baselines/reference/functionCall4.js b/tests/baselines/reference/functionCall4.js index 05021c33563..0f937337d49 100644 --- a/tests/baselines/reference/functionCall4.js +++ b/tests/baselines/reference/functionCall4.js @@ -4,12 +4,8 @@ function bar():()=>any{return foo}; var x = bar(); //// [functionCall4.js] -function foo() { - return ""; -} +function foo() { return ""; } ; -function bar() { - return foo; -} +function bar() { return foo; } ; var x = bar(); diff --git a/tests/baselines/reference/functionCall5.js b/tests/baselines/reference/functionCall5.js index e6b0e049ef6..dc7db4a9959 100644 --- a/tests/baselines/reference/functionCall5.js +++ b/tests/baselines/reference/functionCall5.js @@ -13,8 +13,6 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo() { - return new m1.c1(); -} +function foo() { return new m1.c1(); } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall7.js b/tests/baselines/reference/functionCall7.js index b32c21b5892..cb30e5d8b24 100644 --- a/tests/baselines/reference/functionCall7.js +++ b/tests/baselines/reference/functionCall7.js @@ -18,9 +18,7 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo(a) { - a.a = 1; -} +function foo(a) { a.a = 1; } ; var myC = new m1.c1(); foo(myC); diff --git a/tests/baselines/reference/functionConstraintSatisfaction.js b/tests/baselines/reference/functionConstraintSatisfaction.js index a16f4d1ed36..b8741456178 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction.js +++ b/tests/baselines/reference/functionConstraintSatisfaction.js @@ -63,9 +63,7 @@ function foo2(x: T, y: U) { //// [functionConstraintSatisfaction.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -78,12 +76,8 @@ var c; var r = foo(new Function()); var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r6 = foo(C); var r7 = foo(b); @@ -98,9 +92,7 @@ var a2; var b2; var c2; var r9 = foo(function (x) { return x; }); -var r10 = foo(function (x) { - return x; -}); +var r10 = foo(function (x) { return x; }); var r11 = foo(function (x) { return x; }); var r12 = foo(function (x, y) { return x; }); var r13 = foo(i2); diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.js b/tests/baselines/reference/functionConstraintSatisfaction2.js index 982dcb37a49..9e70a508ccd 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.js +++ b/tests/baselines/reference/functionConstraintSatisfaction2.js @@ -42,15 +42,11 @@ function fff(x: T, y: U) { //// [functionConstraintSatisfaction2.js] // satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted -function foo(x) { - return x; -} +function foo(x) { return x; } foo(1); foo(function () { }, 1); foo(1, function () { }); -function foo2(x) { - return x; -} +function foo2(x) { return x; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.js b/tests/baselines/reference/functionConstraintSatisfaction3.js index 4738cecedab..2c1bfa4d399 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction3.js +++ b/tests/baselines/reference/functionConstraintSatisfaction3.js @@ -43,9 +43,7 @@ var r15 = foo(c2); //// [functionConstraintSatisfaction3.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -57,12 +55,8 @@ var b; var c; var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r8 = foo(c); var i2; @@ -74,9 +68,7 @@ var C2 = (function () { var a2; var b2; var c2; -var r9 = foo(function (x) { - return x; -}); +var r9 = foo(function (x) { return x; }); var r10 = foo(function (x) { return x; }); var r12 = foo(i2); var r15 = foo(c2); diff --git a/tests/baselines/reference/functionExpressionReturningItself.js b/tests/baselines/reference/functionExpressionReturningItself.js index 8553d2da867..9485100164e 100644 --- a/tests/baselines/reference/functionExpressionReturningItself.js +++ b/tests/baselines/reference/functionExpressionReturningItself.js @@ -2,9 +2,7 @@ var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.js] -var x = function somefn() { - return somefn; -}; +var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.d.ts] diff --git a/tests/baselines/reference/functionOverloadAmbiguity1.js b/tests/baselines/reference/functionOverloadAmbiguity1.js index f2fa78e1c14..2833ccbcdc3 100644 --- a/tests/baselines/reference/functionOverloadAmbiguity1.js +++ b/tests/baselines/reference/functionOverloadAmbiguity1.js @@ -12,10 +12,6 @@ callb2((a) => { a.length; } ); // ok, chose first overload //// [functionOverloadAmbiguity1.js] function callb(a) { } -callb(function (a) { - a.length; -}); // error, chose first overload +callb(function (a) { a.length; }); // error, chose first overload function callb2(a) { } -callb2(function (a) { - a.length; -}); // ok, chose first overload +callb2(function (a) { a.length; }); // ok, chose first overload diff --git a/tests/baselines/reference/functionOverloads.js b/tests/baselines/reference/functionOverloads.js index 5504b286628..7e38b8fe993 100644 --- a/tests/baselines/reference/functionOverloads.js +++ b/tests/baselines/reference/functionOverloads.js @@ -5,8 +5,6 @@ function foo(bar?: string): any { return "" }; var x = foo(5); //// [functionOverloads.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } ; var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads1.js b/tests/baselines/reference/functionOverloads1.js index 695a9c37808..5b4acabd02c 100644 --- a/tests/baselines/reference/functionOverloads1.js +++ b/tests/baselines/reference/functionOverloads1.js @@ -5,6 +5,4 @@ function foo():string { return "a" } //// [functionOverloads1.js] 1 + 1; -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads11.js b/tests/baselines/reference/functionOverloads11.js index efc9c793125..8d85b0ffb7b 100644 --- a/tests/baselines/reference/functionOverloads11.js +++ b/tests/baselines/reference/functionOverloads11.js @@ -4,6 +4,4 @@ function foo():string { return "" } //// [functionOverloads11.js] -function foo() { - return ""; -} +function foo() { return ""; } diff --git a/tests/baselines/reference/functionOverloads12.js b/tests/baselines/reference/functionOverloads12.js index ff789083eeb..4681e43ee5b 100644 --- a/tests/baselines/reference/functionOverloads12.js +++ b/tests/baselines/reference/functionOverloads12.js @@ -5,9 +5,7 @@ function foo():any { if (true) return ""; else return 0;} //// [functionOverloads12.js] -function foo() { - if (true) - return ""; - else - return 0; -} +function foo() { if (true) + return ""; +else + return 0; } diff --git a/tests/baselines/reference/functionOverloads13.js b/tests/baselines/reference/functionOverloads13.js index f9eb4d59e47..ff43c85e3df 100644 --- a/tests/baselines/reference/functionOverloads13.js +++ b/tests/baselines/reference/functionOverloads13.js @@ -5,6 +5,4 @@ function foo(bar?:number):any { return "" } //// [functionOverloads13.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads14.js b/tests/baselines/reference/functionOverloads14.js index f9a08ecf952..826b096290a 100644 --- a/tests/baselines/reference/functionOverloads14.js +++ b/tests/baselines/reference/functionOverloads14.js @@ -5,6 +5,4 @@ function foo():{a:any;} { return {a:1} } //// [functionOverloads14.js] -function foo() { - return { a: 1 }; -} +function foo() { return { a: 1 }; } diff --git a/tests/baselines/reference/functionOverloads15.js b/tests/baselines/reference/functionOverloads15.js index 2b80df6630c..fe0c90f82af 100644 --- a/tests/baselines/reference/functionOverloads15.js +++ b/tests/baselines/reference/functionOverloads15.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads15.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads16.js b/tests/baselines/reference/functionOverloads16.js index ebf82febd16..a0fdaa88894 100644 --- a/tests/baselines/reference/functionOverloads16.js +++ b/tests/baselines/reference/functionOverloads16.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads16.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads17.js b/tests/baselines/reference/functionOverloads17.js index d9fa54b744b..3a5dcd81914 100644 --- a/tests/baselines/reference/functionOverloads17.js +++ b/tests/baselines/reference/functionOverloads17.js @@ -4,6 +4,4 @@ function foo():{a:string;} { return {a:""} } //// [functionOverloads17.js] -function foo() { - return { a: "" }; -} +function foo() { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads18.js b/tests/baselines/reference/functionOverloads18.js index e1061a32c09..8c196831e48 100644 --- a/tests/baselines/reference/functionOverloads18.js +++ b/tests/baselines/reference/functionOverloads18.js @@ -4,6 +4,4 @@ function foo(bar:{a:string;}) { return {a:""} } //// [functionOverloads18.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads19.js b/tests/baselines/reference/functionOverloads19.js index 6b383225dd0..4183f6a48b8 100644 --- a/tests/baselines/reference/functionOverloads19.js +++ b/tests/baselines/reference/functionOverloads19.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}) { return {a:""} } //// [functionOverloads19.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads2.js b/tests/baselines/reference/functionOverloads2.js index 7e9eb45d236..39a58663cf4 100644 --- a/tests/baselines/reference/functionOverloads2.js +++ b/tests/baselines/reference/functionOverloads2.js @@ -5,8 +5,6 @@ function foo(bar: any): any { return bar }; var x = foo(true); //// [functionOverloads2.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x = foo(true); diff --git a/tests/baselines/reference/functionOverloads20.js b/tests/baselines/reference/functionOverloads20.js index 012f2ce09cd..4f259a88538 100644 --- a/tests/baselines/reference/functionOverloads20.js +++ b/tests/baselines/reference/functionOverloads20.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}): string {return ""} //// [functionOverloads20.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads21.js b/tests/baselines/reference/functionOverloads21.js index 78fb1fe011f..6e69169efbf 100644 --- a/tests/baselines/reference/functionOverloads21.js +++ b/tests/baselines/reference/functionOverloads21.js @@ -5,6 +5,4 @@ function foo(bar:{a:any; b?:string;}[]) { return 0 } //// [functionOverloads21.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads22.js b/tests/baselines/reference/functionOverloads22.js index 531c37770b1..54b745d96dd 100644 --- a/tests/baselines/reference/functionOverloads22.js +++ b/tests/baselines/reference/functionOverloads22.js @@ -5,6 +5,4 @@ function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] } //// [functionOverloads22.js] -function foo(bar) { - return [{ a: "" }]; -} +function foo(bar) { return [{ a: "" }]; } diff --git a/tests/baselines/reference/functionOverloads23.js b/tests/baselines/reference/functionOverloads23.js index d8cac7eb8ee..aa3a7172ada 100644 --- a/tests/baselines/reference/functionOverloads23.js +++ b/tests/baselines/reference/functionOverloads23.js @@ -5,6 +5,4 @@ function foo(bar:(a?)=>void) { return 0 } //// [functionOverloads23.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads24.js b/tests/baselines/reference/functionOverloads24.js index c7255063174..8fcc3c81902 100644 --- a/tests/baselines/reference/functionOverloads24.js +++ b/tests/baselines/reference/functionOverloads24.js @@ -5,6 +5,4 @@ function foo(bar:any):(a)=>void { return function(){} } //// [functionOverloads24.js] -function foo(bar) { - return function () { }; -} +function foo(bar) { return function () { }; } diff --git a/tests/baselines/reference/functionOverloads25.js b/tests/baselines/reference/functionOverloads25.js index bbaef498926..d466aa82d21 100644 --- a/tests/baselines/reference/functionOverloads25.js +++ b/tests/baselines/reference/functionOverloads25.js @@ -6,8 +6,6 @@ var x = foo(); //// [functionOverloads25.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } ; var x = foo(); diff --git a/tests/baselines/reference/functionOverloads26.js b/tests/baselines/reference/functionOverloads26.js index 088c06147ba..bc4d017b9bb 100644 --- a/tests/baselines/reference/functionOverloads26.js +++ b/tests/baselines/reference/functionOverloads26.js @@ -6,7 +6,5 @@ var x = foo('baz'); //// [functionOverloads26.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo('baz'); diff --git a/tests/baselines/reference/functionOverloads27.js b/tests/baselines/reference/functionOverloads27.js index 2b11b1f6c4e..199905d8219 100644 --- a/tests/baselines/reference/functionOverloads27.js +++ b/tests/baselines/reference/functionOverloads27.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads27.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads28.js b/tests/baselines/reference/functionOverloads28.js index 566972ee25d..d10ef52e2b2 100644 --- a/tests/baselines/reference/functionOverloads28.js +++ b/tests/baselines/reference/functionOverloads28.js @@ -6,8 +6,6 @@ var t:any; var x = foo(t); //// [functionOverloads28.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var t; var x = foo(t); diff --git a/tests/baselines/reference/functionOverloads29.js b/tests/baselines/reference/functionOverloads29.js index c828bb95917..edc1ea178bc 100644 --- a/tests/baselines/reference/functionOverloads29.js +++ b/tests/baselines/reference/functionOverloads29.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads29.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads30.js b/tests/baselines/reference/functionOverloads30.js index 27b1436b6fb..bc7593a0771 100644 --- a/tests/baselines/reference/functionOverloads30.js +++ b/tests/baselines/reference/functionOverloads30.js @@ -6,7 +6,5 @@ var x = foo('bar'); //// [functionOverloads30.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo('bar'); diff --git a/tests/baselines/reference/functionOverloads31.js b/tests/baselines/reference/functionOverloads31.js index 01cee2c342b..2c2a15821a7 100644 --- a/tests/baselines/reference/functionOverloads31.js +++ b/tests/baselines/reference/functionOverloads31.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads31.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads32.js b/tests/baselines/reference/functionOverloads32.js index 4e0efa98b09..a5557042dfb 100644 --- a/tests/baselines/reference/functionOverloads32.js +++ b/tests/baselines/reference/functionOverloads32.js @@ -6,8 +6,6 @@ var baz:number; var x = foo(baz); //// [functionOverloads32.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var baz; var x = foo(baz); diff --git a/tests/baselines/reference/functionOverloads33.js b/tests/baselines/reference/functionOverloads33.js index 0c01cd54d1e..98bcc09b8b4 100644 --- a/tests/baselines/reference/functionOverloads33.js +++ b/tests/baselines/reference/functionOverloads33.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads33.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads34.js b/tests/baselines/reference/functionOverloads34.js index 48ac2b5fc59..3d4311e4193 100644 --- a/tests/baselines/reference/functionOverloads34.js +++ b/tests/baselines/reference/functionOverloads34.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads34.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads35.js b/tests/baselines/reference/functionOverloads35.js index fa373a9ee52..b25ac6c3c5f 100644 --- a/tests/baselines/reference/functionOverloads35.js +++ b/tests/baselines/reference/functionOverloads35.js @@ -6,7 +6,5 @@ var x = foo({a:1}); //// [functionOverloads35.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 1 }); diff --git a/tests/baselines/reference/functionOverloads36.js b/tests/baselines/reference/functionOverloads36.js index 33f6156c66b..4e790917d93 100644 --- a/tests/baselines/reference/functionOverloads36.js +++ b/tests/baselines/reference/functionOverloads36.js @@ -6,7 +6,5 @@ var x = foo({a:'foo'}); //// [functionOverloads36.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 'foo' }); diff --git a/tests/baselines/reference/functionOverloads37.js b/tests/baselines/reference/functionOverloads37.js index f9e6130dbd9..c4e0d4fd18b 100644 --- a/tests/baselines/reference/functionOverloads37.js +++ b/tests/baselines/reference/functionOverloads37.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads37.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads38.js b/tests/baselines/reference/functionOverloads38.js index 410b4358ede..c973cbe7b67 100644 --- a/tests/baselines/reference/functionOverloads38.js +++ b/tests/baselines/reference/functionOverloads38.js @@ -6,7 +6,5 @@ var x = foo([{a:1}]); //// [functionOverloads38.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 1 }]); diff --git a/tests/baselines/reference/functionOverloads39.js b/tests/baselines/reference/functionOverloads39.js index 771a3148036..ad4ded394d8 100644 --- a/tests/baselines/reference/functionOverloads39.js +++ b/tests/baselines/reference/functionOverloads39.js @@ -6,7 +6,5 @@ var x = foo([{a:true}]); //// [functionOverloads39.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: true }]); diff --git a/tests/baselines/reference/functionOverloads4.js b/tests/baselines/reference/functionOverloads4.js index b428f6938b4..3a1ff2ced33 100644 --- a/tests/baselines/reference/functionOverloads4.js +++ b/tests/baselines/reference/functionOverloads4.js @@ -3,6 +3,4 @@ function foo():number; function foo():string { return "a" } //// [functionOverloads4.js] -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads40.js b/tests/baselines/reference/functionOverloads40.js index f718f0a8847..11edff26a4b 100644 --- a/tests/baselines/reference/functionOverloads40.js +++ b/tests/baselines/reference/functionOverloads40.js @@ -6,7 +6,5 @@ var x = foo([{a:'bar'}]); //// [functionOverloads40.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 'bar' }]); diff --git a/tests/baselines/reference/functionOverloads41.js b/tests/baselines/reference/functionOverloads41.js index 566ef21424f..dd730e25b31 100644 --- a/tests/baselines/reference/functionOverloads41.js +++ b/tests/baselines/reference/functionOverloads41.js @@ -6,7 +6,5 @@ var x = foo([{}]); //// [functionOverloads41.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{}]); diff --git a/tests/baselines/reference/functionOverloads42.js b/tests/baselines/reference/functionOverloads42.js index fcca395581c..979bfa86d62 100644 --- a/tests/baselines/reference/functionOverloads42.js +++ b/tests/baselines/reference/functionOverloads42.js @@ -6,7 +6,5 @@ var x = foo([{a:'s'}]); //// [functionOverloads42.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 's' }]); diff --git a/tests/baselines/reference/functionOverloads7.js b/tests/baselines/reference/functionOverloads7.js index 52cac83af72..540abf9eb8c 100644 --- a/tests/baselines/reference/functionOverloads7.js +++ b/tests/baselines/reference/functionOverloads7.js @@ -14,9 +14,7 @@ class foo { var foo = (function () { function foo() { } - foo.prototype.bar = function (foo) { - return "foo"; - }; + foo.prototype.bar = function (foo) { return "foo"; }; foo.prototype.n = function () { var foo = this.bar(); foo = this.bar("test"); diff --git a/tests/baselines/reference/functionOverloads8.js b/tests/baselines/reference/functionOverloads8.js index 08c2c0b65a1..55539a61659 100644 --- a/tests/baselines/reference/functionOverloads8.js +++ b/tests/baselines/reference/functionOverloads8.js @@ -5,6 +5,4 @@ function foo(foo?:any){ return '' } //// [functionOverloads8.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } diff --git a/tests/baselines/reference/functionOverloads9.js b/tests/baselines/reference/functionOverloads9.js index 53cc0385a59..9d2ae21f4fa 100644 --- a/tests/baselines/reference/functionOverloads9.js +++ b/tests/baselines/reference/functionOverloads9.js @@ -5,8 +5,6 @@ var x = foo('foo'); //// [functionOverloads9.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } ; var x = foo('foo'); diff --git a/tests/baselines/reference/functionReturn.js b/tests/baselines/reference/functionReturn.js index fbb889589a0..c433eec190d 100644 --- a/tests/baselines/reference/functionReturn.js +++ b/tests/baselines/reference/functionReturn.js @@ -20,9 +20,7 @@ function f1() { var n = f0(); } function f2() { } -function f3() { - return; -} +function f3() { return; } function f4() { return ''; return; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 68cc22ff45e..0337ab8f1a1 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -382,30 +382,17 @@ var Derived2 = (function (_super) { })(Base); var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); var x1 = function () { return [d1, d2]; }; -var x2 = function () { - return [d1, d2]; -}; -var x3 = function named() { - return [d1, d2]; -}; +var x2 = function () { return [d1, d2]; }; +var x3 = function named() { return [d1, d2]; }; var x4 = function () { return [d1, d2]; }; -var x5 = function () { - return [d1, d2]; -}; -var x6 = function named() { - return [d1, d2]; -}; +var x5 = function () { return [d1, d2]; }; +var x6 = function named() { return [d1, d2]; }; var x7 = [d1, d2]; var x8 = [d1, d2]; var x9 = [d1, d2]; var x10 = { n: [d1, d2] }; -var x11 = function (n) { - var n; - return null; -}; -var x12 = { func: function (n) { - return [d1, d2]; -} }; +var x11 = function (n) { var n; return null; }; +var x12 = { func: function (n) { return [d1, d2]; } }; var x13 = (function () { function x13() { this.member = function () { return [d1, d2]; }; @@ -414,17 +401,13 @@ var x13 = (function () { })(); var x14 = (function () { function x14() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x14; })(); var x15 = (function () { function x15() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x15; })(); @@ -436,17 +419,13 @@ var x16 = (function () { })(); var x17 = (function () { function x17() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x17; })(); var x18 = (function () { function x18() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x18; })(); @@ -476,18 +455,13 @@ var x22 = (function () { })(); var x23 = (function () { function x23() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x23; })(); var x24 = (function () { function x24() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x24; })(); @@ -499,17 +473,13 @@ var x25 = (function () { })(); var x26 = (function () { function x26() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x26; })(); var x27 = (function () { function x27() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x27; })(); @@ -521,17 +491,13 @@ var x28 = (function () { })(); var x29 = (function () { function x29() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x29; })(); var x30 = (function () { function x30() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x30; })(); @@ -561,18 +527,13 @@ var x34 = (function () { })(); var x35 = (function () { function x35() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x35; })(); var x36 = (function () { function x36() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x36; })(); @@ -584,17 +545,13 @@ var x37 = (function () { })(); var x38 = (function () { function x38() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x38; })(); var x39 = (function () { function x39() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x39; })(); @@ -606,17 +563,13 @@ var x40 = (function () { })(); var x41 = (function () { function x41() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x41; })(); var x42 = (function () { function x42() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x42; })(); @@ -646,18 +599,13 @@ var x46 = (function () { })(); var x47 = (function () { function x47() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x47; })(); var x48 = (function () { function x48() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x48; })(); @@ -670,17 +618,13 @@ var x49 = (function () { var x50 = (function () { function x50() { } - x50.member = function () { - return [d1, d2]; - }; + x50.member = function () { return [d1, d2]; }; return x50; })(); var x51 = (function () { function x51() { } - x51.member = function named() { - return [d1, d2]; - }; + x51.member = function named() { return [d1, d2]; }; return x51; })(); var x52 = (function () { @@ -692,17 +636,13 @@ var x52 = (function () { var x53 = (function () { function x53() { } - x53.member = function () { - return [d1, d2]; - }; + x53.member = function () { return [d1, d2]; }; return x53; })(); var x54 = (function () { function x54() { } - x54.member = function named() { - return [d1, d2]; - }; + x54.member = function named() { return [d1, d2]; }; return x54; })(); var x55 = (function () { @@ -732,18 +672,13 @@ var x58 = (function () { var x59 = (function () { function x59() { } - x59.member = function (n) { - var n; - return null; - }; + x59.member = function (n) { var n; return null; }; return x59; })(); var x60 = (function () { function x60() { } - x60.member = { func: function (n) { - return [d1, d2]; - } }; + x60.member = { func: function (n) { return [d1, d2]; } }; return x60; })(); var x61 = (function () { @@ -755,17 +690,13 @@ var x61 = (function () { var x62 = (function () { function x62() { } - x62.member = function () { - return [d1, d2]; - }; + x62.member = function () { return [d1, d2]; }; return x62; })(); var x63 = (function () { function x63() { } - x63.member = function named() { - return [d1, d2]; - }; + x63.member = function named() { return [d1, d2]; }; return x63; })(); var x64 = (function () { @@ -777,17 +708,13 @@ var x64 = (function () { var x65 = (function () { function x65() { } - x65.member = function () { - return [d1, d2]; - }; + x65.member = function () { return [d1, d2]; }; return x65; })(); var x66 = (function () { function x66() { } - x66.member = function named() { - return [d1, d2]; - }; + x66.member = function named() { return [d1, d2]; }; return x66; })(); var x67 = (function () { @@ -817,18 +744,13 @@ var x70 = (function () { var x71 = (function () { function x71() { } - x71.member = function (n) { - var n; - return null; - }; + x71.member = function (n) { var n; return null; }; return x71; })(); var x72 = (function () { function x72() { } - x72.member = { func: function (n) { - return [d1, d2]; - } }; + x72.member = { func: function (n) { return [d1, d2]; } }; return x72; })(); var x73 = (function () { @@ -840,17 +762,13 @@ var x73 = (function () { var x74 = (function () { function x74() { } - x74.member = function () { - return [d1, d2]; - }; + x74.member = function () { return [d1, d2]; }; return x74; })(); var x75 = (function () { function x75() { } - x75.member = function named() { - return [d1, d2]; - }; + x75.member = function named() { return [d1, d2]; }; return x75; })(); var x76 = (function () { @@ -862,17 +780,13 @@ var x76 = (function () { var x77 = (function () { function x77() { } - x77.member = function () { - return [d1, d2]; - }; + x77.member = function () { return [d1, d2]; }; return x77; })(); var x78 = (function () { function x78() { } - x78.member = function named() { - return [d1, d2]; - }; + x78.member = function named() { return [d1, d2]; }; return x78; })(); var x79 = (function () { @@ -902,18 +816,13 @@ var x82 = (function () { var x83 = (function () { function x83() { } - x83.member = function (n) { - var n; - return null; - }; + x83.member = function (n) { var n; return null; }; return x83; })(); var x84 = (function () { function x84() { } - x84.member = { func: function (n) { - return [d1, d2]; - } }; + x84.member = { func: function (n) { return [d1, d2]; } }; return x84; })(); var x85 = (function () { @@ -924,17 +833,13 @@ var x85 = (function () { })(); var x86 = (function () { function x86(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x86; })(); var x87 = (function () { function x87(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x87; })(); @@ -946,17 +851,13 @@ var x88 = (function () { })(); var x89 = (function () { function x89(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x89; })(); var x90 = (function () { function x90(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x90; })(); @@ -986,18 +887,13 @@ var x94 = (function () { })(); var x95 = (function () { function x95(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } } return x95; })(); var x96 = (function () { function x96(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } } return x96; })(); @@ -1010,18 +906,14 @@ var x97 = (function () { })(); var x98 = (function () { function x98(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x98; })(); var x99 = (function () { function x99(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x99; @@ -1035,18 +927,14 @@ var x100 = (function () { })(); var x101 = (function () { function x101(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x101; })(); var x102 = (function () { function x102(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x102; @@ -1081,19 +969,14 @@ var x106 = (function () { })(); var x107 = (function () { function x107(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x107; })(); var x108 = (function () { function x108(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x108; @@ -1107,18 +990,14 @@ var x109 = (function () { })(); var x110 = (function () { function x110(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x110; })(); var x111 = (function () { function x111(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x111; @@ -1132,18 +1011,14 @@ var x112 = (function () { })(); var x113 = (function () { function x113(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x113; })(); var x114 = (function () { function x114(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x114; @@ -1178,19 +1053,14 @@ var x118 = (function () { })(); var x119 = (function () { function x119(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x119; })(); var x120 = (function () { function x120(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x120; @@ -1207,242 +1077,65 @@ function x129(parm) { } function x130(parm) { } function x131(parm) { } function x132(parm) { } -function x133() { - return function () { return [d1, d2]; }; -} -function x134() { - return function () { - return [d1, d2]; - }; -} -function x135() { - return function named() { - return [d1, d2]; - }; -} -function x136() { - return function () { return [d1, d2]; }; -} -function x137() { - return function () { - return [d1, d2]; - }; -} -function x138() { - return function named() { - return [d1, d2]; - }; -} -function x139() { - return [d1, d2]; -} -function x140() { - return [d1, d2]; -} -function x141() { - return [d1, d2]; -} -function x142() { - return { n: [d1, d2] }; -} -function x143() { - return function (n) { - var n; - return null; - }; -} -function x144() { - return { func: function (n) { - return [d1, d2]; - } }; -} -function x145() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x146() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x147() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x148() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x149() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x150() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x151() { - return [d1, d2]; - return [d1, d2]; -} -function x152() { - return [d1, d2]; - return [d1, d2]; -} -function x153() { - return [d1, d2]; - return [d1, d2]; -} -function x154() { - return { n: [d1, d2] }; - return { n: [d1, d2] }; -} -function x155() { - return function (n) { - var n; - return null; - }; - return function (n) { - var n; - return null; - }; -} -function x156() { - return { func: function (n) { - return [d1, d2]; - } }; - return { func: function (n) { - return [d1, d2]; - } }; -} -var x157 = function () { - return function () { return [d1, d2]; }; -}; -var x158 = function () { - return function () { - return [d1, d2]; - }; -}; -var x159 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x160 = function () { - return function () { return [d1, d2]; }; -}; -var x161 = function () { - return function () { - return [d1, d2]; - }; -}; -var x162 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x163 = function () { - return [d1, d2]; -}; -var x164 = function () { - return [d1, d2]; -}; -var x165 = function () { - return [d1, d2]; -}; -var x166 = function () { - return { n: [d1, d2] }; -}; -var x167 = function () { - return function (n) { - var n; - return null; - }; -}; -var x168 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; -var x169 = function () { - return function () { return [d1, d2]; }; -}; -var x170 = function () { - return function () { - return [d1, d2]; - }; -}; -var x171 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x172 = function () { - return function () { return [d1, d2]; }; -}; -var x173 = function () { - return function () { - return [d1, d2]; - }; -}; -var x174 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x175 = function () { - return [d1, d2]; -}; -var x176 = function () { - return [d1, d2]; -}; -var x177 = function () { - return [d1, d2]; -}; -var x178 = function () { - return { n: [d1, d2] }; -}; -var x179 = function () { - return function (n) { - var n; - return null; - }; -}; -var x180 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; +function x133() { return function () { return [d1, d2]; }; } +function x134() { return function () { return [d1, d2]; }; } +function x135() { return function named() { return [d1, d2]; }; } +function x136() { return function () { return [d1, d2]; }; } +function x137() { return function () { return [d1, d2]; }; } +function x138() { return function named() { return [d1, d2]; }; } +function x139() { return [d1, d2]; } +function x140() { return [d1, d2]; } +function x141() { return [d1, d2]; } +function x142() { return { n: [d1, d2] }; } +function x143() { return function (n) { var n; return null; }; } +function x144() { return { func: function (n) { return [d1, d2]; } }; } +function x145() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x146() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x147() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x148() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x149() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x150() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x151() { return [d1, d2]; return [d1, d2]; } +function x152() { return [d1, d2]; return [d1, d2]; } +function x153() { return [d1, d2]; return [d1, d2]; } +function x154() { return { n: [d1, d2] }; return { n: [d1, d2] }; } +function x155() { return function (n) { var n; return null; }; return function (n) { var n; return null; }; } +function x156() { return { func: function (n) { return [d1, d2]; } }; return { func: function (n) { return [d1, d2]; } }; } +var x157 = function () { return function () { return [d1, d2]; }; }; +var x158 = function () { return function () { return [d1, d2]; }; }; +var x159 = function () { return function named() { return [d1, d2]; }; }; +var x160 = function () { return function () { return [d1, d2]; }; }; +var x161 = function () { return function () { return [d1, d2]; }; }; +var x162 = function () { return function named() { return [d1, d2]; }; }; +var x163 = function () { return [d1, d2]; }; +var x164 = function () { return [d1, d2]; }; +var x165 = function () { return [d1, d2]; }; +var x166 = function () { return { n: [d1, d2] }; }; +var x167 = function () { return function (n) { var n; return null; }; }; +var x168 = function () { return { func: function (n) { return [d1, d2]; } }; }; +var x169 = function () { return function () { return [d1, d2]; }; }; +var x170 = function () { return function () { return [d1, d2]; }; }; +var x171 = function () { return function named() { return [d1, d2]; }; }; +var x172 = function () { return function () { return [d1, d2]; }; }; +var x173 = function () { return function () { return [d1, d2]; }; }; +var x174 = function () { return function named() { return [d1, d2]; }; }; +var x175 = function () { return [d1, d2]; }; +var x176 = function () { return [d1, d2]; }; +var x177 = function () { return [d1, d2]; }; +var x178 = function () { return { n: [d1, d2] }; }; +var x179 = function () { return function (n) { var n; return null; }; }; +var x180 = function () { return { func: function (n) { return [d1, d2]; } }; }; var x181; (function (x181) { var t = function () { return [d1, d2]; }; })(x181 || (x181 = {})); var x182; (function (x182) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x182 || (x182 = {})); var x183; (function (x183) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x183 || (x183 = {})); var x184; (function (x184) { @@ -1450,15 +1143,11 @@ var x184; })(x184 || (x184 = {})); var x185; (function (x185) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x185 || (x185 = {})); var x186; (function (x186) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x186 || (x186 = {})); var x187; (function (x187) { @@ -1478,16 +1167,11 @@ var x190; })(x190 || (x190 = {})); var x191; (function (x191) { - var t = function (n) { - var n; - return null; - }; + var t = function (n) { var n; return null; }; })(x191 || (x191 = {})); var x192; (function (x192) { - var t = { func: function (n) { - return [d1, d2]; - } }; + var t = { func: function (n) { return [d1, d2]; } }; })(x192 || (x192 = {})); var x193; (function (x193) { @@ -1495,15 +1179,11 @@ var x193; })(x193 || (x193 = {})); var x194; (function (x194) { - x194.t = function () { - return [d1, d2]; - }; + x194.t = function () { return [d1, d2]; }; })(x194 || (x194 = {})); var x195; (function (x195) { - x195.t = function named() { - return [d1, d2]; - }; + x195.t = function named() { return [d1, d2]; }; })(x195 || (x195 = {})); var x196; (function (x196) { @@ -1511,15 +1191,11 @@ var x196; })(x196 || (x196 = {})); var x197; (function (x197) { - x197.t = function () { - return [d1, d2]; - }; + x197.t = function () { return [d1, d2]; }; })(x197 || (x197 = {})); var x198; (function (x198) { - x198.t = function named() { - return [d1, d2]; - }; + x198.t = function named() { return [d1, d2]; }; })(x198 || (x198 = {})); var x199; (function (x199) { @@ -1539,48 +1215,25 @@ var x202; })(x202 || (x202 = {})); var x203; (function (x203) { - x203.t = function (n) { - var n; - return null; - }; + x203.t = function (n) { var n; return null; }; })(x203 || (x203 = {})); var x204; (function (x204) { - x204.t = { func: function (n) { - return [d1, d2]; - } }; + x204.t = { func: function (n) { return [d1, d2]; } }; })(x204 || (x204 = {})); -var x206 = function () { - return [d1, d2]; -}; -var x207 = function named() { - return [d1, d2]; -}; -var x209 = function () { - return [d1, d2]; -}; -var x210 = function named() { - return [d1, d2]; -}; +var x206 = function () { return [d1, d2]; }; +var x207 = function named() { return [d1, d2]; }; +var x209 = function () { return [d1, d2]; }; +var x210 = function named() { return [d1, d2]; }; var x211 = [d1, d2]; var x212 = [d1, d2]; var x213 = [d1, d2]; var x214 = { n: [d1, d2] }; -var x216 = { func: function (n) { - return [d1, d2]; -} }; -var x217 = undefined || function () { - return [d1, d2]; -}; -var x218 = undefined || function named() { - return [d1, d2]; -}; -var x219 = undefined || function () { - return [d1, d2]; -}; -var x220 = undefined || function named() { - return [d1, d2]; -}; +var x216 = { func: function (n) { return [d1, d2]; } }; +var x217 = undefined || function () { return [d1, d2]; }; +var x218 = undefined || function named() { return [d1, d2]; }; +var x219 = undefined || function () { return [d1, d2]; }; +var x220 = undefined || function named() { return [d1, d2]; }; var x221 = undefined || [d1, d2]; var x222 = undefined || [d1, d2]; var x223 = undefined || [d1, d2]; @@ -1588,23 +1241,15 @@ var x224 = undefined || { n: [d1, d2] }; var x225; x225 = function () { return [d1, d2]; }; var x226; -x226 = function () { - return [d1, d2]; -}; +x226 = function () { return [d1, d2]; }; var x227; -x227 = function named() { - return [d1, d2]; -}; +x227 = function named() { return [d1, d2]; }; var x228; x228 = function () { return [d1, d2]; }; var x229; -x229 = function () { - return [d1, d2]; -}; +x229 = function () { return [d1, d2]; }; var x230; -x230 = function named() { - return [d1, d2]; -}; +x230 = function named() { return [d1, d2]; }; var x231; x231 = [d1, d2]; var x232; @@ -1614,223 +1259,107 @@ x233 = [d1, d2]; var x234; x234 = { n: [d1, d2] }; var x235; -x235 = function (n) { - var n; - return null; -}; +x235 = function (n) { var n; return null; }; var x236; -x236 = { func: function (n) { - return [d1, d2]; -} }; +x236 = { func: function (n) { return [d1, d2]; } }; var x237 = { n: function () { return [d1, d2]; } }; -var x238 = { n: function () { - return [d1, d2]; -} }; -var x239 = { n: function named() { - return [d1, d2]; -} }; +var x238 = { n: function () { return [d1, d2]; } }; +var x239 = { n: function named() { return [d1, d2]; } }; var x240 = { n: function () { return [d1, d2]; } }; -var x241 = { n: function () { - return [d1, d2]; -} }; -var x242 = { n: function named() { - return [d1, d2]; -} }; +var x241 = { n: function () { return [d1, d2]; } }; +var x242 = { n: function named() { return [d1, d2]; } }; var x243 = { n: [d1, d2] }; var x244 = { n: [d1, d2] }; var x245 = { n: [d1, d2] }; var x246 = { n: { n: [d1, d2] } }; -var x247 = { n: function (n) { - var n; - return null; -} }; -var x248 = { n: { func: function (n) { - return [d1, d2]; -} } }; +var x247 = { n: function (n) { var n; return null; } }; +var x248 = { n: { func: function (n) { return [d1, d2]; } } }; var x252 = [function () { return [d1, d2]; }]; -var x253 = [function () { - return [d1, d2]; -}]; -var x254 = [function named() { - return [d1, d2]; -}]; +var x253 = [function () { return [d1, d2]; }]; +var x254 = [function named() { return [d1, d2]; }]; var x255 = [[d1, d2]]; var x256 = [[d1, d2]]; var x257 = [[d1, d2]]; var x258 = [{ n: [d1, d2] }]; -var x260 = [{ func: function (n) { - return [d1, d2]; -} }]; -var x261 = function () { - return [d1, d2]; -} || undefined; -var x262 = function named() { - return [d1, d2]; -} || undefined; -var x263 = function () { - return [d1, d2]; -} || undefined; -var x264 = function named() { - return [d1, d2]; -} || undefined; +var x260 = [{ func: function (n) { return [d1, d2]; } }]; +var x261 = function () { return [d1, d2]; } || undefined; +var x262 = function named() { return [d1, d2]; } || undefined; +var x263 = function () { return [d1, d2]; } || undefined; +var x264 = function named() { return [d1, d2]; } || undefined; var x265 = [d1, d2] || undefined; var x266 = [d1, d2] || undefined; var x267 = [d1, d2] || undefined; var x268 = { n: [d1, d2] } || undefined; -var x269 = undefined || function () { - return [d1, d2]; -}; -var x270 = undefined || function named() { - return [d1, d2]; -}; -var x271 = undefined || function () { - return [d1, d2]; -}; -var x272 = undefined || function named() { - return [d1, d2]; -}; +var x269 = undefined || function () { return [d1, d2]; }; +var x270 = undefined || function named() { return [d1, d2]; }; +var x271 = undefined || function () { return [d1, d2]; }; +var x272 = undefined || function named() { return [d1, d2]; }; var x273 = undefined || [d1, d2]; var x274 = undefined || [d1, d2]; var x275 = undefined || [d1, d2]; var x276 = undefined || { n: [d1, d2] }; -var x277 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x278 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; -var x279 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x280 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; +var x277 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x278 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; +var x279 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x280 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; var x281 = [d1, d2] || [d1, d2]; var x282 = [d1, d2] || [d1, d2]; var x283 = [d1, d2] || [d1, d2]; var x284 = { n: [d1, d2] } || { n: [d1, d2] }; var x285 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x286 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x287 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x286 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x287 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x288 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x289 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x290 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x289 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x290 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x291 = true ? [d1, d2] : [d1, d2]; var x292 = true ? [d1, d2] : [d1, d2]; var x293 = true ? [d1, d2] : [d1, d2]; var x294 = true ? { n: [d1, d2] } : { n: [d1, d2] }; -var x295 = true ? function (n) { - var n; - return null; -} : function (n) { - var n; - return null; -}; -var x296 = true ? { func: function (n) { - return [d1, d2]; -} } : { func: function (n) { - return [d1, d2]; -} }; +var x295 = true ? function (n) { var n; return null; } : function (n) { var n; return null; }; +var x296 = true ? { func: function (n) { return [d1, d2]; } } : { func: function (n) { return [d1, d2]; } }; var x297 = true ? undefined : function () { return [d1, d2]; }; -var x298 = true ? undefined : function () { - return [d1, d2]; -}; -var x299 = true ? undefined : function named() { - return [d1, d2]; -}; +var x298 = true ? undefined : function () { return [d1, d2]; }; +var x299 = true ? undefined : function named() { return [d1, d2]; }; var x300 = true ? undefined : function () { return [d1, d2]; }; -var x301 = true ? undefined : function () { - return [d1, d2]; -}; -var x302 = true ? undefined : function named() { - return [d1, d2]; -}; +var x301 = true ? undefined : function () { return [d1, d2]; }; +var x302 = true ? undefined : function named() { return [d1, d2]; }; var x303 = true ? undefined : [d1, d2]; var x304 = true ? undefined : [d1, d2]; var x305 = true ? undefined : [d1, d2]; var x306 = true ? undefined : { n: [d1, d2] }; -var x307 = true ? undefined : function (n) { - var n; - return null; -}; -var x308 = true ? undefined : { func: function (n) { - return [d1, d2]; -} }; +var x307 = true ? undefined : function (n) { var n; return null; }; +var x308 = true ? undefined : { func: function (n) { return [d1, d2]; } }; var x309 = true ? function () { return [d1, d2]; } : undefined; -var x310 = true ? function () { - return [d1, d2]; -} : undefined; -var x311 = true ? function named() { - return [d1, d2]; -} : undefined; +var x310 = true ? function () { return [d1, d2]; } : undefined; +var x311 = true ? function named() { return [d1, d2]; } : undefined; var x312 = true ? function () { return [d1, d2]; } : undefined; -var x313 = true ? function () { - return [d1, d2]; -} : undefined; -var x314 = true ? function named() { - return [d1, d2]; -} : undefined; +var x313 = true ? function () { return [d1, d2]; } : undefined; +var x314 = true ? function named() { return [d1, d2]; } : undefined; var x315 = true ? [d1, d2] : undefined; var x316 = true ? [d1, d2] : undefined; var x317 = true ? [d1, d2] : undefined; var x318 = true ? { n: [d1, d2] } : undefined; -var x319 = true ? function (n) { - var n; - return null; -} : undefined; -var x320 = true ? { func: function (n) { - return [d1, d2]; -} } : undefined; +var x319 = true ? function (n) { var n; return null; } : undefined; +var x320 = true ? { func: function (n) { return [d1, d2]; } } : undefined; function x321(n) { } ; x321(function () { return [d1, d2]; }); function x322(n) { } ; -x322(function () { - return [d1, d2]; -}); +x322(function () { return [d1, d2]; }); function x323(n) { } ; -x323(function named() { - return [d1, d2]; -}); +x323(function named() { return [d1, d2]; }); function x324(n) { } ; x324(function () { return [d1, d2]; }); function x325(n) { } ; -x325(function () { - return [d1, d2]; -}); +x325(function () { return [d1, d2]; }); function x326(n) { } ; -x326(function named() { - return [d1, d2]; -}); +x326(function named() { return [d1, d2]; }); function x327(n) { } ; x327([d1, d2]); @@ -1845,35 +1374,22 @@ function x330(n) { } x330({ n: [d1, d2] }); function x331(n) { } ; -x331(function (n) { - var n; - return null; -}); +x331(function (n) { var n; return null; }); function x332(n) { } ; -x332({ func: function (n) { - return [d1, d2]; -} }); +x332({ func: function (n) { return [d1, d2]; } }); var x333 = function (n) { return n; }; x333(function () { return [d1, d2]; }); var x334 = function (n) { return n; }; -x334(function () { - return [d1, d2]; -}); +x334(function () { return [d1, d2]; }); var x335 = function (n) { return n; }; -x335(function named() { - return [d1, d2]; -}); +x335(function named() { return [d1, d2]; }); var x336 = function (n) { return n; }; x336(function () { return [d1, d2]; }); var x337 = function (n) { return n; }; -x337(function () { - return [d1, d2]; -}); +x337(function () { return [d1, d2]; }); var x338 = function (n) { return n; }; -x338(function named() { - return [d1, d2]; -}); +x338(function named() { return [d1, d2]; }); var x339 = function (n) { return n; }; x339([d1, d2]); var x340 = function (n) { return n; }; @@ -1883,34 +1399,21 @@ x341([d1, d2]); var x342 = function (n) { return n; }; x342({ n: [d1, d2] }); var x343 = function (n) { return n; }; -x343(function (n) { - var n; - return null; -}); +x343(function (n) { var n; return null; }); var x344 = function (n) { return n; }; -x344({ func: function (n) { - return [d1, d2]; -} }); +x344({ func: function (n) { return [d1, d2]; } }); var x345 = function (n) { }; x345(function () { return [d1, d2]; }); var x346 = function (n) { }; -x346(function () { - return [d1, d2]; -}); +x346(function () { return [d1, d2]; }); var x347 = function (n) { }; -x347(function named() { - return [d1, d2]; -}); +x347(function named() { return [d1, d2]; }); var x348 = function (n) { }; x348(function () { return [d1, d2]; }); var x349 = function (n) { }; -x349(function () { - return [d1, d2]; -}); +x349(function () { return [d1, d2]; }); var x350 = function (n) { }; -x350(function named() { - return [d1, d2]; -}); +x350(function named() { return [d1, d2]; }); var x351 = function (n) { }; x351([d1, d2]); var x352 = function (n) { }; @@ -1920,11 +1423,6 @@ x353([d1, d2]); var x354 = function (n) { }; x354({ n: [d1, d2] }); var x355 = function (n) { }; -x355(function (n) { - var n; - return null; -}); +x355(function (n) { var n; return null; }); var x356 = function (n) { }; -x356({ func: function (n) { - return [d1, d2]; -} }); +x356({ func: function (n) { return [d1, d2]; } }); diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt index 63ff9d9313e..7180dc7c25b 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'f' of types 'Foo' and 'Bar' are not identical. + Named property 'f' of types 'Foo' and 'Bar' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2 interface Hello extends Foo, Bar { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'f' of types 'Foo' and 'Bar' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt index 05fdd68319e..158fd447923 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. - Named properties 'f' of types 'Bar' and 'Foo' are not identical. + Named property 'f' of types 'Bar' and 'Foo' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2 interface Hello extends Bar, Foo { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. -!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical. +!!! error TS2320: Named property 'f' of types 'Bar' and 'Foo' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js index 7abeeda445a..70f70ae07ba 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js @@ -23,9 +23,7 @@ var a4: I = >z; var A = (function () { function A() { } - A.prototype.compareTo = function (other) { - return 1; - }; + A.prototype.compareTo = function (other) { return 1; }; return A; })(); var z = { x: new A() }; diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js index fed1d4ca990..30d4ed353ff 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js @@ -48,25 +48,19 @@ var r3 = foo(function (x) { return ''; }); // {} function foo2(x, cb) { return cb(x); } -var r4 = foo2(1, function (a) { - return ''; -}); // string, contextual signature instantiation is applied to generic functions +var r4 = foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = foo2(1, function (a) { return ''; }); // string var r6 = foo2('', function (a) { return 1; }); function foo3(x, cb, y) { return cb(x); } var r7 = foo3(1, function (a) { return ''; }, ''); // string -var r8 = foo3(1, function (a) { - return ''; -}, 1); // error +var r8 = foo3(1, function (a) { return ''; }, 1); // error var r9 = foo3(1, function (a) { return ''; }, ''); // string function other(t, u) { var r10 = foo2(1, function (x) { return ''; }); // error var r10 = foo2(1, function (x) { return ''; }); // string var r11 = foo3(1, function (x) { return ''; }, ''); // error var r11b = foo3(1, function (x) { return ''; }, 1); // error - var r12 = foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = foo3(1, function (a) { return ''; }, 1); // error } diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js index c289ce3de14..f140caaac61 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js @@ -8,9 +8,7 @@ var x4 = foo({ x: "", y: 4 }, ""); var x5 = foo({ x: "", y: 4 }, ""); //// [genericCallWithObjectLiteralArguments1.js] -function foo(n, m) { - return m; -} +function foo(n, m) { return m; } // these are all errors var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js index 25001bd86bb..b4f96f67942 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js @@ -46,10 +46,7 @@ var NonGenericParameter; function foo4(cb) { return cb; } - var r3 = foo4(function (x) { - var r; - return r; - }); // ok + var r3 = foo4(function (x) { var r; return r; }); // ok })(NonGenericParameter || (NonGenericParameter = {})); var GenericParameter; (function (GenericParameter) { diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 5aa2c716986..4f26e35d1b0 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -92,9 +92,7 @@ var Portal; function Validator(message) { } Validator.prototype.destroy = function () { }; - Validator.prototype._validate = function (value) { - return 0; - }; + Validator.prototype._validate = function (value) { return 0; }; return Validator; })(); Validators.Validator = Validator; diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js index 7ec25949534..5156c4d6b12 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js @@ -104,9 +104,7 @@ var WithCandidates; return C; })(); var c; - var r4 = c.foo2(1, function (a) { - return ''; - }); // string, contextual signature instantiation is applied to generic functions + var r4 = c.foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = c.foo2(1, function (a) { return ''; }); // string var r6 = c.foo2('', function (a) { return 1; }); // number var C2 = (function () { @@ -119,9 +117,7 @@ var WithCandidates; })(); var c2; var r7 = c2.foo3(1, function (a) { return ''; }, ''); // string - var r8 = c2.foo3(1, function (a) { - return ''; - }, ''); // string + var r8 = c2.foo3(1, function (a) { return ''; }, ''); // string var C3 = (function () { function C3() { } @@ -136,8 +132,6 @@ var WithCandidates; var r10 = c.foo2(1, function (x) { return ''; }); // string var r11 = c3.foo3(1, function (x) { return ''; }, ''); // error var r11b = c3.foo3(1, function (x) { return ''; }, 1); // error - var r12 = c3.foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = c3.foo3(1, function (a) { return ''; }, 1); // error } })(WithCandidates || (WithCandidates = {})); diff --git a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js index 2fd410756b6..4caeacd19e2 100644 --- a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js +++ b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js @@ -28,8 +28,6 @@ var Foo = (function () { Foo.a = function (n) { }; Foo.c = []; Foo.d = false || (function (x) { return x || undefined; })(null); - Foo.e = function (x) { - return null; - }; + Foo.e = function (x) { return null; }; return Foo; })(); diff --git a/tests/baselines/reference/genericCombinators2.js b/tests/baselines/reference/genericCombinators2.js index af11f056197..a23f163a906 100644 --- a/tests/baselines/reference/genericCombinators2.js +++ b/tests/baselines/reference/genericCombinators2.js @@ -19,10 +19,6 @@ var r5b = _.map(c2, rf1); //// [genericCombinators2.js] var _; var c2; -var rf1 = function (x, y) { - return x.toFixed(); -}; -var r5a = _.map(c2, function (x, y) { - return x.toFixed(); -}); +var rf1 = function (x, y) { return x.toFixed(); }; +var r5a = _.map(c2, function (x, y) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/genericConstraintDeclaration.js b/tests/baselines/reference/genericConstraintDeclaration.js index cdf93d676d0..6e3f8d5ff8b 100644 --- a/tests/baselines/reference/genericConstraintDeclaration.js +++ b/tests/baselines/reference/genericConstraintDeclaration.js @@ -12,9 +12,7 @@ class List{ var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/genericFunctions0.js b/tests/baselines/reference/genericFunctions0.js index 408abdb9ce0..b52f0583524 100644 --- a/tests/baselines/reference/genericFunctions0.js +++ b/tests/baselines/reference/genericFunctions0.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions0.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctions1.js b/tests/baselines/reference/genericFunctions1.js index 25cc91820b8..d9bb3413890 100644 --- a/tests/baselines/reference/genericFunctions1.js +++ b/tests/baselines/reference/genericFunctions1.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions1.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js index d2e1a5ecc37..9ad885a899a 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js @@ -24,20 +24,8 @@ var Collection = (function () { })(); var utils; var c = new Collection(); -var r3 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var r4 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var f1 = function (x) { - return 1; -}; -var f2 = function (y) { - return new Date(); -}; +var r3 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var r4 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var f1 = function (x) { return 1; }; +var f2 = function (y) { return new Date(); }; var r5 = utils.mapReduce(c, f1, f2); diff --git a/tests/baselines/reference/genericFunduleInModule.js b/tests/baselines/reference/genericFunduleInModule.js index 5a85a46a395..95700edecab 100644 --- a/tests/baselines/reference/genericFunduleInModule.js +++ b/tests/baselines/reference/genericFunduleInModule.js @@ -12,9 +12,7 @@ A.B(1); //// [genericFunduleInModule.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; var B; (function (B) { diff --git a/tests/baselines/reference/genericFunduleInModule2.js b/tests/baselines/reference/genericFunduleInModule2.js index 6b5a0a74e23..956e9129ec7 100644 --- a/tests/baselines/reference/genericFunduleInModule2.js +++ b/tests/baselines/reference/genericFunduleInModule2.js @@ -15,9 +15,7 @@ A.B(1); //// [genericFunduleInModule2.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; })(A || (A = {})); var A; diff --git a/tests/baselines/reference/genericImplements.js b/tests/baselines/reference/genericImplements.js index 17d3d2c0d20..b8d295153a4 100644 --- a/tests/baselines/reference/genericImplements.js +++ b/tests/baselines/reference/genericImplements.js @@ -37,26 +37,20 @@ var B = (function () { var X = (function () { function X() { } - X.prototype.f = function () { - return undefined; - }; + X.prototype.f = function () { return undefined; }; return X; })(); // { f: () => { b; } } // OK var Y = (function () { function Y() { } - Y.prototype.f = function () { - return undefined; - }; + Y.prototype.f = function () { return undefined; }; return Y; })(); // { f: () => { a; } } // OK var Z = (function () { function Z() { } - Z.prototype.f = function () { - return undefined; - }; + Z.prototype.f = function () { return undefined; }; return Z; })(); // { f: () => T } diff --git a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js index f57f6713c9f..e1cc5cadbd5 100644 --- a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js +++ b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js @@ -12,6 +12,4 @@ foo((arg: Foo) => { return arg.x; }); function foo(a) { return null; } -foo(function (arg) { - return arg.x; -}); +foo(function (arg) { return arg.x; }); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 5d4ecdc0838..9b0fbf4bcad 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -7,9 +7,7 @@ module foo { //// [genericMergedDeclarationUsingTypeParameter.js] -function foo(y, z) { - return y; -} +function foo(y, z) { return y; } var foo; (function (foo) { foo.x; diff --git a/tests/baselines/reference/genericObjectLitReturnType.js b/tests/baselines/reference/genericObjectLitReturnType.js index 5191f17796b..826f5233b55 100644 --- a/tests/baselines/reference/genericObjectLitReturnType.js +++ b/tests/baselines/reference/genericObjectLitReturnType.js @@ -15,9 +15,7 @@ t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type var X = (function () { function X() { } - X.prototype.f = function (t) { - return { a: t }; - }; + X.prototype.f = function (t) { return { a: t }; }; return X; })(); var x; diff --git a/tests/baselines/reference/genericOfACloduleType1.js b/tests/baselines/reference/genericOfACloduleType1.js index 85629db765b..1f115aa486a 100644 --- a/tests/baselines/reference/genericOfACloduleType1.js +++ b/tests/baselines/reference/genericOfACloduleType1.js @@ -16,9 +16,7 @@ var g2 = new G() // was: error Type reference cannot refer to container 'M. var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericOfACloduleType2.js b/tests/baselines/reference/genericOfACloduleType2.js index 0b10451bf2c..1d671289cb2 100644 --- a/tests/baselines/reference/genericOfACloduleType2.js +++ b/tests/baselines/reference/genericOfACloduleType2.js @@ -19,9 +19,7 @@ module N { var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericParameterAssignability1.js b/tests/baselines/reference/genericParameterAssignability1.js index 844c8f9a988..a6a465b4089 100644 --- a/tests/baselines/reference/genericParameterAssignability1.js +++ b/tests/baselines/reference/genericParameterAssignability1.js @@ -4,8 +4,6 @@ var r = (x: T) => x; r = f; // should be allowed //// [genericParameterAssignability1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; r = f; // should be allowed diff --git a/tests/baselines/reference/genericPrototypeProperty.js b/tests/baselines/reference/genericPrototypeProperty.js index c38cdb753a7..fb6f9b78848 100644 --- a/tests/baselines/reference/genericPrototypeProperty.js +++ b/tests/baselines/reference/genericPrototypeProperty.js @@ -13,9 +13,7 @@ var r3 = r.foo(null); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var r = C.prototype; diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.js b/tests/baselines/reference/genericReturnTypeFromGetter1.js index 208b12308e1..741c7218345 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.js +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.js @@ -14,9 +14,7 @@ define(["require", "exports"], function (require, exports) { function DbSet() { } Object.defineProperty(DbSet.prototype, "entityType", { - get: function () { - return this._entityType; - } // used to ICE without return type annotation + get: function () { return this._entityType; } // used to ICE without return type annotation , enumerable: true, configurable: true diff --git a/tests/baselines/reference/genericReversingTypeParameters.js b/tests/baselines/reference/genericReversingTypeParameters.js index 0e51b0256ea..2a52c2e9ba6 100644 --- a/tests/baselines/reference/genericReversingTypeParameters.js +++ b/tests/baselines/reference/genericReversingTypeParameters.js @@ -14,12 +14,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericReversingTypeParameters2.js b/tests/baselines/reference/genericReversingTypeParameters2.js index eb904f4a2ed..4f4bc564f89 100644 --- a/tests/baselines/reference/genericReversingTypeParameters2.js +++ b/tests/baselines/reference/genericReversingTypeParameters2.js @@ -13,12 +13,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericSpecializations1.js b/tests/baselines/reference/genericSpecializations1.js index 3df2c5581b9..3e59fceff97 100644 --- a/tests/baselines/reference/genericSpecializations1.js +++ b/tests/baselines/reference/genericSpecializations1.js @@ -19,24 +19,18 @@ class StringFoo3 implements IFoo { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations2.js b/tests/baselines/reference/genericSpecializations2.js index 666ea43eeba..8497d2db8b4 100644 --- a/tests/baselines/reference/genericSpecializations2.js +++ b/tests/baselines/reference/genericSpecializations2.js @@ -31,24 +31,18 @@ var IFoo = (function () { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations3.js b/tests/baselines/reference/genericSpecializations3.js index 8d157761160..3c582ae31fd 100644 --- a/tests/baselines/reference/genericSpecializations3.js +++ b/tests/baselines/reference/genericSpecializations3.js @@ -41,27 +41,21 @@ iFoo.foo(1); var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var intFooBad; var IntFoo = (function () { function IntFoo() { } - IntFoo.prototype.foo = function (x) { - return null; - }; + IntFoo.prototype.foo = function (x) { return null; }; return IntFoo; })(); var intFoo; var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var stringFoo2; @@ -71,9 +65,7 @@ stringFoo2 = intFoo; // error var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); var stringFoo3; diff --git a/tests/baselines/reference/genericStaticAnyTypeFunction.js b/tests/baselines/reference/genericStaticAnyTypeFunction.js index 055e6b4f683..6816afec910 100644 --- a/tests/baselines/reference/genericStaticAnyTypeFunction.js +++ b/tests/baselines/reference/genericStaticAnyTypeFunction.js @@ -25,9 +25,7 @@ var A = (function () { A.one = function (source, value) { return source; }; - A.goo = function () { - return 0; - }; + A.goo = function () { return 0; }; A.two = function (source) { return this.one(source, 42); // should not error }; diff --git a/tests/baselines/reference/genericTypeAssertions3.js b/tests/baselines/reference/genericTypeAssertions3.js index 19a477c142c..b67a277654f 100644 --- a/tests/baselines/reference/genericTypeAssertions3.js +++ b/tests/baselines/reference/genericTypeAssertions3.js @@ -4,9 +4,5 @@ var s = < (x: T) => T > ((x: any) => { return null; }); // no error //// [genericTypeAssertions3.js] -var r = (function (x) { - return null; -}); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error -var s = (function (x) { - return null; -}); // no error +var r = (function (x) { return null; }); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error +var s = (function (x) { return null; }); // no error diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index d04b6cbe104..a607fb07428 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -35,9 +35,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ""; - }; + A.prototype.foo = function () { return ""; }; return A; })(); var B = (function (_super) { @@ -45,9 +43,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return 1; - }; + B.prototype.bar = function () { return 1; }; return B; })(A); var C = (function (_super) { @@ -55,9 +51,7 @@ var C = (function (_super) { function C() { _super.apply(this, arguments); } - C.prototype.baz = function () { - return 1; - }; + C.prototype.baz = function () { return 1; }; return C; })(A); var a; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 1b41116732a..4be1cce27a9 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -55,18 +55,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index f96e25301be..803d499705a 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -50,18 +50,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js index 69bc1c372b3..90ad9e1ff93 100644 --- a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js +++ b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js @@ -15,9 +15,7 @@ var i2: I; // should be an error var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; // error diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.js b/tests/baselines/reference/genericWithOpenTypeParameters1.js index afdce73cb11..90202767012 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.js +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.js @@ -15,22 +15,12 @@ var f4 = (x: B) => { return x.foo(1); } // no error var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var x; x.foo(1); // no error -var f = function (x) { - return x.foo(1); -}; // error -var f2 = function (x) { - return x.foo(1); -}; // error -var f3 = function (x) { - return x.foo(1); -}; // error -var f4 = function (x) { - return x.foo(1); -}; // no error +var f = function (x) { return x.foo(1); }; // error +var f2 = function (x) { return x.foo(1); }; // error +var f3 = function (x) { return x.foo(1); }; // error +var f4 = function (x) { return x.foo(1); }; // no error diff --git a/tests/baselines/reference/genericsAndHigherOrderFunctions.js b/tests/baselines/reference/genericsAndHigherOrderFunctions.js index 1086bd78c54..f2e6ef58f22 100644 --- a/tests/baselines/reference/genericsAndHigherOrderFunctions.js +++ b/tests/baselines/reference/genericsAndHigherOrderFunctions.js @@ -19,5 +19,13 @@ var foo: (g: (x: K) => N) => //// [genericsAndHigherOrderFunctions.js] // no errors expected -var combine = function (f) { return function (g) { return function (x) { return f(g(x)); }; }; }; -var foo = function (g) { return function (h) { return function (f) { return h(combine(f)(g)); }; }; }; +var combine = function (f) { + return function (g) { + return function (x) { return f(g(x)); }; + }; +}; +var foo = function (g) { + return function (h) { + return function (f) { return h(combine(f)(g)); }; + }; +}; diff --git a/tests/baselines/reference/genericsManyTypeParameters.js b/tests/baselines/reference/genericsManyTypeParameters.js index 19a5117cb6b..491f0c41168 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.js +++ b/tests/baselines/reference/genericsManyTypeParameters.js @@ -61,5 +61,22 @@ function Foo< //// [genericsManyTypeParameters.js] function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) { - return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18]; + return [x1, y1, z1, a1, b1, c1, + x2, y2, z2, a2, b2, c2, + x3, y3, z3, a3, b3, c3, + x4, y4, z4, a4, b4, c4, + x5, y5, z5, a5, b5, c5, + x6, y6, z6, a6, b6, c6, + x7, y7, z7, a7, b7, c7, + x8, y8, z8, a8, b8, c8, + x9, y9, z9, a9, b9, c9, + x10, y12, z10, a10, b10, c10, + x11, y13, z11, a11, b11, c11, + x12, y14, z12, a12, b12, c12, + x13, y15, z13, a13, b13, c13, + x14, y16, z14, a14, b14, c14, + x15, y17, z15, a15, b15, c15, + x16, y18, z16, a16, b16, c16, + x17, y19, z17, a17, b17, c17, + x18, y10, z18, a18, b18, c18]; } diff --git a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js index f01f01dbf21..72eeb1ab683 100644 --- a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js +++ b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js @@ -18,21 +18,15 @@ var m = { //// [genericsWithDuplicateTypeParameters1.js] function f() { } -function f2(a, b) { - return null; -} +function f2(a, b) { return null; } var C = (function () { function C() { } C.prototype.f = function () { }; - C.prototype.f2 = function (a, b) { - return null; - }; + C.prototype.f2 = function (a, b) { return null; }; return C; })(); var m = { a: function f() { }, - b: function f2(a, b) { - return null; - } + b: function f2(a, b) { return null; } }; diff --git a/tests/baselines/reference/genericsWithoutTypeParameters1.js b/tests/baselines/reference/genericsWithoutTypeParameters1.js index 8446d40cb11..41abffcb854 100644 --- a/tests/baselines/reference/genericsWithoutTypeParameters1.js +++ b/tests/baselines/reference/genericsWithoutTypeParameters1.js @@ -37,9 +37,7 @@ function f(x: T): A { var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; @@ -49,9 +47,7 @@ var i2; function foo(x, y) { } function foo2(x, y) { } var x = { a: new C() }; -var x2 = { a: { bar: function () { - return 1; -} } }; +var x2 = { a: { bar: function () { return 1; } } }; var D = (function () { function D() { } diff --git a/tests/baselines/reference/getAndSetAsMemberNames.js b/tests/baselines/reference/getAndSetAsMemberNames.js index 41a89e6ec37..8b036cd0f73 100644 --- a/tests/baselines/reference/getAndSetAsMemberNames.js +++ b/tests/baselines/reference/getAndSetAsMemberNames.js @@ -49,13 +49,9 @@ var C4 = (function () { })(); var C5 = (function () { function C5() { - this.set = function () { - return true; - }; + this.set = function () { return true; }; } - C5.prototype.get = function () { - return true; - }; + C5.prototype.get = function () { return true; }; Object.defineProperty(C5.prototype, "t", { set: function (x) { }, enumerable: true, diff --git a/tests/baselines/reference/getsetReturnTypes.js b/tests/baselines/reference/getsetReturnTypes.js index 55d7e9285b0..27b6fc52fe5 100644 --- a/tests/baselines/reference/getsetReturnTypes.js +++ b/tests/baselines/reference/getsetReturnTypes.js @@ -10,9 +10,7 @@ var y: number = makePoint(2).x; //// [getsetReturnTypes.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/getterSetterNonAccessor.js b/tests/baselines/reference/getterSetterNonAccessor.js index e32c62c497e..c28337ff7b4 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.js +++ b/tests/baselines/reference/getterSetterNonAccessor.js @@ -10,9 +10,7 @@ Object.defineProperty({}, "0", ({ //// [getterSetterNonAccessor.js] -function getFunc() { - return 0; -} +function getFunc() { return 0; } function setFunc(v) { } Object.defineProperty({}, "0", ({ get: getFunc, diff --git a/tests/baselines/reference/gettersAndSetters.js b/tests/baselines/reference/gettersAndSetters.js index 6fb9518cfdb..92f959e5988 100644 --- a/tests/baselines/reference/gettersAndSetters.js +++ b/tests/baselines/reference/gettersAndSetters.js @@ -50,25 +50,17 @@ var C = (function () { this.set = function () { }; // ok } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return this.fooBack; - } // ok + get: function () { return this.fooBack; } // ok , - set: function (foo) { - this.fooBack = foo; - } // ok + set: function (foo) { this.fooBack = foo; } // ok , enumerable: true, configurable: true }); Object.defineProperty(C, "Bar", { - get: function () { - return C.barBack; - } // ok + get: function () { return C.barBack; } // ok , - set: function (bar) { - C.barBack = bar; - } // ok + set: function (bar) { C.barBack = bar; } // ok , enumerable: true, configurable: true @@ -84,13 +76,7 @@ C.Bar = "barv"; var baz = c.Baz; c.Baz = "bazv"; // The Foo accessors' return and param types should be contextually typed to the Foo field -var o = { get Foo() { - return 0; -}, set Foo(val) { - val; -} }; // o +var o = { get Foo() { return 0; }, set Foo(val) { val; } }; // o var ofg = o.Foo; o.Foo = 0; -var i = function (n) { - return n; -}; +var i = function (n) { return n; }; diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.js b/tests/baselines/reference/gettersAndSettersAccessibility.js index f472fa36a98..e0cfa3d17c5 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.js +++ b/tests/baselines/reference/gettersAndSettersAccessibility.js @@ -10,9 +10,7 @@ var C99 = (function () { function C99() { } Object.defineProperty(C99.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersErrors.js b/tests/baselines/reference/gettersAndSettersErrors.js index 545517facea..d92f0d833f5 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.js +++ b/tests/baselines/reference/gettersAndSettersErrors.js @@ -22,9 +22,7 @@ var C = (function () { this.Foo = 0; // error - duplicate identifier Foo - confirmed } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok , @@ -32,9 +30,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Goo", { - get: function (v) { - return null; - } // error - getters must not have a parameter + get: function (v) { return null; } // error - getters must not have a parameter , set: function (v) { } // error - setters must not specify a return type , @@ -47,9 +43,7 @@ var E = (function () { function E() { } Object.defineProperty(E.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersTypesAgree.js b/tests/baselines/reference/gettersAndSettersTypesAgree.js index c291c457613..91d3d844981 100644 --- a/tests/baselines/reference/gettersAndSettersTypesAgree.js +++ b/tests/baselines/reference/gettersAndSettersTypesAgree.js @@ -15,9 +15,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok - type inferred from getter return statement , @@ -25,9 +23,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Bar", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (bar) { } // ok - type must be declared , @@ -36,9 +32,5 @@ var C = (function () { }); return C; })(); -var o1 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree (inference) -var o2 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree +var o1 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree (inference) +var o2 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index e8c574d2115..1d623870d63 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -16,7 +16,7 @@ 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 TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. @@ -39,7 +39,7 @@ 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 TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. @@ -63,7 +63,7 @@ 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 TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. @@ -119,7 +119,7 @@ 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 TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. @@ -142,7 +142,7 @@ 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 TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. @@ -166,7 +166,7 @@ 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 TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. @@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. @@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. @@ -364,7 +364,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -474,7 +474,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -601,7 +601,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -828,7 +828,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -938,7 +938,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1065,7 +1065,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1334,7 +1334,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1434,7 +1434,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 7f2c2453b0f..a5109b6e113 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -706,44 +706,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -761,44 +755,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -845,44 +833,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -932,44 +914,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -988,44 +964,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -1072,44 +1042,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/grammarAmbiguities.js b/tests/baselines/reference/grammarAmbiguities.js index ee81d947ff6..f603bd1023f 100644 --- a/tests/baselines/reference/grammarAmbiguities.js +++ b/tests/baselines/reference/grammarAmbiguities.js @@ -12,12 +12,8 @@ f(g < A, B > +(7)); // Should error //// [grammarAmbiguities.js] -function f(n) { - return null; -} -function g(x) { - return null; -} +function f(n) { return null; } +function g(x) { return null; } var A, B; f(g(7)); f(g < A, B > 7); // Should error diff --git a/tests/baselines/reference/grammarAmbiguities1.js b/tests/baselines/reference/grammarAmbiguities1.js index 6ee64527bcc..1917acb7128 100644 --- a/tests/baselines/reference/grammarAmbiguities1.js +++ b/tests/baselines/reference/grammarAmbiguities1.js @@ -23,12 +23,8 @@ var B = (function () { B.prototype.bar = function () { }; return B; })(); -function f(x) { - return x; -} -function g(x) { - return f(x); -} +function f(x) { return x; } +function g(x) { return f(x); } g(7); f(g(7)); f(g < A, B > 7); diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index c7f6ead6b28..793094584bf 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -186,12 +186,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -200,9 +196,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -213,9 +207,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); // literals @@ -306,9 +298,7 @@ var k = { x: 1, y: 'a' }; if (k) { } while (k) { } do { } while (k); -function fn(x) { - return null; -} +function fn(x) { return null; } if (fn()) { } while (fn()) { } do { } while (fn()); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index b978af1a609..0bdcebed9c5 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -36,12 +36,8 @@ var Derived = (function (_super) { __extends(Derived, _super); function Derived() { var r2 = function () { return _super.call(this); }; - var r3 = function () { - _super.call(this); - }; - var r4 = function () { - _super.call(this); - }; + var r3 = function () { _super.call(this); }; + var r4 = function () { _super.call(this); }; var r5 = { get foo() { _super.call(this); diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js index df1c4d51e74..9bfad713d82 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js @@ -22,26 +22,12 @@ var lambda10 = function temp1() { return 5; } var lambda = function (l1) { }; // Error at "l1" var lambd2 = function (ll1, ll2) { }; // Error at "ll1" var lamda3 = function myLambda3(myParam) { }; -var lamda4 = function () { - return null; -}; +var lamda4 = function () { return null; }; // these should be error for implicit any return type -var lambda5 = function temp() { - return null; -}; -var lambda6 = function () { - return null; -}; -var lambda7 = function temp() { - return undefined; -}; -var lambda8 = function () { - return undefined; -}; +var lambda5 = function temp() { return null; }; +var lambda6 = function () { return null; }; +var lambda7 = function temp() { return undefined; }; +var lambda8 = function () { return undefined; }; // this shouldn't be an error -var lambda9 = function () { - return 5; -}; -var lambda10 = function temp1() { - return 5; -}; +var lambda9 = function () { return 5; }; +var lambda10 = function temp1() { return 5; }; diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.js b/tests/baselines/reference/implicitAnyFromCircularInference.js index d97b8420ebf..d818ea17105 100644 --- a/tests/baselines/reference/implicitAnyFromCircularInference.js +++ b/tests/baselines/reference/implicitAnyFromCircularInference.js @@ -58,13 +58,9 @@ var b; var c; // Error expected var d; -function f() { - return f; -} +function f() { return f; } // Error expected -function g() { - return g(); -} +function g() { return g(); } // Error expected var f1 = function () { return f1(); @@ -78,9 +74,7 @@ function h() { return h() || "hello"; } } -function foo(x) { - return "abc"; -} +function foo(x) { return "abc"; } var C = (function () { function C() { // Error expected diff --git a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js index 699b57603eb..82eb56fbde6 100644 --- a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js +++ b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js @@ -26,12 +26,8 @@ undefinedWidenFunction(); //// [implicitAnyFunctionReturnNullOrUndefined.js] // this should be an error -function nullWidenFunction() { - return null; -} // error at "nullWidenFunction" -function undefinedWidenFunction() { - return undefined; -} // error at "undefinedWidenFunction" +function nullWidenFunction() { return null; } // error at "nullWidenFunction" +function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" var C = (function () { function C() { } @@ -44,18 +40,10 @@ var C = (function () { return C; })(); // this should not be an error -function foo1() { - return null; -} -function bar1() { - return undefined; -} -function fooBar() { - return 1; -} -function fooFoo() { - return 5; -} +function foo1() { return null; } +function bar1() { return undefined; } +function fooBar() { return 1; } +function fooFoo() { return 5; } // this should not be an error as the error is raised by expr above nullWidenFunction(); undefinedWidenFunction(); diff --git a/tests/baselines/reference/implicitAnyGenericTypeInference.js b/tests/baselines/reference/implicitAnyGenericTypeInference.js index 2679ae8285c..583ab7f0b01 100644 --- a/tests/baselines/reference/implicitAnyGenericTypeInference.js +++ b/tests/baselines/reference/implicitAnyGenericTypeInference.js @@ -10,7 +10,5 @@ var r = c.compareTo(1, ''); //// [implicitAnyGenericTypeInference.js] var c; -c = { compareTo: function (x, y) { - return y; -} }; +c = { compareTo: function (x, y) { return y; } }; var r = c.compareTo(1, ''); diff --git a/tests/baselines/reference/implicitAnyGenerics.js b/tests/baselines/reference/implicitAnyGenerics.js index a5c98590a8f..daea0dfe54c 100644 --- a/tests/baselines/reference/implicitAnyGenerics.js +++ b/tests/baselines/reference/implicitAnyGenerics.js @@ -46,9 +46,7 @@ var d2 = new D(1); var d3 = new D(1); var d4 = new D(1); var d5 = new D(null); -function foo() { - return null; -} +function foo() { return null; } ; foo(); foo(); diff --git a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js index 4218d9a9a21..9e558122b15 100644 --- a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js +++ b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js @@ -3,7 +3,5 @@ function Point() { this.x = 3; } var x: any = new Point(); // error at "new" //// [implicitAnyNewExprLackConstructorSignature.js] -function Point() { - this.x = 3; -} +function Point() { this.x = 3; } var x = new Point(); // error at "new" diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 9e52c4dd067..8114e88ca4b 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -14,9 +14,7 @@ class Hello extends Greeter { } var Greeter = (function () { function Greeter() { } - Greeter.prototype.greet = function () { - return 'greet'; - }; + Greeter.prototype.greet = function () { return 'greet'; }; return Greeter; })(); exports.Greeter = Greeter; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index d6f2855908e..9d4839e5e7c 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -89,9 +89,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] var d = (function () { @@ -101,9 +99,7 @@ var d = (function () { })(); exports.d = d; var x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require2.js] var d = (function () { @@ -113,9 +109,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] var d = (function () { @@ -125,14 +119,10 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] -function foo2() { - return null; -} +function foo2() { return null; } exports.foo2 = foo2; //// [importDecl_1.js] /// diff --git a/tests/baselines/reference/importedModuleAddToGlobal.js b/tests/baselines/reference/importedModuleAddToGlobal.js index 6685bec69e3..dd7dfcd5fc9 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.js +++ b/tests/baselines/reference/importedModuleAddToGlobal.js @@ -28,7 +28,5 @@ var B; })(B || (B = {})); var C; (function (C) { - function hello() { - return null; - } + function hello() { return null; } })(C || (C = {})); diff --git a/tests/baselines/reference/inOperatorWithFunction.js b/tests/baselines/reference/inOperatorWithFunction.js index 8daeb5a30fb..bc293ca2c43 100644 --- a/tests/baselines/reference/inOperatorWithFunction.js +++ b/tests/baselines/reference/inOperatorWithFunction.js @@ -4,7 +4,5 @@ fn("a" in { "a": true }); //// [inOperatorWithFunction.js] -var fn = function (val) { - return val; -}; +var fn = function (val) { return val; }; fn("a" in { "a": true }); diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 9df5357767f..0985157e0da 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -15,7 +15,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -33,27 +33,27 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv var ra1 = a1 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra2 = a2 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra3 = a3 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra6 = undefined in x; ~~~~~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra9 = {} in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. // invalid right operands // the right operand is required to be of type Any, an object type, or a type parameter type @@ -98,6 +98,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv // both operands are invalid var rc1 = {} in ''; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. ~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleTypes.js b/tests/baselines/reference/incompatibleTypes.js index 2f804f2efa1..7e24afecf5f 100644 --- a/tests/baselines/reference/incompatibleTypes.js +++ b/tests/baselines/reference/incompatibleTypes.js @@ -106,9 +106,7 @@ function if1(a) { } var c1; var c2; if1(c1); -function of1(a) { - return null; -} +function of1(a) { return null; } of1({ e: 0, f: 0 }); function foo(fn) { } diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js index 564516ead64..eb9cd949280 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()++; // ++ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1++; // number type literal var ResultIsNumber3 = ++1; var ResultIsNumber4 = ++{ x: 1, y: 2 }; -var ResultIsNumber5 = ++{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1++; var ResultIsNumber7 = { x: 1, y: 2 }++; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }++; // number type expressions var ResultIsNumber9 = ++foo(); var ResultIsNumber10 = ++A.foo(); diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js index 6c0775b520f..6a974443f7b 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a++, M.n++; //// [incrementOperatorWithUnsupportedBooleanType.js] // ++ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN++; // boolean type literal var ResultIsNumber3 = ++true; var ResultIsNumber4 = ++{ x: true, y: false }; -var ResultIsNumber5 = ++{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true++; var ResultIsNumber7 = { x: true, y: false }++; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }++; // boolean type expressions var ResultIsNumber9 = ++objA.a; var ResultIsNumber10 = ++M.n; diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js index 065cf6ed5eb..82bf03cd83a 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a++, M.n++; // ++ operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1++; // string type literal var ResultIsNumber5 = ++""; var ResultIsNumber6 = ++{ x: "", y: "" }; -var ResultIsNumber7 = ++{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = ++{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""++; var ResultIsNumber9 = { x: "", y: "" }++; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }++; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }++; // string type expressions var ResultIsNumber11 = ++objA.a; var ResultIsNumber12 = ++M.n; diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 82e96bf3846..88e09d7746b 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation. @@ -11,7 +11,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. [x: string]; @@ -23,7 +23,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index d6f547a25cb..4a49de69393 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. -tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'. @@ -9,7 +9,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot interface I { [x = '']: string; ~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } @@ -17,7 +17,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot class C { [x = 0]: string ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.js b/tests/baselines/reference/indexSignaturesInferentialTyping.js index d8200338b62..53636be716c 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.js +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.js @@ -9,12 +9,8 @@ var x4 = bar({ zero: 0, one: 1 }); // type should be number //// [indexSignaturesInferentialTyping.js] -function foo(items) { - return undefined; -} -function bar(items) { - return undefined; -} +function foo(items) { return undefined; } +function bar(items) { return undefined; } var x1 = foo({ 0: 0, 1: 1 }); // type should be number var x2 = foo({ zero: 0, one: 1 }); var x3 = bar({ 0: 0, 1: 1 }); diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 03d0e2ce8ed..9f4b403ca2e 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ==== @@ -75,7 +75,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression yellow[blue]; // error ~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x:number[]; x[0]; diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 468368b5f23..7e72b7804e2 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'. @@ -7,7 +7,7 @@ tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find n // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js index 6b6a47405ad..aeb9a840773 100644 --- a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js @@ -5,6 +5,4 @@ declare function identity(y: V): V; var s = map("", () => { return { x: identity }; }); //// [inferentialTypingWithFunctionTypeNested.js] -var s = map("", function () { - return { x: identity }; -}); +var s = map("", function () { return { x: identity }; }); diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt index 555349cc251..e8c47e95fe9 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,1 interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt index 3f9c4a3bae0..f6debbde7ec 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt index 9864b4a4792..1865e9f6b78 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 1fca887a9b1..f7a274b1990 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -79,13 +79,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -93,11 +89,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js index 3ea0e6e1594..85801ca704f 100644 --- a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js +++ b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js @@ -11,6 +11,4 @@ fn(function (a, b) { return true; }) //// [inheritedFunctionAssignmentCompatibility.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/innerFunc.js b/tests/baselines/reference/innerFunc.js index 1676d0789d1..c790c09e271 100644 --- a/tests/baselines/reference/innerFunc.js +++ b/tests/baselines/reference/innerFunc.js @@ -14,17 +14,13 @@ module M { //// [innerFunc.js] function salt() { - function pepper() { - return 5; - } + function pepper() { return 5; } return pepper(); } var M; (function (M) { function tungsten() { - function oxygen() { - return 6; - } + function oxygen() { return 6; } ; return oxygen(); } diff --git a/tests/baselines/reference/innerModExport1.js b/tests/baselines/reference/innerModExport1.js index d61e79f2396..cbeced37046 100644 --- a/tests/baselines/reference/innerModExport1.js +++ b/tests/baselines/reference/innerModExport1.js @@ -28,18 +28,12 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.ExportFunc(); diff --git a/tests/baselines/reference/innerModExport2.js b/tests/baselines/reference/innerModExport2.js index 26399879e6d..a1526daf6f3 100644 --- a/tests/baselines/reference/innerModExport2.js +++ b/tests/baselines/reference/innerModExport2.js @@ -29,19 +29,13 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } var export_var; Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.NonExportFunc(); diff --git a/tests/baselines/reference/innerOverloads.js b/tests/baselines/reference/innerOverloads.js index 184b644406e..19e3fa78909 100644 --- a/tests/baselines/reference/innerOverloads.js +++ b/tests/baselines/reference/innerOverloads.js @@ -14,9 +14,7 @@ var x = outer(); // should work //// [innerOverloads.js] function outer() { - function inner(a) { - return a; - } + function inner(a) { return a; } return inner(0); } var x = outer(); // should work diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.js b/tests/baselines/reference/instanceAndStaticDeclarations1.js index 1396e2bcfa8..7dbd6dcbe7d 100644 --- a/tests/baselines/reference/instanceAndStaticDeclarations1.js +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.js @@ -24,9 +24,7 @@ var Point = (function () { var dy = this.y - p.y; return Math.sqrt(dx * dx + dy * dy); }; - Point.distance = function (p1, p2) { - return p1.distance(p2); - }; + Point.distance = function (p1, p2) { return p1.distance(p2); }; Point.origin = new Point(0, 0); return Point; })(); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 32507e8209e..7ab3b4a0aa3 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -64,9 +64,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { @@ -98,9 +96,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { diff --git a/tests/baselines/reference/instancePropertyInClassType.js b/tests/baselines/reference/instancePropertyInClassType.js index ac89621b7b9..863f18de323 100644 --- a/tests/baselines/reference/instancePropertyInClassType.js +++ b/tests/baselines/reference/instancePropertyInClassType.js @@ -54,9 +54,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, 2); @@ -81,9 +79,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, ''); diff --git a/tests/baselines/reference/intTypeCheck.js b/tests/baselines/reference/intTypeCheck.js index ab62168007e..fbbe1bb5d03 100644 --- a/tests/baselines/reference/intTypeCheck.js +++ b/tests/baselines/reference/intTypeCheck.js @@ -219,15 +219,9 @@ var anyVar; var obj0; var obj1 = { p: null, - p3: function () { - return 0; - }, - p6: function (pa1) { - return 0; - }, - p7: function (pa1, pa2) { - return 0; - } + p3: function () { return 0; }, + p6: function (pa1) { return 0; }, + p7: function (pa1, pa2) { return 0; } }; var obj2 = new Object(); var obj3 = new obj0; @@ -247,9 +241,7 @@ var obj13 = new Object(); var obj14 = new obj11; var obj15 = new Base; var obj16 = null; -var obj17 = function () { - return 0; -}; +var obj17 = function () { return 0; }; //var obj18: i2 = function foo() { }; var obj19 = anyVar; var obj20 = new < i2 > anyVar; diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 1e8cc0c1e68..b73cfef75df 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' in Property 'prototype' is missing in type 'C1'. tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. - Named properties 'foo' of types 'i10' and 'i11' are not identical. + Named property 'foo' of types 'i10' and 'i11' are not identical. ==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ==== @@ -80,5 +80,5 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i interface i12 extends i10, i11 { } ~~~ !!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. -!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical. +!!! error TS2320: Named property 'foo' of types 'i10' and 'i11' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index c9be8471e8c..7850c10fe26 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is private in type 'Bar' but not in type 'I4'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt index a63dfd6efca..48e3b7d7e6c 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index a230318dcc9..521a71199ad 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -38,9 +38,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -48,12 +46,8 @@ var D = (function (_super) { function D() { _super.apply(this, arguments); } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index b55c6207661..c177f2e7a90 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -34,9 +34,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -46,12 +44,8 @@ var D = (function (_super) { this.x = 2; this.y = 3; } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); @@ -61,12 +55,8 @@ var D2 = (function (_super) { _super.apply(this, arguments); this.x = ""; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; D2.prototype.bar = function () { }; return D2; })(C); diff --git a/tests/baselines/reference/interfaceImplementation5.js b/tests/baselines/reference/interfaceImplementation5.js index 1edfdeb8294..c710eda84f5 100644 --- a/tests/baselines/reference/interfaceImplementation5.js +++ b/tests/baselines/reference/interfaceImplementation5.js @@ -36,9 +36,7 @@ var C1 = (function () { function C1() { } Object.defineProperty(C1.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -58,9 +56,7 @@ var C3 = (function () { function C3() { } Object.defineProperty(C3.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (baz) { }, enumerable: true, configurable: true @@ -71,10 +67,7 @@ var C4 = (function () { function C4() { } Object.defineProperty(C4.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, enumerable: true, configurable: true }); @@ -94,10 +87,7 @@ var C6 = (function () { function C6() { } Object.defineProperty(C6.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, set: function (baz) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/interfaceImplementation7.errors.txt b/tests/baselines/reference/interfaceImplementation7.errors.txt index ff1118e5c69..b297015dfbe 100644 --- a/tests/baselines/reference/interfaceImplementation7.errors.txt +++ b/tests/baselines/reference/interfaceImplementation7.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. - Named properties 'name' of types 'i1' and 'i2' are not identical. + Named property 'name' of types 'i1' and 'i2' are not identical. tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'. Types of property 'name' are incompatible. Type '() => string' is not assignable to type '() => { s: string; n: number; }'. @@ -14,7 +14,7 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' interface i3 extends i1, i2 { } ~~ !!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. -!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical. +!!! error TS2320: Named property 'name' of types 'i1' and 'i2' are not identical. interface i4 extends i1, i2 { name(): { s: string; n: number; }; } class C1 implements i4 { diff --git a/tests/baselines/reference/interfaceImplementation7.js b/tests/baselines/reference/interfaceImplementation7.js index 6345fe93a33..2813d7ee0fe 100644 --- a/tests/baselines/reference/interfaceImplementation7.js +++ b/tests/baselines/reference/interfaceImplementation7.js @@ -14,8 +14,6 @@ class C1 implements i4 { var C1 = (function () { function C1() { } - C1.prototype.name = function () { - return ""; - }; + C1.prototype.name = function () { return ""; }; return C1; })(); diff --git a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt index a7df9c15e59..82301d9ae16 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker extends Mover, Shaker { ~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. } @@ -36,7 +36,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error ~~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above diff --git a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt index b7dfdffc79e..cc333e0e054 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. - Named properties 'a' of types 'E' and 'D' are not identical. + Named property 'a' of types 'E' and 'D' are not identical. tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. - Named properties 'a' of types 'E2' and 'D2' are not identical. + Named property 'a' of types 'E2' and 'D2' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ==== @@ -10,12 +10,12 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: In interface F extends E, D { } // error ~ !!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. -!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical. +!!! error TS2320: Named property 'a' of types 'E' and 'D' are not identical. class D2 { a: number; } class E2 { a: string; } interface F2 extends E2, D2 { } // error ~~ !!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. -!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical. +!!! error TS2320: Named property 'a' of types 'E2' and 'D2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceSubtyping.js b/tests/baselines/reference/interfaceSubtyping.js index 840ce79d869..43004985782 100644 --- a/tests/baselines/reference/interfaceSubtyping.js +++ b/tests/baselines/reference/interfaceSubtyping.js @@ -14,8 +14,6 @@ var Camera = (function () { function Camera(str) { this.str = str; } - Camera.prototype.foo = function () { - return "s"; - }; + Camera.prototype.foo = function () { return "s"; }; return Camera; })(); diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index 1562e16df4d..95adbbf6717 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa Types of property 'b' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. - Named properties 'x' of types 'Base1' and 'Base2' are not identical. + Named property 'x' of types 'Base1' and 'Base2' are not identical. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. Types of property 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'. @@ -86,7 +86,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived3 extends Base1, Base2 { } // error ~~~~~~~~ !!! error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. -!!! error TS2320: Named properties 'x' of types 'Base1' and 'Base2' are not identical. +!!! error TS2320: Named property 'x' of types 'Base1' and 'Base2' are not identical. interface Derived4 extends Base1, Base2 { // error ~~~~~~~~ diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index fe3d62c4ba5..824bee92227 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 9dc30431326..d637158780a 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -46,9 +46,5 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } diff --git a/tests/baselines/reference/invalidStaticField.js b/tests/baselines/reference/invalidStaticField.js index 5521af05c83..620c019fc18 100644 --- a/tests/baselines/reference/invalidStaticField.js +++ b/tests/baselines/reference/invalidStaticField.js @@ -6,9 +6,7 @@ class B { static NOT_NULL = new B(); } var A = (function () { function A() { } - A.prototype.foo = function () { - return B.NULL; - }; + A.prototype.foo = function () { return B.NULL; }; return A; })(); var B = (function () { diff --git a/tests/baselines/reference/ipromise4.js b/tests/baselines/reference/ipromise4.js index bb8a3f12e0b..98660aa5824 100644 --- a/tests/baselines/reference/ipromise4.js +++ b/tests/baselines/reference/ipromise4.js @@ -19,8 +19,4 @@ p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // s //// [ipromise4.js] var p = null; p.then(function (x) { }); // should not error -p.then(function (x) { - return "hello"; -}).then(function (x) { - return x; -}); // should not error +p.then(function (x) { return "hello"; }).then(function (x) { return x; }); // should not error diff --git a/tests/baselines/reference/lambdaASIEmit.js b/tests/baselines/reference/lambdaASIEmit.js index 551aa5f93dd..49672b75c7c 100644 --- a/tests/baselines/reference/lambdaASIEmit.js +++ b/tests/baselines/reference/lambdaASIEmit.js @@ -12,4 +12,7 @@ Foo(() => //// [lambdaASIEmit.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt index 93dc307fc85..fbcee276583 100644 --- a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt +++ b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. ==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ==== { let let = 1; // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. for (let let in []) { } // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { const let = 1; // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { function let() { // should be ok diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 21c09aaeb53..33f8200530b 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -37,11 +37,7 @@ var C = (function (_super) { var x = 10 + w; var ll = x * w; } - C.prototype.liftxyz = function () { - return x + z + this.y; - }; - C.prototype.liftxylocllz = function () { - return x + z + this.y + this.ll; - }; + C.prototype.liftxyz = function () { return x + z + this.y; }; + C.prototype.liftxylocllz = function () { return x + z + this.y + this.ll; }; return C; })(B); diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js index 0f3c39a09ff..107bd9a88ec 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsBoolean = !!BOOLEAN; //// [logicalNotOperatorWithBooleanType.js] // ! operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.js b/tests/baselines/reference/logicalNotOperatorWithNumberType.js index 48e1468285e..0d0601cad23 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.js +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.js @@ -49,15 +49,11 @@ var ResultIsBoolean13 = !!!(NUMBER + NUMBER); // ! operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = !NUMBER1; // number type literal var ResultIsBoolean3 = !1; var ResultIsBoolean4 = !{ x: 1, y: 2 }; -var ResultIsBoolean5 = !{ x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = !{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.js b/tests/baselines/reference/logicalNotOperatorWithStringType.js index 1bab5de239d..7f75814d601 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.js +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.js @@ -48,15 +48,11 @@ var ResultIsBoolean14 = !!!(STRING + STRING); // ! operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = !STRING1; // string type literal var ResultIsBoolean3 = !""; var ResultIsBoolean4 = !{ x: "", y: "" }; -var ResultIsBoolean5 = !{ x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = !{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/maxConstraints.js b/tests/baselines/reference/maxConstraints.js index 4ea37d30501..b2098ccaf2b 100644 --- a/tests/baselines/reference/maxConstraints.js +++ b/tests/baselines/reference/maxConstraints.js @@ -9,7 +9,5 @@ var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); //// [maxConstraints.js] -var max2 = function (x, y) { - return (x.compareTo(y) > 0) ? x : y; -}; +var max2 = function (x, y) { return (x.compareTo(y) > 0) ? x : y; }; var maxResult = max2(1, 2); diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt index 4c49e6beb0c..584edc24bb5 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(31,15): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts (2 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } @@ -41,7 +41,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error, privates conflict ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt index 1e11dc792f1..f7ea6fbc2a0 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts(19,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. - Named properties 'a' of types 'C' and 'C' are not identical. + Named property 'a' of types 'C' and 'C' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts (1 errors) ==== @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultip interface A extends C, C3 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. -!!! error TS2320: Named properties 'a' of types 'C' and 'C' are not identical. +!!! error TS2320: Named property 'a' of types 'C' and 'C' are not identical. y: T; } diff --git a/tests/baselines/reference/missingSelf.js b/tests/baselines/reference/missingSelf.js index c2c1e04ad5c..56dcc4f9fa0 100644 --- a/tests/baselines/reference/missingSelf.js +++ b/tests/baselines/reference/missingSelf.js @@ -22,9 +22,7 @@ c2.b(); var CalcButton = (function () { function CalcButton() { } - CalcButton.prototype.a = function () { - this.onClick(); - }; + CalcButton.prototype.a = function () { this.onClick(); }; CalcButton.prototype.onClick = function () { }; return CalcButton; })(); diff --git a/tests/baselines/reference/modFunctionCrash.js b/tests/baselines/reference/modFunctionCrash.js index f216788c0eb..0d4f62eae63 100644 --- a/tests/baselines/reference/modFunctionCrash.js +++ b/tests/baselines/reference/modFunctionCrash.js @@ -7,6 +7,4 @@ declare module Q { Q.f(function() {this;}); //// [modFunctionCrash.js] -Q.f(function () { - this; -}); +Q.f(function () { this; }); diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js index d2dc938872a..951c558ddfd 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js @@ -23,9 +23,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.js b/tests/baselines/reference/moduleReopenedTypeSameBlock.js index c3546f20b2f..92e7e9e5228 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.js @@ -21,9 +21,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleSymbolMerging.js b/tests/baselines/reference/moduleSymbolMerging.js index 0a812a62e09..d43fff1378a 100644 --- a/tests/baselines/reference/moduleSymbolMerging.js +++ b/tests/baselines/reference/moduleSymbolMerging.js @@ -22,9 +22,7 @@ var A; })(A || (A = {})); var B; (function (B) { - function f() { - return null; - } + function f() { return null; } B.f = f; })(B || (B = {})); diff --git a/tests/baselines/reference/moduleUnassignedVariable.js b/tests/baselines/reference/moduleUnassignedVariable.js index 179a2577adf..1765342efcd 100644 --- a/tests/baselines/reference/moduleUnassignedVariable.js +++ b/tests/baselines/reference/moduleUnassignedVariable.js @@ -12,11 +12,7 @@ module Bar { var Bar; (function (Bar) { Bar.a = 1; - function fooA() { - return Bar.a; - } // Correct: return Bar.a + function fooA() { return Bar.a; } // Correct: return Bar.a Bar.b; - function fooB() { - return Bar.b; - } // Incorrect: return b + function fooB() { return Bar.b; } // Incorrect: return b })(Bar || (Bar = {})); diff --git a/tests/baselines/reference/moduleVisibilityTest1.js b/tests/baselines/reference/moduleVisibilityTest1.js index d8bdedfafe2..a2957cb9582 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.js +++ b/tests/baselines/reference/moduleVisibilityTest1.js @@ -70,15 +70,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest1.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -87,9 +83,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod = M.InnerMod || (M.InnerMod = {})); (function (E) { @@ -109,30 +103,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/moduleVisibilityTest2.js b/tests/baselines/reference/moduleVisibilityTest2.js index 63ecaf0c135..9102bd17ae2 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.js +++ b/tests/baselines/reference/moduleVisibilityTest2.js @@ -71,15 +71,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest2.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -88,9 +84,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod || (InnerMod = {})); var E; @@ -110,30 +104,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/multiModuleClodule1.js b/tests/baselines/reference/multiModuleClodule1.js index 8fa142812cd..9f6d7b5014c 100644 --- a/tests/baselines/reference/multiModuleClodule1.js +++ b/tests/baselines/reference/multiModuleClodule1.js @@ -36,9 +36,7 @@ var C; (function (C) { function foo() { } C.foo = foo; - function baz() { - return ''; - } + function baz() { return ''; } })(C || (C = {})); var c = new C(C.x); c.foo = C.foo; diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt index 633f544a67b..70db70de97b 100644 --- a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. - Named properties 'x' of types 'A' and 'A' are not identical. + Named property 'x' of types 'A' and 'A' are not identical. ==== tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts (1 errors) ==== @@ -11,5 +11,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): e interface C extends A, A { } ~ !!! error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. -!!! error TS2320: Named properties 'x' of types 'A' and 'A' are not identical. +!!! error TS2320: Named property 'x' of types 'A' and 'A' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 9cab77f3dba..269d5c2ea19 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -97,13 +97,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -111,11 +107,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/mutrec.js b/tests/baselines/reference/mutrec.js index ba6c8ade036..1d1ccb4e90b 100644 --- a/tests/baselines/reference/mutrec.js +++ b/tests/baselines/reference/mutrec.js @@ -43,15 +43,11 @@ g(i4); //// [mutrec.js] -function f(p) { - return p; -} +function f(p) { return p; } ; var b; f(b); -function g(p) { - return p; -} +function g(p) { return p; } ; var i2; g(i2); diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 585a3d2178b..76fd13aa320 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -20,9 +20,7 @@ var __extends = this.__extends || function (d, b) { var foo = (function () { function foo() { } - foo.prototype.bar = function () { - return null; - }; + foo.prototype.bar = function () { return null; }; return foo; })(); var foo2 = (function (_super) { diff --git a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js index 3035ab6e628..1f3631e03ba 100644 --- a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js +++ b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js @@ -4,6 +4,4 @@ var y = { x() { x++; } }; //// [nameCollisionsInPropertyAssignments.js] var x = 1; -var y = { x: function () { - x++; -} }; +var y = { x: function () { x++; } }; diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.js b/tests/baselines/reference/negateOperatorWithBooleanType.js index ce7b14b2d82..9442f54490f 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.js +++ b/tests/baselines/reference/negateOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = -A.foo(); //// [negateOperatorWithBooleanType.js] // - operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/negateOperatorWithNumberType.js b/tests/baselines/reference/negateOperatorWithNumberType.js index 15e0eeca435..5fa83e088c8 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.js +++ b/tests/baselines/reference/negateOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = -(NUMBER - NUMBER); // - operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = -NUMBER1; // number type literal var ResultIsNumber3 = -1; var ResultIsNumber4 = -{ x: 1, y: 2 }; -var ResultIsNumber5 = -{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = -{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/negateOperatorWithStringType.js b/tests/baselines/reference/negateOperatorWithStringType.js index 228733b65c5..bdbc4a3d664 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.js +++ b/tests/baselines/reference/negateOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = -STRING.charAt(0); // - operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = -STRING1; // string type literal var ResultIsNumber3 = -""; var ResultIsNumber4 = -{ x: "", y: "" }; -var ResultIsNumber5 = -{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = -{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index fa69ef5950e..70445b3372f 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -37,5 +37,4 @@ var C3 = (function () { return C3; })(); var x = { - class: C4 -}, _a = void 0; + class: C4 }, _a = void 0; diff --git a/tests/baselines/reference/nestedSelf.js b/tests/baselines/reference/nestedSelf.js index 897bdd720e7..9c0feaa887f 100644 --- a/tests/baselines/reference/nestedSelf.js +++ b/tests/baselines/reference/nestedSelf.js @@ -17,9 +17,7 @@ var M; } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this.n * x; - }); + [1, 2, 3].map(function (x) { return _this.n * x; }); }; return C; })(); diff --git a/tests/baselines/reference/newOperatorErrorCases.js b/tests/baselines/reference/newOperatorErrorCases.js index 8a44d51fb5c..b893beba02a 100644 --- a/tests/baselines/reference/newOperatorErrorCases.js +++ b/tests/baselines/reference/newOperatorErrorCases.js @@ -65,7 +65,5 @@ var c1 = new T; var c1; var c2 = new T(); // Parse error // Construct expression of non-void returning function -function fnNumber() { - return 32; -} +function fnNumber() { return 32; } var s = new fnNumber(); // Error diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js index d144a78fae3..bdb55633682 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js @@ -11,7 +11,5 @@ function x() { var console; function x() { var _this = 5; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js index c34ad4c97bd..b3677681822 100644 --- a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js +++ b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js @@ -12,7 +12,5 @@ var console; var _this = 5; function x() { var _this = this; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noConstraintInReturnType1.js b/tests/baselines/reference/noConstraintInReturnType1.js index 747cbfdf758..0402f9d83cb 100644 --- a/tests/baselines/reference/noConstraintInReturnType1.js +++ b/tests/baselines/reference/noConstraintInReturnType1.js @@ -8,9 +8,7 @@ class List { var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.js b/tests/baselines/reference/noImplicitAnyWithOverloads.js index c2e9f174ada..fd56b6e0d73 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.js +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.js @@ -11,6 +11,4 @@ callb((a) => { a.foo; }); // error, chose first overload //// [noImplicitAnyWithOverloads.js] function callb(a) { } -callb(function (a) { - a.foo; -}); // error, chose first overload +callb(function (a) { a.foo; }); // error, chose first overload diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js index 8afbb0c6201..c32cd84ce26 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js @@ -112,12 +112,8 @@ var r6 = true ? { foo: 1 } : null; var r6 = true ? null : { foo: 1 }; var r7 = true ? function () { } : null; var r7 = true ? null : function () { }; -var r8 = true ? function (x) { - return x; -} : null; -var r8b = true ? null : function (x) { - return x; -}; // type parameters not identical across declarations +var r8 = true ? function (x) { return x; } : null; +var r8b = true ? null : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : null; var r9 = true ? null : i1; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 1cfd94a0c97..0474abef393 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -56,9 +56,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -66,9 +64,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt index 73332ff8926..b2f3bd9d824 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? @@ -59,12 +59,12 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS // ElementAccessExpressions can only contain one expression. There should be a parse error here. var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralErrors.js b/tests/baselines/reference/objectLiteralErrors.js index 06158cb87c9..4dccc78b67d 100644 --- a/tests/baselines/reference/objectLiteralErrors.js +++ b/tests/baselines/reference/objectLiteralErrors.js @@ -67,69 +67,25 @@ var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; // Accessor and property with the same name -var f1 = { a: 0, get a() { - return 0; -} }; -var f2 = { a: '', get a() { - return ''; -} }; -var f3 = { a: 0, get a() { - return ''; -} }; -var f4 = { a: true, get a() { - return false; -} }; -var f5 = { a: {}, get a() { - return {}; -} }; -var f6 = { a: 0, get 'a'() { - return 0; -} }; -var f7 = { 'a': 0, get a() { - return 0; -} }; -var f8 = { 'a': 0, get "a"() { - return 0; -} }; -var f9 = { 'a': 0, get 'a'() { - return 0; -} }; -var f10 = { "a": 0, get 'a'() { - return 0; -} }; -var f11 = { 1.0: 0, get '1'() { - return 0; -} }; -var f12 = { 0: 0, get 0() { - return 0; -} }; -var f13 = { 0: 0, get 0() { - return 0; -} }; -var f14 = { 0: 0, get 0x0() { - return 0; -} }; -var f14 = { 0: 0, get 000() { - return 0; -} }; -var f15 = { "100": 0, get 1e2() { - return 0; -} }; -var f16 = { 0x20: 0, get 3.2e1() { - return 0; -} }; -var f17 = { a: 0, get b() { - return 1; -}, get a() { - return 0; -} }; +var f1 = { a: 0, get a() { return 0; } }; +var f2 = { a: '', get a() { return ''; } }; +var f3 = { a: 0, get a() { return ''; } }; +var f4 = { a: true, get a() { return false; } }; +var f5 = { a: {}, get a() { return {}; } }; +var f6 = { a: 0, get 'a'() { return 0; } }; +var f7 = { 'a': 0, get a() { return 0; } }; +var f8 = { 'a': 0, get "a"() { return 0; } }; +var f9 = { 'a': 0, get 'a'() { return 0; } }; +var f10 = { "a": 0, get 'a'() { return 0; } }; +var f11 = { 1.0: 0, get '1'() { return 0; } }; +var f12 = { 0: 0, get 0() { return 0; } }; +var f13 = { 0: 0, get 0() { return 0; } }; +var f14 = { 0: 0, get 0x0() { return 0; } }; +var f14 = { 0: 0, get 000() { return 0; } }; +var f15 = { "100": 0, get 1e2() { return 0; } }; +var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; +var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; // Get and set accessor with mismatched type annotations -var g1 = { get a() { - return 4; -}, set a(n) { } }; -var g2 = { get a() { - return 4; -}, set a(n) { } }; -var g3 = { get a() { - return undefined; -}, set a(n) { } }; +var g1 = { get a() { return 4; }, set a(n) { } }; +var g2 = { get a() { return 4; }, set a(n) { } }; +var g3 = { get a() { return undefined; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralErrorsES3.js b/tests/baselines/reference/objectLiteralErrorsES3.js index 6543827d9f3..031a68fd109 100644 --- a/tests/baselines/reference/objectLiteralErrorsES3.js +++ b/tests/baselines/reference/objectLiteralErrorsES3.js @@ -7,10 +7,6 @@ var e3 = { get a() { return ''; }, set a(n) { } }; //// [objectLiteralErrorsES3.js] -var e1 = { get a() { - return 4; -} }; +var e1 = { get a() { return 4; } }; var e2 = { set a(n) { } }; -var e3 = { get a() { - return ''; -}, set a(n) { } }; +var e3 = { get a() { return ''; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.js b/tests/baselines/reference/objectLiteralGettersAndSetters.js index bd261697d5f..d226c2c5569 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.js +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.js @@ -85,62 +85,24 @@ var getParamType3 = { //// [objectLiteralGettersAndSetters.js] // Get and set accessor with the same name -var sameName1a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; -var sameName2a = { get 0.0() { - return ''; -}, set 0(n) { - var p = n; - var p; -} }; -var sameName3a = { get 0x20() { - return ''; -}, set 3.2e1(n) { - var p = n; - var p; -} }; -var sameName4a = { get ''() { - return ''; -}, set ""(n) { - var p = n; - var p; -} }; -var sameName5a = { get '\t'() { - return ''; -}, set '\t'(n) { - var p = n; - var p; -} }; -var sameName6a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; +var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; +var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p; } }; +var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p; } }; +var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p; } }; +var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p; } }; +var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; // PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} -var callSig1 = { num: function (n) { - return ''; -} }; +var callSig1 = { num: function (n) { return ''; } }; var callSig1; -var callSig2 = { num: function (n) { - return ''; -} }; +var callSig2 = { num: function (n) { return ''; } }; var callSig2; var callSig3 = { num: function (n) { return ''; } }; var callSig3; // Get accessor only, type of the property is the annotated return type of the get accessor -var getter1 = { get x() { - return undefined; -} }; +var getter1 = { get x() { return undefined; } }; var getter1; // Get accessor only, type of the property is the inferred return type of the get accessor -var getter2 = { get x() { - return ''; -} }; +var getter2 = { get x() { return ''; } }; var getter2; // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n) { } }; @@ -150,18 +112,10 @@ var setter2 = { set x(n) { } }; var setter2; var anyVar; // Get and set accessor with matching type annotations -var sameType1 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType2 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType3 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType4 = { get x() { - return undefined; -}, set x(n) { } }; +var sameType1 = { get x() { return undefined; }, set x(n) { } }; +var sameType2 = { get x() { return undefined; }, set x(n) { } }; +var sameType3 = { get x() { return undefined; }, set x(n) { } }; +var sameType4 = { get x() { return undefined; }, set x(n) { } }; // Type of unannotated get accessor return type is the type annotation of the set accessor param var setParamType1 = { set n(x) { }, @@ -187,14 +141,10 @@ var getParamType1 = { var y = x; var y; }, - get n() { - return ''; - } + get n() { return ''; } }; var getParamType2 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; @@ -202,9 +152,7 @@ var getParamType2 = { }; // Type of unannotated accessors is the inferred return type of the get accessor var getParamType3 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; diff --git a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js index 2ad13950b14..d6a8579be04 100644 --- a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js +++ b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js @@ -2,5 +2,4 @@ var v = { foo(); } //// [objectLiteralMemberWithoutBlock1.js] -var v = { foo: function () { -} }; +var v = { foo: function () { } }; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js index c000a30181d..251098eb6c8 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name: name, id: id }; function foo(obj) { } ; -function bar(name, id) { - return { name: name, id: id }; -} -function bar1(name, id) { - return { name: name }; -} -function baz(name, id) { - return { name: name, id: id }; -} +function bar(name, id) { return { name: name, id: id }; } +function bar1(name, id) { return { name: name }; } +function baz(name, id) { return { name: name, id: id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js index ee99de6d470..247ec56d127 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name, id }; function foo(obj) { } ; -function bar(name, id) { - return { name, id }; -} -function bar1(name, id) { - return { name }; -} -function baz(name, id) { - return { name, id }; -} +function bar(name, id) { return { name, id }; } +function bar1(name, id) { return { name }; } +function baz(name, id) { return { name, id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js index 1bef1cc9554..8e2d7f80356 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js @@ -16,8 +16,6 @@ var name = "my name"; var person = { name: name, id: id }; // error var person1 = name, id; ; // error: can't use short-hand property assignment in type position -function foo(name, id) { - return { name: name, id: id }; -} // error +function foo(name, id) { return { name: name, id: id }; } // error function bar(obj) { } bar({ name: name, id: id }); // error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js index b008644116b..71449746add 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js @@ -12,12 +12,8 @@ var person2: { name: string, id: number } = bar("hello", 5); var id = 10000; var name = "my name"; var person = { name: name, id: id }; // error -function bar(name, id) { - return { name: name, id: id }; -} // error -function foo(name, id) { - return { name: name, id: id }; -} // error +function bar(name, id) { return { name: name, id: id }; } // error +function foo(name, id) { return { name: name, id: id }; } // error var person1 = name, id; ; // error : Can't use shorthand in the type position var person2 = bar("hello", 5); diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.js b/tests/baselines/reference/objectLiteralWithSemicolons4.js index 9e1e3dea4b9..a01d52548ee 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.js +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.js @@ -5,5 +5,4 @@ var v = { //// [objectLiteralWithSemicolons4.js] var v = { - a: -}; + a: }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js index 9c327ca3a38..7a2b5e2ec2f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js @@ -29,9 +29,7 @@ i = o; // error var C = (function () { function C() { } - C.prototype.toString = function () { - return 1; - }; + C.prototype.toString = function () { return 1; }; return C; })(); var c; diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js index 21cfc280500..0c6952291f9 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js index 0c7e54ded21..43473d88e0a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js index 434d1cdd31e..498867f0a02 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js index 52dc447f5fb..54400ad81d1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js @@ -121,32 +121,24 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; var b = { - foo: function (x) { - return ''; - } + foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js index b3381ac5825..87067b6be28 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js index 0010d8815b4..c95159ed997 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js index cc17fcbeaf3..c8bed1a47ab 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js index 0dc2c18d491..6ef5d15fd98 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js index b0652b29b7f..2b83064afed 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js index 3486157840c..1f9c5fa5256 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js @@ -121,39 +121,29 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js index 714e7dbf142..21106b56b00 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js @@ -140,39 +140,29 @@ var Two = (function () { var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js index e1940c41587..99188347d36 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js index b4eaf096ec8..10d72bde0b3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js index 2c9ad2767d9..5a20dfdecb6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js index 3e98e5887a9..ec9c786b890 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js index 36d17758c94..a4af2bc820e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js index 4e58adda1c4..28b2f978b55 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js index 71842d18781..de9b4859fa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js index 6183be4fb69..fdc67d4b84a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js @@ -92,9 +92,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js index 59a801134d4..11dcdf0a609 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js @@ -109,9 +109,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js index d61edd07382..5c6f59eef24 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js @@ -128,9 +128,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js index b390f7a933b..556d1bcaee0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js @@ -99,9 +99,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js index d22cc6b254e..68c32cb0e71 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js @@ -95,9 +95,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js index 99d3f8287df..789e02d2d7b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return x; -} }; +var b = { new: function (x) { return x; } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js index cd77c1ee3d1..5a501d05834 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return new C(x); -} }; +var b = { new: function (x) { return new C(x); } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js index 72b8e7c8d8f..685a8441d97 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js index 1c781f299ce..f16d69acaa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js index 8c5aca3cb1c..25c628e9e15 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index 7a237223d7c..cf0d113c244 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,6 +42,5 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, - 1: // error + x: function () { }, 1: // error }; diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.js b/tests/baselines/reference/optionalAccessorsInInterface1.js index 3ebccc2ea8e..dd274b133e5 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.js +++ b/tests/baselines/reference/optionalAccessorsInInterface1.js @@ -17,9 +17,5 @@ defineMyProperty2({}, "name", { get: function () { return 5; } }); //// [optionalAccessorsInInterface1.js] -defineMyProperty({}, "name", { get: function () { - return 5; -} }); -defineMyProperty2({}, "name", { get: function () { - return 5; -} }); +defineMyProperty({}, "name", { get: function () { return 5; } }); +defineMyProperty2({}, "name", { get: function () { return 5; } }); diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.js b/tests/baselines/reference/optionalFunctionArgAssignability.js index bca42060066..c82a47e88da 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.js +++ b/tests/baselines/reference/optionalFunctionArgAssignability.js @@ -9,10 +9,6 @@ a = b; // error because number is not assignable to string //// [optionalFunctionArgAssignability.js] -var a = function then(onFulfill, onReject) { - return null; -}; -var b = function then(onFulFill, onReject) { - return null; -}; +var a = function then(onFulfill, onReject) { return null; }; +var b = function then(onFulFill, onReject) { return null; }; a = b; // error because number is not assignable to string diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 6f9b97036ed..202439bc79a 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -139,12 +139,8 @@ var C1 = (function () { if (p === void 0) { p = 0; } this.n = 0; } - C1.prototype.C1M1 = function () { - return 0; - }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" - C1.prototype.C1M2 = function (C1M2A1) { - return C1M2A1; - }; // will return C1M1A2 without complaint + C1.prototype.C1M1 = function () { return 0; }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" + C1.prototype.C1M2 = function (C1M2A1) { return C1M2A1; }; // will return C1M1A2 without complaint // C1M3 contains all optional parameters C1.prototype.C1M3 = function (C1M3A1, C1M3A2) { if (C1M3A1 === void 0) { C1M3A1 = 0; } @@ -152,9 +148,7 @@ var C1 = (function () { return C1M3A1 + C1M3A2; }; // C1M4 contains a mix of optional and non-optional parameters - C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { - return C1M4A1 + C1M4A2; - }; + C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { return C1M4A1 + C1M4A2; }; C1.prototype.C1M5 = function (C1M5A1, C1M5A2, C1M5A3) { if (C1M5A2 === void 0) { C1M5A2 = 0; } return C1M5A1 + C1M5A2; @@ -175,34 +169,22 @@ var C2 = (function (_super) { } return C2; })(C1); -function F1() { - return 0; -} -function F2(F2A1) { - return F2A1; -} +function F1() { return 0; } +function F2(F2A1) { return F2A1; } function F3(F3A1, F3A2) { if (F3A1 === void 0) { F3A1 = 0; } if (F3A2 === void 0) { F3A2 = F3A1; } return F3A1 + F3A2; } -function F4(F4A1, F4A2) { - return F4A1 + F4A2; -} -var L1 = function () { - return 0; -}; -var L2 = function (L2A1) { - return L2A1; -}; +function F4(F4A1, F4A2) { return F4A1 + F4A2; } +var L1 = function () { return 0; }; +var L2 = function (L2A1) { return L2A1; }; var L3 = function (L3A1, L3A2) { if (L3A1 === void 0) { L3A1 = 0; } if (L3A2 === void 0) { L3A2 = L3A1; } return L3A1 + L3A2; }; -var L4 = function (L4A1, L4A2) { - return L4A1 + L4A2; -}; +var L4 = function (L4A1, L4A2) { return L4A1 + L4A2; }; var c1o1 = new C1(5); var i1o1 = new C1(5); // Valid diff --git a/tests/baselines/reference/overloadAssignmentCompat.js b/tests/baselines/reference/overloadAssignmentCompat.js index f6767f6f33e..2d4bd931844 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.js +++ b/tests/baselines/reference/overloadAssignmentCompat.js @@ -65,7 +65,5 @@ function attr2(nameOrMap, value) { return "s"; } } -function foo() { - return "a"; -} +function foo() { return "a"; } ; diff --git a/tests/baselines/reference/overloadCallTest.js b/tests/baselines/reference/overloadCallTest.js index f7eb97fc9eb..38930b7aea3 100644 --- a/tests/baselines/reference/overloadCallTest.js +++ b/tests/baselines/reference/overloadCallTest.js @@ -18,9 +18,7 @@ class foo { //// [overloadCallTest.js] var foo = (function () { function foo() { - function bar(foo) { - return "foo"; - } + function bar(foo) { return "foo"; } ; var test = bar("test"); var goo = bar(); diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js index 6c66c23f1f8..52f6639e352 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js @@ -35,15 +35,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js index f51f84acb2a..71d7a4e4a3f 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js @@ -34,15 +34,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 8737708beda..1ee5e077c08 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -127,16 +127,12 @@ var SomeDerived3 = (function (_super) { } return SomeDerived3; })(SomeBase); -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1(undefined); var s; // No candidate overloads found fn1({}); // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d = fn2(0, undefined); var d; // Generic and non - generic overload where generic overload is the only candidate when called without type arguments @@ -145,9 +141,7 @@ var s = fn2(0, ''); fn2('', 0); // Error // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments fn2('', 0); // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3(3); var s = fn3('', 3, ''); var n = fn3(5, 5, 5); @@ -173,8 +167,6 @@ fn4(null, null); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error fn4(null, true); // Error -function fn5() { - return undefined; -} +function fn5() { return undefined; } var n = fn5(function (n) { return n.toFixed(); }); var s = fn5(function (n) { return n.substr(0); }); diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js index 86e84ced58f..e77e8d3371f 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js @@ -48,13 +48,7 @@ var Bugs; return result; } })(Bugs || (Bugs = {})); -function bug3(f) { - return f("s"); -} -function fprime(x) { - return x; -} +function bug3(f) { return f("s"); } +function fprime(x) { return x; } bug3(fprime); -bug3(function (x) { - return x; -}); +bug3(function (x) { return x; }); diff --git a/tests/baselines/reference/overloadResolutionTest1.js b/tests/baselines/reference/overloadResolutionTest1.js index a08243fb27a..60b99ebf7b9 100644 --- a/tests/baselines/reference/overloadResolutionTest1.js +++ b/tests/baselines/reference/overloadResolutionTest1.js @@ -26,23 +26,17 @@ function foo4(bar:{a:any;}):any{ return bar }; var x = foo4({a:true}); // error //// [overloadResolutionTest1.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x1 = foo([{ a: true }]); // works var x11 = foo([{ a: 0 }]); // works var x111 = foo([{ a: "s" }]); // error - does not match any signature var x1111 = foo([{ a: null }]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string -function foo2(bar) { - return bar; -} +function foo2(bar) { return bar; } ; var x2 = foo2({ a: 0 }); // works var x3 = foo2({ a: true }); // works var x4 = foo2({ a: "s" }); // error -function foo4(bar) { - return bar; -} +function foo4(bar) { return bar; } ; var x = foo4({ a: true }); // error diff --git a/tests/baselines/reference/parameterInitializersForwardReferencing.js b/tests/baselines/reference/parameterInitializersForwardReferencing.js index d810db54695..8ce7fae6874 100644 --- a/tests/baselines/reference/parameterInitializersForwardReferencing.js +++ b/tests/baselines/reference/parameterInitializersForwardReferencing.js @@ -92,8 +92,6 @@ var x = function (a, b, c) { }; // Should not produce errors - can reference later parameters if they occur within a function expression initializer. function f(a, b, c) { - if (b === void 0) { b = function () { - return c; - }; } + if (b === void 0) { b = function () { return c; }; } if (c === void 0) { c = b(); } } diff --git a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js index 48f8d3e520c..a8d06125d25 100644 --- a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js +++ b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js @@ -30,12 +30,8 @@ var b = { } //// [parametersWithNoAnnotationAreAny.js] -function foo(x) { - return x; -} -var f = function foo(x) { - return x; -}; +function foo(x) { return x; } +var f = function foo(x) { return x; }; var f2 = function (x) { return x; }; var f3 = function (x) { return x; }; var C = (function () { diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.js b/tests/baselines/reference/parenthesizedContexualTyping2.js index d5e4e0ebe8f..993a10ba49c 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.js +++ b/tests/baselines/reference/parenthesizedContexualTyping2.js @@ -49,80 +49,20 @@ function fun() { } return undefined; } -var a = fun(function (x) { - x(undefined); - return x; -}, 10); -var b = fun((function (x) { - x(undefined); - return x; -}), 10); -var c = fun(((function (x) { - x(undefined); - return x; -})), 10); -var d = fun((((function (x) { - x(undefined); - return x; -}))), 10); -var e = fun(function (x) { - x(undefined); - return x; -}, function (x) { - x(undefined); - return x; -}, 10); -var f = fun((function (x) { - x(undefined); - return x; -}), (function (x) { - x(undefined); - return x; -}), 10); -var g = fun(((function (x) { - x(undefined); - return x; -})), ((function (x) { - x(undefined); - return x; -})), 10); -var h = fun((((function (x) { - x(undefined); - return x; -}))), ((function (x) { - x(undefined); - return x; -})), 10); +var a = fun(function (x) { x(undefined); return x; }, 10); +var b = fun((function (x) { x(undefined); return x; }), 10); +var c = fun(((function (x) { x(undefined); return x; })), 10); +var d = fun((((function (x) { x(undefined); return x; }))), 10); +var e = fun(function (x) { x(undefined); return x; }, function (x) { x(undefined); return x; }, 10); +var f = fun((function (x) { x(undefined); return x; }), (function (x) { x(undefined); return x; }), 10); +var g = fun(((function (x) { x(undefined); return x; })), ((function (x) { x(undefined); return x; })), 10); +var h = fun((((function (x) { x(undefined); return x; }))), ((function (x) { x(undefined); return x; })), 10); // Ternaries in parens -var i = fun((Math.random() < 0.5 ? function (x) { - x(undefined); - return x; -} : function (x) { return undefined; }), 10); -var j = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), 10); -var k = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), function (x) { - x(undefined); - return x; -}, 10); -var l = fun(((Math.random() < 0.5 ? ((function (x) { - x(undefined); - return x; -})) : ((function (x) { return undefined; })))), ((function (x) { - x(undefined); - return x; -})), 10); -var lambda1 = function (x) { - x(undefined); - return x; -}; -var lambda2 = (function (x) { - x(undefined); - return x; -}); +var i = fun((Math.random() < 0.5 ? function (x) { x(undefined); return x; } : function (x) { return undefined; }), 10); +var j = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), 10); +var k = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), function (x) { x(undefined); return x; }, 10); +var l = fun(((Math.random() < 0.5 ? ((function (x) { x(undefined); return x; })) : ((function (x) { return undefined; })))), ((function (x) { x(undefined); return x; })), 10); +var lambda1 = function (x) { x(undefined); return x; }; +var lambda2 = (function (x) { x(undefined); return x; }); var obj1 = { x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }; var obj2 = ({ x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }); diff --git a/tests/baselines/reference/parseTypes.js b/tests/baselines/reference/parseTypes.js index 193533de04a..08cc9f2a6bd 100644 --- a/tests/baselines/reference/parseTypes.js +++ b/tests/baselines/reference/parseTypes.js @@ -18,13 +18,9 @@ var x = null; var y = null; var z = null; var w = null; -function f() { - return 3; -} +function f() { return 3; } ; -function g(s) { - true; -} +function g(s) { true; } ; y = f; y = g; diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.js b/tests/baselines/reference/parser15.4.4.14-9-2.js index 9680dbff36b..0f533cd9a26 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.js +++ b/tests/baselines/reference/parser15.4.4.14-9-2.js @@ -37,13 +37,14 @@ runTestCase(testcase); * @description Array.prototype.indexOf must return correct index (Number) */ function testcase() { - var obj = { toString: function () { - return 0; - } }; + var obj = { toString: function () { return 0; } }; var one = 1; var _float = -(4 / 3); var a = new Array(false, undefined, null, "0", obj, -1.3333333333333, "str", -0, true, +0, one, 1, 0, false, _float, -(4 / 3)); - if (a.indexOf(-(4 / 3)) === 14 && a.indexOf(0) === 7 && a.indexOf(-0) === 7 && a.indexOf(1) === 10) { + if (a.indexOf(-(4 / 3)) === 14 && + a.indexOf(0) === 7 && + a.indexOf(-0) === 7 && + a.indexOf(1) === 10) { return true; } } diff --git a/tests/baselines/reference/parserClass1.js b/tests/baselines/reference/parserClass1.js index 1245da3363f..eb1d17566aa 100644 --- a/tests/baselines/reference/parserClass1.js +++ b/tests/baselines/reference/parserClass1.js @@ -13,21 +13,11 @@ var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index 061e2c40c2d..a9b5396781a 100644 --- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index 65748f72b24..2a7a606f4bf 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt index b209f3c7d01..a7a77cf1244 100644 --- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt index 6ac2d276a80..50a6d1bc689 100644 --- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ==== var v: { [e](): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt index f66e5930c26..9635178af16 100644 --- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ==== var v: { [e: number]: string; [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt index f7485a127cb..9e64ddd0d28 100644 --- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ==== var v: { [e]?(): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt index 65c22ff36c3..86bb591011e 100644 --- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ==== var v: { [e]? }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt index d65dfede1d2..035e494af33 100644 --- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e](): number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt index 5a9738a23a6..4ebc321cc80 100644 --- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt index ce20dd0c587..fd9e3797018 100644 --- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt index 8d26c8afdb7..0d0a2a8d833 100644 --- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // No ASI [e] = 0 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2] = 1 diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt index c522ec031eb..a84f3b7d16b 100644 --- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'. @@ -8,12 +8,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: number = 0; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 5e6baed0f06..3d886eacc50 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -10,14 +10,14 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e] = id++ ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt index 97a3b1ee187..4661b0797af 100644 --- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -9,12 +9,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt index da423baaa05..4be8d70383e 100644 --- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: Computed property names are not allowed in an ambient context. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e](): number ~~~ -!!! error TS1165: Computed property names are not allowed in an ambient context. +!!! error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt index 1b4130b0e27..07e937b3b42 100644 --- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [public ]: string; ~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~ !!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt index 65d4ec8627f..5389b187cad 100644 --- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== var v = { [0 in []]: true ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index bcf39b0ca0a..056fa3d82fd 100644 --- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt index 250c7a52c6e..32bb4906353 100644 --- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { public [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt index fd434046564..9db0cbde3bd 100644 --- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 55af923e54b..2c8f1d2ab4f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt index 7db85cdef35..31d3f9985ab 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt index ead27a994d1..b4808607ab0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt index 5918387942d..55176bf76f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== var v = { [e]: 1 }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 861716a3cde..2b39e305e07 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -2,4 +2,7 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] -var v = { [e]: 1 }; +var v = (_a = {}, _a[e] = +1, +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 097ab1ea9cb..07ea47dd3f0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== var v = { [e]() { } }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index f83253b531d..3247b0251f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,4 +2,6 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = { [e]: function () { } }; +var v = (_a = {}, _a[e] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index ca69791c93c..cfb12152c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 568b54500ac..436f967e8de 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,4 +2,6 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = { get [e]() { } }; +var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt index 122ca20a0e4..9125ce7b58f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt index d38d57d87be..277bdcd3c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt index e52727c6929..6b674a1d2c0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt index 8cbe0ffcf8d..fb087a4d82f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt new file mode 100644 index 00000000000..9c1a39b1f4a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== + for (var i of e) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt new file mode 100644 index 00000000000..d7f411b1879 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ==== + for (const v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js new file mode 100644 index 00000000000..2b9dc843887 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement10.ts] +for (const v of X) { +} + +//// [parserES5ForOfStatement10.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt new file mode 100644 index 00000000000..48805a336c7 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ==== + for (const [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js new file mode 100644 index 00000000000..45a24b109c0 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement11.ts] +for (const [a, b] of X) { +} + +//// [parserES5ForOfStatement11.js] +for (var _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt new file mode 100644 index 00000000000..3b9f242b975 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ==== + for (const {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js new file mode 100644 index 00000000000..30beac5118c --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement12.ts] +for (const {a, b} of X) { +} + +//// [parserES5ForOfStatement12.js] +for (var _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt new file mode 100644 index 00000000000..8b8c8ce0868 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ==== + for (let {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js new file mode 100644 index 00000000000..89706613add --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement13.ts] +for (let {a, b} of X) { +} + +//// [parserES5ForOfStatement13.js] +for (let _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt new file mode 100644 index 00000000000..dc4db95270a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ==== + for (let [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js new file mode 100644 index 00000000000..96aa327a625 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement14.ts] +for (let [a, b] of X) { +} + +//// [parserES5ForOfStatement14.js] +for (let _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt new file mode 100644 index 00000000000..07aa6dd5b37 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== + for (var [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js new file mode 100644 index 00000000000..efca0b289f6 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement15.ts] +for (var [a, b] of X) { +} + +//// [parserES5ForOfStatement15.js] +for (var _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt new file mode 100644 index 00000000000..15a3e4f7f0b --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== + for (var {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js new file mode 100644 index 00000000000..102e91685c3 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement16.ts] +for (var {a, b} of X) { +} + +//// [parserES5ForOfStatement16.js] +for (var _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement17.js b/tests/baselines/reference/parserES5ForOfStatement17.js new file mode 100644 index 00000000000..7995c4c689e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement17.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement17.ts] +for (var of; ;) { } + +//// [parserES5ForOfStatement17.js] +for (var of;;) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement17.types b/tests/baselines/reference/parserES5ForOfStatement17.types new file mode 100644 index 00000000000..5dd0f6e9b93 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement17.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts === +for (var of; ;) { } +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt new file mode 100644 index 00000000000..fc314e51012 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== + for (var of of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js new file mode 100644 index 00000000000..1df3e0bed7b --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement18.ts] +for (var of of of) { } + +//// [parserES5ForOfStatement18.js] +for (var of of of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.js b/tests/baselines/reference/parserES5ForOfStatement19.js new file mode 100644 index 00000000000..7ed0d5a333a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement19.ts] +for (var of in of) { } + +//// [parserES5ForOfStatement19.js] +for (var of in of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.types b/tests/baselines/reference/parserES5ForOfStatement19.types new file mode 100644 index 00000000000..13abc7ae757 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt new file mode 100644 index 00000000000..347ae29ddb8 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ==== + for (var of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js new file mode 100644 index 00000000000..dfcfb476172 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement2.ts] +for (var of X) { +} + +//// [parserES5ForOfStatement2.js] +for ( of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt new file mode 100644 index 00000000000..4aee32394b6 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ==== + for (var of = 0 in of) { } + ~~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement20.js b/tests/baselines/reference/parserES5ForOfStatement20.js new file mode 100644 index 00000000000..c51cbbc2a3a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement20.ts] +for (var of = 0 in of) { } + +//// [parserES5ForOfStatement20.js] +for (var of = 0 in of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt new file mode 100644 index 00000000000..2ddbf4b5666 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ==== + for (var of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js new file mode 100644 index 00000000000..e02ed853cb5 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement21.ts] +for (var of of) { } + +//// [parserES5ForOfStatement21.js] +for ( of of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt new file mode 100644 index 00000000000..553ca40aee0 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== + for (var a, b of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js new file mode 100644 index 00000000000..64892eb5094 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement3.ts] +for (var a, b of X) { +} + +//// [parserES5ForOfStatement3.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt new file mode 100644 index 00000000000..6a08c8942ed --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== + for (var a = 1 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js new file mode 100644 index 00000000000..e17699a8662 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement4.ts] +for (var a = 1 of X) { +} + +//// [parserES5ForOfStatement4.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt new file mode 100644 index 00000000000..212eae8ac10 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== + for (var a: number of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js new file mode 100644 index 00000000000..2eeb504365e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement5.ts] +for (var a: number of X) { +} + +//// [parserES5ForOfStatement5.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt new file mode 100644 index 00000000000..e331b66eb85 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== + for (var a = 1, b = 2 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js new file mode 100644 index 00000000000..575368fcd20 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement6.ts] +for (var a = 1, b = 2 of X) { +} + +//// [parserES5ForOfStatement6.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt new file mode 100644 index 00000000000..5ba60c264eb --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== + for (var a: number = 1, b: string = "" of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js new file mode 100644 index 00000000000..ac240494c18 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement7.ts] +for (var a: number = 1, b: string = "" of X) { +} + +//// [parserES5ForOfStatement7.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt new file mode 100644 index 00000000000..3696bf11f8c --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== + for (var v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js new file mode 100644 index 00000000000..c926784adfe --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement8.ts] +for (var v of X) { +} + +//// [parserES5ForOfStatement8.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt new file mode 100644 index 00000000000..6e2e9d05705 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ==== + for (let v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js new file mode 100644 index 00000000000..e2ec49e9ac9 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement9.ts] +for (let v of X) { +} + +//// [parserES5ForOfStatement9.js] +for (let v of X) { +} diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt new file mode 100644 index 00000000000..adfac8f700f --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.js b/tests/baselines/reference/parserES5SymbolIndexer1.js new file mode 100644 index 00000000000..641d93b1170 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer1.js] diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt new file mode 100644 index 00000000000..12eef8ec049 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.js b/tests/baselines/reference/parserES5SymbolIndexer2.js new file mode 100644 index 00000000000..c511b6acafa --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt new file mode 100644 index 00000000000..c9cd9db4fab --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.js b/tests/baselines/reference/parserES5SymbolIndexer3.js new file mode 100644 index 00000000000..daffb51a6d7 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolIndexer3.ts] +var x: { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer3.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty1.errors.txt b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt new file mode 100644 index 00000000000..261b28a0650 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts (1 errors) ==== + interface I { + [Symbol.iterator]: string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty1.js b/tests/baselines/reference/parserES5SymbolProperty1.js new file mode 100644 index 00000000000..36030aec105 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserES5SymbolProperty1.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty2.errors.txt b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt new file mode 100644 index 00000000000..20e166b81f1 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts (1 errors) ==== + interface I { + [Symbol.unscopables](): string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty2.js b/tests/baselines/reference/parserES5SymbolProperty2.js new file mode 100644 index 00000000000..d600b05ea52 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty2.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty3.errors.txt b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt new file mode 100644 index 00000000000..9125e8b6dcc --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts (1 errors) ==== + declare class C { + [Symbol.unscopables](): string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty3.js b/tests/baselines/reference/parserES5SymbolProperty3.js new file mode 100644 index 00000000000..0d0fb18313f --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty3.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty4.errors.txt b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt new file mode 100644 index 00000000000..af64d0895d5 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts (1 errors) ==== + declare class C { + [Symbol.isRegExp]: string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty4.js b/tests/baselines/reference/parserES5SymbolProperty4.js new file mode 100644 index 00000000000..d8f55358e73 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty4.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty5.errors.txt b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt new file mode 100644 index 00000000000..7ebc7f589d2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts (1 errors) ==== + class C { + [Symbol.isRegExp]: string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty5.js b/tests/baselines/reference/parserES5SymbolProperty5.js new file mode 100644 index 00000000000..e2448432542 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty6.errors.txt b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt new file mode 100644 index 00000000000..f72a3b4fd28 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts (1 errors) ==== + class C { + [Symbol.toStringTag]: string = ""; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty6.js b/tests/baselines/reference/parserES5SymbolProperty6.js new file mode 100644 index 00000000000..ce2050688c3 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserES5SymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty7.errors.txt b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt new file mode 100644 index 00000000000..9fab662b513 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts (1 errors) ==== + class C { + [Symbol.toStringTag](): void { } + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty7.js b/tests/baselines/reference/parserES5SymbolProperty7.js new file mode 100644 index 00000000000..102d10af417 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserES5SymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty8.errors.txt b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt new file mode 100644 index 00000000000..289b321b2af --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts (1 errors) ==== + var x: { + [Symbol.toPrimitive](): string + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty8.js b/tests/baselines/reference/parserES5SymbolProperty8.js new file mode 100644 index 00000000000..ed3a55db0f2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserES5SymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty9.errors.txt b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt new file mode 100644 index 00000000000..1b74bb23d11 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts (1 errors) ==== + var x: { + [Symbol.toPrimitive]: string + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty9.js b/tests/baselines/reference/parserES5SymbolProperty9.js new file mode 100644 index 00000000000..4728765e553 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserES5SymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js index 1ed36d8dac5..c33dbc2a626 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js @@ -3,4 +3,5 @@ var v = [1, 2, 3 4, 5, 6, 7]; //// [parserErrorRecoveryArrayLiteralExpression1.js] -var v = [1, 2, 3, 4, 5, 6, 7]; +var v = [1, 2, 3, + 4, 5, 6, 7]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js index c5386a2b6a2..0bfe59964db 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js @@ -5,4 +5,5 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 //// [parserErrorRecoveryArrayLiteralExpression2.js] -var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, + .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; diff --git a/tests/baselines/reference/parserErrorRecovery_Block1.js b/tests/baselines/reference/parserErrorRecovery_Block1.js index cdcd5856fa6..e2bc5f89a39 100644 --- a/tests/baselines/reference/parserErrorRecovery_Block1.js +++ b/tests/baselines/reference/parserErrorRecovery_Block1.js @@ -6,6 +6,7 @@ function f() { //// [parserErrorRecovery_Block1.js] function f() { - 1 + ; + 1 + + ; return; } diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js index c26b16b5a0a..ae2509c3f49 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js index 866f96a8030..4936b1ea8bc 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js index 08dc96d38ef..6a703759fff 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -3,4 +3,5 @@ var v = { a return; //// [parserErrorRecovery_ObjectLiteral2.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js index 1ea23d59112..eecf45fea4f 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -3,4 +3,5 @@ var v = { a: return; //// [parserErrorRecovery_ObjectLiteral3.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js index 4fe49788740..87a1a31437e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -3,4 +3,5 @@ var v = { a: 1 return; //// [parserErrorRecovery_ObjectLiteral4.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js index cf55b59c711..97e618946a0 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -3,4 +3,5 @@ var v = { a: 1, return; //// [parserErrorRecovery_ObjectLiteral5.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js index 63591985d1e..4d8008639c9 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js @@ -10,8 +10,10 @@ switch (e) { //// [parserErrorRecovery_SwitchStatement1.js] switch (e) { case 1: - 1 + ; + 1 + + ; case 2: - 1 + ; + 1 + + ; default: } diff --git a/tests/baselines/reference/parserForInStatement4.errors.txt b/tests/baselines/reference/parserForInStatement4.errors.txt index a4df2beaedb..91484260903 100644 --- a/tests/baselines/reference/parserForInStatement4.errors.txt +++ b/tests/baselines/reference/parserForInStatement4.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,19): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (2 errors) ==== for (var a = 1 in X) { + ~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. ~ !!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForInStatement7.errors.txt b/tests/baselines/reference/parserForInStatement7.errors.txt index 397401003db..7c85ce3f795 100644 --- a/tests/baselines/reference/parserForInStatement7.errors.txt +++ b/tests/baselines/reference/parserForInStatement7.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,43): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (2 errors) ==== for (var a: number = 1, b: string = "" in X) { - ~ -!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. ~ !!! error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. ~ diff --git a/tests/baselines/reference/parserForOfStatement1.d.errors.txt b/tests/baselines/reference/parserForOfStatement1.d.errors.txt new file mode 100644 index 00000000000..05af0a6f775 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement1.d.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ==== + for (var i of e) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.errors.txt b/tests/baselines/reference/parserForOfStatement10.errors.txt new file mode 100644 index 00000000000..570c319b51f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts (1 errors) ==== + for (const v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.js b/tests/baselines/reference/parserForOfStatement10.js new file mode 100644 index 00000000000..d0b48203090 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement10.ts] +for (const v of X) { +} + +//// [parserForOfStatement10.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement11.errors.txt b/tests/baselines/reference/parserForOfStatement11.errors.txt new file mode 100644 index 00000000000..f253a2d4295 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts (1 errors) ==== + for (const [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement11.js b/tests/baselines/reference/parserForOfStatement11.js new file mode 100644 index 00000000000..daa3fb6df48 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement11.ts] +for (const [a, b] of X) { +} + +//// [parserForOfStatement11.js] +for (var [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement12.errors.txt b/tests/baselines/reference/parserForOfStatement12.errors.txt new file mode 100644 index 00000000000..07ef4498984 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts (1 errors) ==== + for (const {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement12.js b/tests/baselines/reference/parserForOfStatement12.js new file mode 100644 index 00000000000..2e62b90de5e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement12.ts] +for (const {a, b} of X) { +} + +//// [parserForOfStatement12.js] +for (var { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement13.errors.txt b/tests/baselines/reference/parserForOfStatement13.errors.txt new file mode 100644 index 00000000000..6c10a7b0582 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts (1 errors) ==== + for (let {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement13.js b/tests/baselines/reference/parserForOfStatement13.js new file mode 100644 index 00000000000..a9c59046b8e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement13.ts] +for (let {a, b} of X) { +} + +//// [parserForOfStatement13.js] +for (let { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement14.errors.txt b/tests/baselines/reference/parserForOfStatement14.errors.txt new file mode 100644 index 00000000000..209a39c0513 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts (1 errors) ==== + for (let [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement14.js b/tests/baselines/reference/parserForOfStatement14.js new file mode 100644 index 00000000000..e46e2c46ea6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement14.ts] +for (let [a, b] of X) { +} + +//// [parserForOfStatement14.js] +for (let [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement15.errors.txt b/tests/baselines/reference/parserForOfStatement15.errors.txt new file mode 100644 index 00000000000..c5fd77af299 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts (1 errors) ==== + for (var [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement15.js b/tests/baselines/reference/parserForOfStatement15.js new file mode 100644 index 00000000000..81782393383 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement15.ts] +for (var [a, b] of X) { +} + +//// [parserForOfStatement15.js] +for (var [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement16.errors.txt b/tests/baselines/reference/parserForOfStatement16.errors.txt new file mode 100644 index 00000000000..d169eef1256 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts (1 errors) ==== + for (var {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement16.js b/tests/baselines/reference/parserForOfStatement16.js new file mode 100644 index 00000000000..f0ca1ee3e6d --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement16.ts] +for (var {a, b} of X) { +} + +//// [parserForOfStatement16.js] +for (var { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement17.js b/tests/baselines/reference/parserForOfStatement17.js new file mode 100644 index 00000000000..a6e2aee79a4 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement17.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement17.ts] +for (var of; ;) { } + +//// [parserForOfStatement17.js] +for (var of;;) { } diff --git a/tests/baselines/reference/parserForOfStatement17.types b/tests/baselines/reference/parserForOfStatement17.types new file mode 100644 index 00000000000..64e15462dd6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement17.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts === +for (var of; ;) { } +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement18.errors.txt b/tests/baselines/reference/parserForOfStatement18.errors.txt new file mode 100644 index 00000000000..9312af76fc1 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts (1 errors) ==== + for (var of of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement18.js b/tests/baselines/reference/parserForOfStatement18.js new file mode 100644 index 00000000000..c30fbb60857 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement18.ts] +for (var of of of) { } + +//// [parserForOfStatement18.js] +for (var of of of) { } diff --git a/tests/baselines/reference/parserForOfStatement19.js b/tests/baselines/reference/parserForOfStatement19.js new file mode 100644 index 00000000000..c838e8c71e0 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement19.ts] +for (var of in of) { } + +//// [parserForOfStatement19.js] +for (var of in of) { } diff --git a/tests/baselines/reference/parserForOfStatement19.types b/tests/baselines/reference/parserForOfStatement19.types new file mode 100644 index 00000000000..6fcc5e8f792 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement2.errors.txt b/tests/baselines/reference/parserForOfStatement2.errors.txt new file mode 100644 index 00000000000..8e7da497308 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ==== + for (var of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement2.js b/tests/baselines/reference/parserForOfStatement2.js new file mode 100644 index 00000000000..84d23d4e2aa --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement2.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement2.ts] +for (var of X) { +} + +//// [parserForOfStatement2.js] +for ( of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement20.errors.txt b/tests/baselines/reference/parserForOfStatement20.errors.txt new file mode 100644 index 00000000000..461f307f6b9 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ==== + for (var of = 0 in of) { } + ~~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement20.js b/tests/baselines/reference/parserForOfStatement20.js new file mode 100644 index 00000000000..8599238d853 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement20.ts] +for (var of = 0 in of) { } + +//// [parserForOfStatement20.js] +for (var of = 0 in of) { } diff --git a/tests/baselines/reference/parserForOfStatement21.errors.txt b/tests/baselines/reference/parserForOfStatement21.errors.txt new file mode 100644 index 00000000000..dad48f415cd --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement21.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ==== + for (var of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement21.js b/tests/baselines/reference/parserForOfStatement21.js new file mode 100644 index 00000000000..5db883e18a0 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement21.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement21.ts] +for (var of of) { } + +//// [parserForOfStatement21.js] +for ( of of) { } diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt new file mode 100644 index 00000000000..83985f1a710 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== + for (var a, b of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.js b/tests/baselines/reference/parserForOfStatement3.js new file mode 100644 index 00000000000..206e8fe5af8 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement3.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement3.ts] +for (var a, b of X) { +} + +//// [parserForOfStatement3.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement4.errors.txt b/tests/baselines/reference/parserForOfStatement4.errors.txt new file mode 100644 index 00000000000..94dd08ed597 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ==== + for (var a = 1 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement4.js b/tests/baselines/reference/parserForOfStatement4.js new file mode 100644 index 00000000000..9e7549c20fc --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement4.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement4.ts] +for (var a = 1 of X) { +} + +//// [parserForOfStatement4.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement5.errors.txt b/tests/baselines/reference/parserForOfStatement5.errors.txt new file mode 100644 index 00000000000..6570f4a0755 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== + for (var a: number of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement5.js b/tests/baselines/reference/parserForOfStatement5.js new file mode 100644 index 00000000000..9028ebe7e3f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement5.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement5.ts] +for (var a: number of X) { +} + +//// [parserForOfStatement5.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt new file mode 100644 index 00000000000..6208749911f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== + for (var a = 1, b = 2 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.js b/tests/baselines/reference/parserForOfStatement6.js new file mode 100644 index 00000000000..37f3560a29c --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement6.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement6.ts] +for (var a = 1, b = 2 of X) { +} + +//// [parserForOfStatement6.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt new file mode 100644 index 00000000000..1810daad5ee --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== + for (var a: number = 1, b: string = "" of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.js b/tests/baselines/reference/parserForOfStatement7.js new file mode 100644 index 00000000000..0b18d0358b4 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement7.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement7.ts] +for (var a: number = 1, b: string = "" of X) { +} + +//// [parserForOfStatement7.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement8.errors.txt b/tests/baselines/reference/parserForOfStatement8.errors.txt new file mode 100644 index 00000000000..8e2c41d0cef --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts (1 errors) ==== + for (var v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement8.js b/tests/baselines/reference/parserForOfStatement8.js new file mode 100644 index 00000000000..3565998701e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement8.ts] +for (var v of X) { +} + +//// [parserForOfStatement8.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement9.errors.txt b/tests/baselines/reference/parserForOfStatement9.errors.txt new file mode 100644 index 00000000000..01fd729e9cd --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts (1 errors) ==== + for (let v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement9.js b/tests/baselines/reference/parserForOfStatement9.js new file mode 100644 index 00000000000..f03dad33c5f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement9.ts] +for (let v of X) { +} + +//// [parserForOfStatement9.js] +for (let v of X) { +} diff --git a/tests/baselines/reference/parserForStatement3.errors.txt b/tests/baselines/reference/parserForStatement3.errors.txt index 533958505c1..06c3f083d45 100644 --- a/tests/baselines/reference/parserForStatement3.errors.txt +++ b/tests/baselines/reference/parserForStatement3.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2304: Cannot find name 'd'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,10): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,15): error TS2304: Cannot find name 'a'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,18): error TS2304: Cannot find name '_'. @@ -7,12 +6,10 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,2 tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,30): error TS2304: Cannot find name 'b'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (7 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (6 errors) ==== for(d in _.jh[a]=_.jh[a]||[],b); ~ !!! error TS2304: Cannot find name 'd'. - ~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. ~ !!! error TS2304: Cannot find name '_'. ~ diff --git a/tests/baselines/reference/parserForStatement6.errors.txt b/tests/baselines/reference/parserForStatement6.errors.txt index a098141c81b..a41f103e929 100644 --- a/tests/baselines/reference/parserForStatement6.errors.txt +++ b/tests/baselines/reference/parserForStatement6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2304: Cannot find name 'foo'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,15): error TS2304: Cannot find name 'b'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,1 ~~~ !!! error TS2304: Cannot find name 'foo'. ~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~ !!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForStatement7.errors.txt b/tests/baselines/reference/parserForStatement7.errors.txt index da1f1ce6808..3aa67480105 100644 --- a/tests/baselines/reference/parserForStatement7.errors.txt +++ b/tests/baselines/reference/parserForStatement7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,10): error TS2304: Cannot find name 'foo'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,19): error TS2304: Cannot find name 'b'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,1 ==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts (3 errors) ==== for (new foo() in b) { ~~~~~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~~~ !!! error TS2304: Cannot find name 'foo'. ~ diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js index 4ff1f26d890..766c95632ab 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity10.js] -1 >>> 2; +1 >>> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js index 5cc8bb3b88e..b2eba6d5873 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity14.js] -1 >> ; +1 >> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js index df9e55b7e3c..8675365d9ea 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity15.js] -1 >>= 2; +1 >>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js index 52035691c84..d0671d8649f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity19.js] -1 >>> ; +1 >>> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js index e6043febcd1..e190e94e9f9 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity20.js] -1 >>>= 2; +1 >>>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js index 5ef065681dc..c0b8fc45cc1 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity4.js] -1 > > 2; +1 > + > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js index a707e808b4a..59d13d5c9d3 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity5.js] -1 >> 2; +1 >> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js index 25c5ed53a7c..757ddf38a7f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity9.js] -1 >> > 2; +1 >> + > 2; diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index 8cf474b19bb..f1f2a4a00f4 100644 --- a/tests/baselines/reference/parserIndexSignature11.errors.txt +++ b/tests/baselines/reference/parserIndexSignature11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1 interface I { [p]; // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt index d625f27eb6f..bd73b4d2bf4 100644 --- a/tests/baselines/reference/parserIndexSignature4.errors.txt +++ b/tests/baselines/reference/parserIndexSignature4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4 interface I { [a = 0] // Used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt index 3f3415973d9..54ccd05f4f9 100644 --- a/tests/baselines/reference/parserIndexSignature5.errors.txt +++ b/tests/baselines/reference/parserIndexSignature5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5 interface I { [a] // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserRealSource1.js b/tests/baselines/reference/parserRealSource1.js index c62897c9aff..d19c2242f0b 100644 --- a/tests/baselines/reference/parserRealSource1.js +++ b/tests/baselines/reference/parserRealSource1.js @@ -189,21 +189,11 @@ var TypeScript; var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; @@ -218,21 +208,11 @@ var TypeScript; this._error = this.logger.error(); this._fatal = this.logger.fatal(); } - LoggerAdapter.prototype.information = function () { - return this._information; - }; - LoggerAdapter.prototype.debug = function () { - return this._debug; - }; - LoggerAdapter.prototype.warning = function () { - return this._warning; - }; - LoggerAdapter.prototype.error = function () { - return this._error; - }; - LoggerAdapter.prototype.fatal = function () { - return this._fatal; - }; + LoggerAdapter.prototype.information = function () { return this._information; }; + LoggerAdapter.prototype.debug = function () { return this._debug; }; + LoggerAdapter.prototype.warning = function () { return this._warning; }; + LoggerAdapter.prototype.error = function () { return this._error; }; + LoggerAdapter.prototype.fatal = function () { return this._fatal; }; LoggerAdapter.prototype.log = function (s) { this.logger.log(s); }; @@ -243,21 +223,11 @@ var TypeScript; function BufferedLogger() { this.logContents = []; } - BufferedLogger.prototype.information = function () { - return false; - }; - BufferedLogger.prototype.debug = function () { - return false; - }; - BufferedLogger.prototype.warning = function () { - return false; - }; - BufferedLogger.prototype.error = function () { - return false; - }; - BufferedLogger.prototype.fatal = function () { - return false; - }; + BufferedLogger.prototype.information = function () { return false; }; + BufferedLogger.prototype.debug = function () { return false; }; + BufferedLogger.prototype.warning = function () { return false; }; + BufferedLogger.prototype.error = function () { return false; }; + BufferedLogger.prototype.fatal = function () { return false; }; BufferedLogger.prototype.log = function (s) { this.logContents.push(s); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 0dd944a7721..768e35c1a3b 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -813,7 +813,8 @@ var TypeScript; else { var tokenInfo = lookupToken(this.tokenId); if (tokenInfo != undefined) { - if ((tokenInfo.unopNodeType != NodeType.None) || (tokenInfo.binopNodeType != NodeType.None)) { + if ((tokenInfo.unopNodeType != NodeType.None) || + (tokenInfo.binopNodeType != NodeType.None)) { return 2 /* Operator */; } } diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0574c52eaaa..72fec692184 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2397,18 +2397,10 @@ var TypeScript; this.postComments = null; this.isParenthesized = false; } - AST.prototype.isExpression = function () { - return false; - }; - AST.prototype.isStatementOrExpression = function () { - return false; - }; - AST.prototype.isCompoundStatement = function () { - return false; - }; - AST.prototype.isLeaf = function () { - return this.isStatementOrExpression() && (!this.isCompoundStatement()); - }; + AST.prototype.isExpression = function () { return false; }; + AST.prototype.isStatementOrExpression = function () { return false; }; + AST.prototype.isCompoundStatement = function () { return false; }; + AST.prototype.isLeaf = function () { return this.isStatementOrExpression() && (!this.isCompoundStatement()); }; AST.prototype.typeCheck = function (typeFlow) { switch (this.nodeType) { case NodeType.Error: @@ -2496,7 +2488,8 @@ var TypeScript; if (context.parser !== null) { context.parser.getSourceLineCol(lineCol, this.minChar); context.parser.getSourceLineCol(limLineCol, this.limChar); - context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): "); + context.write("(" + lineCol.line + "," + lineCol.col + ")--" + + "(" + limLineCol.line + "," + limLineCol.col + "): "); } var lab = this.printLabel(); if (hasFlag(this.flags, ASTFlags.Error)) { @@ -2643,12 +2636,8 @@ var TypeScript; this.text = actualText; } }; - Identifier.prototype.isMissing = function () { - return false; - }; - Identifier.prototype.isLeaf = function () { - return true; - }; + Identifier.prototype.isMissing = function () { return false; }; + Identifier.prototype.isLeaf = function () { return true; }; Identifier.prototype.treeViewLabel = function () { return "id: " + this.actualText; }; @@ -2692,9 +2681,7 @@ var TypeScript; _super.call(this, NodeType.Label); this.id = id; } - Label.prototype.printLabel = function () { - return this.id.actualText + ":"; - }; + Label.prototype.printLabel = function () { return this.id.actualText + ":"; }; Label.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -2717,12 +2704,8 @@ var TypeScript; function Expression(nodeType) { _super.call(this, nodeType); } - Expression.prototype.isExpression = function () { - return true; - }; - Expression.prototype.isStatementOrExpression = function () { - return true; - }; + Expression.prototype.isExpression = function () { return true; }; + Expression.prototype.isStatementOrExpression = function () { return true; }; return Expression; })(AST); TypeScript.Expression = Expression; @@ -3183,9 +3166,7 @@ var TypeScript; this.varFlags = VarFlags.None; this.isDynamicImport = false; } - ImportDeclaration.prototype.isStatementOrExpression = function () { - return true; - }; + ImportDeclaration.prototype.isStatementOrExpression = function () { return true; }; ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) { var mod = this.alias.type; // REVIEW: Only modules may be aliased for now, though there's no real @@ -3246,18 +3227,10 @@ var TypeScript; this.varFlags = VarFlags.None; this.sym = null; } - BoundDecl.prototype.isStatementOrExpression = function () { - return true; - }; - BoundDecl.prototype.isPrivate = function () { - return hasFlag(this.varFlags, VarFlags.Private); - }; - BoundDecl.prototype.isPublic = function () { - return hasFlag(this.varFlags, VarFlags.Public); - }; - BoundDecl.prototype.isProperty = function () { - return hasFlag(this.varFlags, VarFlags.Property); - }; + BoundDecl.prototype.isStatementOrExpression = function () { return true; }; + BoundDecl.prototype.isPrivate = function () { return hasFlag(this.varFlags, VarFlags.Private); }; + BoundDecl.prototype.isPublic = function () { return hasFlag(this.varFlags, VarFlags.Public); }; + BoundDecl.prototype.isProperty = function () { return hasFlag(this.varFlags, VarFlags.Property); }; BoundDecl.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckBoundDecl(this); }; @@ -3272,15 +3245,9 @@ var TypeScript; function VarDecl(id, nest) { _super.call(this, id, NodeType.VarDecl, nest); } - VarDecl.prototype.isAmbient = function () { - return hasFlag(this.varFlags, VarFlags.Ambient); - }; - VarDecl.prototype.isExported = function () { - return hasFlag(this.varFlags, VarFlags.Exported); - }; - VarDecl.prototype.isStatic = function () { - return hasFlag(this.varFlags, VarFlags.Static); - }; + VarDecl.prototype.isAmbient = function () { return hasFlag(this.varFlags, VarFlags.Ambient); }; + VarDecl.prototype.isExported = function () { return hasFlag(this.varFlags, VarFlags.Exported); }; + VarDecl.prototype.isStatic = function () { return hasFlag(this.varFlags, VarFlags.Static); }; VarDecl.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitJavascriptVarDecl(this, tokenId); }; @@ -3297,9 +3264,7 @@ var TypeScript; this.isOptional = false; this.parameterPropertySym = null; } - ArgDecl.prototype.isOptionalArg = function () { - return this.isOptional || this.init; - }; + ArgDecl.prototype.isOptionalArg = function () { return this.isOptional || this.init; }; ArgDecl.prototype.treeViewLabel = function () { return "arg: " + this.id.actualText; }; @@ -3360,12 +3325,8 @@ var TypeScript; } return this.internalNameCache; }; - FuncDecl.prototype.hasSelfReference = function () { - return hasFlag(this.fncFlags, FncFlags.HasSelfReference); - }; - FuncDecl.prototype.setHasSelfReference = function () { - this.fncFlags |= FncFlags.HasSelfReference; - }; + FuncDecl.prototype.hasSelfReference = function () { return hasFlag(this.fncFlags, FncFlags.HasSelfReference); }; + FuncDecl.prototype.setHasSelfReference = function () { this.fncFlags |= FncFlags.HasSelfReference; }; FuncDecl.prototype.addCloRef = function (id, sym) { if (this.envids == null) { this.envids = new Identifier[]; @@ -3419,45 +3380,19 @@ var TypeScript; FuncDecl.prototype.isMethod = function () { return (this.fncFlags & FncFlags.Method) != FncFlags.None; }; - FuncDecl.prototype.isCallMember = function () { - return hasFlag(this.fncFlags, FncFlags.CallMember); - }; - FuncDecl.prototype.isConstructMember = function () { - return hasFlag(this.fncFlags, FncFlags.ConstructMember); - }; - FuncDecl.prototype.isIndexerMember = function () { - return hasFlag(this.fncFlags, FncFlags.IndexerMember); - }; - FuncDecl.prototype.isSpecialFn = function () { - return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); - }; - FuncDecl.prototype.isAnonymousFn = function () { - return this.name === null; - }; - FuncDecl.prototype.isAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isGetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor); - }; - FuncDecl.prototype.isSetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isAmbient = function () { - return hasFlag(this.fncFlags, FncFlags.Ambient); - }; - FuncDecl.prototype.isExported = function () { - return hasFlag(this.fncFlags, FncFlags.Exported); - }; - FuncDecl.prototype.isPrivate = function () { - return hasFlag(this.fncFlags, FncFlags.Private); - }; - FuncDecl.prototype.isPublic = function () { - return hasFlag(this.fncFlags, FncFlags.Public); - }; - FuncDecl.prototype.isStatic = function () { - return hasFlag(this.fncFlags, FncFlags.Static); - }; + FuncDecl.prototype.isCallMember = function () { return hasFlag(this.fncFlags, FncFlags.CallMember); }; + FuncDecl.prototype.isConstructMember = function () { return hasFlag(this.fncFlags, FncFlags.ConstructMember); }; + FuncDecl.prototype.isIndexerMember = function () { return hasFlag(this.fncFlags, FncFlags.IndexerMember); }; + FuncDecl.prototype.isSpecialFn = function () { return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); }; + FuncDecl.prototype.isAnonymousFn = function () { return this.name === null; }; + FuncDecl.prototype.isAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isGetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor); }; + FuncDecl.prototype.isSetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isAmbient = function () { return hasFlag(this.fncFlags, FncFlags.Ambient); }; + FuncDecl.prototype.isExported = function () { return hasFlag(this.fncFlags, FncFlags.Exported); }; + FuncDecl.prototype.isPrivate = function () { return hasFlag(this.fncFlags, FncFlags.Private); }; + FuncDecl.prototype.isPublic = function () { return hasFlag(this.fncFlags, FncFlags.Public); }; + FuncDecl.prototype.isStatic = function () { return hasFlag(this.fncFlags, FncFlags.Static); }; FuncDecl.prototype.treeViewLabel = function () { if (this.name == null) { return "funcExpr"; @@ -3469,12 +3404,8 @@ var TypeScript; FuncDecl.prototype.ClearFlags = function () { this.fncFlags = FncFlags.None; }; - FuncDecl.prototype.isSignature = function () { - return (this.fncFlags & FncFlags.Signature) != FncFlags.None; - }; - FuncDecl.prototype.hasStaticDeclarations = function () { - return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); - }; + FuncDecl.prototype.isSignature = function () { return (this.fncFlags & FncFlags.Signature) != FncFlags.None; }; + FuncDecl.prototype.hasStaticDeclarations = function () { return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); }; return FuncDecl; })(AST); TypeScript.FuncDecl = FuncDecl; @@ -3583,15 +3514,9 @@ var TypeScript; this.scopes = scopes; this.prettyName = this.name.actualText; } - ModuleDeclaration.prototype.isExported = function () { - return hasFlag(this.modFlags, ModuleFlags.Exported); - }; - ModuleDeclaration.prototype.isAmbient = function () { - return hasFlag(this.modFlags, ModuleFlags.Ambient); - }; - ModuleDeclaration.prototype.isEnum = function () { - return hasFlag(this.modFlags, ModuleFlags.IsEnum); - }; + ModuleDeclaration.prototype.isExported = function () { return hasFlag(this.modFlags, ModuleFlags.Exported); }; + ModuleDeclaration.prototype.isAmbient = function () { return hasFlag(this.modFlags, ModuleFlags.Ambient); }; + ModuleDeclaration.prototype.isEnum = function () { return hasFlag(this.modFlags, ModuleFlags.IsEnum); }; ModuleDeclaration.prototype.recordNonInterface = function () { this.modFlags &= ~ModuleFlags.ShouldEmitModuleDecl; }; @@ -3664,15 +3589,9 @@ var TypeScript; _super.call(this, nodeType); this.flags |= ASTFlags.IsStatement; } - Statement.prototype.isLoop = function () { - return false; - }; - Statement.prototype.isStatementOrExpression = function () { - return true; - }; - Statement.prototype.isCompoundStatement = function () { - return this.isLoop(); - }; + Statement.prototype.isLoop = function () { return false; }; + Statement.prototype.isStatementOrExpression = function () { return true; }; + Statement.prototype.isCompoundStatement = function () { return this.isLoop(); }; Statement.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -3776,9 +3695,7 @@ var TypeScript; this.target = null; this.resolvedTarget = null; } - Jump.prototype.hasExplicitTarget = function () { - return (this.target); - }; + Jump.prototype.hasExplicitTarget = function () { return (this.target); }; Jump.prototype.setResolvedTarget = function (parser, stmt) { if (stmt.isLoop()) { this.resolvedTarget = stmt; @@ -3829,9 +3746,7 @@ var TypeScript; this.cond = cond; this.body = null; } - WhileStatement.prototype.isLoop = function () { - return true; - }; + WhileStatement.prototype.isLoop = function () { return true; }; WhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3884,9 +3799,7 @@ var TypeScript; this.whileAST = null; this.cond = null; } - DoWhileStatement.prototype.isLoop = function () { - return true; - }; + DoWhileStatement.prototype.isLoop = function () { return true; }; DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3942,9 +3855,7 @@ var TypeScript; this.elseBod = null; this.statement = new ASTSpan(); } - IfStatement.prototype.isCompoundStatement = function () { - return true; - }; + IfStatement.prototype.isCompoundStatement = function () { return true; }; IfStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4064,9 +3975,7 @@ var TypeScript; this.lval.varFlags |= VarFlags.AutoInit; } } - ForInStatement.prototype.isLoop = function () { - return true; - }; + ForInStatement.prototype.isLoop = function () { return true; }; ForInStatement.prototype.isFiltered = function () { if (this.body) { var singleItem = null; @@ -4093,13 +4002,16 @@ var TypeScript; var target = cond.target; if (target.nodeType == NodeType.Dot) { var binex = target; - if ((binex.operand1.nodeType == NodeType.Name) && (this.obj.nodeType == NodeType.Name) && (binex.operand1.actualText == this.obj.actualText)) { + if ((binex.operand1.nodeType == NodeType.Name) && + (this.obj.nodeType == NodeType.Name) && + (binex.operand1.actualText == this.obj.actualText)) { var prop = binex.operand2; if (prop.actualText == "hasOwnProperty") { var args = cond.arguments; if ((args !== null) && (args.members.length == 1)) { var arg = args.members[0]; - if ((arg.nodeType == NodeType.Name) && (this.lval.nodeType == NodeType.Name)) { + if ((arg.nodeType == NodeType.Name) && + (this.lval.nodeType == NodeType.Name)) { if ((this.lval.actualText) == arg.actualText) { return true; } @@ -4173,9 +4085,7 @@ var TypeScript; _super.call(this, NodeType.For); this.init = init; } - ForStatement.prototype.isLoop = function () { - return true; - }; + ForStatement.prototype.isLoop = function () { return true; }; ForStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4267,9 +4177,7 @@ var TypeScript; this.expr = expr; this.withSym = null; } - WithStatement.prototype.isCompoundStatement = function () { - return true; - }; + WithStatement.prototype.isCompoundStatement = function () { return true; }; WithStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4296,9 +4204,7 @@ var TypeScript; this.defaultCase = null; this.statement = new ASTSpan(); } - SwitchStatement.prototype.isCompoundStatement = function () { - return true; - }; + SwitchStatement.prototype.isCompoundStatement = function () { return true; }; SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4452,9 +4358,7 @@ var TypeScript; this.tryNode = tryNode; this.finallyNode = finallyNode; } - TryFinally.prototype.isCompoundStatement = function () { - return true; - }; + TryFinally.prototype.isCompoundStatement = function () { return true; }; TryFinally.prototype.emit = function (emitter, tokenId, startLine) { emitter.recordSourceMappingStart(this); emitter.emitJavascript(this.tryNode, TokenID.Try, false); @@ -4499,9 +4403,7 @@ var TypeScript; this.tryNode = tryNode; this.catchNode = catchNode; } - TryCatch.prototype.isCompoundStatement = function () { - return true; - }; + TryCatch.prototype.isCompoundStatement = function () { return true; }; TryCatch.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 9b9ee2bcf84..540296e6973 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -607,9 +607,7 @@ var TypeScript; }; AstPath.prototype.clone = function () { var clone = new AstPath(); - clone.asts = this.asts.map(function (value) { - return value; - }); + clone.asts = this.asts.map(function (value) { return value; }); clone.top = this.top; return clone; }; @@ -658,167 +656,288 @@ var TypeScript; AstPath.prototype.isNameOfClass = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfInterface = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfArgument = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfVariable = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.VarDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.VarDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfModule = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfFunction = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && + (this.parent().name === this.ast()); }; AstPath.prototype.isChildOfScript = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; }; AstPath.prototype.isChildOfModule = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; }; AstPath.prototype.isChildOfClass = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; }; AstPath.prototype.isArgumentOfClassConstructor = function () { var ast = lastOf(this.asts); - return this.count() >= 5 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && (this.asts[this.top - 2].isConstructor) && (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); + return this.count() >= 5 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && + (this.asts[this.top - 2].isConstructor) && + (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && + (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); }; AstPath.prototype.isChildOfInterface = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; }; AstPath.prototype.isTopLevelImplicitModule = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && + TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfTopLevelImplicitModule = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0] && TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0] && + TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfScript = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfSwitch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].caseList == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].caseList == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfModule = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfClass = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfInterface = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfBlock = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 1].statements == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 1].statements == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFor = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCase = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfTry = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCatch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDoWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfForIn = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWith = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFinally = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1]; }; AstPath.prototype.isDefaultCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1] && this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1] && + this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; }; AstPath.prototype.isListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfObjectLit = function () { return this.isListOfObjectLit(); }; AstPath.prototype.isEmptyListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0] && this.asts[this.top - 0].members.length == 0; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0] && + this.asts[this.top - 0].members.length == 0; }; AstPath.prototype.isMemberOfObjectLit = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 2].operand == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 2].operand == this.asts[this.top - 1]; }; AstPath.prototype.isNameOfMemberOfObjectLit = function () { - return this.count() >= 4 && this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && this.asts[this.top - 3].operand == this.asts[this.top - 2]; + return this.count() >= 4 && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && + this.asts[this.top - 3].operand == this.asts[this.top - 2]; }; AstPath.prototype.isListOfArrayLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isTargetOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; }; AstPath.prototype.isMemberOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isItemOfList = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; //(this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isThenOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; }; AstPath.prototype.isElseOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDefaultCase = function () { return this.isBodyOfCase(); }; AstPath.prototype.isSingleStatementList = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.List && this.asts[this.top].members.length === 1; + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.List && + this.asts[this.top].members.length === 1; }; AstPath.prototype.isArgumentListOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentOfFunction = function () { - return this.count() >= 3 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 2].arguments === this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 2].arguments === this.asts[this.top - 1]; }; AstPath.prototype.isArgumentListOfCall = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentListOfNew = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isSynthesizedBlock = function () { - return this.count() >= 1 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 0].isStatementBlock === false; + return this.count() >= 1 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 0].isStatementBlock === false; }; return AstPath; })(); @@ -879,7 +998,9 @@ var TypeScript; // bar // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid - var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { diff --git a/tests/baselines/reference/parserRealSource4.js b/tests/baselines/reference/parserRealSource4.js index 1d6ed0aaf13..563e9e92a08 100644 --- a/tests/baselines/reference/parserRealSource4.js +++ b/tests/baselines/reference/parserRealSource4.js @@ -377,9 +377,7 @@ var TypeScript; } return false; }; - StringHashTable.prototype.count = function () { - return this.itemCount; - }; + StringHashTable.prototype.count = function () { return this.itemCount; }; StringHashTable.prototype.lookup = function (key) { var data = this.table[key]; if (data != undefined) { @@ -515,9 +513,7 @@ var TypeScript; } return result; }; - HashTable.prototype.count = function () { - return this.itemCount; - }; + HashTable.prototype.count = function () { return this.itemCount; }; HashTable.prototype.lookup = function (key) { var current; var val = this.hashFn(key); diff --git a/tests/baselines/reference/parserRealSource6.js b/tests/baselines/reference/parserRealSource6.js index e747b95e610..d65207b8c77 100644 --- a/tests/baselines/reference/parserRealSource6.js +++ b/tests/baselines/reference/parserRealSource6.js @@ -329,7 +329,8 @@ var TypeScript; // is has not been fully re-parsed yet. if (ast.nodeType == NodeType.Script && context.pos > limChar) limChar = context.pos; - if ((minChar <= context.pos) && (limChar >= context.pos)) { + if ((minChar <= context.pos) && + (limChar >= context.pos)) { switch (ast.nodeType) { case NodeType.Script: var script = ast; diff --git a/tests/baselines/reference/parserRealSource7.js b/tests/baselines/reference/parserRealSource7.js index c8dd3ae1b15..5073c33febd 100644 --- a/tests/baselines/reference/parserRealSource7.js +++ b/tests/baselines/reference/parserRealSource7.js @@ -1053,7 +1053,8 @@ var TypeScript; if (isExported) { typeSymbol.flags |= SymbolFlags.Exported; } - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { typeSymbol.flags |= SymbolFlags.ModuleMember; } moduleDecl.mod = modType; @@ -1079,7 +1080,11 @@ var TypeScript; // REVIEW-CLASSES if (!typeSymbol) { var valTypeSymbol = scopeChain.scope.findLocal(className, false, false); - if (valTypeSymbol && valTypeSymbol.isType() && valTypeSymbol.declAST && valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && valTypeSymbol.declAST.isSignature()) { + if (valTypeSymbol && + valTypeSymbol.isType() && + valTypeSymbol.declAST && + valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && + valTypeSymbol.declAST.isSignature()) { typeSymbol = valTypeSymbol; foundValSymbol = true; if (isExported) { @@ -1233,7 +1238,10 @@ var TypeScript; if (context.scopeChain.moduleDecl) { context.scopeChain.moduleDecl.recordNonInterface(); } - if (isProperty || isExported || (context.scopeChain.container == context.checker.gloMod) || context.scopeChain.moduleDecl) { + if (isProperty || + isExported || + (context.scopeChain.container == context.checker.gloMod) || + context.scopeChain.moduleDecl) { if (isAmbient) { var existingSym = scopeChain.scope.findLocal(varDecl.id.text, false, false); if (existingSym) { @@ -1254,7 +1262,8 @@ var TypeScript; } field.symbol = fieldSymbol; fieldSymbol.declAST = ast; - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { fieldSymbol.flags |= SymbolFlags.ModuleMember; fieldSymbol.declModule = context.scopeChain.moduleDecl; } @@ -1305,7 +1314,12 @@ var TypeScript; // If the parent is the constructor, and this isn't an instance method, skip it. // That way, we'll set the type during scope assignment, and can be sure that the // function will be placed in the constructor-local scope - if (!funcDecl.isConstructor && containerSym && containerSym.declAST && containerSym.declAST.nodeType == NodeType.FuncDecl && containerSym.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + containerSym && + containerSym.declAST && + containerSym.declAST.nodeType == NodeType.FuncDecl && + containerSym.declAST.isConstructor && + !funcDecl.isMethod()) { return go; } // Interfaces and overloads @@ -1394,7 +1408,14 @@ var TypeScript; } } // REVIEW: Move this check into the typecheck phase? It's only being run over properties... - if (fgSym && !fgSym.isAccessor() && fgSym.type && fgSym.type.construct && fgSym.type.construct.signatures != [] && (fgSym.type.construct.signatures[0].declAST == null || !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && !funcDecl.isConstructor) { + if (fgSym && + !fgSym.isAccessor() && + fgSym.type && + fgSym.type.construct && + fgSym.type.construct.signatures != [] && + (fgSym.type.construct.signatures[0].declAST == null || + !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && + !funcDecl.isConstructor) { context.checker.errorReporter.simpleError(funcDecl, "Functions may not have class overloads"); } if (fgSym && !(fgSym.kind() == SymbolKind.Type) && funcDecl.isMethod() && !funcDecl.isAccessor() && !funcDecl.isConstructor) { diff --git a/tests/baselines/reference/parserRealSource8.js b/tests/baselines/reference/parserRealSource8.js index fcdb170ae12..8a667ad6dbe 100644 --- a/tests/baselines/reference/parserRealSource8.js +++ b/tests/baselines/reference/parserRealSource8.js @@ -632,7 +632,8 @@ var TypeScript; // the enclosing scope // REVIEW: Some twisted logic here - this needs to be cleaned up once old classes are removed // - if it's a new class, always use the contained scope, since we initialize the constructor scope below - if (context.scopeChain.thisType && (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { + if (context.scopeChain.thisType && + (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { var instType = context.scopeChain.thisType; if (!(instType.typeFlags & TypeFlags.IsClass) && !hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) { if (!funcDecl.isMethod() || isStatic) { @@ -644,7 +645,10 @@ var TypeScript; } } else { - if (context.scopeChain.previous.scope.container && context.scopeChain.previous.scope.container.declAST && context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && context.scopeChain.previous.scope.container.declAST.isConstructor) { + if (context.scopeChain.previous.scope.container && + context.scopeChain.previous.scope.container.declAST && + context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && + context.scopeChain.previous.scope.container.declAST.isConstructor) { // if the parent is the class constructor, use the constructor scope parentScope = instType.constructorScope; } @@ -681,7 +685,12 @@ var TypeScript; outerFnc.innerStaticFuncs[outerFnc.innerStaticFuncs.length] = funcDecl; } else { - if (!funcDecl.isConstructor && container && container.declAST && container.declAST.nodeType == NodeType.FuncDecl && container.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + container && + container.declAST && + container.declAST.nodeType == NodeType.FuncDecl && + container.declAST.isConstructor && + !funcDecl.isMethod()) { funcScope = context.scopeChain.thisType.constructorScope; //locals; } else { @@ -702,7 +711,11 @@ var TypeScript; } context.typeFlow.checker.createFunctionSignature(funcDecl, container, funcScope, fgSym, fgSym == null); // it's a getter or setter for a class property - if (!funcDecl.accessorSymbol && (funcDecl.fncFlags & FncFlags.ClassMethod) && container && ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || (fgSym && fgSym.isAccessor())) { + if (!funcDecl.accessorSymbol && + (funcDecl.fncFlags & FncFlags.ClassMethod) && + container && + ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || + (fgSym && fgSym.isAccessor())) { funcDecl.accessorSymbol = context.typeFlow.checker.createAccessorSymbol(funcDecl, fgSym, container.getType(), (funcDecl.isMethod() && isStatic), true, funcScope, container); } funcDecl.type.symbol.flags |= SymbolFlags.TypeSetDuringScopeAssignment; diff --git a/tests/baselines/reference/parserReturnStatement4.js b/tests/baselines/reference/parserReturnStatement4.js index 3a993697cc6..f6800cbb8fd 100644 --- a/tests/baselines/reference/parserReturnStatement4.js +++ b/tests/baselines/reference/parserReturnStatement4.js @@ -2,6 +2,4 @@ var v = { get foo() { return } }; //// [parserReturnStatement4.js] -var v = { get foo() { - return; -} }; +var v = { get foo() { return; } }; diff --git a/tests/baselines/reference/parserSymbolIndexer1.errors.txt b/tests/baselines/reference/parserSymbolIndexer1.errors.txt new file mode 100644 index 00000000000..5c6c38d52b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.js b/tests/baselines/reference/parserSymbolIndexer1.js new file mode 100644 index 00000000000..752391dad53 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserSymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserSymbolIndexer1.js] diff --git a/tests/baselines/reference/parserSymbolIndexer2.errors.txt b/tests/baselines/reference/parserSymbolIndexer2.errors.txt new file mode 100644 index 00000000000..3961f4942de --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer2.js b/tests/baselines/reference/parserSymbolIndexer2.js new file mode 100644 index 00000000000..563614e1c8c --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserSymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt new file mode 100644 index 00000000000..5484a096d4c --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,13): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== + class C { + static [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer3.js b/tests/baselines/reference/parserSymbolIndexer3.js new file mode 100644 index 00000000000..917945193ae --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer3.ts] +class C { + static [s: symbol]: string; +} + +//// [parserSymbolIndexer3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer4.errors.txt b/tests/baselines/reference/parserSymbolIndexer4.errors.txt new file mode 100644 index 00000000000..1cf184a4847 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.js b/tests/baselines/reference/parserSymbolIndexer4.js new file mode 100644 index 00000000000..21367ca5969 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.js @@ -0,0 +1,7 @@ +//// [parserSymbolIndexer4.ts] +var x: { + [s: symbol]: string; +} + +//// [parserSymbolIndexer4.js] +var x; diff --git a/tests/baselines/reference/parserSymbolIndexer5.errors.txt b/tests/baselines/reference/parserSymbolIndexer5.errors.txt new file mode 100644 index 00000000000..a8c19338e01 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,6): error TS2304: Cannot find name 's'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,7): error TS1005: ']' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,9): error TS2304: Cannot find name 'symbol'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,15): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,16): error TS1136: Property assignment expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(3,1): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (6 errors) ==== + var x = { + [s: symbol]: "" + ~ +!!! error TS2304: Cannot find name 's'. + ~ +!!! error TS1005: ']' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'symbol'. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1136: Property assignment expected. + } + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer5.js b/tests/baselines/reference/parserSymbolIndexer5.js new file mode 100644 index 00000000000..3aa046e2114 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.js @@ -0,0 +1,9 @@ +//// [parserSymbolIndexer5.ts] +var x = { + [s: symbol]: "" +} + +//// [parserSymbolIndexer5.js] +var x = { + [s]: symbol, "": +}; diff --git a/tests/baselines/reference/parserSymbolProperty1.js b/tests/baselines/reference/parserSymbolProperty1.js new file mode 100644 index 00000000000..6bcede608fb --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserSymbolProperty1.js] diff --git a/tests/baselines/reference/parserSymbolProperty1.types b/tests/baselines/reference/parserSymbolProperty1.types new file mode 100644 index 00000000000..6c0cd75cf59 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts === +interface I { +>I : I + + [Symbol.iterator]: string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty2.js b/tests/baselines/reference/parserSymbolProperty2.js new file mode 100644 index 00000000000..6530072d46f --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty2.js] diff --git a/tests/baselines/reference/parserSymbolProperty2.types b/tests/baselines/reference/parserSymbolProperty2.types new file mode 100644 index 00000000000..bcf14b83a2a --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts === +interface I { +>I : I + + [Symbol.unscopables](): string; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty3.js b/tests/baselines/reference/parserSymbolProperty3.js new file mode 100644 index 00000000000..5b1b48254b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty3.js] diff --git a/tests/baselines/reference/parserSymbolProperty3.types b/tests/baselines/reference/parserSymbolProperty3.types new file mode 100644 index 00000000000..977375d7393 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts === +declare class C { +>C : C + + [Symbol.unscopables](): string; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty4.js b/tests/baselines/reference/parserSymbolProperty4.js new file mode 100644 index 00000000000..f79db0b1d79 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty4.js] diff --git a/tests/baselines/reference/parserSymbolProperty4.types b/tests/baselines/reference/parserSymbolProperty4.types new file mode 100644 index 00000000000..a9070897fa8 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts === +declare class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty5.js b/tests/baselines/reference/parserSymbolProperty5.js new file mode 100644 index 00000000000..922e1fb0323 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserSymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty5.types b/tests/baselines/reference/parserSymbolProperty5.types new file mode 100644 index 00000000000..8a171598e83 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts === +class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty6.js b/tests/baselines/reference/parserSymbolProperty6.js new file mode 100644 index 00000000000..cbc06cd2951 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserSymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty6.types b/tests/baselines/reference/parserSymbolProperty6.types new file mode 100644 index 00000000000..660cbf4e545 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts === +class C { +>C : C + + [Symbol.toStringTag]: string = ""; +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty7.js b/tests/baselines/reference/parserSymbolProperty7.js new file mode 100644 index 00000000000..9368fd12855 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserSymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty7.types b/tests/baselines/reference/parserSymbolProperty7.types new file mode 100644 index 00000000000..f8dc2523692 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts === +class C { +>C : C + + [Symbol.toStringTag](): void { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty8.js b/tests/baselines/reference/parserSymbolProperty8.js new file mode 100644 index 00000000000..f312ede6b1d --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserSymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty8.types b/tests/baselines/reference/parserSymbolProperty8.types new file mode 100644 index 00000000000..06387c9c231 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts === +var x: { +>x : { [Symbol.toPrimitive](): string; } + + [Symbol.toPrimitive](): string +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty9.js b/tests/baselines/reference/parserSymbolProperty9.js new file mode 100644 index 00000000000..6efc6650ea0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserSymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty9.types b/tests/baselines/reference/parserSymbolProperty9.types new file mode 100644 index 00000000000..40fbde2acff --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts === +var x: { +>x : { [Symbol.toPrimitive]: string; } + + [Symbol.toPrimitive]: string +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 7299abf6818..02304380013 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2627,9 +2627,7 @@ var Harness; var description = b.description + (prop ? ": " + prop : ''); emitLog('testStart', { desc: description }); emitLog('pass', { - desc: description, - pass: true, - perfResults: { + desc: description, pass: true, perfResults: { mean: b.results[prop].mean(), min: b.results[prop].min(), max: b.results[prop].max(), @@ -2694,18 +2692,10 @@ var Harness; this.fileCollection[s] = writer; return writer; }; - EmitterIOHost.prototype.directoryExists = function (s) { - return false; - }; - EmitterIOHost.prototype.fileExists = function (s) { - return typeof this.fileCollection[s] !== 'undefined'; - }; - EmitterIOHost.prototype.resolvePath = function (s) { - return s; - }; - EmitterIOHost.prototype.reset = function () { - this.fileCollection = {}; - }; + EmitterIOHost.prototype.directoryExists = function (s) { return false; }; + EmitterIOHost.prototype.fileExists = function (s) { return typeof this.fileCollection[s] !== 'undefined'; }; + EmitterIOHost.prototype.resolvePath = function (s) { return s; }; + EmitterIOHost.prototype.reset = function () { this.fileCollection = {}; }; EmitterIOHost.prototype.toArray = function () { var result = []; for (var p in this.fileCollection) { @@ -3511,21 +3501,11 @@ var Harness; ////////////////////////////////////////////////////////////////////// // ILogger implementation // - TypeScriptLS.prototype.information = function () { - return false; - }; - TypeScriptLS.prototype.debug = function () { - return true; - }; - TypeScriptLS.prototype.warning = function () { - return true; - }; - TypeScriptLS.prototype.error = function () { - return true; - }; - TypeScriptLS.prototype.fatal = function () { - return true; - }; + TypeScriptLS.prototype.information = function () { return false; }; + TypeScriptLS.prototype.debug = function () { return true; }; + TypeScriptLS.prototype.warning = function () { return true; }; + TypeScriptLS.prototype.error = function () { return true; }; + TypeScriptLS.prototype.fatal = function () { return true; }; TypeScriptLS.prototype.log = function (s) { // For debugging... //IO.printLine("TypeScriptLS:" + s); diff --git a/tests/baselines/reference/parserindenter.js b/tests/baselines/reference/parserindenter.js index 514a24afcf6..511e75ea135 100644 --- a/tests/baselines/reference/parserindenter.js +++ b/tests/baselines/reference/parserindenter.js @@ -778,7 +778,10 @@ var Formatting; } Indenter.prototype.GetIndentationEdits = function (token, nextToken, node, sameLineIndent) { if (this.logger.information()) { - this.logger.log("GetIndentationEdits(" + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + ")"); + this.logger.log("GetIndentationEdits(" + + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + + ")"); } var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent); if (this.logger.information()) { @@ -938,7 +941,8 @@ var Formatting; }; Indenter.prototype.GetSpecialCaseIndentationForLCurly = function (node) { var indentationInfo = null; - if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { + if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || + node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { // flushed with the node (function & if) indentationInfo = node.GetNodeStartLineIndentation(this); return indentationInfo; @@ -1233,7 +1237,8 @@ var Formatting; // Get the parent that is really on a different line from the self node var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); parent = tree.StartNodeSelf.Parent; - while (parent != null && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { + while (parent != null && + startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { parent = parent.Parent; } } @@ -1331,7 +1336,8 @@ var Formatting; } }; Indenter.prototype.IsMultiLineString = function (token) { - return token.tokenID === TypeScript.TokenID.StringLiteral && this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); + return token.tokenID === TypeScript.TokenID.StringLiteral && + this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); }; return Indenter; })(); diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.js b/tests/baselines/reference/plusOperatorWithBooleanType.js index 3de502f5ff6..5af1a8fb903 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.js +++ b/tests/baselines/reference/plusOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = +A.foo(); //// [plusOperatorWithBooleanType.js] // + operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/plusOperatorWithNumberType.js b/tests/baselines/reference/plusOperatorWithNumberType.js index fa993b80f87..a0adaa5dec2 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.js +++ b/tests/baselines/reference/plusOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = +(NUMBER + NUMBER); // + operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = +NUMBER1; // number type literal var ResultIsNumber3 = +1; var ResultIsNumber4 = +{ x: 1, y: 2 }; -var ResultIsNumber5 = +{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = +{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/plusOperatorWithStringType.js b/tests/baselines/reference/plusOperatorWithStringType.js index 93af186ce8f..ed2c60111b3 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.js +++ b/tests/baselines/reference/plusOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = +STRING.charAt(0); // + operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = +STRING1; // string type literal var ResultIsNumber3 = +""; var ResultIsNumber4 = +{ x: "", y: "" }; -var ResultIsNumber5 = +{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = +{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index f41d2a65bba..bf3f1a17105 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -65,8 +65,6 @@ var foo = (function (_super) { function foo() { _super.apply(this, arguments); } - foo.prototype.bar = function () { - return undefined; - }; + foo.prototype.bar = function () { return undefined; }; return foo; })(baz); diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js index 61d1a44b121..116b255a921 100644 --- a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 13849216ca0..5a36a9eae18 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,8 +11,9 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = { - [x]: string, - string: -}; +var x = (_a = {}, _a[x] = +string, _a.string = +, +_a); var y; +var _a; diff --git a/tests/baselines/reference/privateInstanceVisibility.js b/tests/baselines/reference/privateInstanceVisibility.js index e1ccb287515..b730a763e1e 100644 --- a/tests/baselines/reference/privateInstanceVisibility.js +++ b/tests/baselines/reference/privateInstanceVisibility.js @@ -57,9 +57,7 @@ var Test; var C = (function () { function C() { } - C.prototype.getX = function () { - return this.x; - }; + C.prototype.getX = function () { return this.x; }; C.prototype.clone = function (other) { this.x = other.x; }; diff --git a/tests/baselines/reference/privateVisibility.js b/tests/baselines/reference/privateVisibility.js index 9565b6fc25d..d70d7b4756f 100644 --- a/tests/baselines/reference/privateVisibility.js +++ b/tests/baselines/reference/privateVisibility.js @@ -32,9 +32,7 @@ var Foo = (function () { this.pubProp = 0; this.privProp = 0; } - Foo.prototype.pubMeth = function () { - this.privMeth(); - }; + Foo.prototype.pubMeth = function () { this.privMeth(); }; Foo.prototype.privMeth = function () { }; return Foo; })(); diff --git a/tests/baselines/reference/privateVisibles.js b/tests/baselines/reference/privateVisibles.js index c9206964f80..b2cb673c681 100644 --- a/tests/baselines/reference/privateVisibles.js +++ b/tests/baselines/reference/privateVisibles.js @@ -15,8 +15,6 @@ var Foo = (function () { this.pvar = 0; var n = this.pvar; } - Foo.prototype.meth = function () { - var q = this.pvar; - }; + Foo.prototype.meth = function () { var q = this.pvar; }; return Foo; })(); diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index 5cffcbec64c..d9cd90a48fc 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (4 errors) ==== @@ -88,7 +88,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature var ll = numIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using string value on type with string index signature and no numeric index signature var mm = strIndex['N']; @@ -127,7 +127,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using values of other types on type with no index signatures var uu = noIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using numeric value on type with numeric index signature and string index signature var vv = noIndex[32]; @@ -152,7 +152,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature var zzzz = bothIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x1 = numIndex[stringOrNumber]; var x1: any; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 81cdcec5434..88baee7752e 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -92,9 +92,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index eb3770bc0b3..941adc7ab43 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -67,9 +67,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 3a88ec832f7..fe3c9433796 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -54,9 +54,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 51850754a9a..47359caf9c2 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: Computed property names are not allowed in type literals. +tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. @@ -12,7 +12,7 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~~~~~ !!! error TS2304: Cannot find name 'index'. var bar2: { x : number; } diff --git a/tests/baselines/reference/propertyOrdering.js b/tests/baselines/reference/propertyOrdering.js index 1dc930f93a1..f0f4644a983 100644 --- a/tests/baselines/reference/propertyOrdering.js +++ b/tests/baselines/reference/propertyOrdering.js @@ -31,9 +31,7 @@ var Foo = (function () { Foo.prototype.foo = function () { return this._store.length; // shouldn't be an error }; - Foo.prototype.bar = function () { - return this.store; - }; // should be an error + Foo.prototype.bar = function () { return this.store; }; // should be an error return Foo; })(); var Bar = (function () { diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js index 992011ee4af..19ec9f50d27 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 381d10f43ea..28a1da5ffec 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -38,36 +38,20 @@ var C = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.x; - }; - C.prototype.bar = function () { - return this.foo(); - }; + C.prototype.foo = function () { return this.x; }; + C.prototype.bar = function () { return this.foo(); }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.x; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.x; }; + C.bar = function () { this.foo(); }; return C; })(B); diff --git a/tests/baselines/reference/qualifiedModuleLocals.js b/tests/baselines/reference/qualifiedModuleLocals.js index 45d61949c63..b7ba5b70e81 100644 --- a/tests/baselines/reference/qualifiedModuleLocals.js +++ b/tests/baselines/reference/qualifiedModuleLocals.js @@ -14,9 +14,7 @@ A.a(); var A; (function (A) { function b() { } - function a() { - A.b(); - } + function a() { A.b(); } A.a = a; // A.b should be an unresolved symbol error })(A || (A = {})); A.a(); diff --git a/tests/baselines/reference/quotedAccessorName1.js b/tests/baselines/reference/quotedAccessorName1.js index 93fd5b8dd6b..69e0fdb2c8e 100644 --- a/tests/baselines/reference/quotedAccessorName1.js +++ b/tests/baselines/reference/quotedAccessorName1.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/quotedAccessorName2.js b/tests/baselines/reference/quotedAccessorName2.js index 43041a29bf4..5d2d4861550 100644 --- a/tests/baselines/reference/quotedAccessorName2.js +++ b/tests/baselines/reference/quotedAccessorName2.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/rectype.js b/tests/baselines/reference/rectype.js index ed303b6b26e..15c5d9861f4 100644 --- a/tests/baselines/reference/rectype.js +++ b/tests/baselines/reference/rectype.js @@ -16,9 +16,7 @@ module M { //// [rectype.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } M.f = f; ; var i; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index 661ecb3a0e7..89fe29ee2ef 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -122,9 +122,7 @@ var Sample; var StartFindAction = (function () { function StartFindAction() { } - StartFindAction.prototype.getId = function () { - return "yo"; - }; + StartFindAction.prototype.getId = function () { return "yo"; }; StartFindAction.prototype.run = function (Thing) { return true; }; @@ -148,11 +146,9 @@ var Sample; // scenario 1 codeThing.addWidget("addWidget", this); } - FindWidget.prototype.gar = function (runner) { - if (true) { - return runner(this); - } - }; + FindWidget.prototype.gar = function (runner) { if (true) { + return runner(this); + } }; FindWidget.prototype.getDomNode = function () { return domNode; }; @@ -167,9 +163,7 @@ var Sample; var AbstractMode = (function () { function AbstractMode() { } - AbstractMode.prototype.getInitialState = function () { - return null; - }; + AbstractMode.prototype.getInitialState = function () { return null; }; return AbstractMode; })(); var Sample; @@ -190,9 +184,7 @@ var Sample; State.prototype.equals = function (other) { return this === other; }; - State.prototype.getMode = function () { - return mode; - }; + State.prototype.getMode = function () { return mode; }; return State; })(); PlainText.State = State; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index d2e66a925a8..a61032b3797 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,MAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA;wBAAiBE,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,WAAIA,KAAJA,WAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA;oBAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;wBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;oBAAAA,CAACA;gBAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA;QAAmCE,MAAMA,CAACA,IAAIA,CAACA;IAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA;wBAA0BI,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,MAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA,cAAiBE,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,WAAIA,KAAJA,WAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA,IAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;gBAAAA,CAACA,CAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA,cAAmCE,MAAMA,CAACA,IAAIA,CAACA,CAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA,cAA0BI,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index d7163bf7760..84ddc2befb3 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -240,7 +240,7 @@ sourceFile:recursiveClassReferenceTest.ts >>> } 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements Sample.Thing.IAction { > > public getId() { return "yo"; } @@ -254,61 +254,56 @@ sourceFile:recursiveClassReferenceTest.ts 1 >Emitted(19, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) 2 >Emitted(19, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) --- ->>> StartFindAction.prototype.getId = function () { +>>> StartFindAction.prototype.getId = function () { return "yo"; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getId 3 > +4 > public getId() { +5 > return +6 > +7 > "yo" +8 > ; +9 > +10> } 1->Emitted(20, 21) Source(35, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 2 >Emitted(20, 52) Source(35, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 3 >Emitted(20, 55) Source(35, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) ---- ->>> return "yo"; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getId() { -2 > return -3 > -4 > "yo" -5 > ; -1 >Emitted(21, 25) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(21, 31) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -3 >Emitted(21, 32) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -4 >Emitted(21, 36) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -5 >Emitted(21, 37) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(22, 21) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(22, 22) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +4 >Emitted(20, 69) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +5 >Emitted(20, 75) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +6 >Emitted(20, 76) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +7 >Emitted(20, 80) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +8 >Emitted(20, 81) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +9 >Emitted(20, 82) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +10>Emitted(20, 83) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) --- >>> StartFindAction.prototype.run = function (Thing) { -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^ -1-> +1 > > > public 2 > run 3 > 4 > public run( 5 > Thing:Sample.Thing.ICodeThing -1->Emitted(23, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(23, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(23, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -4 >Emitted(23, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -5 >Emitted(23, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1 >Emitted(21, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(21, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(21, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +4 >Emitted(21, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +5 >Emitted(21, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> return true; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -323,11 +318,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > true 5 > ; -1 >Emitted(24, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(24, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -3 >Emitted(24, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -4 >Emitted(24, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -5 >Emitted(24, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(22, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(22, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +3 >Emitted(22, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +4 >Emitted(22, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +5 >Emitted(22, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -336,8 +331,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(25, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(25, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(23, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(23, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> return StartFindAction; 1->^^^^^^^^^^^^^^^^^^^^ @@ -345,8 +340,8 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > 2 > } -1->Emitted(26, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(26, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1->Emitted(24, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(24, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -366,10 +361,10 @@ sourceFile:recursiveClassReferenceTest.ts > return true; > } > } -1 >Emitted(27, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(27, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(27, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(27, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1 >Emitted(25, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(25, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(25, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(25, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> Find.StartFindAction = StartFindAction; 1->^^^^^^^^^^^^^^^^ @@ -391,11 +386,11 @@ sourceFile:recursiveClassReferenceTest.ts > } > } 5 > -1->Emitted(28, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(28, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(28, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(28, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) -5 >Emitted(28, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1->Emitted(26, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(26, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(26, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(26, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +5 >Emitted(26, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> })(Find = _Thing.Find || (_Thing.Find = {})); 1->^^^^^^^^^^^^ @@ -428,15 +423,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(29, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(29, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(29, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -4 >Emitted(29, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -5 >Emitted(29, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -6 >Emitted(29, 34) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -7 >Emitted(29, 39) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -8 >Emitted(29, 50) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -9 >Emitted(29, 58) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +1->Emitted(27, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(27, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(27, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +4 >Emitted(27, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +5 >Emitted(27, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +6 >Emitted(27, 34) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +7 >Emitted(27, 39) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +8 >Emitted(27, 50) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +9 >Emitted(27, 58) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) --- >>> })(Thing = Actions.Thing || (Actions.Thing = {})); 1->^^^^^^^^ @@ -468,15 +463,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(30, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) -2 >Emitted(30, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) -3 >Emitted(30, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -4 >Emitted(30, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -5 >Emitted(30, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -6 >Emitted(30, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -7 >Emitted(30, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -8 >Emitted(30, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -9 >Emitted(30, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +1->Emitted(28, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) +2 >Emitted(28, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +3 >Emitted(28, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +4 >Emitted(28, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +5 >Emitted(28, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +6 >Emitted(28, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +7 >Emitted(28, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +8 >Emitted(28, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +9 >Emitted(28, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) --- >>> })(Actions = Sample.Actions || (Sample.Actions = {})); 1->^^^^ @@ -507,15 +502,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(31, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) -2 >Emitted(31, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) -3 >Emitted(31, 8) Source(32, 15) + SourceIndex(0) name (Sample) -4 >Emitted(31, 15) Source(32, 22) + SourceIndex(0) name (Sample) -5 >Emitted(31, 18) Source(32, 15) + SourceIndex(0) name (Sample) -6 >Emitted(31, 32) Source(32, 22) + SourceIndex(0) name (Sample) -7 >Emitted(31, 37) Source(32, 15) + SourceIndex(0) name (Sample) -8 >Emitted(31, 51) Source(32, 22) + SourceIndex(0) name (Sample) -9 >Emitted(31, 59) Source(42, 2) + SourceIndex(0) name (Sample) +1->Emitted(29, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) +2 >Emitted(29, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +3 >Emitted(29, 8) Source(32, 15) + SourceIndex(0) name (Sample) +4 >Emitted(29, 15) Source(32, 22) + SourceIndex(0) name (Sample) +5 >Emitted(29, 18) Source(32, 15) + SourceIndex(0) name (Sample) +6 >Emitted(29, 32) Source(32, 22) + SourceIndex(0) name (Sample) +7 >Emitted(29, 37) Source(32, 15) + SourceIndex(0) name (Sample) +8 >Emitted(29, 51) Source(32, 22) + SourceIndex(0) name (Sample) +9 >Emitted(29, 59) Source(42, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -542,13 +537,13 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(32, 1) Source(42, 1) + SourceIndex(0) name (Sample) -2 >Emitted(32, 2) Source(42, 2) + SourceIndex(0) name (Sample) -3 >Emitted(32, 4) Source(32, 8) + SourceIndex(0) -4 >Emitted(32, 10) Source(32, 14) + SourceIndex(0) -5 >Emitted(32, 15) Source(32, 8) + SourceIndex(0) -6 >Emitted(32, 21) Source(32, 14) + SourceIndex(0) -7 >Emitted(32, 29) Source(42, 2) + SourceIndex(0) +1 >Emitted(30, 1) Source(42, 1) + SourceIndex(0) name (Sample) +2 >Emitted(30, 2) Source(42, 2) + SourceIndex(0) name (Sample) +3 >Emitted(30, 4) Source(32, 8) + SourceIndex(0) +4 >Emitted(30, 10) Source(32, 14) + SourceIndex(0) +5 >Emitted(30, 15) Source(32, 8) + SourceIndex(0) +6 >Emitted(30, 21) Source(32, 14) + SourceIndex(0) +7 >Emitted(30, 29) Source(42, 2) + SourceIndex(0) --- >>>var Sample; 1 > @@ -582,10 +577,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(33, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(33, 5) Source(44, 8) + SourceIndex(0) -3 >Emitted(33, 11) Source(44, 14) + SourceIndex(0) -4 >Emitted(33, 12) Source(64, 2) + SourceIndex(0) +1 >Emitted(31, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(44, 8) + SourceIndex(0) +3 >Emitted(31, 11) Source(44, 14) + SourceIndex(0) +4 >Emitted(31, 12) Source(64, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -594,9 +589,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(34, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(34, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(34, 18) Source(44, 14) + SourceIndex(0) +1->Emitted(32, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(32, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(32, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -628,10 +623,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(35, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(35, 9) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(35, 14) Source(44, 20) + SourceIndex(0) name (Sample) -4 >Emitted(35, 15) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(33, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(33, 9) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(33, 14) Source(44, 20) + SourceIndex(0) name (Sample) +4 >Emitted(33, 15) Source(64, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -641,9 +636,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(36, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(36, 16) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(36, 21) Source(44, 20) + SourceIndex(0) name (Sample) +1->Emitted(34, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(34, 16) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(34, 21) Source(44, 20) + SourceIndex(0) name (Sample) --- >>> var Widgets; 1->^^^^^^^^ @@ -675,10 +670,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(37, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(37, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(37, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(37, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(35, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(35, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(35, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(35, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -692,11 +687,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > Widgets 4 > 5 > { -1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(38, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(38, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(38, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(38, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(36, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(36, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(36, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(36, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(36, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ @@ -707,9 +702,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > FindWidget -1->Emitted(39, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(39, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(39, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(37, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(37, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(37, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -733,11 +728,11 @@ sourceFile:recursiveClassReferenceTest.ts > private domNode:any = null; > constructor(private 5 > codeThing: Sample.Thing.ICodeThing -1->Emitted(40, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(40, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(40, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(40, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(40, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(38, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(38, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(38, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(38, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(38, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -750,11 +745,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(41, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(41, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(41, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(41, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(41, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(39, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(39, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(39, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(39, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(39, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -767,11 +762,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(42, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(42, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(42, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(42, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(42, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(40, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(40, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(40, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(40, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(40, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -784,9 +779,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > 3 > // scenario 1 -1 >Emitted(43, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(43, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(43, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(41, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(41, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(41, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -810,113 +805,108 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(44, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(44, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(44, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(44, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(44, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -6 >Emitted(44, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -7 >Emitted(44, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -8 >Emitted(44, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -9 >Emitted(44, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -10>Emitted(44, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(42, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(42, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(42, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(42, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(42, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +6 >Emitted(42, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +7 >Emitted(42, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +8 >Emitted(42, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +9 >Emitted(42, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +10>Emitted(42, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(45, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(45, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(43, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(43, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- ->>> FindWidget.prototype.gar = function (runner) { +>>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^^ +6 > ^^^^ +7 > ^^ +8 > ^ +9 > ^ +10> ^^^^ +11> ^ +12> ^ +13> ^ 1-> 2 > gar 3 > 4 > public gar( 5 > runner:(widget:Sample.Thing.IWidget)=>any -1->Emitted(46, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(46, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(46, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(46, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(46, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 > ) { +7 > if +8 > +9 > ( +10> true +11> ) +12> +13> { +1->Emitted(44, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(44, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(44, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(44, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(44, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 >Emitted(44, 64) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(44, 66) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(44, 67) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +9 >Emitted(44, 68) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +10>Emitted(44, 72) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +11>Emitted(44, 73) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +12>Emitted(44, 74) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +13>Emitted(44, 75) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> if (true) { +>>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^ -5 > ^^^^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^^^^^^^^^^^^-> -1 >) { -2 > if -3 > -4 > ( -5 > true -6 > ) -7 > -8 > { -1 >Emitted(47, 21) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(47, 23) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(47, 24) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(47, 25) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(47, 29) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(47, 30) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(47, 31) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(47, 32) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> return runner(this); -1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^ -1-> -2 > return -3 > -4 > runner -5 > ( -6 > this -7 > ) -8 > ; -1->Emitted(48, 25) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(48, 31) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(48, 32) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(48, 38) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(48, 39) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(48, 43) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(48, 44) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(48, 45) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> } -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^ 1 > -2 > } -1 >Emitted(49, 21) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(49, 22) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 > return +3 > +4 > runner +5 > ( +6 > this +7 > ) +8 > ; +1 >Emitted(45, 21) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(45, 27) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(45, 28) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(45, 34) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +5 >Emitted(45, 35) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +6 >Emitted(45, 39) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(45, 40) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(45, 41) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> }; +>>> } }; 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > } -1 >Emitted(50, 17) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(50, 18) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 > +4 > } +1 >Emitted(46, 17) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(46, 18) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(46, 19) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(46, 20) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -933,9 +923,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(51, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(51, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(51, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(47, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(47, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(47, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -949,11 +939,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(52, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(52, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -3 >Emitted(52, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -4 >Emitted(52, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -5 >Emitted(52, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(48, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(48, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +3 >Emitted(48, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +4 >Emitted(48, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +5 >Emitted(48, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -962,8 +952,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(53, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(53, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(49, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(49, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -974,9 +964,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(54, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(54, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(54, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(50, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(50, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(50, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -986,8 +976,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(55, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) -2 >Emitted(55, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -996,8 +986,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(56, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(56, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(52, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(52, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> })(); 1 >^^^^^^^^^^^^ @@ -1027,10 +1017,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(57, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(57, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(57, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(57, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1 >Emitted(53, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(53, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(53, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(53, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -1062,11 +1052,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(58, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(58, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(58, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(58, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) -5 >Emitted(58, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(54, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(54, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(54, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(54, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +5 >Emitted(54, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1108,15 +1098,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(59, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(59, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(59, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(59, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(59, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(59, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(59, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(59, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(59, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(55, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(55, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(55, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(55, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(55, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(55, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(55, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(55, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(55, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1157,15 +1147,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(60, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(60, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(60, 8) Source(44, 15) + SourceIndex(0) name (Sample) -4 >Emitted(60, 13) Source(44, 20) + SourceIndex(0) name (Sample) -5 >Emitted(60, 16) Source(44, 15) + SourceIndex(0) name (Sample) -6 >Emitted(60, 28) Source(44, 20) + SourceIndex(0) name (Sample) -7 >Emitted(60, 33) Source(44, 15) + SourceIndex(0) name (Sample) -8 >Emitted(60, 45) Source(44, 20) + SourceIndex(0) name (Sample) -9 >Emitted(60, 53) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(56, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(56, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(56, 8) Source(44, 15) + SourceIndex(0) name (Sample) +4 >Emitted(56, 13) Source(44, 20) + SourceIndex(0) name (Sample) +5 >Emitted(56, 16) Source(44, 15) + SourceIndex(0) name (Sample) +6 >Emitted(56, 28) Source(44, 20) + SourceIndex(0) name (Sample) +7 >Emitted(56, 33) Source(44, 15) + SourceIndex(0) name (Sample) +8 >Emitted(56, 45) Source(44, 20) + SourceIndex(0) name (Sample) +9 >Emitted(56, 53) Source(64, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -1203,13 +1193,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(61, 1) Source(64, 1) + SourceIndex(0) name (Sample) -2 >Emitted(61, 2) Source(64, 2) + SourceIndex(0) name (Sample) -3 >Emitted(61, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(61, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(61, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(61, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(61, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(57, 1) Source(64, 1) + SourceIndex(0) name (Sample) +2 >Emitted(57, 2) Source(64, 2) + SourceIndex(0) name (Sample) +3 >Emitted(57, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(57, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(57, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(57, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(57, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1222,9 +1212,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >class 3 > AbstractMode -1->Emitted(62, 1) Source(67, 1) + SourceIndex(0) -2 >Emitted(62, 5) Source(67, 7) + SourceIndex(0) -3 >Emitted(62, 17) Source(67, 19) + SourceIndex(0) +1->Emitted(58, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(58, 5) Source(67, 7) + SourceIndex(0) +3 >Emitted(58, 17) Source(67, 19) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ @@ -1233,63 +1223,58 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > class 3 > AbstractMode -1->Emitted(63, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) -2 >Emitted(63, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) -3 >Emitted(63, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) +1->Emitted(59, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) +2 >Emitted(59, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) +3 >Emitted(59, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) --- >>> } 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements IMode { public getInitialState(): IState { return null;} 2 > } -1 >Emitted(64, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) -2 >Emitted(64, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) +1 >Emitted(60, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) +2 >Emitted(60, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) --- ->>> AbstractMode.prototype.getInitialState = function () { +>>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getInitialState 3 > -1->Emitted(65, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) -2 >Emitted(65, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) -3 >Emitted(65, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) ---- ->>> return null; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getInitialState(): IState { -2 > return -3 > -4 > null -5 > ; -1 >Emitted(66, 9) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(66, 15) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) -3 >Emitted(66, 16) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) -4 >Emitted(66, 20) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) -5 >Emitted(66, 21) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(67, 5) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(67, 6) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) +4 > public getInitialState(): IState { +5 > return +6 > +7 > null +8 > ; +9 > +10> } +1->Emitted(61, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) +2 >Emitted(61, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) +3 >Emitted(61, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) +4 >Emitted(61, 60) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) +5 >Emitted(61, 66) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) +6 >Emitted(61, 67) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) +7 >Emitted(61, 71) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) +8 >Emitted(61, 72) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +9 >Emitted(61, 73) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +10>Emitted(61, 74) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) --- >>> return AbstractMode; -1->^^^^ +1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ -1-> +1 > 2 > } -1->Emitted(68, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(68, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) +1 >Emitted(62, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(62, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) --- >>>})(); 1 > @@ -1301,10 +1286,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(69, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(69, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) -3 >Emitted(69, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(69, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(63, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(63, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) +3 >Emitted(63, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(63, 6) Source(67, 89) + SourceIndex(0) --- >>>var Sample; 1-> @@ -1349,10 +1334,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(70, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(70, 5) Source(76, 8) + SourceIndex(0) -3 >Emitted(70, 11) Source(76, 14) + SourceIndex(0) -4 >Emitted(70, 12) Source(100, 2) + SourceIndex(0) +1->Emitted(64, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(64, 5) Source(76, 8) + SourceIndex(0) +3 >Emitted(64, 11) Source(76, 14) + SourceIndex(0) +4 >Emitted(64, 12) Source(100, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -1361,9 +1346,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(71, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(71, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(71, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(65, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(65, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(65, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1399,10 +1384,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(72, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(72, 9) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(72, 14) Source(76, 20) + SourceIndex(0) name (Sample) -4 >Emitted(72, 15) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(66, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(66, 9) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(66, 14) Source(76, 20) + SourceIndex(0) name (Sample) +4 >Emitted(66, 15) Source(100, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -1412,9 +1397,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(73, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(73, 16) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(73, 21) Source(76, 20) + SourceIndex(0) name (Sample) +1->Emitted(67, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(67, 16) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(67, 21) Source(76, 20) + SourceIndex(0) name (Sample) --- >>> var Languages; 1->^^^^^^^^ @@ -1450,10 +1435,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(74, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(74, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(74, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(74, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(68, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(68, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(68, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(68, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1462,9 +1447,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(75, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(75, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(75, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(69, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(69, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(69, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1500,10 +1485,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(76, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(76, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(76, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(76, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1 >Emitted(70, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(70, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(70, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(70, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1517,11 +1502,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > PlainText 4 > 5 > { -1->Emitted(77, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(77, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(77, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(77, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(77, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(71, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(71, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(71, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(71, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(71, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1533,9 +1518,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > State -1->Emitted(78, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(78, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(78, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(72, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(72, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(72, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1551,11 +1536,11 @@ sourceFile:recursiveClassReferenceTest.ts 4 > implements IState { > constructor(private 5 > mode: IMode -1->Emitted(79, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(79, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(79, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(79, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(79, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(73, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(73, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(73, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(73, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(73, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1568,11 +1553,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(80, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(80, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -3 >Emitted(80, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -4 >Emitted(80, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -5 >Emitted(80, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1->Emitted(74, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(74, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +3 >Emitted(74, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +4 >Emitted(74, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +5 >Emitted(74, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1580,8 +1565,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(81, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(81, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1 >Emitted(75, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(75, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1591,9 +1576,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(82, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(82, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(82, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(76, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(76, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(76, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1607,11 +1592,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(83, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(83, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -3 >Emitted(83, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -4 >Emitted(83, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -5 >Emitted(83, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(77, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(77, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +3 >Emitted(77, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +4 >Emitted(77, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +5 >Emitted(77, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1620,8 +1605,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(84, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(84, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(78, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(78, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1636,11 +1621,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(85, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(85, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(85, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(85, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(85, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(79, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(79, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(79, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(79, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(79, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1658,71 +1643,66 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(86, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(86, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -3 >Emitted(86, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -4 >Emitted(86, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -5 >Emitted(86, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -6 >Emitted(86, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -7 >Emitted(86, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(80, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(80, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +3 >Emitted(80, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +4 >Emitted(80, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +5 >Emitted(80, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +6 >Emitted(80, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +7 >Emitted(80, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(87, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(87, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(81, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(81, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- ->>> State.prototype.getMode = function () { +>>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> > > public 2 > getMode 3 > -1->Emitted(88, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(88, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(88, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) ---- ->>> return mode; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getMode(): IMode { -2 > return -3 > -4 > mode -5 > ; -1 >Emitted(89, 25) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(89, 31) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -3 >Emitted(89, 32) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -4 >Emitted(89, 36) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -5 >Emitted(89, 37) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(90, 21) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(90, 22) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +4 > public getMode(): IMode { +5 > return +6 > +7 > mode +8 > ; +9 > +10> } +1->Emitted(82, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(82, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(82, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(82, 61) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +5 >Emitted(82, 67) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +6 >Emitted(82, 68) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +7 >Emitted(82, 72) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +8 >Emitted(82, 73) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +9 >Emitted(82, 74) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +10>Emitted(82, 75) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) --- >>> return State; -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^ -1-> +1 > > 2 > } -1->Emitted(91, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(91, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1 >Emitted(83, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(83, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -1745,10 +1725,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(92, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(92, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(92, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(92, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1 >Emitted(84, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(84, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(84, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(84, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1773,11 +1753,11 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 5 > -1->Emitted(93, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(93, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(93, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(93, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(93, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(85, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(85, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(85, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(85, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(85, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1789,9 +1769,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > Mode -1->Emitted(94, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(94, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(94, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(86, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(86, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(86, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ @@ -1802,10 +1782,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > 3 > Mode 4 > extends AbstractMode -1->Emitted(95, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(95, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(95, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -4 >Emitted(95, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(87, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(87, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(87, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +4 >Emitted(87, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1815,17 +1795,17 @@ sourceFile:recursiveClassReferenceTest.ts 1 > 2 > export class 3 > Mode -1 >Emitted(96, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(96, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(96, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1 >Emitted(88, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(88, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(88, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> _super.apply(this, arguments); 1->^^^^^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> extends 2 > AbstractMode -1->Emitted(97, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(97, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1->Emitted(89, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(89, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1841,8 +1821,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(98, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(98, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1 >Emitted(90, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(90, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1850,8 +1830,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(99, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(99, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(91, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(91, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1861,9 +1841,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(100, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(100, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(100, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(92, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(92, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(92, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1885,15 +1865,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(101, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(101, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -3 >Emitted(101, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -4 >Emitted(101, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -5 >Emitted(101, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -6 >Emitted(101, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -7 >Emitted(101, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -8 >Emitted(101, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -9 >Emitted(101, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(93, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(93, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +3 >Emitted(93, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +4 >Emitted(93, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +5 >Emitted(93, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +6 >Emitted(93, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +7 >Emitted(93, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +8 >Emitted(93, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +9 >Emitted(93, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1902,8 +1882,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(102, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(102, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(94, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(94, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1914,8 +1894,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(103, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(103, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(95, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(95, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> })(AbstractMode); 1->^^^^^^^^^^^^^^^^ @@ -1939,12 +1919,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(104, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(104, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(104, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(104, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(104, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -6 >Emitted(104, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(96, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(96, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(96, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(96, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(96, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +6 >Emitted(96, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1966,11 +1946,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(105, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(105, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(105, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(105, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(105, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(97, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(97, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(97, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(97, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(97, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -2016,15 +1996,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(106, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(106, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(106, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(106, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(106, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -6 >Emitted(106, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -7 >Emitted(106, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -8 >Emitted(106, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -9 >Emitted(106, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(98, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(98, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(98, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(98, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(98, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +6 >Emitted(98, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +7 >Emitted(98, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +8 >Emitted(98, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +9 >Emitted(98, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -2069,15 +2049,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(107, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(107, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(107, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(107, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(107, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(107, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(107, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(107, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(107, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1 >Emitted(99, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(99, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(99, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(99, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(99, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(99, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(99, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(99, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(99, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -2122,15 +2102,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(108, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(108, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(108, 8) Source(76, 15) + SourceIndex(0) name (Sample) -4 >Emitted(108, 13) Source(76, 20) + SourceIndex(0) name (Sample) -5 >Emitted(108, 16) Source(76, 15) + SourceIndex(0) name (Sample) -6 >Emitted(108, 28) Source(76, 20) + SourceIndex(0) name (Sample) -7 >Emitted(108, 33) Source(76, 15) + SourceIndex(0) name (Sample) -8 >Emitted(108, 45) Source(76, 20) + SourceIndex(0) name (Sample) -9 >Emitted(108, 53) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(100, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(100, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(100, 8) Source(76, 15) + SourceIndex(0) name (Sample) +4 >Emitted(100, 13) Source(76, 20) + SourceIndex(0) name (Sample) +5 >Emitted(100, 16) Source(76, 15) + SourceIndex(0) name (Sample) +6 >Emitted(100, 28) Source(76, 20) + SourceIndex(0) name (Sample) +7 >Emitted(100, 33) Source(76, 15) + SourceIndex(0) name (Sample) +8 >Emitted(100, 45) Source(76, 20) + SourceIndex(0) name (Sample) +9 >Emitted(100, 53) Source(100, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -2172,12 +2152,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(109, 1) Source(100, 1) + SourceIndex(0) name (Sample) -2 >Emitted(109, 2) Source(100, 2) + SourceIndex(0) name (Sample) -3 >Emitted(109, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(109, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(109, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(109, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(109, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(101, 1) Source(100, 1) + SourceIndex(0) name (Sample) +2 >Emitted(101, 2) Source(100, 2) + SourceIndex(0) name (Sample) +3 >Emitted(101, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(101, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(101, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(101, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(101, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveFunctionTypes.js b/tests/baselines/reference/recursiveFunctionTypes.js index 1158fb539d0..040c323066d 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.js +++ b/tests/baselines/reference/recursiveFunctionTypes.js @@ -45,9 +45,7 @@ f7(""); // ok (function takes an any param) f7(); // ok //// [recursiveFunctionTypes.js] -function fn() { - return 1; -} +function fn() { return 1; } var x = fn; // error var y = fn; // ok var f; @@ -55,9 +53,7 @@ var g; function f1(d) { } function f2() { } function g2() { } -function f3() { - return f3; -} +function f3() { return f3; } var a = f3; // error var C = (function () { function C() { @@ -68,12 +64,8 @@ var C = (function () { C.g(3); // error var f4; f4 = 3; // error -function f5() { - return f5; -} -function f6(a) { - return f6; -} +function f5() { return f5; } +function f6(a) { return f6; } f6("", 3); // error (arity mismatch) f6(""); // ok (function takes an any param) f6(); // ok diff --git a/tests/baselines/reference/recursiveGetterAccess.js b/tests/baselines/reference/recursiveGetterAccess.js index cf042c2c1a0..1dea2e02d3a 100644 --- a/tests/baselines/reference/recursiveGetterAccess.js +++ b/tests/baselines/reference/recursiveGetterAccess.js @@ -10,9 +10,7 @@ var MyClass = (function () { function MyClass() { } Object.defineProperty(MyClass.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js index e1ea203ac5b..3c53c2b2a0a 100644 --- a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js +++ b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js @@ -20,9 +20,7 @@ module M { //// [recursiveIdenticalOverloadResolution.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } ; var i; f(i); diff --git a/tests/baselines/reference/recursiveInference1.js b/tests/baselines/reference/recursiveInference1.js index 839e13130f2..3a26ead542d 100644 --- a/tests/baselines/reference/recursiveInference1.js +++ b/tests/baselines/reference/recursiveInference1.js @@ -3,7 +3,5 @@ function fib(x:number) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); //// [recursiveInference1.js] -function fib(x) { - return x <= 1 ? x : fib(x - 1) + fib(x - 2); -} +function fib(x) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); diff --git a/tests/baselines/reference/recursiveInferenceBug.js b/tests/baselines/reference/recursiveInferenceBug.js index ff9b1c31434..5b4d4f0c0a1 100644 --- a/tests/baselines/reference/recursiveInferenceBug.js +++ b/tests/baselines/reference/recursiveInferenceBug.js @@ -18,7 +18,5 @@ function f(x) { } var zz = { g: function () { }, - get f() { - return "abc"; - } + get f() { return "abc"; } }; diff --git a/tests/baselines/reference/recursiveInheritance3.js b/tests/baselines/reference/recursiveInheritance3.js index 710b691fa94..bc9fb6cb4f9 100644 --- a/tests/baselines/reference/recursiveInheritance3.js +++ b/tests/baselines/reference/recursiveInheritance3.js @@ -13,8 +13,6 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); diff --git a/tests/baselines/reference/recursiveProperties.js b/tests/baselines/reference/recursiveProperties.js index 63644484956..84d9ebcd27c 100644 --- a/tests/baselines/reference/recursiveProperties.js +++ b/tests/baselines/reference/recursiveProperties.js @@ -12,9 +12,7 @@ var A = (function () { function A() { } Object.defineProperty(A.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); @@ -24,9 +22,7 @@ var B = (function () { function B() { } Object.defineProperty(B.prototype, "testProp", { - set: function (value) { - this.testProp = value; - }, + set: function (value) { this.testProp = value; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveReturns.js b/tests/baselines/reference/recursiveReturns.js index d01825f8cbf..18c9ed4dd7c 100644 --- a/tests/baselines/reference/recursiveReturns.js +++ b/tests/baselines/reference/recursiveReturns.js @@ -20,9 +20,7 @@ function R1() { R1(); return; } -function R2() { - R2(); -} +function R2() { R2(); } function R3(n) { if (n == 0) { } diff --git a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js index 0d972d3e86c..0cef9be47ab 100644 --- a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js +++ b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js @@ -61,9 +61,7 @@ function foo2(x) { function other() { function foo3(x) { } function foo4(x) { } - function foo5(x) { - return null; - } + function foo5(x) { return null; } var list; var myList; var r = foo5(list); diff --git a/tests/baselines/reference/redefineArray.js b/tests/baselines/reference/redefineArray.js index 93494232436..080d2b1a2d2 100644 --- a/tests/baselines/reference/redefineArray.js +++ b/tests/baselines/reference/redefineArray.js @@ -2,6 +2,4 @@ Array = function (n:number, s:string) {return n;}; //// [redefineArray.js] -Array = function (n, s) { - return n; -}; +Array = function (n, s) { return n; }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 608090e8722..24f0e7f1bcb 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1036,41 +1036,31 @@ var rionegrensis; caniventer.prototype.salomonseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.uchidai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.raffrayana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.Uranium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.nayaur = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return caniventer; @@ -1084,41 +1074,31 @@ var rionegrensis; veraecrucis.prototype.naso = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.vancouverensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.africana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.palliolata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.nivicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return veraecrucis; @@ -1139,41 +1119,31 @@ var julianae; nudicaudus.prototype.brandtii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.maxwellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.endoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.venezuelae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.zamicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nudicaudus; @@ -1185,57 +1155,43 @@ var julianae; galapagoensis.prototype.isabellae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rueppellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.peregusna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.gliroides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.banakrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rozendaali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.stuhlmanni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return galapagoensis; @@ -1247,57 +1203,43 @@ var julianae; albidens.prototype.mattheyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.Astatine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.vincenti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.hirta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.virginianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.macrophyllum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.porcellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return albidens; @@ -1311,105 +1253,79 @@ var julianae; oralis.prototype.cepapi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.porteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.bindi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.puda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.mindorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ignitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.rufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.monax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.unalascensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.wuchihensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.leucippe = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ordii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.eisentrauti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oralis; @@ -1423,57 +1339,43 @@ var julianae; sumatrana.prototype.wolffsohni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.geata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.awashensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.sturdeei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.pachyurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.lyelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.neohibernicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sumatrana; @@ -1485,89 +1387,67 @@ var julianae; gerbillus.prototype.pundti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.tristrami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.swarthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.horsfieldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.diazi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.rennelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.maulinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.muscina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.pelengensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.abramus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.reevesi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gerbillus; @@ -1579,97 +1459,73 @@ var julianae; acariensis.prototype.levicula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.minous = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.cinereiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.longicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.baeodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.soricoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.datae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.spixii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.anakuma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.kihaulei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.gymnura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.olchonensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return acariensis; @@ -1683,25 +1539,19 @@ var julianae; durangae.prototype.Californium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.Flerovium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.phrudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return durangae; @@ -1716,17 +1566,13 @@ var ruatanica; hector.prototype.humulis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; hector.prototype.eurycerus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return hector; @@ -1741,25 +1587,19 @@ var Lanthanum; suillus.prototype.spilosoma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.tumbalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.anatolicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return suillus; @@ -1773,81 +1613,61 @@ var Lanthanum; nitidus.prototype.granatensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.negligens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.lewisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.arge = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.dominicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.taurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.tonganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.silvatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.midas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.bicornis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nitidus; @@ -1861,65 +1681,49 @@ var Lanthanum; megalonyx.prototype.phillipsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.melanogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.ourebi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.caraccioli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.parva = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.albipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megalonyx; @@ -1931,113 +1735,85 @@ var Lanthanum; jugularis.prototype.torrei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.revoili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.macrobullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.compactus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.talpinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.stramineus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.dartmouthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ogilbyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.incomtus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.surdaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.melanorhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.picticaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.pomona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ileile = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return jugularis; @@ -2054,113 +1830,85 @@ var rendalli; zuluensis.prototype.telfairi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.keyensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.occasius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.damarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.Neptunium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.griseoflavus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.thar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.alborufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.fusicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.gordonorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.ruber = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.desmarestianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.lutillus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.salocco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return zuluensis; @@ -2172,81 +1920,61 @@ var rendalli; moojeni.prototype.floweri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.montosa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.miletus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.heaneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.marchei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.budini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.maggietaylorae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.poliocephalus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.zibethicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.biacensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return moojeni; @@ -2260,25 +1988,19 @@ var rendalli; crenulata.prototype.salvanius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.maritimus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.edax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return crenulata; @@ -2293,65 +2015,49 @@ var trivirgatus; tumidifrons.prototype.nivalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vestitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.aequatorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.scherman = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.improvisum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.cervinipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.audax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vallinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return tumidifrons; @@ -2365,57 +2071,43 @@ var trivirgatus; mixtus.prototype.ochrogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.bryophilus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.liechtensteini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.crawfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.hypsibia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.matacus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.demidoff = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mixtus; @@ -2427,17 +2119,13 @@ var trivirgatus; lotor.prototype.balensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lotor.prototype.pullata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lotor; @@ -2449,57 +2137,43 @@ var trivirgatus; falconeri.prototype.cabrali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gouldi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.fuscicollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.martiensseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gaoligongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.shawi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gmelini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return falconeri; @@ -2511,113 +2185,85 @@ var trivirgatus; oconnelli.prototype.youngsoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.terrestris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.chrysopus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.fuscomurina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.hellwaldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.aenea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.perrini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.entellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.krebsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.cephalotes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.molossinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.luisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ceylonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ralli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oconnelli; @@ -2632,33 +2278,25 @@ var quasiater; bobrinskoi.prototype.crassicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.mulatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.ansorgei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.Copper = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return bobrinskoi; @@ -2675,33 +2313,25 @@ var ruatanica; americanus.prototype.nasoloi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.mystacalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.fardoulisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.tumidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return americanus; @@ -2718,105 +2348,79 @@ var lavali; wilsoni.prototype.setiger = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.lorentzii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.antisensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.blossevillii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.bontanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.caligata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.franqueti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.roberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.degelidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.amoenus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.kob = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.csorbai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.dorsata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wilsoni; @@ -2836,105 +2440,79 @@ var lavali; otion.prototype.bonaerensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.dussumieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.osvaldoreigi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.grevyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.hirtula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.cristatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.darlingtoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.fontanierii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.umbrosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.chiriquinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.orarius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.ilaeus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.musschenbroekii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return otion; @@ -2946,97 +2524,73 @@ var lavali; xanthognathus.prototype.nanulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.albigena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.onca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.gunnii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.apeco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.variegates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.goudotii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.pohlei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.ineptus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.euryotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.maurisca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.coyhaiquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return xanthognathus; @@ -3050,65 +2604,49 @@ var lavali; thaeleri.prototype.coromandra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.parvipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.sponsorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.vates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.roosmalenorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.rubicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.ikonnikovi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.paramicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thaeleri; @@ -3122,17 +2660,13 @@ var lavali; lepturus.prototype.ferrumequinum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lepturus.prototype.aequalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lepturus; @@ -3149,73 +2683,55 @@ var dogramacii; robustulus.prototype.fossor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.humboldti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.mexicana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.martini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.beatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.leporina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.pearsonii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.keaysi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.hindei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return robustulus; @@ -3227,9 +2743,7 @@ var dogramacii; koepckeae.prototype.culturatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return koepckeae; @@ -3241,105 +2755,79 @@ var dogramacii; kaiseri.prototype.bedfordiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.paramorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.rubidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.juninensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.marginata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Meitnerium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.pinetorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.hoolock = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.poeyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Thulium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.patrius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.quadraticauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.ater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return kaiseri; @@ -3351,65 +2839,49 @@ var dogramacii; aurata.prototype.grunniens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.howensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.karlkoopmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.mirapitanga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.ophiodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.landeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.sonomae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.erythromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return aurata; @@ -3426,113 +2898,85 @@ var lutreolus; schlegeli.prototype.mittendorfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.blicki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.culionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.scrofa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.fernandoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.Tin = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.marmorata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.tavaratra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.peregrina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.frontalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.cuniculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.magdalenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.andamanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.dispar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return schlegeli; @@ -3547,89 +2991,67 @@ var argurus; dauricus.prototype.chinensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.duodecimcostatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.foxi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.macleayii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.darienensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.hardwickii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.albifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.jacobitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.guentheri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.mahomet = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.misionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dauricus; @@ -3644,65 +3066,49 @@ var nigra; dolichurus.prototype.solomonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.alfredi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.morrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.lekaguli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.dimissus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.phaeotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.ustus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.sagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dolichurus; @@ -3719,49 +3125,37 @@ var panglima; amphibius.prototype.bottegi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.jerdoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.camtschatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.spadix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.luismanueli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.aceramarcae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amphibius; @@ -3775,25 +3169,19 @@ var panglima; fundatus.prototype.crassulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.flamarioni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.mirabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fundatus; @@ -3807,41 +3195,31 @@ var panglima; abidi.prototype.greyii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.macedonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.galili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.thierryi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.ega = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return abidi; @@ -3856,57 +3234,43 @@ var quasiater; carolinensis.prototype.concinna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aeneus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aloysiisabaudiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.tenellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.andium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.persephone = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.patrizii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return carolinensis; @@ -3923,97 +3287,73 @@ var minutus; himalayana.prototype.simoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.lobata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.rusticus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.latona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.famulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.flaviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.paradoxolophus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.Osmium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vulgaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.betsileoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vespuccii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.olympus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return himalayana; @@ -4030,65 +3370,49 @@ var caurinus; mahaganus.prototype.martiniquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.devius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.masalai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.kathleenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.simulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.nigrovittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.senegalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.acticola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mahaganus; @@ -4103,9 +3427,7 @@ var macrorhinos; marmosurus.prototype.tansaniana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marmosurus; @@ -4122,9 +3444,7 @@ var howi; angulatus.prototype.pennatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return angulatus; @@ -4148,65 +3468,49 @@ var nigra; thalia.prototype.dichotomus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.arnuxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.verheyeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.dauuricus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.tristriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.lasiura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.gangetica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.brucei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thalia; @@ -4223,9 +3527,7 @@ var sagitta; walkeri.prototype.maracajuensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return walkeri; @@ -4242,9 +3544,7 @@ var minutus; inez.prototype.vexillaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return inez; @@ -4272,73 +3572,55 @@ var panamensis; linulus.prototype.goslingi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.taki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.fumosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.rufinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.lami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.regina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.nanilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.enganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.gomantongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return linulus; @@ -4353,105 +3635,79 @@ var nigra; gracilis.prototype.weddellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.echinothrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.garridoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.rouxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.aurita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.geoffrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.theresa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.melanocarpus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.dubiaquercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.pectoralis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.apoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.grisescens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.ramirohitra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gracilis; @@ -4468,105 +3724,79 @@ var samarensis; pelurus.prototype.Palladium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.castanea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chamek = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nigriceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.lunatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.madurae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chinchilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.eliasi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.proditor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.gambianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.petteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nusatenggara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.olitor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pelurus; @@ -4580,113 +3810,85 @@ var samarensis; fuscus.prototype.planifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.badia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.prymnolopha = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.natalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.hunteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.sapiens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.macrocercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.nimbae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.suricatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.jagorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.beecrofti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.imaizumii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.colocolo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.wolfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fuscus; @@ -4698,33 +3900,25 @@ var samarensis; pallidus.prototype.oblativa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.watersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.glacialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.viaria = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pallidus; @@ -4736,41 +3930,31 @@ var samarensis; cahirinus.prototype.alashanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.flaviventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.bottai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.pinetis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.saussurei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cahirinus; @@ -4787,41 +3971,31 @@ var sagitta; leptoceros.prototype.victus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.hoplomyoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.gratiosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.rex = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.bolami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return leptoceros; @@ -4838,9 +4012,7 @@ var daubentonii; nigricans.prototype.woosnami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nigricans; @@ -4866,25 +4038,19 @@ var argurus; pygmaea.prototype.pajeros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.capucinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.cuvieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pygmaea; @@ -4901,57 +4067,43 @@ var chrysaeolus; sarasinorum.prototype.belzebul = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.hinpoon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.kandti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.cynosuros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Germanium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Ununoctium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.princeps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sarasinorum; @@ -4966,57 +4118,43 @@ var argurus; wetmorei.prototype.leucoptera = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.ochraventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.tephromelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.cracens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.jamaicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.gymnocaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.mayori = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wetmorei; @@ -5033,65 +4171,49 @@ var argurus; oreas.prototype.salamonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.paniscus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.fagani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.papuanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.timidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.nghetinhensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.barbei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.univittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oreas; @@ -5106,97 +4228,73 @@ var daubentonii; arboreus.prototype.capreolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.moreni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.hypoleucos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.paedulcus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.pucheranii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.stella = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brasiliensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brevicaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.vitticollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.huangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.cameroni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.tianshanica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return arboreus; @@ -5211,105 +4309,79 @@ var patas; uralensis.prototype.cartilagonodus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.pyrrhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.insulans = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.nigricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.muricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.fallax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.attenuata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.megalura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.neblina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.citellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.tanezumi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return uralensis; @@ -5326,17 +4398,13 @@ var provocax; melanoleuca.prototype.Neodymium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanoleuca.prototype.baeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanoleuca; @@ -5351,17 +4419,13 @@ var sagitta; sicarius.prototype.Chlorine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sicarius.prototype.simulator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sicarius; @@ -5378,113 +4442,85 @@ var howi; marcanoi.prototype.formosae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.dudui = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.leander = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.martinsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.beatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.griseoventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.zerda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.yucatanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.nigrita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.jouvenetae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.indefessus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.vuquangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.Zirconium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.hyaena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marcanoi; @@ -5499,97 +4535,73 @@ var argurus; gilbertii.prototype.nasutus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.poecilops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.sondaicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.auriventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.cherriei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.lindberghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.pipistrellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.paranus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.dubosti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.opossum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.oreopolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.amurensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gilbertii; @@ -5613,105 +4625,79 @@ var lutreolus; punicus.prototype.strandi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.erica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.trichura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lemniscatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.aspalax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.marshalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Zinc = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.monochromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.purinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.ischyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.tenuis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Helium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return punicus; @@ -5726,49 +4712,37 @@ var macrorhinos; daphaenodon.prototype.bredanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.othus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.hammondi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.aureocollaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.flavipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.callosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return daphaenodon; @@ -5783,97 +4757,73 @@ var sagitta; cinereus.prototype.zunigae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.microps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.guaporensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.tonkeana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.montensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sphinx = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.glis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.dorsalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.fimbriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.epimelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.pittieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cinereus; @@ -5905,81 +4855,61 @@ var gabriellae; amicus.prototype.pirrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.phaeura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.voratus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.satarae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.hooperi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.perrensi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.ridei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.audeberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.Lutetium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.atrox = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amicus; @@ -5991,9 +4921,7 @@ var gabriellae; echinatus.prototype.tenuipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return echinatus; @@ -6008,49 +4936,37 @@ var imperfecta; lasiurus.prototype.marisae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.fulvus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.paranaensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.didactylus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.schreibersii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.orii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lasiurus; @@ -6062,89 +4978,67 @@ var imperfecta; subspinosus.prototype.monticularis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Gadolinium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.oasicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.paterculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.punctata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.invictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.stangeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.siskiyou = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.welwitschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Polonium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.harpia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return subspinosus; @@ -6158,25 +5052,19 @@ var imperfecta; ciliolabrum.prototype.leschenaultii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.ludia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.sinicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return ciliolabrum; @@ -6191,33 +5079,25 @@ var quasiater; wattsi.prototype.lagotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.hussoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.bilarni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.cabrerae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wattsi; @@ -6234,73 +5114,55 @@ var petrophilus; sodyi.prototype.saundersiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.imberbis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.cansdalei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.Lawrencium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.catta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.breviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.transitionalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.heptneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.bairdii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sodyi; @@ -6317,65 +5179,49 @@ var caurinus; megaphyllus.prototype.montana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.amatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.bucculentus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.lepida = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.graecus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.forsteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.perotensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.cirrhosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megaphyllus; @@ -6390,25 +5236,19 @@ var minutus; portoricensis.prototype.relictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.aequatorianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.rhinogradoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return portoricensis; @@ -6423,105 +5263,79 @@ var lutreolus; foina.prototype.tarfayensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.Promethium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.salinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.kerri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.scotti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.camerunensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.affinis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.siebersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.maquassiensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.layardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.bishopi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.apodemoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.argentiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return foina; @@ -6538,81 +5352,61 @@ var lutreolus; cor.prototype.antinorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.voi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mussoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.truncatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.achates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.praedatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mzabi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.xanthinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.tapoatafa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.castroviejoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cor; @@ -6627,17 +5421,13 @@ var howi; coludo.prototype.bernhardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; coludo.prototype.isseli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return coludo; @@ -6654,17 +5444,13 @@ var argurus; germaini.prototype.sharpei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; germaini.prototype.palmarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return germaini; @@ -6679,89 +5465,67 @@ var sagitta; stolzmanni.prototype.riparius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.dhofarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.tricolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.gardneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.walleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.talpoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.pallipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.lagurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.hipposideros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.griselda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.florium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return stolzmanni; @@ -6778,105 +5542,79 @@ var dammermani; melanops.prototype.blarina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.harwoodi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.ashaninka = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.wiedii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.godmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.condorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.xerophila = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.laminatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.archeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.hidalgo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.unicolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.philippii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.bocagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanops; @@ -6893,65 +5631,49 @@ var argurus; peninsulae.prototype.aitkeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.novaeangliae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.olallae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.anselli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.timminsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.sordidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.telfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.cavernarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return peninsulae; @@ -6966,105 +5688,79 @@ var argurus; netscheri.prototype.gravis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tricuspidatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.fernandezi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.colletti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.microbullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.eburneae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tatei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.millardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.pruinosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.delator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.nyikae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruemmleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return netscheri; @@ -7081,105 +5777,79 @@ var ruatanica; Praseodymium.prototype.clara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.spectabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.kamensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.ruddi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.bartelsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.yerbabuenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.davidi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.pilirostris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.catherinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.frontata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.Terbium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.thomensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.soricinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return Praseodymium; @@ -7196,9 +5866,7 @@ var caurinus; johorensis.prototype.maini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return johorensis; @@ -7213,9 +5881,7 @@ var argurus; luctuosa.prototype.loriae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return luctuosa; @@ -7230,65 +5896,49 @@ var panamensis; setulosus.prototype.duthieae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.guereza = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.buselaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.nuttalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.pelii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.tunneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.lamula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.vampyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return setulosus; @@ -7303,41 +5953,31 @@ var petrophilus; rosalia.prototype.palmeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.baeops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.ozensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.creaghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.montivaga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return rosalia; @@ -7354,49 +5994,37 @@ var caurinus; psilurus.prototype.socialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.lundi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.araeum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.calamianensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.petersoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.nitela = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return psilurus; diff --git a/tests/baselines/reference/restElementWithNullInitializer.errors.txt b/tests/baselines/reference/restElementWithNullInitializer.errors.txt new file mode 100644 index 00000000000..7beb7b9a642 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,15): error TS2461: Type 'null' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(4,15): error TS2461: Type 'undefined' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + + +==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (3 errors) ==== + function foo1([...r] = null) { + ~~~~~~ +!!! error TS2461: Type 'null' is not an array type. + } + + function foo2([...r] = undefined) { + ~~~~~~ +!!! error TS2461: Type 'undefined' is not an array type. + } + + function foo3([...r] = {}) { + ~~~~~~ +!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + } + + function foo4([...r] = []) { + } + \ No newline at end of file diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js new file mode 100644 index 00000000000..9f326602fb8 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -0,0 +1,27 @@ +//// [restElementWithNullInitializer.ts] +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} + + +//// [restElementWithNullInitializer.js] +function foo1(_a) { + var _b = _a === void 0 ? null : _a, r = _b.slice(0); +} +function foo2(_a) { + var _b = _a === void 0 ? undefined : _a, r = _b.slice(0); +} +function foo3(_a) { + var _b = _a === void 0 ? {} : _a, r = _b.slice(0); +} +function foo4(_a) { + var _b = _a === void 0 ? [] : _a, r = _b.slice(0); +} diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 59a91566043..77b6ae1f774 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -32,30 +32,14 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // all the following should be valid -function fn1() { - return 1; -} -function fn2() { - return ''; -} -function fn3() { - return undefined; -} -function fn4() { - return; -} -function fn5() { - return true; -} -function fn6() { - return new Date(12); -} -function fn7() { - return null; -} -function fn8() { - return; -} // OK, eq. to 'return undefined' +function fn1() { return 1; } +function fn2() { return ''; } +function fn3() { return undefined; } +function fn4() { return; } +function fn5() { return true; } +function fn6() { return new Date(12); } +function fn7() { return null; } +function fn8() { return; } // OK, eq. to 'return undefined' var C = (function () { function C() { } @@ -69,15 +53,7 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} -function fn12() { - return new D(); -} -function fn13() { - return null; -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } +function fn12() { return new D(); } +function fn13() { return null; } diff --git a/tests/baselines/reference/returnTypeParameter.js b/tests/baselines/reference/returnTypeParameter.js index 75e8a998942..d5f46cba776 100644 --- a/tests/baselines/reference/returnTypeParameter.js +++ b/tests/baselines/reference/returnTypeParameter.js @@ -4,6 +4,4 @@ function f2(a: T): T { return T; } // bug was that this satisfied the return //// [returnTypeParameter.js] function f(a) { } // error, no return statement -function f2(a) { - return T; -} // bug was that this satisfied the return statement requirement +function f2(a) { return T; } // bug was that this satisfied the return statement requirement diff --git a/tests/baselines/reference/returnTypeParameterWithModules.js b/tests/baselines/reference/returnTypeParameterWithModules.js index 2894774de01..4790fe1341b 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.js +++ b/tests/baselines/reference/returnTypeParameterWithModules.js @@ -33,9 +33,7 @@ var M2; M2.compose = compose; ; function compose2(g, f) { - return function (x) { - return g(f(x)); - }; + return function (x) { return g(f(x)); }; } M2.compose2 = compose2; ; diff --git a/tests/baselines/reference/returnTypeTypeArguments.js b/tests/baselines/reference/returnTypeTypeArguments.js index 5be549d2f34..b374cb1c581 100644 --- a/tests/baselines/reference/returnTypeTypeArguments.js +++ b/tests/baselines/reference/returnTypeTypeArguments.js @@ -92,65 +92,31 @@ var Three = (function () { } return Three; })(); -function A1() { - return null; -} -function A2() { - return null; -} -function A3() { - return null; -} -function B1() { - return null; -} -function B2() { - return null; -} -function B3() { - return null; -} +function A1() { return null; } +function A2() { return null; } +function A3() { return null; } +function B1() { return null; } +function B2() { return null; } +function B3() { return null; } var C = (function () { function C() { } - C.prototype.A1 = function () { - return null; - }; - C.prototype.A2 = function () { - return null; - }; - C.prototype.A3 = function () { - return null; - }; - C.prototype.B1 = function () { - return null; - }; - C.prototype.B2 = function () { - return null; - }; - C.prototype.B3 = function () { - return null; - }; + C.prototype.A1 = function () { return null; }; + C.prototype.A2 = function () { return null; }; + C.prototype.A3 = function () { return null; }; + C.prototype.B1 = function () { return null; }; + C.prototype.B2 = function () { return null; }; + C.prototype.B3 = function () { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.A2 = function () { - return null; - }; - D.prototype.A3 = function () { - return null; - }; - D.prototype.B1 = function () { - return null; - }; - D.prototype.B2 = function () { - return null; - }; - D.prototype.B3 = function () { - return null; - }; + D.prototype.A2 = function () { return null; }; + D.prototype.A3 = function () { return null; }; + D.prototype.B1 = function () { return null; }; + D.prototype.B2 = function () { return null; }; + D.prototype.B3 = function () { return null; }; return D; })(); var Y = (function () { diff --git a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js index 7108029ac54..f9c3242e1ea 100644 --- a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js +++ b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js @@ -5,8 +5,6 @@ x.sort(compare); // Error, but shouldn't be //// [reverseInferenceInContextualInstantiation.js] -function compare(a, b) { - return 0; -} +function compare(a, b) { return 0; } var x; x.sort(compare); // Error, but shouldn't be diff --git a/tests/baselines/reference/scannertest1.js b/tests/baselines/reference/scannertest1.js index dc003e95a8f..8c9d805c5f2 100644 --- a/tests/baselines/reference/scannertest1.js +++ b/tests/baselines/reference/scannertest1.js @@ -33,7 +33,9 @@ var CharacterInfo = (function () { return c >= CharacterCodes._0 && c <= CharacterCodes._9; }; CharacterInfo.isHexDigit = function (c) { - return isDecimalDigit(c) || (c >= CharacterCodes.A && c <= CharacterCodes.F) || (c >= CharacterCodes.a && c <= CharacterCodes.f); + return isDecimalDigit(c) || + (c >= CharacterCodes.A && c <= CharacterCodes.F) || + (c >= CharacterCodes.a && c <= CharacterCodes.f); }; CharacterInfo.hexValue = function (c) { Debug.assert(isHexDigit(c)); diff --git a/tests/baselines/reference/selfInCallback.js b/tests/baselines/reference/selfInCallback.js index 85f16390f96..25228b03187 100644 --- a/tests/baselines/reference/selfInCallback.js +++ b/tests/baselines/reference/selfInCallback.js @@ -12,14 +12,10 @@ var C = (function () { function C() { this.p1 = 0; } - C.prototype.callback = function (cb) { - cb(); - }; + C.prototype.callback = function (cb) { cb(); }; C.prototype.doit = function () { var _this = this; - this.callback(function () { - _this.p1 + 1; - }); + this.callback(function () { _this.p1 + 1; }); }; return C; })(); diff --git a/tests/baselines/reference/shadowingViaLocalValue.errors.txt b/tests/baselines/reference/shadowingViaLocalValue.errors.txt index 2a585ba8b7d..8e6f16b91cc 100644 --- a/tests/baselines/reference/shadowingViaLocalValue.errors.txt +++ b/tests/baselines/reference/shadowingViaLocalValue.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS4090: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. ==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS4090: Cannot init { var x = 1; ~ -!!! error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } } @@ -23,7 +23,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS4090: Cannot init { for (var x1 = 0; ;); ~~ -!!! error TS4090: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +!!! error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. } } diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js b/tests/baselines/reference/sourceMap-FileWithComments.js index 6143ff95fb8..e9755f6c048 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js +++ b/tests/baselines/reference/sourceMap-FileWithComments.js @@ -48,9 +48,7 @@ var Shapes; this.y = y; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 7405d21eb85..28d4566efc7 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA;YAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA;QAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 8dc11688ab0..c0e46430688 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -192,7 +192,7 @@ sourceFile:sourceMap-FileWithComments.ts >>> // Instance member 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -200,112 +200,106 @@ sourceFile:sourceMap-FileWithComments.ts 1->Emitted(11, 9) Source(15, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(11, 27) Source(15, 27) + SourceIndex(0) name (Shapes.Point) --- ->>> Point.prototype.getDist = function () { +>>> Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^^^^ +10> ^ +11> ^^^^ +12> ^ +13> ^ +14> ^^^ +15> ^^^^ +16> ^ +17> ^ +18> ^^^ +19> ^^^^ +20> ^ +21> ^ +22> ^^^ +23> ^^^^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ 1-> > 2 > getDist 3 > +4 > getDist() { +5 > return +6 > +7 > Math +8 > . +9 > sqrt +10> ( +11> this +12> . +13> x +14> * +15> this +16> . +17> x +18> + +19> this +20> . +21> y +22> * +23> this +24> . +25> y +26> ) +27> ; +28> +29> } 1->Emitted(12, 9) Source(16, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(12, 32) Source(16, 16) + SourceIndex(0) name (Shapes.Point) 3 >Emitted(12, 35) Source(16, 9) + SourceIndex(0) name (Shapes.Point) ---- ->>> return Math.sqrt(this.x * this.x + this.y * this.y); -1->^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^^^^ -9 > ^ -10> ^ -11> ^^^ -12> ^^^^ -13> ^ -14> ^ -15> ^^^ -16> ^^^^ -17> ^ -18> ^ -19> ^^^ -20> ^^^^ -21> ^ -22> ^ -23> ^ -24> ^ -1->getDist() { -2 > return -3 > -4 > Math -5 > . -6 > sqrt -7 > ( -8 > this -9 > . -10> x -11> * -12> this -13> . -14> x -15> + -16> this -17> . -18> y -19> * -20> this -21> . -22> y -23> ) -24> ; -1->Emitted(13, 13) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(13, 19) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) -3 >Emitted(13, 20) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) -4 >Emitted(13, 24) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) -5 >Emitted(13, 25) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) -6 >Emitted(13, 29) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) -7 >Emitted(13, 30) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) -8 >Emitted(13, 34) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) -9 >Emitted(13, 35) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) -10>Emitted(13, 36) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) -11>Emitted(13, 39) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) -12>Emitted(13, 43) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) -13>Emitted(13, 44) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) -14>Emitted(13, 45) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) -15>Emitted(13, 48) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) -16>Emitted(13, 52) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) -17>Emitted(13, 53) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) -18>Emitted(13, 54) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) -19>Emitted(13, 57) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) -20>Emitted(13, 61) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) -21>Emitted(13, 62) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) -22>Emitted(13, 63) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) -23>Emitted(13, 64) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) -24>Emitted(13, 65) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(14, 9) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(14, 10) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) +4 >Emitted(12, 49) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) +5 >Emitted(12, 55) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) +6 >Emitted(12, 56) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) +7 >Emitted(12, 60) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) +8 >Emitted(12, 61) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) +9 >Emitted(12, 65) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) +10>Emitted(12, 66) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) +11>Emitted(12, 70) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) +12>Emitted(12, 71) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) +13>Emitted(12, 72) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) +14>Emitted(12, 75) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) +15>Emitted(12, 79) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) +16>Emitted(12, 80) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) +17>Emitted(12, 81) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) +18>Emitted(12, 84) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) +19>Emitted(12, 88) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) +20>Emitted(12, 89) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) +21>Emitted(12, 90) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) +22>Emitted(12, 93) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) +23>Emitted(12, 97) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) +24>Emitted(12, 98) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) +25>Emitted(12, 99) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) +26>Emitted(12, 100) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) +27>Emitted(12, 101) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) +28>Emitted(12, 102) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) +29>Emitted(12, 103) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) --- >>> // Static member -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^-> -1-> +1 > > > 2 > // Static member -1->Emitted(15, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(15, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(13, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(13, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) --- >>> Point.origin = new Point(0, 0); 1->^^^^^^^^ @@ -331,17 +325,17 @@ sourceFile:sourceMap-FileWithComments.ts 9 > 0 10> ) 11> ; -1->Emitted(16, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(16, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(16, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) -4 >Emitted(16, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) -5 >Emitted(16, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) -6 >Emitted(16, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) -7 >Emitted(16, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) -8 >Emitted(16, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) -9 >Emitted(16, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) -10>Emitted(16, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) -11>Emitted(16, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) +1->Emitted(14, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(14, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(14, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) +4 >Emitted(14, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) +5 >Emitted(14, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) +6 >Emitted(14, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) +7 >Emitted(14, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) +8 >Emitted(14, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) +9 >Emitted(14, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) +10>Emitted(14, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) +11>Emitted(14, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) --- >>> return Point; 1 >^^^^^^^^ @@ -349,8 +343,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 > > 2 > } -1 >Emitted(17, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(17, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(15, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(15, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) --- >>> })(); 1 >^^^^ @@ -371,10 +365,10 @@ sourceFile:sourceMap-FileWithComments.ts > // Static member > static origin = new Point(0, 0); > } -1 >Emitted(18, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(18, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(18, 6) Source(11, 5) + SourceIndex(0) name (Shapes) -4 >Emitted(18, 10) Source(20, 6) + SourceIndex(0) name (Shapes) +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(16, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(16, 6) Source(11, 5) + SourceIndex(0) name (Shapes) +4 >Emitted(16, 10) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> Shapes.Point = Point; 1->^^^^ @@ -397,11 +391,11 @@ sourceFile:sourceMap-FileWithComments.ts > static origin = new Point(0, 0); > } 5 > -1->Emitted(19, 5) Source(11, 18) + SourceIndex(0) name (Shapes) -2 >Emitted(19, 17) Source(11, 23) + SourceIndex(0) name (Shapes) -3 >Emitted(19, 20) Source(11, 18) + SourceIndex(0) name (Shapes) -4 >Emitted(19, 25) Source(20, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(19, 26) Source(20, 6) + SourceIndex(0) name (Shapes) +1->Emitted(17, 5) Source(11, 18) + SourceIndex(0) name (Shapes) +2 >Emitted(17, 17) Source(11, 23) + SourceIndex(0) name (Shapes) +3 >Emitted(17, 20) Source(11, 18) + SourceIndex(0) name (Shapes) +4 >Emitted(17, 25) Source(20, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(17, 26) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> // Variable comment after class 1->^^^^ @@ -413,9 +407,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 > // Variable comment after class -1->Emitted(20, 5) Source(23, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(20, 5) Source(22, 5) + SourceIndex(0) name (Shapes) -3 >Emitted(20, 36) Source(22, 36) + SourceIndex(0) name (Shapes) +1->Emitted(18, 5) Source(23, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(18, 5) Source(22, 5) + SourceIndex(0) name (Shapes) +3 >Emitted(18, 36) Source(22, 36) + SourceIndex(0) name (Shapes) --- >>> var a = 10; 1 >^^^^^^^^ @@ -430,11 +424,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1 >Emitted(21, 9) Source(23, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(21, 10) Source(23, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(21, 13) Source(23, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(21, 15) Source(23, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(21, 16) Source(23, 16) + SourceIndex(0) name (Shapes) +1 >Emitted(19, 9) Source(23, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(19, 10) Source(23, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(19, 13) Source(23, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(19, 15) Source(23, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(19, 16) Source(23, 16) + SourceIndex(0) name (Shapes) --- >>> function foo() { 1->^^^^ @@ -445,9 +439,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > export function 3 > foo -1->Emitted(22, 5) Source(25, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(22, 14) Source(25, 21) + SourceIndex(0) name (Shapes) -3 >Emitted(22, 17) Source(25, 24) + SourceIndex(0) name (Shapes) +1->Emitted(20, 5) Source(25, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(20, 14) Source(25, 21) + SourceIndex(0) name (Shapes) +3 >Emitted(20, 17) Source(25, 24) + SourceIndex(0) name (Shapes) --- >>> } 1 >^^^^ @@ -456,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(23, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) -2 >Emitted(23, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) --- >>> Shapes.foo = foo; 1->^^^^ @@ -472,11 +466,11 @@ sourceFile:sourceMap-FileWithComments.ts 4 > foo() { > } 5 > -1->Emitted(24, 5) Source(25, 21) + SourceIndex(0) name (Shapes) -2 >Emitted(24, 15) Source(25, 24) + SourceIndex(0) name (Shapes) -3 >Emitted(24, 18) Source(25, 21) + SourceIndex(0) name (Shapes) -4 >Emitted(24, 21) Source(26, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(24, 22) Source(26, 6) + SourceIndex(0) name (Shapes) +1->Emitted(22, 5) Source(25, 21) + SourceIndex(0) name (Shapes) +2 >Emitted(22, 15) Source(25, 24) + SourceIndex(0) name (Shapes) +3 >Emitted(22, 18) Source(25, 21) + SourceIndex(0) name (Shapes) +4 >Emitted(22, 21) Source(26, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(22, 22) Source(26, 6) + SourceIndex(0) name (Shapes) --- >>> /** comment after function 1->^^^^ @@ -489,8 +483,8 @@ sourceFile:sourceMap-FileWithComments.ts > */ > 2 > -1->Emitted(25, 5) Source(31, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(25, 5) Source(28, 5) + SourceIndex(0) name (Shapes) +1->Emitted(23, 5) Source(31, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) name (Shapes) --- >>> * this is another comment >>> */ @@ -499,7 +493,7 @@ sourceFile:sourceMap-FileWithComments.ts 1->/** comment after function > * this is another comment > */ -1->Emitted(27, 7) Source(30, 7) + SourceIndex(0) name (Shapes) +1->Emitted(25, 7) Source(30, 7) + SourceIndex(0) name (Shapes) --- >>> var b = 10; 1->^^^^^^^^ @@ -514,11 +508,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1->Emitted(28, 9) Source(31, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(28, 10) Source(31, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(28, 13) Source(31, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(28, 15) Source(31, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(28, 16) Source(31, 16) + SourceIndex(0) name (Shapes) +1->Emitted(26, 9) Source(31, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(26, 10) Source(31, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(26, 13) Source(31, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(26, 15) Source(31, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(26, 16) Source(31, 16) + SourceIndex(0) name (Shapes) --- >>>})(Shapes || (Shapes = {})); 1-> @@ -560,13 +554,13 @@ sourceFile:sourceMap-FileWithComments.ts > */ > var b = 10; > } -1->Emitted(29, 1) Source(32, 1) + SourceIndex(0) name (Shapes) -2 >Emitted(29, 2) Source(32, 2) + SourceIndex(0) name (Shapes) -3 >Emitted(29, 4) Source(8, 8) + SourceIndex(0) -4 >Emitted(29, 10) Source(8, 14) + SourceIndex(0) -5 >Emitted(29, 15) Source(8, 8) + SourceIndex(0) -6 >Emitted(29, 21) Source(8, 14) + SourceIndex(0) -7 >Emitted(29, 29) Source(32, 2) + SourceIndex(0) +1->Emitted(27, 1) Source(32, 1) + SourceIndex(0) name (Shapes) +2 >Emitted(27, 2) Source(32, 2) + SourceIndex(0) name (Shapes) +3 >Emitted(27, 4) Source(8, 8) + SourceIndex(0) +4 >Emitted(27, 10) Source(8, 14) + SourceIndex(0) +5 >Emitted(27, 15) Source(8, 8) + SourceIndex(0) +6 >Emitted(27, 21) Source(8, 14) + SourceIndex(0) +7 >Emitted(27, 29) Source(32, 2) + SourceIndex(0) --- >>>/** Local Variable */ 1 > @@ -579,9 +573,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 >/** Local Variable */ -1 >Emitted(30, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(30, 1) Source(34, 1) + SourceIndex(0) -3 >Emitted(30, 22) Source(34, 22) + SourceIndex(0) +1 >Emitted(28, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(28, 1) Source(34, 1) + SourceIndex(0) +3 >Emitted(28, 22) Source(34, 22) + SourceIndex(0) --- >>>var p = new Shapes.Point(3, 4); 1->^^^^ @@ -611,19 +605,19 @@ sourceFile:sourceMap-FileWithComments.ts 11> 4 12> ) 13> ; -1->Emitted(31, 5) Source(35, 5) + SourceIndex(0) -2 >Emitted(31, 6) Source(35, 6) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 17) + SourceIndex(0) -4 >Emitted(31, 13) Source(35, 21) + SourceIndex(0) -5 >Emitted(31, 19) Source(35, 27) + SourceIndex(0) -6 >Emitted(31, 20) Source(35, 28) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 33) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 34) + SourceIndex(0) -9 >Emitted(31, 27) Source(35, 35) + SourceIndex(0) -10>Emitted(31, 29) Source(35, 37) + SourceIndex(0) -11>Emitted(31, 30) Source(35, 38) + SourceIndex(0) -12>Emitted(31, 31) Source(35, 39) + SourceIndex(0) -13>Emitted(31, 32) Source(35, 40) + SourceIndex(0) +1->Emitted(29, 5) Source(35, 5) + SourceIndex(0) +2 >Emitted(29, 6) Source(35, 6) + SourceIndex(0) +3 >Emitted(29, 9) Source(35, 17) + SourceIndex(0) +4 >Emitted(29, 13) Source(35, 21) + SourceIndex(0) +5 >Emitted(29, 19) Source(35, 27) + SourceIndex(0) +6 >Emitted(29, 20) Source(35, 28) + SourceIndex(0) +7 >Emitted(29, 25) Source(35, 33) + SourceIndex(0) +8 >Emitted(29, 26) Source(35, 34) + SourceIndex(0) +9 >Emitted(29, 27) Source(35, 35) + SourceIndex(0) +10>Emitted(29, 29) Source(35, 37) + SourceIndex(0) +11>Emitted(29, 30) Source(35, 38) + SourceIndex(0) +12>Emitted(29, 31) Source(35, 39) + SourceIndex(0) +13>Emitted(29, 32) Source(35, 40) + SourceIndex(0) --- >>>var dist = p.getDist(); 1 > @@ -646,14 +640,14 @@ sourceFile:sourceMap-FileWithComments.ts 7 > getDist 8 > () 9 > ; -1 >Emitted(32, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(32, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(32, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(32, 12) Source(36, 12) + SourceIndex(0) -5 >Emitted(32, 13) Source(36, 13) + SourceIndex(0) -6 >Emitted(32, 14) Source(36, 14) + SourceIndex(0) -7 >Emitted(32, 21) Source(36, 21) + SourceIndex(0) -8 >Emitted(32, 23) Source(36, 23) + SourceIndex(0) -9 >Emitted(32, 24) Source(36, 24) + SourceIndex(0) +1 >Emitted(30, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(30, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(30, 12) Source(36, 12) + SourceIndex(0) +5 >Emitted(30, 13) Source(36, 13) + SourceIndex(0) +6 >Emitted(30, 14) Source(36, 14) + SourceIndex(0) +7 >Emitted(30, 21) Source(36, 21) + SourceIndex(0) +8 >Emitted(30, 23) Source(36, 23) + SourceIndex(0) +9 >Emitted(30, 24) Source(36, 24) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMap-FileWithComments.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js index d56e0938684..3116571166f 100644 --- a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js +++ b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js @@ -28,6 +28,4 @@ function foo() { series2.map(seriesExtent); return null; } -var keyExtent2 = series.data.map(function (d) { - return d; -}); +var keyExtent2 = series.data.map(function (d) { return d; }); diff --git a/tests/baselines/reference/specializeVarArgs1.js b/tests/baselines/reference/specializeVarArgs1.js index 3eac6daa61f..cc09df1daa6 100644 --- a/tests/baselines/reference/specializeVarArgs1.js +++ b/tests/baselines/reference/specializeVarArgs1.js @@ -23,8 +23,6 @@ a.push('Some Value'); //// [specializeVarArgs1.js] -function observableArray() { - return null; -} +function observableArray() { return null; } var a = observableArray(); a.push('Some Value'); diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index af5780d96cf..529cc230d73 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var Base = (function () { function Base() { } - Base.prototype.foo = function () { - return 1; - }; + Base.prototype.foo = function () { return 1; }; Base.create = function () { return new this(); }; @@ -36,9 +34,7 @@ var Derived = (function (_super) { function Derived() { _super.apply(this, arguments); } - Derived.prototype.foo = function () { - return 2; - }; + Derived.prototype.foo = function () { return 2; }; return Derived; })(Base); var d = Derived.create(); diff --git a/tests/baselines/reference/staticGetterAndSetter.js b/tests/baselines/reference/staticGetterAndSetter.js index 64fcc134ad9..5c61af0b7cc 100644 --- a/tests/baselines/reference/staticGetterAndSetter.js +++ b/tests/baselines/reference/staticGetterAndSetter.js @@ -10,9 +10,7 @@ var Foo = (function () { function Foo() { } Object.defineProperty(Foo, "Foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticMemberExportAccess.js b/tests/baselines/reference/staticMemberExportAccess.js index 5de5a76ca7a..37799356708 100644 --- a/tests/baselines/reference/staticMemberExportAccess.js +++ b/tests/baselines/reference/staticMemberExportAccess.js @@ -24,9 +24,7 @@ Sammy.bar(); var Sammy = (function () { function Sammy() { } - Sammy.prototype.foo = function () { - return "hi"; - }; + Sammy.prototype.foo = function () { return "hi"; }; Sammy.bar = function () { return -1; }; diff --git a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js index 499e16ec581..76fa7d6249e 100644 --- a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js +++ b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js @@ -7,8 +7,6 @@ class C { var C = (function () { function C() { } - C.s = function (p) { - return p; - }; + C.s = function (p) { return p; }; return C; })(); diff --git a/tests/baselines/reference/staticPropertyNotInClassType.js b/tests/baselines/reference/staticPropertyNotInClassType.js index 3a00c80e033..e9df2b2158d 100644 --- a/tests/baselines/reference/staticPropertyNotInClassType.js +++ b/tests/baselines/reference/staticPropertyNotInClassType.js @@ -47,13 +47,9 @@ var NonGeneric; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -77,13 +73,9 @@ var Generic; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticVisibility.js b/tests/baselines/reference/staticVisibility.js index 0da2e3dbe2c..7dbf49a2baa 100644 --- a/tests/baselines/reference/staticVisibility.js +++ b/tests/baselines/reference/staticVisibility.js @@ -58,13 +58,9 @@ var C2 = (function () { this.barback = ""; } Object.defineProperty(C2, "Bar", { - get: function () { - return "bar"; - } // ok + get: function () { return "bar"; } // ok , - set: function (bar) { - barback = bar; - } // not ok + set: function (bar) { barback = bar; } // not ok , enumerable: true, configurable: true diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index b9195403b20..c9278c40446 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -50,9 +50,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -60,9 +58,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js index 3a6280b15ba..6260493dea0 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js @@ -113,15 +113,9 @@ function f9(x) { } var C = (function () { function C() { } - C.prototype.toString = function () { - return null; - }; - C.prototype.charAt = function (pos) { - return null; - }; - C.prototype.charCodeAt = function (index) { - return null; - }; + C.prototype.toString = function () { return null; }; + C.prototype.charAt = function (pos) { return null; }; + C.prototype.charCodeAt = function (index) { return null; }; C.prototype.concat = function () { var strings = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -129,51 +123,21 @@ var C = (function () { } return null; }; - C.prototype.indexOf = function (searchString, position) { - return null; - }; - C.prototype.lastIndexOf = function (searchString, position) { - return null; - }; - C.prototype.localeCompare = function (that) { - return null; - }; - C.prototype.match = function (regexp) { - return null; - }; - C.prototype.replace = function (searchValue, replaceValue) { - return null; - }; - C.prototype.search = function (regexp) { - return null; - }; - C.prototype.slice = function (start, end) { - return null; - }; - C.prototype.split = function (separator, limit) { - return null; - }; - C.prototype.substring = function (start, end) { - return null; - }; - C.prototype.toLowerCase = function () { - return null; - }; - C.prototype.toLocaleLowerCase = function () { - return null; - }; - C.prototype.toUpperCase = function () { - return null; - }; - C.prototype.toLocaleUpperCase = function () { - return null; - }; - C.prototype.trim = function () { - return null; - }; - C.prototype.substr = function (from, length) { - return null; - }; + C.prototype.indexOf = function (searchString, position) { return null; }; + C.prototype.lastIndexOf = function (searchString, position) { return null; }; + C.prototype.localeCompare = function (that) { return null; }; + C.prototype.match = function (regexp) { return null; }; + C.prototype.replace = function (searchValue, replaceValue) { return null; }; + C.prototype.search = function (regexp) { return null; }; + C.prototype.slice = function (start, end) { return null; }; + C.prototype.split = function (separator, limit) { return null; }; + C.prototype.substring = function (start, end) { return null; }; + C.prototype.toLowerCase = function () { return null; }; + C.prototype.toLocaleLowerCase = function () { return null; }; + C.prototype.toUpperCase = function () { return null; }; + C.prototype.toLocaleUpperCase = function () { return null; }; + C.prototype.trim = function () { return null; }; + C.prototype.substr = function (from, length) { return null; }; return C; })(); function f10(x) { } diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 5a5a02733ba..7d739132a77 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -178,12 +178,8 @@ function f2(x, y) { var r6 = true ? x : { foo: 1 }; var r7 = true ? function () { } : x; var r7 = true ? x : function () { }; - var r8 = true ? function (x) { - return x; - } : x; - var r8b = true ? x : function (x) { - return x; - }; // type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; + var r8b = true ? x : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : x; var r9 = true ? x : i1; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js index 0687a434ae6..df4511fb7ad 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js @@ -249,12 +249,8 @@ function f11(x) { var r7 = true ? x : function () { }; // ok } function f12(x) { - var r8 = true ? function (x) { - return x; - } : x; // ok - var r8b = true ? x : function (x) { - return x; - }; // ok, type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; // ok + var r8b = true ? x : function (x) { return x; }; // ok, type parameters not identical across declarations } function f13(x) { var i1; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index cf29ac3b1a4..7ef1ce1c62a 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -70,9 +70,7 @@ var Other = (function (_super) { var _this = this; _super.call(this); this.propertyInitializer = _super.prototype.instanceMethod.call(this); - this.functionProperty = function () { - _super.prototype.instanceMethod.call(_this); - }; + this.functionProperty = function () { _super.prototype.instanceMethod.call(_this); }; _super.prototype.instanceMethod.call(this); } // in instance method diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 418aeed61ed..ce49da10687 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -87,9 +87,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); } RegisteredUser.prototype.sayHello = function () { // super call in a method @@ -99,9 +97,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); }; RegisteredUser.staticFunction = function () { var _this = this; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 13dfe1ee3a7..a5419aaf36e 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -49,14 +49,10 @@ var MyBase = (function () { this.d1 = 42; this.d2 = 42; } - MyBase.prototype.m1 = function (a) { - return a; - }; + MyBase.prototype.m1 = function (a) { return a; }; MyBase.prototype.p1 = function () { }; Object.defineProperty(MyBase.prototype, "value", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (v) { }, enumerable: true, configurable: true @@ -76,9 +72,7 @@ var MyDerived = (function (_super) { _super.prototype.p1.call(this); // Should error, private not public instance member function var l1 = _super.prototype.d1; // Should error, instance data property not a public instance member function var l1 = _super.prototype.d2; // Should error, instance data property not a public instance member function - _super.prototype.m1 = function (a) { - return ""; - }; // Should be allowed, we will not restrict assignment + _super.prototype.m1 = function (a) { return ""; }; // Should be allowed, we will not restrict assignment _super.prototype.value = 0; // Should error, instance data property not a public instance member function var z = _super.prototype.value; // Should error, instance data property not a public instance member function }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 48ae609cdc6..7fd55d221ab 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -52,9 +52,7 @@ var ObjectLiteral; var F = (function () { function F() { } - F.prototype.test = function () { - return ""; - }; + F.prototype.test = function () { return ""; }; return F; })(); var SuperObjectTest = (function (_super) { diff --git a/tests/baselines/reference/symbolDeclarationEmit1.js b/tests/baselines/reference/symbolDeclarationEmit1.js new file mode 100644 index 00000000000..16d208db5eb --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.js @@ -0,0 +1,17 @@ +//// [symbolDeclarationEmit1.ts] +class C { + [Symbol.isRegExp]: number; +} + +//// [symbolDeclarationEmit1.js] +var C = (function () { + function C() { + } + return C; +})(); + + +//// [symbolDeclarationEmit1.d.ts] +declare class C { + [Symbol.isRegExp]: number; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit1.types b/tests/baselines/reference/symbolDeclarationEmit1.types new file mode 100644 index 00000000000..e35bbfe8861 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts === +class C { +>C : C + + [Symbol.isRegExp]: number; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js new file mode 100644 index 00000000000..0c46d8750e9 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -0,0 +1,17 @@ +//// [symbolDeclarationEmit10.ts] +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} + +//// [symbolDeclarationEmit10.js] +var obj = { + get [Symbol.isConcatSpreadable]() { return ''; }, + set [Symbol.isConcatSpreadable](x) { } +}; + + +//// [symbolDeclarationEmit10.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit10.types b/tests/baselines/reference/symbolDeclarationEmit10.types new file mode 100644 index 00000000000..194893ef00f --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: string; } +>{ get [Symbol.isConcatSpreadable]() { return '' }, set [Symbol.isConcatSpreadable](x) { }} : { [Symbol.isConcatSpreadable]: string; } + + get [Symbol.isConcatSpreadable]() { return '' }, +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + set [Symbol.isConcatSpreadable](x) { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js new file mode 100644 index 00000000000..e5822104bf8 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -0,0 +1,30 @@ +//// [symbolDeclarationEmit11.ts] +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit11.js] +var C = (function () { + function C() { + } + C[Symbol.toPrimitive] = function () { }; + Object.defineProperty(C, Symbol.isRegExp, { + get: function () { return ""; }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + C[Symbol.iterator] = 0; + return C; +})(); + + +//// [symbolDeclarationEmit11.d.ts] +declare class C { + static [Symbol.iterator]: number; + static [Symbol.toPrimitive](): void; + static [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.types b/tests/baselines/reference/symbolDeclarationEmit11.types new file mode 100644 index 00000000000..1bf58f205d1 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts === +class C { +>C : C + + static [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + static [Symbol.toPrimitive]() { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + static get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + static set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit12.errors.txt b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt new file mode 100644 index 00000000000..0e2f6b828f6 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(4,28): error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(5,33): error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(6,40): error TS4055: Return type of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(10,34): error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts (4 errors) ==== + module M { + interface I { } + export class C { + [Symbol.iterator]: I; + ~ +!!! error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. + [Symbol.toPrimitive](x: I) { } + ~ +!!! error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. + [Symbol.isConcatSpreadable](): I { + ~ +!!! error TS4055: Return type of public method from exported class has or is using private name 'I'. + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + ~ +!!! error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js new file mode 100644 index 00000000000..68a256bd39d --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -0,0 +1,34 @@ +//// [symbolDeclarationEmit12.ts] +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} + +//// [symbolDeclarationEmit12.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function (x) { }; + C.prototype[Symbol.isConcatSpreadable] = function () { + return undefined; + }; + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return undefined; }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; + })(); + M.C = C; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js new file mode 100644 index 00000000000..acf470ffce1 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -0,0 +1,29 @@ +//// [symbolDeclarationEmit13.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} + +//// [symbolDeclarationEmit13.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return ""; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit13.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit13.types b/tests/baselines/reference/symbolDeclarationEmit13.types new file mode 100644 index 00000000000..6579e49c426 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.toStringTag](x) { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js new file mode 100644 index 00000000000..64330c6ce92 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -0,0 +1,29 @@ +//// [symbolDeclarationEmit14.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} + +//// [symbolDeclarationEmit14.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return ""; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { return ""; }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit14.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.types b/tests/baselines/reference/symbolDeclarationEmit14.types new file mode 100644 index 00000000000..f3e7c32047c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { return ""; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.js b/tests/baselines/reference/symbolDeclarationEmit2.js new file mode 100644 index 00000000000..2112f9e7748 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.js @@ -0,0 +1,18 @@ +//// [symbolDeclarationEmit2.ts] +class C { + [Symbol.isRegExp] = ""; +} + +//// [symbolDeclarationEmit2.js] +var C = (function () { + function C() { + this[Symbol.isRegExp] = ""; + } + return C; +})(); + + +//// [symbolDeclarationEmit2.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.types b/tests/baselines/reference/symbolDeclarationEmit2.types new file mode 100644 index 00000000000..4844b2b8f84 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts === +class C { +>C : C + + [Symbol.isRegExp] = ""; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.js b/tests/baselines/reference/symbolDeclarationEmit3.js new file mode 100644 index 00000000000..e3b22d883c8 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.js @@ -0,0 +1,21 @@ +//// [symbolDeclarationEmit3.ts] +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} + +//// [symbolDeclarationEmit3.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.isRegExp] = function (x) { }; + return C; +})(); + + +//// [symbolDeclarationEmit3.d.ts] +declare class C { + [Symbol.isRegExp](x: number): any; + [Symbol.isRegExp](x: string): any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.types b/tests/baselines/reference/symbolDeclarationEmit3.types new file mode 100644 index 00000000000..0ea55d876b3 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts === +class C { +>C : C + + [Symbol.isRegExp](x: number); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : number + + [Symbol.isRegExp](x: string); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string + + [Symbol.isRegExp](x: any) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js new file mode 100644 index 00000000000..cfe3a14122d --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -0,0 +1,24 @@ +//// [symbolDeclarationEmit4.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit4.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return ""; }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit4.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.types b/tests/baselines/reference/symbolDeclarationEmit4.types new file mode 100644 index 00000000000..aeb24fc146c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.js b/tests/baselines/reference/symbolDeclarationEmit5.js new file mode 100644 index 00000000000..ba1ef9a137c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit5.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} + +//// [symbolDeclarationEmit5.js] + + +//// [symbolDeclarationEmit5.d.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.types b/tests/baselines/reference/symbolDeclarationEmit5.types new file mode 100644 index 00000000000..557483cf636 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable](): string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.js b/tests/baselines/reference/symbolDeclarationEmit6.js new file mode 100644 index 00000000000..2aac05bb6ea --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit6.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit6.js] + + +//// [symbolDeclarationEmit6.d.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.types b/tests/baselines/reference/symbolDeclarationEmit6.types new file mode 100644 index 00000000000..714467aba12 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit7.js b/tests/baselines/reference/symbolDeclarationEmit7.js new file mode 100644 index 00000000000..c53c2110d11 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.js @@ -0,0 +1,13 @@ +//// [symbolDeclarationEmit7.ts] +var obj: { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit7.js] +var obj; + + +//// [symbolDeclarationEmit7.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit7.types b/tests/baselines/reference/symbolDeclarationEmit7.types new file mode 100644 index 00000000000..dff109e8127 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts === +var obj: { +>obj : { [Symbol.isConcatSpreadable]: string; } + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit8.js b/tests/baselines/reference/symbolDeclarationEmit8.js new file mode 100644 index 00000000000..428d0a0d60c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit8.ts] +var obj = { + [Symbol.isConcatSpreadable]: 0 +} + +//// [symbolDeclarationEmit8.js] +var obj = { + [Symbol.isConcatSpreadable]: 0 +}; + + +//// [symbolDeclarationEmit8.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: number; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit8.types b/tests/baselines/reference/symbolDeclarationEmit8.types new file mode 100644 index 00000000000..75d39748e22 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: number; } +>{ [Symbol.isConcatSpreadable]: 0} : { [Symbol.isConcatSpreadable]: number; } + + [Symbol.isConcatSpreadable]: 0 +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit9.js b/tests/baselines/reference/symbolDeclarationEmit9.js new file mode 100644 index 00000000000..d38171767a5 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit9.ts] +var obj = { + [Symbol.isConcatSpreadable]() { } +} + +//// [symbolDeclarationEmit9.js] +var obj = { + [Symbol.isConcatSpreadable]() { } +}; + + +//// [symbolDeclarationEmit9.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable](): void; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit9.types b/tests/baselines/reference/symbolDeclarationEmit9.types new file mode 100644 index 00000000000..a7a6b459fcc --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable](): void; } +>{ [Symbol.isConcatSpreadable]() { }} : { [Symbol.isConcatSpreadable](): void; } + + [Symbol.isConcatSpreadable]() { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolProperty1.js b/tests/baselines/reference/symbolProperty1.js new file mode 100644 index 00000000000..0117dd3b1c2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.js @@ -0,0 +1,19 @@ +//// [symbolProperty1.ts] +var s: symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty1.js] +var s; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty1.types b/tests/baselines/reference/symbolProperty1.types new file mode 100644 index 00000000000..55c86c14f6e --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty1.ts === +var s: symbol; +>s : symbol + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : symbol + + [s]() { }, +>s : symbol + + get [s]() { +>s : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty10.errors.txt b/tests/baselines/reference/symbolProperty10.errors.txt new file mode 100644 index 00000000000..513d5792c5e --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty10.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty10.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]?: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty10.js b/tests/baselines/reference/symbolProperty10.js new file mode 100644 index 00000000000..5b4e44f11ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.js @@ -0,0 +1,21 @@ +//// [symbolProperty10.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty10.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.js b/tests/baselines/reference/symbolProperty11.js new file mode 100644 index 00000000000..83a380c79e7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.js @@ -0,0 +1,19 @@ +//// [symbolProperty11.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty11.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.types b/tests/baselines/reference/symbolProperty11.types new file mode 100644 index 00000000000..109bd969d55 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty11.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +var i: I; +>i : I +>I : I + +i = new C; +>i = new C : C +>i : I +>new C : C +>C : typeof C + +var c: C = i; +>c : C +>C : C +>i : I + diff --git a/tests/baselines/reference/symbolProperty12.errors.txt b/tests/baselines/reference/symbolProperty12.errors.txt new file mode 100644 index 00000000000..5ec8d645203 --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(9,1): error TS2322: Type 'C' is not assignable to type 'I'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty12.ts (2 errors) ==== + class C { + private [Symbol.iterator]: { x }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + ~ +!!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty12.js b/tests/baselines/reference/symbolProperty12.js new file mode 100644 index 00000000000..9f63f86bc18 --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.js @@ -0,0 +1,21 @@ +//// [symbolProperty12.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty12.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty13.js b/tests/baselines/reference/symbolProperty13.js new file mode 100644 index 00000000000..1cf24a49c7e --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.js @@ -0,0 +1,27 @@ +//// [symbolProperty13.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty13.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty13.types b/tests/baselines/reference/symbolProperty13.types new file mode 100644 index 00000000000..1e890a91085 --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty13.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty14.js b/tests/baselines/reference/symbolProperty14.js new file mode 100644 index 00000000000..0283cb01b79 --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.js @@ -0,0 +1,27 @@ +//// [symbolProperty14.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty14.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty14.types b/tests/baselines/reference/symbolProperty14.types new file mode 100644 index 00000000000..5e5469ad915 --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty14.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty15.js b/tests/baselines/reference/symbolProperty15.js new file mode 100644 index 00000000000..0c198037093 --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.js @@ -0,0 +1,25 @@ +//// [symbolProperty15.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty15.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty15.types b/tests/baselines/reference/symbolProperty15.types new file mode 100644 index 00000000000..b2baa3fccee --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty15.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : C +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty16.js b/tests/baselines/reference/symbolProperty16.js new file mode 100644 index 00000000000..1a1f3f857af --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.js @@ -0,0 +1,27 @@ +//// [symbolProperty16.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty16.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty16.types b/tests/baselines/reference/symbolProperty16.types new file mode 100644 index 00000000000..041770aea04 --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty16.ts === +class C { +>C : C + + private [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty17.errors.txt b/tests/baselines/reference/symbolProperty17.errors.txt new file mode 100644 index 00000000000..51f77646f0d --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty17.ts (1 errors) ==== + interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + "__@iterator": string; + } + + var i: I; + var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty17.js b/tests/baselines/reference/symbolProperty17.js new file mode 100644 index 00000000000..549577c8d6c --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.js @@ -0,0 +1,13 @@ +//// [symbolProperty17.ts] +interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; + +//// [symbolProperty17.js] +var i; +var it = i[Symbol.iterator]; diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js new file mode 100644 index 00000000000..1d0a57e7b50 --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.js @@ -0,0 +1,20 @@ +//// [symbolProperty18.ts] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; + +//// [symbolProperty18.js] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return ""; }, + set [Symbol.toPrimitive](p) { } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; diff --git a/tests/baselines/reference/symbolProperty18.types b/tests/baselines/reference/symbolProperty18.types new file mode 100644 index 00000000000..8dd74112a8d --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty18.ts === +var i = { +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>{ [Symbol.iterator]: 0, [Symbol.toStringTag]() { return "" }, set [Symbol.toPrimitive](p: boolean) { }} : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.toStringTag]() { return "" }, +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + set [Symbol.toPrimitive](p: boolean) { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +>p : boolean +} + +var it = i[Symbol.iterator]; +>it : number +>i[Symbol.iterator] : number +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : string +>i[Symbol.toStringTag]() : string +>i[Symbol.toStringTag] : () => string +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + +i[Symbol.toPrimitive] = false; +>i[Symbol.toPrimitive] = false : boolean +>i[Symbol.toPrimitive] : boolean +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + diff --git a/tests/baselines/reference/symbolProperty19.js b/tests/baselines/reference/symbolProperty19.js new file mode 100644 index 00000000000..5ec7968218a --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.js @@ -0,0 +1,16 @@ +//// [symbolProperty19.ts] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); + +//// [symbolProperty19.js] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty19.types b/tests/baselines/reference/symbolProperty19.types new file mode 100644 index 00000000000..705c2b8bdf7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty19.ts === +var i = { +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>{ [Symbol.iterator]: { p: null }, [Symbol.toStringTag]() { return { p: undefined }; }} : { [Symbol.iterator]: { p: null; }; [Symbol.toStringTag](): { p: any; }; } + + [Symbol.iterator]: { p: null }, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>{ p: null } : { p: null; } +>p : null + + [Symbol.toStringTag]() { return { p: undefined }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>{ p: undefined } : { p: undefined; } +>p : undefined +>undefined : undefined +} + +var it = i[Symbol.iterator]; +>it : { p: any; } +>i[Symbol.iterator] : { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : { p: any; } +>i[Symbol.toStringTag]() : { p: any; } +>i[Symbol.toStringTag] : () => { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + diff --git a/tests/baselines/reference/symbolProperty2.js b/tests/baselines/reference/symbolProperty2.js new file mode 100644 index 00000000000..0158366f9d5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.js @@ -0,0 +1,19 @@ +//// [symbolProperty2.ts] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty2.js] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty2.types b/tests/baselines/reference/symbolProperty2.types new file mode 100644 index 00000000000..37fe9d13bdb --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty2.ts === +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : symbol + + [s]() { }, +>s : symbol + + get [s]() { +>s : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js new file mode 100644 index 00000000000..df7516552e0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.js @@ -0,0 +1,16 @@ +//// [symbolProperty20.ts] +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} + +//// [symbolProperty20.js] +var i = { + [Symbol.iterator]: s => { return s; }, + [Symbol.toStringTag](n) { return n; } +}; diff --git a/tests/baselines/reference/symbolProperty20.types b/tests/baselines/reference/symbolProperty20.types new file mode 100644 index 00000000000..745401142d8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty20.ts === +interface I { +>I : I + + [Symbol.iterator]: (s: string) => string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>s : string + + [Symbol.toStringTag](s: number): number; +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>s : number +} + +var i: I = { +>i : I +>I : I +>{ [Symbol.iterator]: s => s, [Symbol.toStringTag](n) { return n; }} : { [Symbol.iterator]: (s: string) => string; [Symbol.toStringTag](n: number): number; } + + [Symbol.iterator]: s => s, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>s => s : (s: string) => string +>s : string +>s : string + + [Symbol.toStringTag](n) { return n; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>n : number +>n : number +} diff --git a/tests/baselines/reference/symbolProperty21.js b/tests/baselines/reference/symbolProperty21.js new file mode 100644 index 00000000000..13eaf06a97b --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.js @@ -0,0 +1,20 @@ +//// [symbolProperty21.ts] +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); + +//// [symbolProperty21.js] +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types new file mode 100644 index 00000000000..053dae46479 --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables]: T; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>T : T + + [Symbol.isConcatSpreadable]: U; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>U : U +} + +declare function foo(p: I): { t: T; u: U }; +>foo : (p: I) => { t: T; u: U; } +>T : T +>U : U +>p : I +>I : I +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + +foo({ +>foo({ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true}) : { t: boolean; u: string; } +>foo : (p: I) => { t: T; u: U; } +>{ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.isRegExp]: number; [Symbol.unscopables]: boolean; } + + [Symbol.isConcatSpreadable]: "", +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + [Symbol.isRegExp]: 0, +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + [Symbol.unscopables]: true +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + +}); diff --git a/tests/baselines/reference/symbolProperty22.js b/tests/baselines/reference/symbolProperty22.js new file mode 100644 index 00000000000..35757182143 --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.js @@ -0,0 +1,11 @@ +//// [symbolProperty22.ts] +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); + +//// [symbolProperty22.js] +foo("", { [Symbol.unscopables]: s => { return s.length; } }); diff --git a/tests/baselines/reference/symbolProperty22.types b/tests/baselines/reference/symbolProperty22.types new file mode 100644 index 00000000000..64fb5fc234c --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty22.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables](x: T): U; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>x : T +>T : T +>U : U +} + +declare function foo(p1: T, p2: I): U; +>foo : (p1: T, p2: I) => U +>T : T +>U : U +>p1 : T +>T : T +>p2 : I +>I : I +>T : T +>U : U +>U : U + +foo("", { [Symbol.unscopables]: s => s.length }); +>foo("", { [Symbol.unscopables]: s => s.length }) : number +>foo : (p1: T, p2: I) => U +>{ [Symbol.unscopables]: s => s.length } : { [Symbol.unscopables]: (s: string) => number; } +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + diff --git a/tests/baselines/reference/symbolProperty23.js b/tests/baselines/reference/symbolProperty23.js new file mode 100644 index 00000000000..b3291ad34e8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.js @@ -0,0 +1,20 @@ +//// [symbolProperty23.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} + +//// [symbolProperty23.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return true; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty23.types b/tests/baselines/reference/symbolProperty23.types new file mode 100644 index 00000000000..b28ecb2dbe4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty23.ts === +interface I { +>I : I + + [Symbol.toPrimitive]: () => boolean; +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} + +class C implements I { +>C : C +>I : I + + [Symbol.toPrimitive]() { +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + return true; + } +} diff --git a/tests/baselines/reference/symbolProperty24.errors.txt b/tests/baselines/reference/symbolProperty24.errors.txt new file mode 100644 index 00000000000..25cba184e25 --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty24.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Types of property '[Symbol.toPrimitive]' are incompatible. + Type '() => string' is not assignable to type '() => boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty24.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Types of property '[Symbol.toPrimitive]' are incompatible. +!!! error TS2420: Type '() => string' is not assignable to type '() => boolean'. +!!! error TS2420: Type 'string' is not assignable to type 'boolean'. + [Symbol.toPrimitive]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty24.js b/tests/baselines/reference/symbolProperty24.js new file mode 100644 index 00000000000..b5d059dd29f --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.js @@ -0,0 +1,20 @@ +//// [symbolProperty24.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty24.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty25.errors.txt b/tests/baselines/reference/symbolProperty25.errors.txt new file mode 100644 index 00000000000..a6cde31c1ad --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty25.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Property '[Symbol.toPrimitive]' is missing in type 'C'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty25.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Property '[Symbol.toPrimitive]' is missing in type 'C'. + [Symbol.toStringTag]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty25.js b/tests/baselines/reference/symbolProperty25.js new file mode 100644 index 00000000000..c932da1e3eb --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.js @@ -0,0 +1,20 @@ +//// [symbolProperty25.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty25.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty26.js b/tests/baselines/reference/symbolProperty26.js new file mode 100644 index 00000000000..9e98027603d --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.js @@ -0,0 +1,38 @@ +//// [symbolProperty26.ts] +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty26.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 C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty26.types b/tests/baselines/reference/symbolProperty26.types new file mode 100644 index 00000000000..3971ccb402d --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty26.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty27.js b/tests/baselines/reference/symbolProperty27.js new file mode 100644 index 00000000000..f19d05233cb --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.js @@ -0,0 +1,38 @@ +//// [symbolProperty27.ts] +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty27.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 C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return {}; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty27.types b/tests/baselines/reference/symbolProperty27.types new file mode 100644 index 00000000000..5a5261a11b5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty27.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return {}; +>{} : {} + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty28.js b/tests/baselines/reference/symbolProperty28.js new file mode 100644 index 00000000000..219a192e381 --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.js @@ -0,0 +1,36 @@ +//// [symbolProperty28.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; + +//// [symbolProperty28.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 C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); +var c; +var obj = c[Symbol.toStringTag]().x; diff --git a/tests/baselines/reference/symbolProperty28.types b/tests/baselines/reference/symbolProperty28.types new file mode 100644 index 00000000000..ef5aa0f3003 --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty28.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } +} + +class C2 extends C1 { } +>C2 : C2 +>C1 : C1 + +var c: C2; +>c : C2 +>C2 : C2 + +var obj = c[Symbol.toStringTag]().x; +>obj : string +>c[Symbol.toStringTag]().x : string +>c[Symbol.toStringTag]() : { x: string; } +>c[Symbol.toStringTag] : () => { x: string; } +>c : C2 +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : string + diff --git a/tests/baselines/reference/symbolProperty29.errors.txt b/tests/baselines/reference/symbolProperty29.errors.txt new file mode 100644 index 00000000000..1efaeb2b3bf --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty29.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty29.js b/tests/baselines/reference/symbolProperty29.js new file mode 100644 index 00000000000..f7fee99f6a1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.js @@ -0,0 +1,17 @@ +//// [symbolProperty29.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty29.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty3.errors.txt b/tests/baselines/reference/symbolProperty3.errors.txt new file mode 100644 index 00000000000..ed557c85a63 --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty3.ts (3 errors) ==== + var s = Symbol; + var x = { + [s]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [s]() { }, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [s]() { + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty3.js b/tests/baselines/reference/symbolProperty3.js new file mode 100644 index 00000000000..dda9ca23d32 --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.js @@ -0,0 +1,19 @@ +//// [symbolProperty3.ts] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty3.js] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty30.errors.txt b/tests/baselines/reference/symbolProperty30.errors.txt new file mode 100644 index 00000000000..b839d11d1b8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty30.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty30.js b/tests/baselines/reference/symbolProperty30.js new file mode 100644 index 00000000000..bdb108015cf --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.js @@ -0,0 +1,17 @@ +//// [symbolProperty30.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty30.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty31.errors.txt b/tests/baselines/reference/symbolProperty31.errors.txt new file mode 100644 index 00000000000..39735c017b2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty31.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty31.js b/tests/baselines/reference/symbolProperty31.js new file mode 100644 index 00000000000..cf532774652 --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.js @@ -0,0 +1,32 @@ +//// [symbolProperty31.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty31.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 C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty32.errors.txt b/tests/baselines/reference/symbolProperty32.errors.txt new file mode 100644 index 00000000000..4051f8f91c8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty32.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty32.js b/tests/baselines/reference/symbolProperty32.js new file mode 100644 index 00000000000..73e4bffdc01 --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.js @@ -0,0 +1,32 @@ +//// [symbolProperty32.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty32.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 C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt new file mode 100644 index 00000000000..25a16b045ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty33.js b/tests/baselines/reference/symbolProperty33.js new file mode 100644 index 00000000000..f5a08010338 --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.js @@ -0,0 +1,32 @@ +//// [symbolProperty33.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty33.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 C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt new file mode 100644 index 00000000000..4339af94788 --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty34.js b/tests/baselines/reference/symbolProperty34.js new file mode 100644 index 00000000000..5b25f487fbf --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.js @@ -0,0 +1,32 @@ +//// [symbolProperty34.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty34.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 C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty35.errors.txt b/tests/baselines/reference/symbolProperty35.errors.txt new file mode 100644 index 00000000000..1558f5a3409 --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty35.ts(8,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. + Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty35.ts (1 errors) ==== + interface I1 { + [Symbol.toStringTag](): { x: string } + } + interface I2 { + [Symbol.toStringTag](): { x: number } + } + + interface I3 extends I1, I2 { } + ~~ +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. +!!! error TS2320: Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty35.js b/tests/baselines/reference/symbolProperty35.js new file mode 100644 index 00000000000..c96e4ce28b1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.js @@ -0,0 +1,11 @@ +//// [symbolProperty35.ts] +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } + +//// [symbolProperty35.js] diff --git a/tests/baselines/reference/symbolProperty36.errors.txt b/tests/baselines/reference/symbolProperty36.errors.txt new file mode 100644 index 00000000000..6fe3299ab90 --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty36.ts (2 errors) ==== + var x = { + [Symbol.isConcatSpreadable]: 0, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: 1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty36.js b/tests/baselines/reference/symbolProperty36.js new file mode 100644 index 00000000000..35d29d4892d --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.js @@ -0,0 +1,11 @@ +//// [symbolProperty36.ts] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} + +//// [symbolProperty36.js] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +}; diff --git a/tests/baselines/reference/symbolProperty37.errors.txt b/tests/baselines/reference/symbolProperty37.errors.txt new file mode 100644 index 00000000000..96e10e7f2a4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty37.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty37.js b/tests/baselines/reference/symbolProperty37.js new file mode 100644 index 00000000000..2aaf97ef300 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.js @@ -0,0 +1,7 @@ +//// [symbolProperty37.ts] +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty37.js] diff --git a/tests/baselines/reference/symbolProperty38.errors.txt b/tests/baselines/reference/symbolProperty38.errors.txt new file mode 100644 index 00000000000..a519f7eb9a3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(5,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty38.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty38.js b/tests/baselines/reference/symbolProperty38.js new file mode 100644 index 00000000000..b90b4d8081d --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.js @@ -0,0 +1,9 @@ +//// [symbolProperty38.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty38.js] diff --git a/tests/baselines/reference/symbolProperty39.errors.txt b/tests/baselines/reference/symbolProperty39.errors.txt new file mode 100644 index 00000000000..62dbdfc591c --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(2,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(3,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(4,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(7,5): error TS2393: Duplicate function implementation. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty39.ts (4 errors) ==== + class C { + [Symbol.iterator](x: string): string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty39.js b/tests/baselines/reference/symbolProperty39.js new file mode 100644 index 00000000000..18551d20c0b --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.js @@ -0,0 +1,24 @@ +//// [symbolProperty39.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty39.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty4.js b/tests/baselines/reference/symbolProperty4.js new file mode 100644 index 00000000000..6072d6bbf72 --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.js @@ -0,0 +1,17 @@ +//// [symbolProperty4.ts] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty4.js] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty4.types b/tests/baselines/reference/symbolProperty4.types new file mode 100644 index 00000000000..b8aac1f2770 --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty4.ts === +var x = { +>x : {} +>{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : {} + + [Symbol()]: 0, +>Symbol() : symbol +>Symbol : SymbolConstructor + + [Symbol()]() { }, +>Symbol() : symbol +>Symbol : SymbolConstructor + + get [Symbol()]() { +>Symbol() : symbol +>Symbol : SymbolConstructor + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty40.js b/tests/baselines/reference/symbolProperty40.js new file mode 100644 index 00000000000..15d8c5c6fba --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.js @@ -0,0 +1,26 @@ +//// [symbolProperty40.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); + + +//// [symbolProperty40.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/baselines/reference/symbolProperty40.types b/tests/baselines/reference/symbolProperty40.types new file mode 100644 index 00000000000..a87a6ea28a8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty40.ts === +class C { +>C : C + + [Symbol.iterator](x: string): string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string + + [Symbol.iterator](x: number): number; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : number + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : string +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator](0); +>c[Symbol.iterator](0) : number +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty41.js b/tests/baselines/reference/symbolProperty41.js new file mode 100644 index 00000000000..d26b2c7682a --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.js @@ -0,0 +1,26 @@ +//// [symbolProperty41.ts] +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); + + +//// [symbolProperty41.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/baselines/reference/symbolProperty41.types b/tests/baselines/reference/symbolProperty41.types new file mode 100644 index 00000000000..94032c194d6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.types @@ -0,0 +1,51 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty41.ts === +class C { +>C : C + + [Symbol.iterator](x: string): { x: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string +>x : string + + [Symbol.iterator](x: "hello"): { x: string; hello: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : "hello" +>x : string +>hello : string + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : { x: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator]("hello"); +>c[Symbol.iterator]("hello") : { x: string; hello: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty42.errors.txt b/tests/baselines/reference/symbolProperty42.errors.txt new file mode 100644 index 00000000000..291c1c1cc50 --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(3,12): error TS2388: Function overload must not be static. +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(4,5): error TS2387: Function overload must be static. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty42.ts (2 errors) ==== + class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2388: Function overload must not be static. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2387: Function overload must be static. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty42.js b/tests/baselines/reference/symbolProperty42.js new file mode 100644 index 00000000000..1990f54066c --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.js @@ -0,0 +1,18 @@ +//// [symbolProperty42.ts] +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty42.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty43.errors.txt b/tests/baselines/reference/symbolProperty43.errors.txt new file mode 100644 index 00000000000..c5124c4cd22 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/Symbols/symbolProperty43.ts(3,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty43.ts (1 errors) ==== + class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty43.js b/tests/baselines/reference/symbolProperty43.js new file mode 100644 index 00000000000..fcb1fd3f8e5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.js @@ -0,0 +1,12 @@ +//// [symbolProperty43.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} + +//// [symbolProperty43.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty44.errors.txt b/tests/baselines/reference/symbolProperty44.errors.txt new file mode 100644 index 00000000000..2cef480e736 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(2,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty44.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty44.js b/tests/baselines/reference/symbolProperty44.js new file mode 100644 index 00000000000..d4824e79318 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.js @@ -0,0 +1,23 @@ +//// [symbolProperty44.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} + +//// [symbolProperty44.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.js b/tests/baselines/reference/symbolProperty45.js new file mode 100644 index 00000000000..d056aba9f56 --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.js @@ -0,0 +1,30 @@ +//// [symbolProperty45.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty45.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toPrimitive, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.types b/tests/baselines/reference/symbolProperty45.types new file mode 100644 index 00000000000..24a74729aec --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty45.ts === +class C { +>C : C + + get [Symbol.hasInstance]() { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + + return ""; + } + get [Symbol.toPrimitive]() { +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty46.errors.txt b/tests/baselines/reference/symbolProperty46.errors.txt new file mode 100644 index 00000000000..68f86afc315 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty46.ts (1 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } + } + + (new C)[Symbol.hasInstance] = 0; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + (new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty46.js b/tests/baselines/reference/symbolProperty46.js new file mode 100644 index 00000000000..255fbac0809 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.js @@ -0,0 +1,31 @@ +//// [symbolProperty46.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty46.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt new file mode 100644 index 00000000000..b35650f94bb --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } + } + + (new C)[Symbol.hasInstance] = 0; + (new C)[Symbol.hasInstance] = ""; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty47.js b/tests/baselines/reference/symbolProperty47.js new file mode 100644 index 00000000000..92429c720c1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.js @@ -0,0 +1,31 @@ +//// [symbolProperty47.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty47.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty48.errors.txt b/tests/baselines/reference/symbolProperty48.errors.txt new file mode 100644 index 00000000000..8d52fa48a07 --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty48.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty48.ts (1 errors) ==== + module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty48.js b/tests/baselines/reference/symbolProperty48.js new file mode 100644 index 00000000000..48717470f2f --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.js @@ -0,0 +1,20 @@ +//// [symbolProperty48.ts] +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty48.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty49.errors.txt b/tests/baselines/reference/symbolProperty49.errors.txt new file mode 100644 index 00000000000..8a15b359ee7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty49.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty49.ts (1 errors) ==== + module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js new file mode 100644 index 00000000000..6c115a89ae4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.js @@ -0,0 +1,20 @@ +//// [symbolProperty49.ts] +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty49.js] +var M; +(function (M) { + M.Symbol; + var C = (function () { + function C() { + } + C.prototype[M.Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty5.js b/tests/baselines/reference/symbolProperty5.js new file mode 100644 index 00000000000..c7c88681f8a --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.js @@ -0,0 +1,17 @@ +//// [symbolProperty5.ts] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty5.js] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty5.types b/tests/baselines/reference/symbolProperty5.types new file mode 100644 index 00000000000..7d6a9f05858 --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty5.ts === +var x = { +>x : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } +>{ [Symbol.iterator]: 0, [Symbol.isRegExp]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.isRegExp]() { }, +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty50.js b/tests/baselines/reference/symbolProperty50.js new file mode 100644 index 00000000000..61ded053938 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.js @@ -0,0 +1,19 @@ +//// [symbolProperty50.ts] +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty50.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty50.types b/tests/baselines/reference/symbolProperty50.types new file mode 100644 index 00000000000..8258dfe1b72 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty50.ts === +module M { +>M : typeof M + + interface Symbol { } +>Symbol : Symbol + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + } +} diff --git a/tests/baselines/reference/symbolProperty51.js b/tests/baselines/reference/symbolProperty51.js new file mode 100644 index 00000000000..246dbaaa173 --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.js @@ -0,0 +1,19 @@ +//// [symbolProperty51.ts] +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty51.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty51.types b/tests/baselines/reference/symbolProperty51.types new file mode 100644 index 00000000000..6677b3b2e2d --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty51.ts === +module M { +>M : typeof M + + module Symbol { } +>Symbol : unknown + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + } +} diff --git a/tests/baselines/reference/symbolProperty52.errors.txt b/tests/baselines/reference/symbolProperty52.errors.txt new file mode 100644 index 00000000000..5a44918d564 --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(2,13): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(5,1): error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. + Property '[Symbol.nonsense]' is missing in type '{}'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(7,12): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty52.ts (3 errors) ==== + var obj = { + [Symbol.nonsense]: 0 + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + }; + + obj = {}; + ~~~ +!!! error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. +!!! error TS2322: Property '[Symbol.nonsense]' is missing in type '{}'. + + obj[Symbol.nonsense]; + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty52.js b/tests/baselines/reference/symbolProperty52.js new file mode 100644 index 00000000000..1bf4a47de7f --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.js @@ -0,0 +1,15 @@ +//// [symbolProperty52.ts] +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +obj[Symbol.nonsense]; + +//// [symbolProperty52.js] +var obj = { + [Symbol.nonsense]: 0 +}; +obj = {}; +obj[Symbol.nonsense]; diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt new file mode 100644 index 00000000000..7658744eb55 --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ==== + var obj = { + [Symbol.for]: 0 + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; + + obj[Symbol.for]; + ~~~~~~~~~~~~~~~ +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.js b/tests/baselines/reference/symbolProperty53.js new file mode 100644 index 00000000000..71c82d14917 --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.js @@ -0,0 +1,12 @@ +//// [symbolProperty53.ts] +var obj = { + [Symbol.for]: 0 +}; + +obj[Symbol.for]; + +//// [symbolProperty53.js] +var obj = { + [Symbol.for]: 0 +}; +obj[Symbol.for]; diff --git a/tests/baselines/reference/symbolProperty54.errors.txt b/tests/baselines/reference/symbolProperty54.errors.txt new file mode 100644 index 00000000000..b634b4edb0f --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty54.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty54.ts (1 errors) ==== + var obj = { + [Symbol.prototype]: 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty54.js b/tests/baselines/reference/symbolProperty54.js new file mode 100644 index 00000000000..ace8a7ca926 --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.js @@ -0,0 +1,9 @@ +//// [symbolProperty54.ts] +var obj = { + [Symbol.prototype]: 0 +}; + +//// [symbolProperty54.js] +var obj = { + [Symbol.prototype]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty55.js b/tests/baselines/reference/symbolProperty55.js new file mode 100644 index 00000000000..e19e2d8e2f6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.js @@ -0,0 +1,23 @@ +//// [symbolProperty55.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} + +//// [symbolProperty55.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty55.types b/tests/baselines/reference/symbolProperty55.types new file mode 100644 index 00000000000..34b32e27eae --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty55.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: SymbolConstructor; +>Symbol : SymbolConstructor +>SymbolConstructor : SymbolConstructor + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +>obj[Symbol.iterator] : any +>obj : { [Symbol.iterator]: number; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/symbolProperty56.js b/tests/baselines/reference/symbolProperty56.js new file mode 100644 index 00000000000..fea4520c2f8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.js @@ -0,0 +1,23 @@ +//// [symbolProperty56.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} + +//// [symbolProperty56.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty56.types b/tests/baselines/reference/symbolProperty56.types new file mode 100644 index 00000000000..8fc2e97b751 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty56.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: {}; +>Symbol : {} + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +>obj[Symbol["iterator"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["iterator"] : any +>Symbol : {} +} diff --git a/tests/baselines/reference/symbolProperty57.js b/tests/baselines/reference/symbolProperty57.js new file mode 100644 index 00000000000..8fffcba3e27 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.js @@ -0,0 +1,14 @@ +//// [symbolProperty57.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; + +//// [symbolProperty57.js] +var obj = { + [Symbol.iterator]: 0 +}; +// Should give type 'any'. +obj[Symbol["nonsense"]]; diff --git a/tests/baselines/reference/symbolProperty57.types b/tests/baselines/reference/symbolProperty57.types new file mode 100644 index 00000000000..013c008ce12 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty57.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; +>obj[Symbol["nonsense"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["nonsense"] : any +>Symbol : SymbolConstructor + diff --git a/tests/baselines/reference/symbolProperty58.errors.txt b/tests/baselines/reference/symbolProperty58.errors.txt new file mode 100644 index 00000000000..5f8b117a74c --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty58.ts(6,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty58.ts (1 errors) ==== + interface SymbolConstructor { + foo: string; + } + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty58.js b/tests/baselines/reference/symbolProperty58.js new file mode 100644 index 00000000000..94b22156b1a --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.js @@ -0,0 +1,13 @@ +//// [symbolProperty58.ts] +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} + +//// [symbolProperty58.js] +var obj = { + [Symbol.foo]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty59.errors.txt b/tests/baselines/reference/symbolProperty59.errors.txt new file mode 100644 index 00000000000..dfb2ece3d21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty59.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty59.ts (1 errors) ==== + interface I { + [Symbol.keyFor]: string; + ~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty59.js b/tests/baselines/reference/symbolProperty59.js new file mode 100644 index 00000000000..78d1d212f28 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.js @@ -0,0 +1,6 @@ +//// [symbolProperty59.ts] +interface I { + [Symbol.keyFor]: string; +} + +//// [symbolProperty59.js] diff --git a/tests/baselines/reference/symbolProperty6.js b/tests/baselines/reference/symbolProperty6.js new file mode 100644 index 00000000000..aee61b97435 --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.js @@ -0,0 +1,25 @@ +//// [symbolProperty6.ts] +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.iterator] = 0; + } + C.prototype[Symbol.isRegExp] = function () { }; + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty6.types b/tests/baselines/reference/symbolProperty6.types new file mode 100644 index 00000000000..e5aac6f48da --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty6.ts === +class C { +>C : C + + [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.unscopables]: number; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + + [Symbol.isRegExp]() { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty7.errors.txt b/tests/baselines/reference/symbolProperty7.errors.txt new file mode 100644 index 00000000000..652f637d852 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty7.ts (2 errors) ==== + class C { + [Symbol()] = 0; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [Symbol()]: number; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [Symbol()]() { } + get [Symbol()]() { + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty7.js b/tests/baselines/reference/symbolProperty7.js new file mode 100644 index 00000000000..781113572a1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.js @@ -0,0 +1,25 @@ +//// [symbolProperty7.ts] +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty7.js] +var C = (function () { + function C() { + this[Symbol()] = 0; + } + C.prototype[Symbol()] = function () { }; + Object.defineProperty(C.prototype, Symbol(), { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty8.js b/tests/baselines/reference/symbolProperty8.js new file mode 100644 index 00000000000..6f3ec6cfa26 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.js @@ -0,0 +1,7 @@ +//// [symbolProperty8.ts] +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} + +//// [symbolProperty8.js] diff --git a/tests/baselines/reference/symbolProperty8.types b/tests/baselines/reference/symbolProperty8.types new file mode 100644 index 00000000000..d6c2f464b53 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty8.ts === +interface I { +>I : I + + [Symbol.unscopables]: number; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + + [Symbol.isRegExp](); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolProperty9.errors.txt b/tests/baselines/reference/symbolProperty9.errors.txt new file mode 100644 index 00000000000..e621ab6c5a6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty9.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty9.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty9.js b/tests/baselines/reference/symbolProperty9.js new file mode 100644 index 00000000000..f97a1d44a21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.js @@ -0,0 +1,21 @@ +//// [symbolProperty9.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty9.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolType1.errors.txt b/tests/baselines/reference/symbolType1.errors.txt new file mode 100644 index 00000000000..00873ccc871 --- /dev/null +++ b/tests/baselines/reference/symbolType1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolType1.ts(1,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType1.ts(2,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/es6/Symbols/symbolType1.ts(4,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + + +==== tests/cases/conformance/es6/Symbols/symbolType1.ts (3 errors) ==== + Symbol() instanceof Symbol; + ~~~~~~~~ +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. + Symbol instanceof Symbol(); + ~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + (Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types + Symbol instanceof (Symbol() || {}); + ~~~~~~~~~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType1.js b/tests/baselines/reference/symbolType1.js new file mode 100644 index 00000000000..90fb5405162 --- /dev/null +++ b/tests/baselines/reference/symbolType1.js @@ -0,0 +1,11 @@ +//// [symbolType1.ts] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); + +//// [symbolType1.js] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); diff --git a/tests/baselines/reference/symbolType10.errors.txt b/tests/baselines/reference/symbolType10.errors.txt new file mode 100644 index 00000000000..852f863bae8 --- /dev/null +++ b/tests/baselines/reference/symbolType10.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType10.ts (8 errors) ==== + var s = Symbol.for("bitwise"); + s & s; + ~ +!!! 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. + s | s; + ~ +!!! 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. + s ^ s; + ~ +!!! 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. + + s & 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 | s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType10.js b/tests/baselines/reference/symbolType10.js new file mode 100644 index 00000000000..378479fb70f --- /dev/null +++ b/tests/baselines/reference/symbolType10.js @@ -0,0 +1,16 @@ +//// [symbolType10.ts] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; + +//// [symbolType10.js] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; +s & 0; +0 | s; diff --git a/tests/baselines/reference/symbolType11.js b/tests/baselines/reference/symbolType11.js new file mode 100644 index 00000000000..3328be28d15 --- /dev/null +++ b/tests/baselines/reference/symbolType11.js @@ -0,0 +1,17 @@ +//// [symbolType11.ts] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; + +//// [symbolType11.js] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types new file mode 100644 index 00000000000..21de110854c --- /dev/null +++ b/tests/baselines/reference/symbolType11.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolType11.ts === +var s = Symbol.for("logical"); +>s : symbol +>Symbol.for("logical") : symbol +>Symbol.for : (key: string) => symbol +>Symbol : SymbolConstructor +>for : (key: string) => symbol + +s && s; +>s && s : symbol +>s : symbol +>s : symbol + +s && []; +>s && [] : undefined[] +>s : symbol +>[] : undefined[] + +0 && s; +>0 && s : symbol +>s : symbol + +s || s; +>s || s : symbol +>s : symbol +>s : symbol + +s || 1; +>s || 1 : number | symbol +>s : symbol + +({}) || s; +>({}) || s : {} +>({}) : {} +>{} : {} +>s : symbol + diff --git a/tests/baselines/reference/symbolType12.errors.txt b/tests/baselines/reference/symbolType12.errors.txt new file mode 100644 index 00000000000..adceb58ae56 --- /dev/null +++ b/tests/baselines/reference/symbolType12.errors.txt @@ -0,0 +1,136 @@ +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.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/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.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/conformance/es6/Symbols/symbolType12.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(22,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType12.ts (35 errors) ==== + var s = Symbol.for("assign"); + var str = ""; + s *= s; + ~ +!!! 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. + s *= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s /= s; + ~ +!!! 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. + s /= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s %= s; + ~ +!!! 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. + s %= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s += s; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. + s += 0; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. + s += ""; + ~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. + str += s; + ~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. + s -= s; + ~ +!!! 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. + s -= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s <<= s; + ~ +!!! 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. + s <<= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>= s; + ~ +!!! 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. + s >>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>>= s; + ~ +!!! 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. + s >>>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s &= s; + ~ +!!! 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. + s &= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^= s; + ~ +!!! 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. + s ^= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s |= s; + ~ +!!! 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. + s |= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + str += (s || str); + ~~~~~~~~~~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType12.js b/tests/baselines/reference/symbolType12.js new file mode 100644 index 00000000000..069846e136f --- /dev/null +++ b/tests/baselines/reference/symbolType12.js @@ -0,0 +1,58 @@ +//// [symbolType12.ts] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +str += (s || str); + +//// [symbolType12.js] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; +str += (s || str); diff --git a/tests/baselines/reference/symbolType13.errors.txt b/tests/baselines/reference/symbolType13.errors.txt new file mode 100644 index 00000000000..68981d0072b --- /dev/null +++ b/tests/baselines/reference/symbolType13.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/Symbols/symbolType13.ts(4,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/es6/Symbols/symbolType13.ts(5,11): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType13.ts(6,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + +==== tests/cases/conformance/es6/Symbols/symbolType13.ts (3 errors) ==== + var s = Symbol(); + var x: any; + + for (s in {}) { } + ~ +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. + for (x in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + for (var y in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType13.js b/tests/baselines/reference/symbolType13.js new file mode 100644 index 00000000000..afd62079bb5 --- /dev/null +++ b/tests/baselines/reference/symbolType13.js @@ -0,0 +1,14 @@ +//// [symbolType13.ts] +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } + +//// [symbolType13.js] +var s = Symbol(); +var x; +for (s in {}) { } +for (x in s) { } +for (var y in s) { } diff --git a/tests/baselines/reference/symbolType14.errors.txt b/tests/baselines/reference/symbolType14.errors.txt new file mode 100644 index 00000000000..a31230efe23 --- /dev/null +++ b/tests/baselines/reference/symbolType14.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType14.ts(1,1): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/conformance/es6/Symbols/symbolType14.ts (1 errors) ==== + new Symbol(); + ~~~~~~~~~~~~ +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType14.js b/tests/baselines/reference/symbolType14.js new file mode 100644 index 00000000000..4bbd24f30d9 --- /dev/null +++ b/tests/baselines/reference/symbolType14.js @@ -0,0 +1,5 @@ +//// [symbolType14.ts] +new Symbol(); + +//// [symbolType14.js] +new Symbol(); diff --git a/tests/baselines/reference/symbolType15.errors.txt b/tests/baselines/reference/symbolType15.errors.txt new file mode 100644 index 00000000000..eb63e5798d5 --- /dev/null +++ b/tests/baselines/reference/symbolType15.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/Symbols/symbolType15.ts(5,1): error TS2322: Type 'Symbol' is not assignable to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType15.ts (1 errors) ==== + var sym: symbol; + var symObj: Symbol; + + symObj = sym; + sym = symObj; + ~~~ +!!! error TS2322: Type 'Symbol' is not assignable to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType15.js b/tests/baselines/reference/symbolType15.js new file mode 100644 index 00000000000..1c3519d603e --- /dev/null +++ b/tests/baselines/reference/symbolType15.js @@ -0,0 +1,12 @@ +//// [symbolType15.ts] +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; + +//// [symbolType15.js] +var sym; +var symObj; +symObj = sym; +sym = symObj; diff --git a/tests/baselines/reference/symbolType16.js b/tests/baselines/reference/symbolType16.js new file mode 100644 index 00000000000..65a95dd8365 --- /dev/null +++ b/tests/baselines/reference/symbolType16.js @@ -0,0 +1,11 @@ +//// [symbolType16.ts] +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; + +//// [symbolType16.js] +var sym; +sym.newSymbolProp; diff --git a/tests/baselines/reference/symbolType16.types b/tests/baselines/reference/symbolType16.types new file mode 100644 index 00000000000..91fdc9978da --- /dev/null +++ b/tests/baselines/reference/symbolType16.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolType16.ts === +interface Symbol { +>Symbol : Symbol + + newSymbolProp: number; +>newSymbolProp : number +} + +var sym: symbol; +>sym : symbol + +sym.newSymbolProp; +>sym.newSymbolProp : number +>sym : symbol +>newSymbolProp : number + diff --git a/tests/baselines/reference/symbolType17.js b/tests/baselines/reference/symbolType17.js new file mode 100644 index 00000000000..a00d2cb36f7 --- /dev/null +++ b/tests/baselines/reference/symbolType17.js @@ -0,0 +1,21 @@ +//// [symbolType17.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} + +//// [symbolType17.js] +var x; +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType17.types b/tests/baselines/reference/symbolType17.types new file mode 100644 index 00000000000..b86d5a70ff7 --- /dev/null +++ b/tests/baselines/reference/symbolType17.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType17.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "symbol") { +>typeof x === "symbol" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : symbol +} +else { + x; +>x : Foo +} diff --git a/tests/baselines/reference/symbolType18.js b/tests/baselines/reference/symbolType18.js new file mode 100644 index 00000000000..f8a784d2500 --- /dev/null +++ b/tests/baselines/reference/symbolType18.js @@ -0,0 +1,21 @@ +//// [symbolType18.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} + +//// [symbolType18.js] +var x; +x; +if (typeof x === "object") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType18.types b/tests/baselines/reference/symbolType18.types new file mode 100644 index 00000000000..1693c6e2499 --- /dev/null +++ b/tests/baselines/reference/symbolType18.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType18.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : Foo +} +else { + x; +>x : symbol | Foo +} diff --git a/tests/baselines/reference/symbolType19.js b/tests/baselines/reference/symbolType19.js new file mode 100644 index 00000000000..f3ba0e12472 --- /dev/null +++ b/tests/baselines/reference/symbolType19.js @@ -0,0 +1,24 @@ +//// [symbolType19.ts] +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} + +//// [symbolType19.js] +var E; +(function (E) { +})(E || (E = {})); +var x; +x; +if (typeof x === "number") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType19.types b/tests/baselines/reference/symbolType19.types new file mode 100644 index 00000000000..d01fbfa87fe --- /dev/null +++ b/tests/baselines/reference/symbolType19.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolType19.ts === +enum E { } +>E : E + +var x: symbol | E; +>x : symbol | E +>E : E + +x; +>x : symbol | E + +if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : symbol | E + + x; +>x : E +} +else { + x; +>x : symbol +} diff --git a/tests/baselines/reference/symbolType2.errors.txt b/tests/baselines/reference/symbolType2.errors.txt new file mode 100644 index 00000000000..441db917718 --- /dev/null +++ b/tests/baselines/reference/symbolType2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/Symbols/symbolType2.ts(2,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter + + +==== tests/cases/conformance/es6/Symbols/symbolType2.ts (1 errors) ==== + Symbol.isConcatSpreadable in {}; + "" in Symbol.toPrimitive; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/symbolType2.js b/tests/baselines/reference/symbolType2.js new file mode 100644 index 00000000000..e15e4da626e --- /dev/null +++ b/tests/baselines/reference/symbolType2.js @@ -0,0 +1,7 @@ +//// [symbolType2.ts] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; + +//// [symbolType2.js] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; diff --git a/tests/baselines/reference/symbolType20.errors.txt b/tests/baselines/reference/symbolType20.errors.txt new file mode 100644 index 00000000000..41345e371f8 --- /dev/null +++ b/tests/baselines/reference/symbolType20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType20.ts(1,11): error TS2427: Interface name cannot be 'symbol' + + +==== tests/cases/conformance/es6/Symbols/symbolType20.ts (1 errors) ==== + interface symbol { } + ~~~~~~ +!!! error TS2427: Interface name cannot be 'symbol' \ No newline at end of file diff --git a/tests/baselines/reference/symbolType20.js b/tests/baselines/reference/symbolType20.js new file mode 100644 index 00000000000..cf80d0d30ac --- /dev/null +++ b/tests/baselines/reference/symbolType20.js @@ -0,0 +1,4 @@ +//// [symbolType20.ts] +interface symbol { } + +//// [symbolType20.js] diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt new file mode 100644 index 00000000000..7cc9e82b3b3 --- /dev/null +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(8,3): error TS2469: The '-' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== + var s = Symbol(); + delete Symbol.iterator; + void Symbol.toPrimitive; + typeof Symbol.toStringTag; + ++s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + --s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + Symbol(); + ~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + - Symbol(); + ~~~~~~~~ +!!! error TS2469: The '-' operator cannot be applied to type 'symbol'. + ~ Symbol(); + ~~~~~~~~ +!!! error TS2469: The '~' operator cannot be applied to type 'symbol'. + ! Symbol(); + + +(Symbol() || 0); + ~~~~~~~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.js b/tests/baselines/reference/symbolType3.js new file mode 100644 index 00000000000..4f599dacbe0 --- /dev/null +++ b/tests/baselines/reference/symbolType3.js @@ -0,0 +1,26 @@ +//// [symbolType3.ts] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + ++(Symbol() || 0); + +//// [symbolType3.js] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++Symbol(); +-Symbol(); +~Symbol(); +!Symbol(); ++(Symbol() || 0); diff --git a/tests/baselines/reference/symbolType4.errors.txt b/tests/baselines/reference/symbolType4.errors.txt new file mode 100644 index 00000000000..210fe94b8d7 --- /dev/null +++ b/tests/baselines/reference/symbolType4.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolType4.ts(2,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType4.ts(3,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType4.ts (2 errors) ==== + var s = Symbol.for("postfix"); + s++; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + s--; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType4.js b/tests/baselines/reference/symbolType4.js new file mode 100644 index 00000000000..321de5a3bf9 --- /dev/null +++ b/tests/baselines/reference/symbolType4.js @@ -0,0 +1,9 @@ +//// [symbolType4.ts] +var s = Symbol.for("postfix"); +s++; +s--; + +//// [symbolType4.js] +var s = Symbol.for("postfix"); +s++; +s--; diff --git a/tests/baselines/reference/symbolType5.errors.txt b/tests/baselines/reference/symbolType5.errors.txt new file mode 100644 index 00000000000..af70aad0f26 --- /dev/null +++ b/tests/baselines/reference/symbolType5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType5.ts (8 errors) ==== + var s = Symbol.for("multiply"); + s * s; + ~ +!!! 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. + s / s; + ~ +!!! 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. + s % s; + ~ +!!! 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. + + s * 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 / s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType5.js b/tests/baselines/reference/symbolType5.js new file mode 100644 index 00000000000..ce76e034bd9 --- /dev/null +++ b/tests/baselines/reference/symbolType5.js @@ -0,0 +1,16 @@ +//// [symbolType5.ts] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; + +//// [symbolType5.js] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; +s * 0; +0 / s; diff --git a/tests/baselines/reference/symbolType6.errors.txt b/tests/baselines/reference/symbolType6.errors.txt new file mode 100644 index 00000000000..29d894c2afb --- /dev/null +++ b/tests/baselines/reference/symbolType6.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/es6/Symbols/symbolType6.ts(3,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType6.ts (13 errors) ==== + var s = Symbol.for("add"); + var a: any; + s + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. + s - s; + ~ +!!! 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. + s + ""; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + s + a; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + s + 0; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. + "" + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + a + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + 0 + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. + s - 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 - s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (s || "") + ""; + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + "" + (s || ""); + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType6.js b/tests/baselines/reference/symbolType6.js new file mode 100644 index 00000000000..b316f48cf03 --- /dev/null +++ b/tests/baselines/reference/symbolType6.js @@ -0,0 +1,32 @@ +//// [symbolType6.ts] +var s = Symbol.for("add"); +var a: any; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; + +(s || "") + ""; +"" + (s || ""); + +//// [symbolType6.js] +var s = Symbol.for("add"); +var a; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; +(s || "") + ""; +"" + (s || ""); diff --git a/tests/baselines/reference/symbolType7.errors.txt b/tests/baselines/reference/symbolType7.errors.txt new file mode 100644 index 00000000000..80ecd2486ff --- /dev/null +++ b/tests/baselines/reference/symbolType7.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.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/conformance/es6/Symbols/symbolType7.ts (9 errors) ==== + var s = Symbol.for("shift"); + s << s; + ~ +!!! 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. + s << 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >> s; + ~ +!!! 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. + s >> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>> s; + ~ +!!! 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. + s >>> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType7.js b/tests/baselines/reference/symbolType7.js new file mode 100644 index 00000000000..47ace567a3d --- /dev/null +++ b/tests/baselines/reference/symbolType7.js @@ -0,0 +1,17 @@ +//// [symbolType7.ts] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; + +//// [symbolType7.js] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; diff --git a/tests/baselines/reference/symbolType8.errors.txt b/tests/baselines/reference/symbolType8.errors.txt new file mode 100644 index 00000000000..8df7db61feb --- /dev/null +++ b/tests/baselines/reference/symbolType8.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/es6/Symbols/symbolType8.ts(2,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(3,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(4,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(5,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(6,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(7,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(8,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(9,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(11,6): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(12,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType8.ts (10 errors) ==== + var s = Symbol.for("compare"); + s < s; + ~ +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. + s < 0; + ~ +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. + s > s; + ~ +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. + s > 0; + ~ +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. + s <= s; + ~ +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. + s <= 0; + ~ +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. + s >= s; + ~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + s >= 0; + ~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + + 0 >= (s || 0); + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + (s || 0) >= s; + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType8.js b/tests/baselines/reference/symbolType8.js new file mode 100644 index 00000000000..7e56416ca84 --- /dev/null +++ b/tests/baselines/reference/symbolType8.js @@ -0,0 +1,26 @@ +//// [symbolType8.ts] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; + +//// [symbolType8.js] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; +0 >= (s || 0); +(s || 0) >= s; diff --git a/tests/baselines/reference/symbolType9.errors.txt b/tests/baselines/reference/symbolType9.errors.txt new file mode 100644 index 00000000000..5506fdc6f9d --- /dev/null +++ b/tests/baselines/reference/symbolType9.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType9.ts (4 errors) ==== + var s = Symbol.for("equal"); + s == s; + s == true; + ~~~~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. + s != s; + 0 != s; + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. + s === s; + s === 1; + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. + s !== s; + false !== s; + ~~~~~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType9.js b/tests/baselines/reference/symbolType9.js new file mode 100644 index 00000000000..c9b0c801cc8 --- /dev/null +++ b/tests/baselines/reference/symbolType9.js @@ -0,0 +1,21 @@ +//// [symbolType9.ts] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; + +//// [symbolType9.js] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.js b/tests/baselines/reference/taggedTemplateContextualTyping1.js index 173d0f56bb7..17618b50e8b 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.js @@ -26,28 +26,7 @@ function tempTag1(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag1 `${x => { - x(undefined); - return x; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${(y) => { - y(undefined); - return y; -}}${undefined}`; -tempTag1 `${(x) => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${undefined}`; +tempTag1 `${x => { x(undefined); return x; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${y => { y(undefined); return y; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${(y) => { y(undefined); return y; }}${undefined}`; +tempTag1 `${(x) => { x(undefined); return x; }}${y => { y(undefined); return y; }}${undefined}`; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.js b/tests/baselines/reference/taggedTemplateContextualTyping2.js index 1eed600da4c..8adea53f470 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.js @@ -25,18 +25,6 @@ function tempTag2(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag2 `${x => { - x(undefined); - return x; -}}${0}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${y => { - y(null); - return y; -}}${"hello"}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${undefined}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${0}`; +tempTag2 `${x => { x(undefined); return x; }}${y => { y(null); return y; }}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${undefined}${"hello"}`; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 5b078893c6e..dd3cb161317 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -136,11 +136,17 @@ function someGenerics7(strs, a, b, c) { } (_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); (_v = ["", "", "", ""], _v.raw = ["", "", "", ""], someGenerics7(_v, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with argument of generic function type +<<<<<<< HEAD function someGenerics8(strs, n) { return n; } var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7)); (_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null)); +======= +function someGenerics8(strs, n) { return n; } +var x = someGenerics8 "" + someGenerics7; +x "" + null + null + null; +>>>>>>> master // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs, a, b, c) { return null; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js index 25203c40d91..3f1817c6419 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js @@ -135,9 +135,7 @@ someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${(n) => { return n; }}${(n) => { return n; }}${(n) => { return n; }}`; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 `${someGenerics7}`; x `${null}${null}${null}`; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index dfb4bf43b35..a393ba28a6a 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -74,6 +74,7 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3.js] +<<<<<<< HEAD function fn1() { return null; } @@ -85,11 +86,21 @@ function fn2() { } var d1 = (_c = ["", "", ""], _c.raw = ["", "", ""], fn2(_c, 0, undefined)); // contextually typed var d2 = (_d = ["", "", ""], _d.raw = ["", "", ""], fn2(_d, 0, undefined)); // any +======= +function fn1() { return null; } +var s = fn1 "" + undefined; +// No candidate overloads found +fn1 "" + {}; // Error +function fn2() { return undefined; } +var d1 = fn2 "" + 0 + undefined; // contextually typed +var d2 = fn2 "" + 0 + undefined; // any +>>>>>>> master d1.foo(); // error d2(); // no error (typed as any) // Generic and non-generic overload where generic overload is the only candidate (_e = ["", "", ""], _e.raw = ["", "", ""], fn2(_e, 0, '')); // OK // Generic and non-generic overload where non-generic overload is the only candidate +<<<<<<< HEAD (_f = ["", "", ""], _f.raw = ["", "", ""], fn2(_f, '', 0)); // OK function fn3() { return null; @@ -97,6 +108,13 @@ function fn3() { var s = (_g = ["", ""], _g.raw = ["", ""], fn3(_g, 3)); var s = (_h = ["", "", "", ""], _h.raw = ["", "", "", ""], fn3(_h, '', 3, '')); var n = (_j = ["", "", "", ""], _j.raw = ["", "", "", ""], fn3(_j, 5, 5, 5)); +======= +fn2 "" + '' + 0; // OK +function fn3() { return null; } +var s = fn3 "" + 3; +var s = fn3 "" + '' + 3 + ''; +var n = fn3 "" + 5 + 5 + 5; +>>>>>>> master var n; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4)); @@ -113,6 +131,7 @@ function fn4() { } // Generic overloads with constraints called with type arguments that do not satisfy the constraints (_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints +<<<<<<< HEAD (_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null)); (_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true)); function fn5() { @@ -121,3 +140,10 @@ function fn5() { (_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. (_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { return n.substr(0); })); var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; +======= +fn4 "" + true + null; +fn4 "" + null + true; +function fn5() { return undefined; } +fn5 "" + function (n) { return n.toFixed(); }; // will error; 'n' should have type 'string'. +fn5 "" + function (n) { return n.substr(0); }; +>>>>>>> master diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js index 75a01df6af6..8bcc426627d 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js @@ -73,15 +73,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3_ES6.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 `${undefined}`; // No candidate overloads found fn1 `${{}}`; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 `${0}${undefined}`; // contextually typed var d2 = fn2 `${0}${undefined}`; // any d1.foo(); // error @@ -90,9 +86,7 @@ d2(); // no error (typed as any) fn2 `${0}${''}`; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${''}${0}`; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 `${3}`; var s = fn3 `${''}${3}${''}`; var n = fn3 `${5}${5}${5}`; @@ -114,8 +108,6 @@ fn4 `${null}${null}`; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${true}${null}`; fn4 `${null}${true}`; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 `${(n) => { return n.toFixed(); }}`; // will error; 'n' should have type 'string'. fn5 `${(n) => { return n.substr(0); }}`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index 10a8f1f2a12..6552476a8f1 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -13,7 +13,11 @@ function foo() { rest[_i - 0] = arguments[_i]; } } +<<<<<<< HEAD (_a = ["", ""], _a.raw = ["", ""], foo(_a, function (x) { x = "bad"; })); var _a; +======= +foo "" + function (x) { x = "bad"; }; +>>>>>>> master diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index bc18a600458..7691b83b3bc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -8,6 +8,4 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] function foo(...rest) { } -foo `${function (x) { - x = "bad"; -}}`; +foo `${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/targetTypeArgs.js b/tests/baselines/reference/targetTypeArgs.js index 1a05a6d6f31..18dff375abe 100644 --- a/tests/baselines/reference/targetTypeArgs.js +++ b/tests/baselines/reference/targetTypeArgs.js @@ -18,24 +18,10 @@ foo(function(x) { x }); function foo(callback) { callback("hello"); } -foo(function (x) { - x; -}); -[1].forEach(function (v, i, a) { - v; -}); -["hello"].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -["s"].every(function (v, i, a) { - return true; -}); -["s"].forEach(function (v, i, a) { - v; -}); +foo(function (x) { x; }); +[1].forEach(function (v, i, a) { v; }); +["hello"].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +["s"].every(function (v, i, a) { return true; }); +["s"].forEach(function (v, i, a) { v; }); diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index b09d4960d01..c886183bacf 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -31,18 +31,12 @@ var Foo = (function () { } return Foo; })(); -foo(function (s) { - s = 5; -}); // Error, can’t assign number to string -new Foo(function (s) { - s = 5; -}); // error, if types are applied correctly +foo(function (s) { s = 5; }); // Error, can’t assign number to string +new Foo(function (s) { s = 5; }); // error, if types are applied correctly var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.call(this, function (s) { - s = 5; - }); + _super.call(this, function (s) { s = 5; }); } return Bar; })(Foo); // error, if types are applied correctly diff --git a/tests/baselines/reference/targetTypeCalls.js b/tests/baselines/reference/targetTypeCalls.js index 302419a2693..168195216ca 100644 --- a/tests/baselines/reference/targetTypeCalls.js +++ b/tests/baselines/reference/targetTypeCalls.js @@ -6,27 +6,7 @@ var fra3: (v:any)=>string = function() { return function() { return function(v) var fra4: (v:any)=>void = function() { return function() { return function(v) {return v;};}(); }() // should work //// [targetTypeCalls.js] -var fra1 = function () { - return function (v) { - return v; - }; -}(); // should work -var fra2 = function () { - return function () { - return 0; - }; -}(); // should work -var fra3 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work -var fra4 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work +var fra1 = function () { return function (v) { return v; }; }(); // should work +var fra2 = function () { return function () { return 0; }; }(); // should work +var fra3 = function () { return function () { return function (v) { return v; }; }(); }(); // should work +var fra4 = function () { return function () { return function (v) { return v; }; }(); }(); // should work diff --git a/tests/baselines/reference/targetTypeCastTest.js b/tests/baselines/reference/targetTypeCastTest.js index c9a30c6d685..053aced7305 100644 --- a/tests/baselines/reference/targetTypeCastTest.js +++ b/tests/baselines/reference/targetTypeCastTest.js @@ -28,12 +28,8 @@ function Point(x, y) { this.x = x; this.y = y; } -var add = function (x, y) { - return x + y; -}; +var add = function (x, y) { return x + y; }; var add2 = function (x, y) { return 0; }; -function add3(x, y) { - x; -} +function add3(x, y) { x; } diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 94af7579fbb..8f9657ee9d0 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -80,9 +80,7 @@ function Point(x, y) { this.x = x; this.y = y; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var x = EF1(1, 2); // Point.origin declared as type Point Point.origin = new Point(0, 0); @@ -110,6 +108,10 @@ function C(a, b) { this.a = a; this.b = b; } -C.prototype = { a: 0, b: 0, C1M1: function (c, d) { - return (this.a + c) + (this.b + d); -} }; +C.prototype = + { a: 0, + b: 0, + C1M1: function (c, d) { + return (this.a + c) + (this.b + d); + } + }; diff --git a/tests/baselines/reference/targetTypeTest2.js b/tests/baselines/reference/targetTypeTest2.js index c6f940572ef..0ba82bc9cce 100644 --- a/tests/baselines/reference/targetTypeTest2.js +++ b/tests/baselines/reference/targetTypeTest2.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest2.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeTest3.js b/tests/baselines/reference/targetTypeTest3.js index 53e5691ab49..13972478582 100644 --- a/tests/baselines/reference/targetTypeTest3.js +++ b/tests/baselines/reference/targetTypeTest3.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest3.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; // should produce an error -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeVoidFunc.js b/tests/baselines/reference/targetTypeVoidFunc.js index 9913b4bd491..dba2086b0e1 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.js +++ b/tests/baselines/reference/targetTypeVoidFunc.js @@ -9,9 +9,7 @@ var z = new (f1())(); //// [targetTypeVoidFunc.js] function f1() { - return function () { - return; - }; + return function () { return; }; } ; var x = f1(); diff --git a/tests/baselines/reference/targetTypingOnFunctions.js b/tests/baselines/reference/targetTypingOnFunctions.js index 5b11a34ff4d..fad75a4bf6d 100644 --- a/tests/baselines/reference/targetTypingOnFunctions.js +++ b/tests/baselines/reference/targetTypingOnFunctions.js @@ -4,9 +4,5 @@ var fu: (s: string) => string = function (s) { return s.toLowerCase() }; var zu = fu = function (s) { return s.toLowerCase() }; //// [targetTypingOnFunctions.js] -var fu = function (s) { - return s.toLowerCase(); -}; -var zu = fu = function (s) { - return s.toLowerCase(); -}; +var fu = function (s) { return s.toLowerCase(); }; +var zu = fu = function (s) { return s.toLowerCase(); }; diff --git a/tests/baselines/reference/templateStringInEqualityChecks.js b/tests/baselines/reference/templateStringInEqualityChecks.js index 54f5fa610c2..ca9fc2ed80b 100644 --- a/tests/baselines/reference/templateStringInEqualityChecks.js +++ b/tests/baselines/reference/templateStringInEqualityChecks.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecks.js] -var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && "abc" + 0 + "abc" == "abc0abc" && "abc0abc" !== "abc" + 0 + "abc"; +var x = "abc" + 0 + "abc" === "abc" || + "abc" !== "abc" + 0 + "abc" && + "abc" + 0 + "abc" == "abc0abc" && + "abc0abc" !== "abc" + 0 + "abc"; diff --git a/tests/baselines/reference/templateStringInEqualityChecksES6.js b/tests/baselines/reference/templateStringInEqualityChecksES6.js index 317db1ab366..db00827fac5 100644 --- a/tests/baselines/reference/templateStringInEqualityChecksES6.js +++ b/tests/baselines/reference/templateStringInEqualityChecksES6.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecksES6.js] -var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc`; +var x = `abc${0}abc` === `abc` || + `abc` !== `abc${0}abc` && + `abc${0}abc` == "abc0abc" && + "abc0abc" !== `abc${0}abc`; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index 5a096b0adfa..92a03415d84 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -5,8 +5,13 @@ var x = { } //// [templateStringInObjectLiteral.js] +<<<<<<< HEAD var x = (_a = ["b"], _a.raw = ["b"], ({ a: "abc" + 123 + "def" })(_a)); +======= +var x = { + a: "abc" + 123 + "def" } "b"; +>>>>>>> master 321; var _a; diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.js b/tests/baselines/reference/templateStringInObjectLiteralES6.js index 22144e75247..7de012185a9 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.js +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteralES6.js] var x = { - a: `abc${123}def`, -} `b`; + a: `abc${123}def`, } `b`; 321; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js index 3447ff87ac3..88a8349d1a4 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpression.js] -var x = "abc" + function y() { - return y; -} + "def"; +var x = "abc" + function y() { return y; } + "def"; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js index 46e37c0ac18..f0e2f749cfd 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpressionES6.js] -var x = `abc${function y() { - return y; -}}def`; +var x = `abc${function y() { return y; }}def`; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index ef113312060..72d0fd8c8db 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -4,6 +4,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] -"" + function (x) { - x = "bad"; -}; +"" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index 9ce47348dc1..18fae66c78a 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -3,6 +3,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] -`${function (x) { - x = "bad"; -}}`; +`${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/thisBinding2.js b/tests/baselines/reference/thisBinding2.js index ced47c0bc7b..76b99797e16 100644 --- a/tests/baselines/reference/thisBinding2.js +++ b/tests/baselines/reference/thisBinding2.js @@ -40,8 +40,6 @@ var messenger = { message: "Hello World", start: function () { var _this = this; - return setTimeout(function () { - var x = _this.message; - }, 3000); + return setTimeout(function () { var x = _this.message; }, 3000); } }; diff --git a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js index fb917edf753..78b06d30dd2 100644 --- a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js +++ b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js @@ -10,9 +10,7 @@ var C = (function () { } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this; - }); + [1, 2, 3].map(function (x) { return _this; }); }; return C; })(); diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 36ee45b1110..3f1bac98075 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -100,15 +100,11 @@ var A = (function () { } }; this.prop4 = { - a: function () { - return this; - } + a: function () { return this; } }; this.prop5 = function () { return { - a: function () { - return this; - } + a: function () { return this; } }; }; } @@ -120,18 +116,17 @@ var B = (function () { this.prop1 = this; this.prop2 = function () { return _this; }; this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; }; - this.prop4 = ' ' + function () { - } + ' ' + (function () { return function () { return function () { return _this; }; }; }); + this.prop4 = ' ' + + function () { + } + + ' ' + + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { - a: function () { - return _this; - } + a: function () { return _this; } }; this.prop6 = function () { return { - a: function () { - return _this; - } + a: function () { return _this; } }; }; } diff --git a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js index d6718a56106..99341af9f86 100644 --- a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js +++ b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js @@ -10,7 +10,7 @@ function test() //// [thisReferencedInFunctionInsideArrowFunction1.js] var foo = function (dummy) { }; function test() { - foo(function () { return function () { - return this; - }; }); + foo(function () { + return function () { return this; }; + }); } diff --git a/tests/baselines/reference/throwInEnclosingStatements.js b/tests/baselines/reference/throwInEnclosingStatements.js index b52926e651e..0b072434f33 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.js +++ b/tests/baselines/reference/throwInEnclosingStatements.js @@ -50,9 +50,7 @@ var aa = { function fn(x) { throw x; } -(function (x) { - throw x; -}); +(function (x) { throw x; }); var y; switch (y) { case 'a': diff --git a/tests/baselines/reference/throwStatements.js b/tests/baselines/reference/throwStatements.js index 146d1232792..83663d08cc4 100644 --- a/tests/baselines/reference/throwStatements.js +++ b/tests/baselines/reference/throwStatements.js @@ -97,9 +97,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -108,9 +106,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; @@ -155,9 +151,7 @@ throw false; throw null; throw undefined; throw 'a string'; -throw function () { - return 'a string'; -}; +throw function () { return 'a string'; }; throw function (x) { return 42; }; throw { x: 12, y: 13 }; throw []; diff --git a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js index 8aa23c82469..4b00c5fd0f2 100644 --- a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js +++ b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js @@ -19,10 +19,6 @@ var r1b = _.map(c2, rf1); //// [tooFewArgumentsInGenericFunctionTypedArgument.js] var c2; var _; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); -var rf1 = function (x) { - return x.toFixed(); -}; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); +var rf1 = function (x) { return x.toFixed(); }; var r1b = _.map(c2, rf1); diff --git a/tests/baselines/reference/topLevelExports.js b/tests/baselines/reference/topLevelExports.js index 0f539310b15..91e28b6a976 100644 --- a/tests/baselines/reference/topLevelExports.js +++ b/tests/baselines/reference/topLevelExports.js @@ -8,8 +8,6 @@ void log(foo).toString(); //// [topLevelExports.js] define(["require", "exports"], function (require, exports) { exports.foo = 3; - function log(n) { - return n; - } + function log(n) { return n; } void log(exports.foo).toString(); }); diff --git a/tests/baselines/reference/topLevelLambda.js b/tests/baselines/reference/topLevelLambda.js index 756a42b4340..3c4f1a3bc84 100644 --- a/tests/baselines/reference/topLevelLambda.js +++ b/tests/baselines/reference/topLevelLambda.js @@ -8,7 +8,5 @@ module M { var M; (function (M) { var _this = this; - var f = function () { - _this.window; - }; + var f = function () { _this.window; }; })(M || (M = {})); diff --git a/tests/baselines/reference/topLevelLambda3.js b/tests/baselines/reference/topLevelLambda3.js index 1505e38956a..0314b356b0f 100644 --- a/tests/baselines/reference/topLevelLambda3.js +++ b/tests/baselines/reference/topLevelLambda3.js @@ -3,6 +3,4 @@ var f = () => {this.window;} //// [topLevelLambda3.js] var _this = this; -var f = function () { - _this.window; -}; +var f = function () { _this.window; }; diff --git a/tests/baselines/reference/twoAccessorsWithSameName.js b/tests/baselines/reference/twoAccessorsWithSameName.js index 2d15bf6a02a..1e447ea1205 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName.js +++ b/tests/baselines/reference/twoAccessorsWithSameName.js @@ -39,9 +39,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.js b/tests/baselines/reference/twoAccessorsWithSameName2.js index b6ef280156d..847f83e6a70 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName2.js +++ b/tests/baselines/reference/twoAccessorsWithSameName2.js @@ -21,9 +21,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js index be252fe345b..cf5ddb23ccd 100644 --- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js +++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js @@ -29,8 +29,7 @@ var menuData = [ "type": "image", "link": "", "icon": "modules/menu/logo.svg" - }, - { + }, { "id": "productName", "type": "default", "link": "", diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.js b/tests/baselines/reference/typeArgumentConstraintResolution1.js index 64b1bfe5b6c..fd661dd812c 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.js +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.js @@ -15,7 +15,5 @@ foo2(""); // Type Date does not satisfy the constraint 'Number' for type p //// [typeArgumentConstraintResolution1.js] function foo1(test) { } foo1(""); // should error -function foo2(test) { - return null; -} +function foo2(test) { return null; } foo2(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number' diff --git a/tests/baselines/reference/typeArgumentInference.js b/tests/baselines/reference/typeArgumentInference.js index 65de6ea071f..1d10562ac7c 100644 --- a/tests/baselines/reference/typeArgumentInference.js +++ b/tests/baselines/reference/typeArgumentInference.js @@ -150,9 +150,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); x(null, null, null); // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.js b/tests/baselines/reference/typeArgumentInferenceOrdering.js index 53917844f66..96978bfd489 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.js +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.js @@ -16,9 +16,7 @@ interface Goo { //// [typeArgumentInferenceOrdering.js] -function foo(f) { - return null; -} +function foo(f) { return null; } var x = foo(new C()).x; // was Error that property x does not exist on type {} var C = (function () { function C() { diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js index 50d7767b5db..941c9330a5f 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js @@ -8,9 +8,7 @@ var e: Elephant; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal //// [typeArgumentInferenceWithConstraintAsCommonRoot.js] -function f(x, y) { - return undefined; -} +function f(x, y) { return undefined; } var g; var e; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js index f2300de8144..b8c051f0c37 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js @@ -160,9 +160,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); // Error x(null, null, null); // Error // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.js b/tests/baselines/reference/typeAssertionToGenericFunctionType.js index 1746cee3e85..15e5cf82f26 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.js +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.js @@ -9,9 +9,7 @@ x.b(); // error //// [typeAssertionToGenericFunctionType.js] var x = { a: (function (x) { return 1; }), - b: function (x) { - x; - } + b: function (x) { x; } }; x.a(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition x.b(); // error diff --git a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js index 9d387d850a7..9dad9fb671f 100644 --- a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js +++ b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js @@ -9,8 +9,8 @@ var functions = [function () { //// [typeCheckingInsideFunctionExpressionInArray.js] var functions = [function () { - var k = 10; - k = new Object(); - [1, 2, 3].NonexistantMethod(); - derp(); -}]; + var k = 10; + k = new Object(); + [1, 2, 3].NonexistantMethod(); + derp(); + }]; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index ebe84879d2b..e493df66ce6 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -142,7 +142,8 @@ function foo7(x) { } function foo8(x) { var b; - return typeof x === "string" ? x === "hello" : ((b = x) && (typeof x === "boolean" ? x // boolean + return typeof x === "string" ? x === "hello" : ((b = x) && + (typeof x === "boolean" ? x // boolean : x == 10)); // number } function foo9(x) { diff --git a/tests/baselines/reference/typeInfer1.js b/tests/baselines/reference/typeInfer1.js index f0b14a6b6c9..f9613298838 100644 --- a/tests/baselines/reference/typeInfer1.js +++ b/tests/baselines/reference/typeInfer1.js @@ -19,7 +19,5 @@ var x = { WriteLine: function (s) { } }; var yyyyyyyy = { - Moo: function () { - return "cow"; - } + Moo: function () { return "cow"; } }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index f262adb4e18..1fd624e4e5b 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -93,12 +93,8 @@ function f4() { a = { x: 1, y: _any }; a = { x: 1, y: _any, z: 1 }; a = { x: 1 }; // error - var mf = function m(n) { - return false; - }; - var zf = function z(n) { - return true; - }; + var mf = function m(n) { return false; }; + var zf = function z(n) { return true; }; mf = zf; mf(_any); zf(_any); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js index c54e8694c6e..9266f520867 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js @@ -29,18 +29,14 @@ foo2(1, ['']); //// [typeParameterAsTypeParameterConstraint.js] // using a type parameter as a constraint for a type parameter is valid // no errors expected except illegal constraints -function foo(x, y) { - return y; -} +function foo(x, y) { return y; } var r = foo(1, 2); var r = foo({}, 1); var a; var b; var r2 = foo(a, b); var r3 = foo({ x: 1 }, { x: 2, y: 3 }); -function foo2(x, y) { - return y; -} +function foo2(x, y) { return y; } foo2(1, ''); foo2({}, { length: 2 }); foo2(1, { width: 3, length: 2 }); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js index 9e1b3b1b3ec..e8066b9ebfa 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js @@ -21,16 +21,12 @@ foo2([], ['']); //// [typeParameterAsTypeParameterConstraint2.js] // using a type parameter as a constraint for a type parameter is invalid // these should be errors unless otherwise noted -function foo(x, y) { - return y; -} // this is now an error +function foo(x, y) { return y; } // this is now an error foo(1, ''); foo(1, {}); var n; var r3 = foo(1, n); -function foo2(x, y) { - return y; -} // this is now an error +function foo2(x, y) { return y; } // this is now an error foo2(1, { length: '' }); foo2(1, { length: {} }); foo2([], ['']); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js index 20cadec3981..bc50363036d 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js @@ -30,18 +30,14 @@ foo(b, b, { foo: 1, bar: '', hm: '' }); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, 3); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: '', z: true }); foo(a, b, c); foo(a, b, { foo: 1, bar: '', hm: true }); foo(function (x, y) { }, function (x) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(a, a, a); foo(a, b, c); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js index c63c1e9e13a..6541cfaa231 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js @@ -29,18 +29,14 @@ foo(c, c, a); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, ''); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: 2, z: true }); foo(a, b, a); foo(a, { foo: 1, bar: '', hm: true }, b); foo(function (x, y) { }, function (x, y) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(b, a, c); foo(c, c, a); diff --git a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js index 04fb7b1dc25..7e923941386 100644 --- a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js +++ b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js @@ -25,14 +25,10 @@ i2 = a2; // no error //// [typeParameterCompatibilityAccrossDeclarations.js] define(["require", "exports"], function (require, exports) { var a = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var a2 = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var i; var i2; diff --git a/tests/baselines/reference/typeParametersInStaticAccessors.js b/tests/baselines/reference/typeParametersInStaticAccessors.js index 2f9d8c795ff..c621de910bc 100644 --- a/tests/baselines/reference/typeParametersInStaticAccessors.js +++ b/tests/baselines/reference/typeParametersInStaticAccessors.js @@ -9,9 +9,7 @@ var foo = (function () { function foo() { } Object.defineProperty(foo, "Foo", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeQueryOnClass.js b/tests/baselines/reference/typeQueryOnClass.js index 5c881a5ced3..1c8b2424a7e 100644 --- a/tests/baselines/reference/typeQueryOnClass.js +++ b/tests/baselines/reference/typeQueryOnClass.js @@ -82,9 +82,7 @@ var C = (function () { enumerable: true, configurable: true }); - C.prototype.baz = function (x) { - return ''; - }; + C.prototype.baz = function (x) { return ''; }; Object.defineProperty(C.prototype, "ic", { get: function () { return 1; diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index d7c5a1a5edf..82af3eac26f 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -53,15 +53,11 @@ z: typeof M.n; //// [typeofOperatorWithBooleanType.js] // typeof operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index d40f09ee604..14b45ab518f 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof NUMBER1; // number type literal var ResultIsString3 = typeof 1; var ResultIsString4 = typeof { x: 1, y: 2 }; -var ResultIsString5 = typeof { x: 1, y: function (n) { - return n; -} }; +var ResultIsString5 = typeof { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index b3c3b748df6..381205ff8c1 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof STRING1; // string type literal var ResultIsString3 = typeof ""; var ResultIsString4 = typeof { x: "", y: "" }; -var ResultIsString5 = typeof { x: "", y: function (s) { - return s; -} }; +var ResultIsString5 = typeof { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js index 94211010677..f314f9ad111 100644 --- a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js +++ b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js @@ -11,6 +11,6 @@ var functions = [function() { //// [undefinedSymbolReferencedInArrayLiteral1.js] var tokens = [{ startIndex: deltaOffset }]; var functions = [function () { - [1, 2, 3].NonexistantMethod(); - anotherNonExistingMethod(); -}]; + [1, 2, 3].NonexistantMethod(); + anotherNonExistingMethod(); + }]; diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index b9bfe51533c..bbecbac4059 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -962,21 +962,15 @@ _.range(0, 30, 5); _.range(0, 30, 5); _.range(0); /////////////////////////////////////////////////////////////////////////////////////// -var func = function (greeting) { - return greeting + ': ' + this.name; -}; +var func = function (greeting) { return greeting + ': ' + this.name; }; // need a second var otherwise typescript thinks func signature is the above func type, // instead of the newly returned _bind => func type. var func2 = _.bind(func, { name: 'moe' }, 'hi'); func2(); var buttonView = { label: 'underscore', - onClick: function () { - alert('clicked: ' + this.label); - }, - onHover: function () { - alert('hovering: ' + this.label); - } + onClick: function () { alert('clicked: ' + this.label); }, + onHover: function () { alert('hovering: ' + this.label); } }; _.bindAll(buttonView); $('#underscore_button').bind('click', buttonView.onClick); @@ -985,9 +979,7 @@ var fibonacci = _.memoize(function (n) { }); var log = _.bind(function (message) { }, Date); _.delay(log, 1000, 'logged later'); -_.defer(function () { - alert('deferred'); -}); +_.defer(function () { alert('deferred'); }); var updatePosition = function () { return alert('updating position...'); }; var throttled = _.throttle(updatePosition, 100); $(null).scroll(throttled); @@ -1002,19 +994,11 @@ var notes; var render = function () { return alert("rendering..."); }; var renderNotes = _.after(notes.length, render); _.each(notes, function (note) { return note.asyncSave({ success: renderNotes }); }); -var hello = function (name) { - return "hello: " + name; -}; -hello = _.wrap(hello, function (func, arg) { - return "before, " + func(arg) + ", after"; -}); +var hello = function (name) { return "hello: " + name; }; +hello = _.wrap(hello, function (func, arg) { return "before, " + func(arg) + ", after"; }); hello("moe"); -var greet = function (name) { - return "hi: " + name; -}; -var exclaim = function (statement) { - return statement + "!"; -}; +var greet = function (name) { return "hi: " + name; }; +var exclaim = function (statement) { return statement + "!"; }; var welcome = _.compose(exclaim, greet); welcome('moe'); /////////////////////////////////////////////////////////////////////////////////////// @@ -1029,11 +1013,7 @@ _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid'); var iceCream = { flavor: "chocolate" }; _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); _.clone({ name: 'moe' }); -_.chain([1, 2, 3, 200]).filter(function (num) { - return num % 2 == 0; -}).tap(alert).map(function (num) { - return num * num; -}).value(); +_.chain([1, 2, 3, 200]).filter(function (num) { return num % 2 == 0; }).tap(alert).map(function (num) { return num * num; }).value(); _.has({ a: 1, b: 2, c: 3 }, "b"); var moe = { name: 'moe', luckyNumbers: [13, 27, 34] }; var clone = { name: 'moe', luckyNumbers: [13, 27, 34] }; @@ -1042,9 +1022,7 @@ _.isEqual(moe, clone); _.isEmpty([1, 2, 3]); _.isEmpty({}); _.isElement($('body')[0]); -(function () { - return _.isArray(arguments); -})(); +(function () { return _.isArray(arguments); })(); _.isArray([1, 2, 3]); _.isObject({}); _.isObject(1); @@ -1069,9 +1047,7 @@ var underscore = _.noConflict(); var moe2 = { name: 'moe' }; moe2 === _.identity(moe); var genie; -_.times(3, function (n) { - genie.grantWishNumber(n); -}); +_.times(3, function (n) { genie.grantWishNumber(n); }); _.random(0, 100); _.mixin({ capitalize: function (string) { @@ -1081,9 +1057,7 @@ _.mixin({ _("fabio").capitalize(); _.uniqueId('contact_'); _.escape('Curly, Larry & Moe'); -var object = { cheese: 'crumpets', stuff: function () { - return 'nonsense'; -} }; +var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; _.result(object, 'cheese'); _.result(object, 'stuff'); var compiled = _.template("hello: <%= name %>"); diff --git a/tests/baselines/reference/unexpectedStatementBlockTerminator.js b/tests/baselines/reference/unexpectedStatementBlockTerminator.js index c4bf2c51aee..87b4652375a 100644 --- a/tests/baselines/reference/unexpectedStatementBlockTerminator.js +++ b/tests/baselines/reference/unexpectedStatementBlockTerminator.js @@ -18,6 +18,4 @@ var Bar = (function () { } return Bar; })(); -function Goo() { - return { a: 1, b: 2 }; -} +function Goo() { return { a: 1, b: 2 }; } diff --git a/tests/baselines/reference/unknownSymbols2.js b/tests/baselines/reference/unknownSymbols2.js index ba1b92ef71c..b158f5c9503 100644 --- a/tests/baselines/reference/unknownSymbols2.js +++ b/tests/baselines/reference/unknownSymbols2.js @@ -51,9 +51,7 @@ var M; break; } var a = function () { return asdf; }; - var b = function (asdf) { - return qwerty; - }; + var b = function (asdf) { return qwerty; }; var N; (function (N) { var x = 1; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index f7974578ee2..0ca464a93af 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -240,7 +240,9 @@ var ts; this.flags = flags; } Property.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Property; })(Symbol); @@ -258,10 +260,14 @@ var ts; this.returnType = returnType; } Signature.prototype.equalsNoReturn = function (other) { - return this.parameters.length === other.parameters.length && this.typeParameters.length === other.typeParameters.length && arrayEquals(this.parameters, other.parameters) && arrayEquals(this.typeParameters, other.typeParameters); + return this.parameters.length === other.parameters.length && + this.typeParameters.length === other.typeParameters.length && + arrayEquals(this.parameters, other.parameters) && + arrayEquals(this.typeParameters, other.typeParameters); }; Signature.prototype.equals = function (other) { - return this.equalsNoReturn(other) && this.returnType.equals(other.returnType); + return this.equalsNoReturn(other) && + this.returnType.equals(other.returnType); }; return Signature; })(Symbol); @@ -274,7 +280,9 @@ var ts; this.flags = flags; } Parameter.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Parameter; })(Symbol); diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 9ff4a5c469a..9e0ff95536d 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -51,9 +51,7 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // none of these function calls should be allowed -var x = function () { - return; -}; +var x = function () { return; }; var r1 = x(); var y = x; var r2 = y(); diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.js b/tests/baselines/reference/validMultipleVariableDeclarations.js index 5c65d388711..16c47ce8ee2 100644 --- a/tests/baselines/reference/validMultipleVariableDeclarations.js +++ b/tests/baselines/reference/validMultipleVariableDeclarations.js @@ -59,9 +59,7 @@ var p = { x: 1, y: undefined }; var p = { x: 1, y: 2 }; var p = { x: 0, y: undefined }; var p; -var fn = function (s) { - return 42; -}; +var fn = function (s) { return 42; }; var fn = function (s) { return 3; }; var fn; var fn; diff --git a/tests/baselines/reference/voidFunctionAssignmentCompat.js b/tests/baselines/reference/voidFunctionAssignmentCompat.js index 42e0f99ec31..0b7c4b60d89 100644 --- a/tests/baselines/reference/voidFunctionAssignmentCompat.js +++ b/tests/baselines/reference/voidFunctionAssignmentCompat.js @@ -20,39 +20,15 @@ var frv3: (v:any)=>number = (function() { return function () { return 0; } })() //// [voidFunctionAssignmentCompat.js] -var fa = function () { - return 3; -}; +var fa = function () { return 3; }; fa = function () { }; // should not work var fv = function () { }; -fv = function () { - return 0; -}; // should work -function execAny(callback) { - return callback(0); -} +fv = function () { return 0; }; // should work +function execAny(callback) { return callback(0); } execAny(function () { }); // should work -function execVoid(callback) { - callback(0); -} -execVoid(function () { - return 0; -}); // should work -var fra = function () { - return function () { }; -}; // should work -var frv = function () { - return function () { - return 0; - }; -}; // should work -var fra3 = (function () { - return function (v) { - return v; - }; -})(); // should work -var frv3 = (function () { - return function () { - return 0; - }; -})(); // should work +function execVoid(callback) { callback(0); } +execVoid(function () { return 0; }); // should work +var fra = function () { return function () { }; }; // should work +var frv = function () { return function () { return 0; }; }; // should work +var fra3 = (function () { return function (v) { return v; }; })(); // should work +var frv3 = (function () { return function () { return 0; }; })(); // should work diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 64c09e2ea65..69c609c1280 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -41,15 +41,11 @@ void M.n; //// [voidOperatorWithBooleanType.js] // void operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index e37e5a82577..2426690489d 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -49,15 +49,11 @@ void objA.a, M.n; // void operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsAny2 = void NUMBER1; // number type literal var ResultIsAny3 = void 1; var ResultIsAny4 = void { x: 1, y: 2 }; -var ResultIsAny5 = void { x: 1, y: function (n) { - return n; -} }; +var ResultIsAny5 = void { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 7954f50bf57..9f30d1fcb0c 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -48,15 +48,11 @@ void objA.a,M.n; // void operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsAny2 = void STRING1; // string type literal var ResultIsAny3 = void ""; var ResultIsAny4 = void { x: "", y: "" }; -var ResultIsAny5 = void { x: "", y: function (s) { - return s; -} }; +var ResultIsAny5 = void { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 7374bd23b77..2277ef6eea7 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. @@ -20,7 +20,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: n null in {}; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. "" in null; ~~~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter diff --git a/tests/baselines/reference/witness.js b/tests/baselines/reference/witness.js index 607c2415044..82a1298f156 100644 --- a/tests/baselines/reference/witness.js +++ b/tests/baselines/reference/witness.js @@ -210,9 +210,7 @@ function fnArg1(x, y) { var x; fnArg1(fnArg1, 0); } -function overload1() { - return undefined; -} +function overload1() { return undefined; } ; function fnArg2() { return overload1(fnArg2); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js index 01f591de323..fb0f5388aaa 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js @@ -30,6 +30,6 @@ var C = (function () { })(); var c = new C({ length: 2 }); var r = c.foo({ length: 3, charAt: function (x) { - ''; -} }); + ''; + } }); var r2 = r(''); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js index da4117860a7..998c16a9f87 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js @@ -28,5 +28,5 @@ var C = (function () { var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: function (x) { - ''; -} }); // error + ''; + } }); // error diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 50ec02ab6f3..f1703835380 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index c95d6273d4e..287a2a56dee 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index e9d9a46d286..438b9520010 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 212f83b3935..3b1c83419bf 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts new file mode 100644 index 00000000000..8a9276416c5 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts @@ -0,0 +1,11 @@ +//@target: ES5 +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts new file mode 100644 index 00000000000..07c95eb27d9 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts @@ -0,0 +1,11 @@ +//@target: ES5 +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts new file mode 100644 index 00000000000..262e47557f8 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts new file mode 100644 index 00000000000..2b14e64a33c --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts new file mode 100644 index 00000000000..ec46ddad21d --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts new file mode 100644 index 00000000000..59b7d2291aa --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts @@ -0,0 +1,6 @@ +//@target: ES5 +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts new file mode 100644 index 00000000000..766b86f9b5d --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolType1.ts b/tests/cases/conformance/Symbols/ES5SymbolType1.ts new file mode 100644 index 00000000000..bfd5592f8e4 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolType1.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var s: symbol; +s.toString(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts new file mode 100644 index 00000000000..b99806a1eee --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp]: number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts new file mode 100644 index 00000000000..cf3496c2553 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts new file mode 100644 index 00000000000..4b88ab55980 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +//@declaration: true +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts new file mode 100644 index 00000000000..c18b470d35d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts @@ -0,0 +1,14 @@ +//@target: ES6 +//@declaration: true +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts new file mode 100644 index 00000000000..18568e853e8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts new file mode 100644 index 00000000000..312476628b8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts new file mode 100644 index 00000000000..420e1c84906 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp] = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts new file mode 100644 index 00000000000..b70ee3c15ac --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts @@ -0,0 +1,7 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts new file mode 100644 index 00000000000..dde80577fa4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts new file mode 100644 index 00000000000..e5acf9c9f7c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts new file mode 100644 index 00000000000..1d0059f954f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts new file mode 100644 index 00000000000..01f91681b15 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj: { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts new file mode 100644 index 00000000000..2682a4940f9 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts new file mode 100644 index 00000000000..2c35a553600 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty1.ts b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts new file mode 100644 index 00000000000..0e008511be3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s: symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty10.ts b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts new file mode 100644 index 00000000000..0f63356eaf6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty11.ts b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts new file mode 100644 index 00000000000..1377970613d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty12.ts b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts new file mode 100644 index 00000000000..5a835a34b62 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty13.ts b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts new file mode 100644 index 00000000000..4b5023e1d06 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty14.ts b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts new file mode 100644 index 00000000000..0109ec3be25 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty15.ts b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts new file mode 100644 index 00000000000..3ec6c6ecc7a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts @@ -0,0 +1,15 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty16.ts b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts new file mode 100644 index 00000000000..2b3a976df98 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty17.ts b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts new file mode 100644 index 00000000000..737059d0e3b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty18.ts b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts new file mode 100644 index 00000000000..2fabea34960 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty19.ts b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts new file mode 100644 index 00000000000..df9b99f5ca4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty2.ts b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts new file mode 100644 index 00000000000..44a2ba13874 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty20.ts b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts new file mode 100644 index 00000000000..7180ceec87d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty21.ts b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts new file mode 100644 index 00000000000..52e84a00425 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts @@ -0,0 +1,13 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty22.ts b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts new file mode 100644 index 00000000000..a0eec6dd471 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty23.ts b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts new file mode 100644 index 00000000000..6d8a2108720 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty24.ts b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts new file mode 100644 index 00000000000..8e1c35879ab --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty25.ts b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts new file mode 100644 index 00000000000..ee571174933 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty26.ts b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts new file mode 100644 index 00000000000..88b7d168d64 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty27.ts b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts new file mode 100644 index 00000000000..c6283595575 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty28.ts b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts new file mode 100644 index 00000000000..7f68444a75e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty29.ts b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts new file mode 100644 index 00000000000..8d1b8491d37 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty3.ts b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts new file mode 100644 index 00000000000..027e93a86ad --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty30.ts b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts new file mode 100644 index 00000000000..a75f77d6056 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty31.ts b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts new file mode 100644 index 00000000000..d41f5d6b0fe --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty32.ts b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts new file mode 100644 index 00000000000..52da68fc57c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty33.ts b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts new file mode 100644 index 00000000000..8c7a4d274f3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty34.ts b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts new file mode 100644 index 00000000000..6e8bb521f0a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty35.ts b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts new file mode 100644 index 00000000000..2d9527e2fd4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty36.ts b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts new file mode 100644 index 00000000000..709ea39cd5d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts @@ -0,0 +1,5 @@ +//@target: ES6 +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty37.ts b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts new file mode 100644 index 00000000000..7a6c86a7bea --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty38.ts b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts new file mode 100644 index 00000000000..c8683344edc --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty39.ts b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts new file mode 100644 index 00000000000..af3a95eb155 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty4.ts b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts new file mode 100644 index 00000000000..b6079bb31b3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty40.ts b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts new file mode 100644 index 00000000000..91fd953a4d7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty41.ts b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts new file mode 100644 index 00000000000..9c9583264cd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty42.ts b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts new file mode 100644 index 00000000000..79fbce7bb90 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts @@ -0,0 +1,8 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty43.ts b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts new file mode 100644 index 00000000000..c524b6423a5 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts @@ -0,0 +1,5 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty44.ts b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts new file mode 100644 index 00000000000..a6281592605 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty45.ts b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts new file mode 100644 index 00000000000..cfdcc317646 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty46.ts b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts new file mode 100644 index 00000000000..84ce050ac1c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty47.ts b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts new file mode 100644 index 00000000000..05e46aaee75 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty48.ts b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts new file mode 100644 index 00000000000..77ce9303b44 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty49.ts b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts new file mode 100644 index 00000000000..bc34e146f2c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty5.ts b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts new file mode 100644 index 00000000000..84cb12a9de8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty50.ts b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts new file mode 100644 index 00000000000..8bcf25fab29 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty51.ts b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts new file mode 100644 index 00000000000..3da5d45bf84 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty52.ts b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts new file mode 100644 index 00000000000..b14838a6914 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +obj[Symbol.nonsense]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty53.ts b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts new file mode 100644 index 00000000000..c58b6e885af --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var obj = { + [Symbol.for]: 0 +}; + +obj[Symbol.for]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty54.ts b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts new file mode 100644 index 00000000000..b3eab2a54a1 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var obj = { + [Symbol.prototype]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty55.ts b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts new file mode 100644 index 00000000000..3c6ceb69b0e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty56.ts b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts new file mode 100644 index 00000000000..ae9e5232b9b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty57.ts b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts new file mode 100644 index 00000000000..b60c18a05ee --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty58.ts b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts new file mode 100644 index 00000000000..48cc6eb90f3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty59.ts b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts new file mode 100644 index 00000000000..bdea9dab62c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.keyFor]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty6.ts b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts new file mode 100644 index 00000000000..ff17b977c38 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty7.ts b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts new file mode 100644 index 00000000000..972e96c282b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty8.ts b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts new file mode 100644 index 00000000000..14b4a32688f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty9.ts b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts new file mode 100644 index 00000000000..33ffcb5ee25 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType1.ts b/tests/cases/conformance/es6/Symbols/symbolType1.ts new file mode 100644 index 00000000000..3a7339fbeb7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType10.ts b/tests/cases/conformance/es6/Symbols/symbolType10.ts new file mode 100644 index 00000000000..a1ee87de159 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType10.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType11.ts b/tests/cases/conformance/es6/Symbols/symbolType11.ts new file mode 100644 index 00000000000..8b9661bb046 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType12.ts b/tests/cases/conformance/es6/Symbols/symbolType12.ts new file mode 100644 index 00000000000..44852bc10e6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType12.ts @@ -0,0 +1,29 @@ +//@target: ES6 +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +str += (s || str); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType13.ts b/tests/cases/conformance/es6/Symbols/symbolType13.ts new file mode 100644 index 00000000000..4b657c4c37a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType13.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType14.ts b/tests/cases/conformance/es6/Symbols/symbolType14.ts new file mode 100644 index 00000000000..c20a8be874b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType14.ts @@ -0,0 +1,2 @@ +//@target: ES6 +new Symbol(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType15.ts b/tests/cases/conformance/es6/Symbols/symbolType15.ts new file mode 100644 index 00000000000..22f1f9662c0 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType15.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType16.ts b/tests/cases/conformance/es6/Symbols/symbolType16.ts new file mode 100644 index 00000000000..0421e0ccc02 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType16.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType17.ts b/tests/cases/conformance/es6/Symbols/symbolType17.ts new file mode 100644 index 00000000000..95824f1794b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType17.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType18.ts b/tests/cases/conformance/es6/Symbols/symbolType18.ts new file mode 100644 index 00000000000..caa84171737 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType18.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType19.ts b/tests/cases/conformance/es6/Symbols/symbolType19.ts new file mode 100644 index 00000000000..85d13b2cbdd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType19.ts @@ -0,0 +1,11 @@ +//@target: ES6 +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType2.ts b/tests/cases/conformance/es6/Symbols/symbolType2.ts new file mode 100644 index 00000000000..54954c17bd3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType20.ts b/tests/cases/conformance/es6/Symbols/symbolType20.ts new file mode 100644 index 00000000000..ef14e34048b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +interface symbol { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType3.ts b/tests/cases/conformance/es6/Symbols/symbolType3.ts new file mode 100644 index 00000000000..b5855ecab41 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType3.ts @@ -0,0 +1,13 @@ +//@target: ES6 +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + ++(Symbol() || 0); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType4.ts b/tests/cases/conformance/es6/Symbols/symbolType4.ts new file mode 100644 index 00000000000..bd5b5ba1a06 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var s = Symbol.for("postfix"); +s++; +s--; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType5.ts b/tests/cases/conformance/es6/Symbols/symbolType5.ts new file mode 100644 index 00000000000..302cfcafdf3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType6.ts b/tests/cases/conformance/es6/Symbols/symbolType6.ts new file mode 100644 index 00000000000..2efa682b98f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType6.ts @@ -0,0 +1,16 @@ +//@target: ES6 +var s = Symbol.for("add"); +var a: any; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; + +(s || "") + ""; +"" + (s || ""); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType7.ts b/tests/cases/conformance/es6/Symbols/symbolType7.ts new file mode 100644 index 00000000000..841ca9e8b10 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType7.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType8.ts b/tests/cases/conformance/es6/Symbols/symbolType8.ts new file mode 100644 index 00000000000..b3bc68094c7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType8.ts @@ -0,0 +1,13 @@ +//@target: ES6 +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType9.ts b/tests/cases/conformance/es6/Symbols/symbolType9.ts new file mode 100644 index 00000000000..1fa43143640 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType9.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts new file mode 100644 index 00000000000..59a8e9d3420 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts new file mode 100644 index 00000000000..33288184b16 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts new file mode 100644 index 00000000000..365ca67c1a3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts new file mode 100644 index 00000000000..fb44bfb4145 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts new file mode 100644 index 00000000000..8f78f279eba --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts new file mode 100644 index 00000000000..2baa39cf61a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts new file mode 100644 index 00000000000..01204a1e619 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts new file mode 100644 index 00000000000..e52067cc7f4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts new file mode 100644 index 00000000000..3c929b20ddf --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts new file mode 100644 index 00000000000..87a1bf81178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +module M { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts new file mode 100644 index 00000000000..70ba98a818c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts new file mode 100644 index 00000000000..6cff3715d83 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var obj = { + [this.bar]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts new file mode 100644 index 00000000000..caee82c8ea3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [this.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts new file mode 100644 index 00000000000..41142951421 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts new file mode 100644 index 00000000000..e0a86c21842 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts new file mode 100644 index 00000000000..ff94b6c9617 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts new file mode 100644 index 00000000000..d791b8b9178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts new file mode 100644 index 00000000000..4b0d794b1a7 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts new file mode 100644 index 00000000000..1cae37aa093 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts new file mode 100644 index 00000000000..c82d7b000e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts new file mode 100644 index 00000000000..c650c6e6c3f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts new file mode 100644 index 00000000000..7c2517cd514 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts new file mode 100644 index 00000000000..528e9b7c583 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts new file mode 100644 index 00000000000..39c5ca2b747 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts new file mode 100644 index 00000000000..f9c17c632ae --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts new file mode 100644 index 00000000000..0dcbabf4063 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts new file mode 100644 index 00000000000..b6892f1bd80 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts new file mode 100644 index 00000000000..7d3df135b10 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts new file mode 100644 index 00000000000..95099715ad8 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts new file mode 100644 index 00000000000..cb931fc31d6 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts new file mode 100644 index 00000000000..5ea07aa1605 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts new file mode 100644 index 00000000000..929332c5d32 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts new file mode 100644 index 00000000000..1f34f9ad287 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts new file mode 100644 index 00000000000..bba1068fef3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts new file mode 100644 index 00000000000..1e8ed7d6cd1 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts new file mode 100644 index 00000000000..fc181d5a548 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts new file mode 100644 index 00000000000..c130692c118 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts new file mode 100644 index 00000000000..4c9422ed44e --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts @@ -0,0 +1,12 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts new file mode 100644 index 00000000000..c1eb09275c5 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts new file mode 100644 index 00000000000..d009c960d6b --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var o = { + ["" || 0]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts new file mode 100644 index 00000000000..b158ef76447 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts new file mode 100644 index 00000000000..1c854603b09 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts @@ -0,0 +1,18 @@ +// @target: es5 +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts new file mode 100644 index 00000000000..611d6a7d30f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts new file mode 100644 index 00000000000..58f97a80feb --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts new file mode 100644 index 00000000000..17089b7244f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts new file mode 100644 index 00000000000..f7411e7cb4f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts new file mode 100644 index 00000000000..c599477c2e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts new file mode 100644 index 00000000000..e9d7d6ffab4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts new file mode 100644 index 00000000000..0521873d70c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts new file mode 100644 index 00000000000..e3b379602b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +enum E { + member +} +var v = { + [E.member]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts new file mode 100644 index 00000000000..0723552edc2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts new file mode 100644 index 00000000000..e1c675d95e4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts new file mode 100644 index 00000000000..dd208340520 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts new file mode 100644 index 00000000000..d8aad5bf468 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts new file mode 100644 index 00000000000..c9a425b5a99 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts new file mode 100644 index 00000000000..3f5a6f7f91f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts new file mode 100644 index 00000000000..8ce0503c449 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts new file mode 100644 index 00000000000..42acf42ee2a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts new file mode 100644 index 00000000000..9e6248878b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts new file mode 100644 index 00000000000..722891c2f6a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts new file mode 100644 index 00000000000..5e6835b5948 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts new file mode 100644 index 00000000000..aa30d333d11 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts new file mode 100644 index 00000000000..1091304b6b2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts new file mode 100644 index 00000000000..b30b8e13062 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts new file mode 100644 index 00000000000..aa4e3b2cf2f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +interface I { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts new file mode 100644 index 00000000000..9a6e17f4c93 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +var v: { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts new file mode 100644 index 00000000000..eb12ea9b471 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @declaration: true +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts new file mode 100644 index 00000000000..a025a074e31 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts new file mode 100644 index 00000000000..9454483cdb4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +class C { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts new file mode 100644 index 00000000000..3d35cd12430 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +var v = { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts diff --git a/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts new file mode 100644 index 00000000000..1b03c533e7d --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts @@ -0,0 +1,11 @@ +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts new file mode 100644 index 00000000000..8f9a4072f42 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var i of e) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts new file mode 100644 index 00000000000..3a6f932e821 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts new file mode 100644 index 00000000000..94ca9330ab0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts new file mode 100644 index 00000000000..7d4655e4b36 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts new file mode 100644 index 00000000000..7a11d2e073e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts new file mode 100644 index 00000000000..c39939a1a08 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts new file mode 100644 index 00000000000..95c5c2c53ee --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts new file mode 100644 index 00000000000..9a68bad827c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts new file mode 100644 index 00000000000..882ae938d6c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of; ;) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts new file mode 100644 index 00000000000..a7dff6f225b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts new file mode 100644 index 00000000000..730f574be33 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts new file mode 100644 index 00000000000..7ef97688115 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts new file mode 100644 index 00000000000..edffb88a1e3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of = 0 in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts new file mode 100644 index 00000000000..a61edfbd050 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts new file mode 100644 index 00000000000..1b183225b74 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a, b of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts new file mode 100644 index 00000000000..a99b69a2f4a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a = 1 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts new file mode 100644 index 00000000000..c3c434b605c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a: number of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts new file mode 100644 index 00000000000..4e03b361e73 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a = 1, b = 2 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts new file mode 100644 index 00000000000..8340bab563b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a: number = 1, b: string = "" of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts new file mode 100644 index 00000000000..39ecbcfbcb3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts new file mode 100644 index 00000000000..63fe58a93f8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts new file mode 100644 index 00000000000..5c10e2d487b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts new file mode 100644 index 00000000000..e5d29c08f7d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts new file mode 100644 index 00000000000..d4bd13aa1d6 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts new file mode 100644 index 00000000000..64ca01bba6c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts new file mode 100644 index 00000000000..cc606c2e6a3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts new file mode 100644 index 00000000000..978d4ef95f0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts new file mode 100644 index 00000000000..7f16672ebd2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts new file mode 100644 index 00000000000..fb7f00d7694 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts new file mode 100644 index 00000000000..3fc8e6f8979 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts new file mode 100644 index 00000000000..a27636388c0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts new file mode 100644 index 00000000000..78e5738f7da --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts new file mode 100644 index 00000000000..7838df4d8fc --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts new file mode 100644 index 00000000000..9248d2fb45c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var i of e) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts new file mode 100644 index 00000000000..9febb87d74f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts new file mode 100644 index 00000000000..dbcf40c36ab --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts new file mode 100644 index 00000000000..8bb57d3a356 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts new file mode 100644 index 00000000000..5da8edc65c4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts new file mode 100644 index 00000000000..ddd1216471f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts new file mode 100644 index 00000000000..43e18b460ca --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts new file mode 100644 index 00000000000..e042179fbba --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts new file mode 100644 index 00000000000..f088b36f4fd --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of; ;) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts new file mode 100644 index 00000000000..268dc163dde --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts new file mode 100644 index 00000000000..4dff469112b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts new file mode 100644 index 00000000000..8274876781d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts new file mode 100644 index 00000000000..d0b7b75175d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of = 0 in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts new file mode 100644 index 00000000000..f480ac371a2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts new file mode 100644 index 00000000000..d16c99e6c3d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a, b of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts new file mode 100644 index 00000000000..f7cd4b34d26 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a = 1 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts new file mode 100644 index 00000000000..789e5f9725d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a: number of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts new file mode 100644 index 00000000000..946e5ba1574 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a = 1, b = 2 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts new file mode 100644 index 00000000000..e7e56f74c4e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a: number = 1, b: string = "" of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts new file mode 100644 index 00000000000..7a528a9898e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts new file mode 100644 index 00000000000..741a56a8cf7 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts new file mode 100644 index 00000000000..805584ef078 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts new file mode 100644 index 00000000000..c593d0a4b0a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts new file mode 100644 index 00000000000..183ecea6e63 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + static [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts new file mode 100644 index 00000000000..c6f9077f648 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts new file mode 100644 index 00000000000..a028a3b6488 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x = { + [s: symbol]: "" +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts new file mode 100644 index 00000000000..d29272fd561 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts new file mode 100644 index 00000000000..3ef11e99aa9 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts new file mode 100644 index 00000000000..d63302991d0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts new file mode 100644 index 00000000000..6a0962f15cb --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts new file mode 100644 index 00000000000..5f3fbaeaaea --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts new file mode 100644 index 00000000000..24d67c8b707 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts new file mode 100644 index 00000000000..69f2f4b30f8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts new file mode 100644 index 00000000000..dcc6d5b7615 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts new file mode 100644 index 00000000000..b7093f188d2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/fourslash/definition.ts b/tests/cases/fourslash/definition.ts new file mode 100644 index 00000000000..531e4562843 --- /dev/null +++ b/tests/cases/fourslash/definition.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: b.ts +////import n = require('a/*1*/'); +////var x = new n.Foo(); + +// @Filename: a.ts +//// /*2*/export class Foo {} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingForOfKeyword.ts b/tests/cases/fourslash/formattingForOfKeyword.ts new file mode 100644 index 00000000000..33b3d83c00f --- /dev/null +++ b/tests/cases/fourslash/formattingForOfKeyword.ts @@ -0,0 +1,8 @@ +/// + +/////**/for ([]of[]) { } + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('for ([] of []) { }'); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts b/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts new file mode 100644 index 00000000000..37e6f5782e0 --- /dev/null +++ b/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts @@ -0,0 +1,13 @@ +/// + +/////*1*/new Error(`Failed to expand glob: ${projectSpec.filesGlob} +/////*2*/ at projectPath : ${projectFile} +/////*3*/ with error: ${ex.message}`) + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("new Error(`Failed to expand glob: ${projectSpec.filesGlob}"); +goTo.marker("2"); +verify.currentLineContentIs(" at projectPath : ${projectFile}"); +goTo.marker("3"); +verify.currentLineContentIs(" with error: ${ex.message}`)"); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts new file mode 100644 index 00000000000..e3dde6738e9 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts @@ -0,0 +1,17 @@ +/// + +////{| "itemName": "C", "kind": "class", "parentName": "" |} +////class C { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "C" |} +//// [Symbol.isRegExp] = 0; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "C" |} +//// [Symbol.iterator]() { } +//// {| "itemName": "[Symbol.isConcatSpreadable]", "kind": "getter", "parentName": "C" |} +//// get [Symbol.isConcatSpreadable]() { } +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts new file mode 100644 index 00000000000..d048de895ec --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts @@ -0,0 +1,15 @@ +/// + +////{| "itemName": "I", "kind": "interface", "parentName": "" |} +////interface I { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "I" |} +//// [Symbol.isRegExp]: string; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "I" |} +//// [Symbol.iterator](): string; +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts new file mode 100644 index 00000000000..19f81037559 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts @@ -0,0 +1,13 @@ +/// + +////{| "itemName": "E", "kind": "enum", "parentName": "" |} +////enum E { +//// // No nav bar entry for this +//// [Symbol.isRegExp] = 0 +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/server/brace.ts b/tests/cases/fourslash/server/brace.ts new file mode 100644 index 00000000000..fc8a71197db --- /dev/null +++ b/tests/cases/fourslash/server/brace.ts @@ -0,0 +1,43 @@ +/// + +//////curly braces +////module Foo [|{ +//// class Bar [|{ +//// private f() [|{ +//// }|] +//// +//// private f2() [|{ +//// if (true) [|{ }|] [|{ }|]; +//// }|] +//// }|] +////}|] +//// +//////parenthesis +////class FooBar { +//// private f[|()|] { +//// return [|([|(1 + 1)|])|]; +//// } +//// +//// private f2[|()|] { +//// if [|(true)|] { } +//// } +////} +//// +//////square brackets +////class Baz { +//// private f() { +//// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|]; +//// } +////} +//// +////// angular brackets +////class TemplateTest [||] { +//// public foo(a, b) { +//// return [||] a; +//// } +////} + +test.ranges().forEach((range) => { + verify.matchingBracePositionInCurrentFile(range.start, range.end - 1); + verify.matchingBracePositionInCurrentFile(range.end - 1, range.start); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/server/completions.ts b/tests/cases/fourslash/server/completions.ts new file mode 100644 index 00000000000..82d3b5b2400 --- /dev/null +++ b/tests/cases/fourslash/server/completions.ts @@ -0,0 +1,17 @@ +/// + +////var x: string[] = []; +////x.forEach(function (y) { y/*1*/ +////x.forEach(y => y/*2*/ + +goTo.marker('1'); +edit.insert('.'); +verify.memberListContains('trim'); +verify.memberListCount(20); +edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear + +goTo.marker('2'); +edit.insert('.'); +verify.memberListContains('trim'); +verify.memberListCount(20); + \ No newline at end of file diff --git a/tests/cases/fourslash/server/completions2.ts b/tests/cases/fourslash/server/completions2.ts new file mode 100644 index 00000000000..b34aad66ba2 --- /dev/null +++ b/tests/cases/fourslash/server/completions2.ts @@ -0,0 +1,18 @@ +/// + +////class Foo { +////} +////module Foo { +//// export var x: number; +////} +////Foo./**/ + +goTo.marker(""); +verify.completionListContains("x"); + +// Make an edit +edit.insert("a"); +edit.backspace(); + +// Checking for completion details after edit should work too +verify.completionEntryDetailIs("x", "(var) Foo.x: number"); diff --git a/tests/cases/fourslash/server/definition.ts b/tests/cases/fourslash/server/definition.ts new file mode 100644 index 00000000000..531e4562843 --- /dev/null +++ b/tests/cases/fourslash/server/definition.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: b.ts +////import n = require('a/*1*/'); +////var x = new n.Foo(); + +// @Filename: a.ts +//// /*2*/export class Foo {} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/format.ts b/tests/cases/fourslash/server/format.ts new file mode 100644 index 00000000000..75d06eef0c2 --- /dev/null +++ b/tests/cases/fourslash/server/format.ts @@ -0,0 +1,8 @@ +/// + +/////**/module Default{var x= ( { } ) ;} + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('module Default { var x = ({}); }'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/formatonkey.ts b/tests/cases/fourslash/server/formatonkey.ts new file mode 100644 index 00000000000..64cd74ca858 --- /dev/null +++ b/tests/cases/fourslash/server/formatonkey.ts @@ -0,0 +1,12 @@ +/// + +////switch (1) { +//// case 1: +//// { +//// /*1*/ +//// break; +////} + +goTo.marker("1"); +edit.insert("}"); +verify.currentLineContentIs(" }"); diff --git a/tests/cases/fourslash/server/navbar.ts b/tests/cases/fourslash/server/navbar.ts new file mode 100644 index 00000000000..e18f49c1db9 --- /dev/null +++ b/tests/cases/fourslash/server/navbar.ts @@ -0,0 +1,52 @@ +/// + +////// Interface +////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { +//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; +//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; +//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; +//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; +//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////} +//// +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { +//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } +//// +//// // Instance member +//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// +//// // Getter +//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } +//// +//// // Setter +//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } +//// +//// // Static member +//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); +//// +//// // Static method +//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} +//// } +//// +//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { +//// value1, +//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, +//// value3, +//// } +////} +//// +////// Local variables +////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); +////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(23); diff --git a/tests/cases/fourslash/server/navto.ts b/tests/cases/fourslash/server/navto.ts new file mode 100644 index 00000000000..8dc42a2365e --- /dev/null +++ b/tests/cases/fourslash/server/navto.ts @@ -0,0 +1,28 @@ +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes", "matchKind": "substring" |}export class Point { +//// // Instance member +//// {| "itemName": "originPointAttheHorizon", "kind": "property", "parentName": "Point", "matchKind": "substring"|}private originPointAttheHorizon = 0.0; +//// +//// // Getter +//// {| "itemName": "distanceFromOrigin", "kind": "getter", "parentName": "Point", "matchKind": "substring" |}get distanceFromOrigin(): number { return 0; } +//// +//// } +////} +//// +////// Local variables +////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point(); + +//// Testing for substring matching of navigationItems +//var searchValue = "FromOrigin horizon INITIATED Shape Point"; + +test.markers().forEach((marker) => { + if (marker.data) { + var name = marker.data.itemName; + verify.navigationItemsListContains(name, marker.data.kind, name.substr(1), marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); \ No newline at end of file diff --git a/tests/cases/fourslash/server/quickinfo.ts b/tests/cases/fourslash/server/quickinfo.ts new file mode 100644 index 00000000000..b5c7dc0a01c --- /dev/null +++ b/tests/cases/fourslash/server/quickinfo.ts @@ -0,0 +1,27 @@ +/// + +////interface One { +//// commonProperty: number; +//// commonFunction(): number; +////} +//// +////interface Two { +//// commonProperty: string +//// commonFunction(): number; +////} +//// +////var /*1*/x : One | Two; +//// +////x./*2*/commonProperty; +////x./*3*/commonFunction; + + +goTo.marker("1"); +verify.quickInfoIs('(var) x: One | Two'); + + +goTo.marker("2"); +verify.quickInfoIs('(property) commonProperty: string | number'); + +goTo.marker("3"); +verify.quickInfoIs('(method) commonFunction(): number'); diff --git a/tests/cases/fourslash/server/references.ts b/tests/cases/fourslash/server/references.ts new file mode 100644 index 00000000000..55b21615551 --- /dev/null +++ b/tests/cases/fourslash/server/references.ts @@ -0,0 +1,18 @@ +/// + +// Global class reference. + +// @Filename: referencesForGlobals_1.ts +////class /*2*/globalClass { +//// public f() { } +////} + +// @Filename: referencesForGlobals_2.ts +/////// +////var c = /*1*/globalClass(); + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/server/rename.ts b/tests/cases/fourslash/server/rename.ts new file mode 100644 index 00000000000..4f8b7b98cd4 --- /dev/null +++ b/tests/cases/fourslash/server/rename.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/syntacticClassificationsForOfKeyword.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts new file mode 100644 index 00000000000..a7a8c704ce6 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts @@ -0,0 +1,16 @@ +/// + +//// for (var of of of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.keyword("of"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts new file mode 100644 index 00000000000..30cfaea51e0 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts @@ -0,0 +1,16 @@ +/// + +//// for (var of in of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.keyword("in"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts new file mode 100644 index 00000000000..3af4733f3b2 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts @@ -0,0 +1,18 @@ +/// + +//// for (var of; of; of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.punctuation(";"), + c.text("of"), + c.punctuation(";"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/unittests/incrementalParser.ts b/tests/cases/unittests/incrementalParser.ts index 7c4213e22c2..54adcaf345f 100644 --- a/tests/cases/unittests/incrementalParser.ts +++ b/tests/cases/unittests/incrementalParser.ts @@ -248,7 +248,7 @@ module ts { var oldText = ScriptSnapshot.fromString(source); var newTextAndChange = withChange(oldText, index, 2, "+"); - compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 21); + compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 24); }); it('Strict mode 1',() => { diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index c834f85806d..6c685cdb174 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -43,7 +43,7 @@ describe('Colorization', function () { } function testLexicalClassification(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void { - var result = classifier.getClassificationsForLine(text, initialEndOfLineState); + var result = classifier.getClassificationsForLine(text, initialEndOfLineState, /*syntacticClassifierAbsent*/ false); for (var i = 0, n = expectedEntries.length; i < n; i++) { var expectedEntry = expectedEntries[i]; @@ -430,5 +430,20 @@ class D { }\r\n\ comment(">>>>>>> Branch - a"), finalEndOfLineState(ts.EndOfLineState.Start)); }); + + it("'of' keyword", function () { + testLexicalClassification("for (var of of of) { }", + ts.EndOfLineState.Start, + keyword("for"), + punctuation("("), + keyword("var"), + keyword("of"), + keyword("of"), + keyword("of"), + punctuation(")"), + punctuation("{"), + punctuation("}"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); }); }); \ No newline at end of file diff --git a/tests/cases/unittests/services/patternMatcher.ts b/tests/cases/unittests/services/patternMatcher.ts new file mode 100644 index 00000000000..ddf1f9fe344 --- /dev/null +++ b/tests/cases/unittests/services/patternMatcher.ts @@ -0,0 +1,532 @@ +/// +/// + +describe('PatternMatcher', function () { + describe("BreakIntoCharacterSpans", function () { + it("EmptyIdentifier", () => { + verifyBreakIntoCharacterSpans("") + }); + + it("SimpleIdentifier", () => { + verifyBreakIntoCharacterSpans("foo", "foo"); + }); + + it("PrefixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("_foo", "_", "foo"); + }); + + it("UnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("f_oo", "f", "_", "oo"); + }); + + it("PostfixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("foo_", "foo", "_"); + }); + + it("PrefixUnderscoredIdentifierWithCapital", () => { + verifyBreakIntoCharacterSpans("_Foo", "_", "Foo"); + }); + + it("MUnderscorePrefixed", () => { + verifyBreakIntoCharacterSpans("m_foo", "m", "_", "foo"); + }); + + it("CamelCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("FogBar", "Fog", "Bar"); + }); + + it("MixedCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("fogBar", "fog", "Bar"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoCharacterSpans("UIElement", "U", "I", "Element"); + }); + + it("NumberSuffixedIdentifier", () => { + verifyBreakIntoCharacterSpans("Foo42", "Foo", "42"); + }); + + it("NumberContainingIdentifier", () => { + verifyBreakIntoCharacterSpans("Fog42Bar", "Fog", "42", "Bar"); + }); + + it("NumberPrefixedIdentifier", () => { + verifyBreakIntoCharacterSpans("42Bar", "42", "Bar"); + }); + }); + + describe("BreakIntoWordSpans", function () { + it("VarbatimIdentifier", () => { + verifyBreakIntoWordSpans("@int:", "int"); + }); + + it("AllCapsConstant", () => { + verifyBreakIntoWordSpans("C_STYLE_CONSTANT", "C", "_", "STYLE", "_", "CONSTANT"); + }); + + it("SingleLetterPrefix1", () => { + verifyBreakIntoWordSpans("UInteger", "U", "Integer"); + }); + + it("SingleLetterPrefix2", () => { + verifyBreakIntoWordSpans("IDisposable", "I", "Disposable"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoWordSpans("UIElement", "UI", "Element"); + }); + + it("XDocument", () => { + verifyBreakIntoWordSpans("XDocument", "X", "Document"); + }); + + it("XMLDocument1", () => { + verifyBreakIntoWordSpans("XMLDocument", "XML", "Document"); + }); + + it("XMLDocument2", () => { + verifyBreakIntoWordSpans("XmlDocument", "Xml", "Document"); + }); + + it("TwoUppercaseCharacters", () => { + verifyBreakIntoWordSpans("SimpleUIElement", "Simple", "UI", "Element"); + }); + }); + + describe("SingleWordPattern", () => { + it("PreferCaseSensitiveExact", () => { + debugger; + var match = getFirstMatch("Foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveExactInsensitive", () => { + var match = getFirstMatch("foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefix", () => { + var match = getFirstMatch("Foo", "Fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefixCaseInsensitive", () => { + var match = getFirstMatch("Foo", "fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchSimple", () => { + debugger; + var match = getFirstMatch("FogBar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + assertInRange(match.camelCaseWeight, 1, 1 << 30); + }); + + it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => { + var match = getFirstMatch("FogBar", "FoB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => { + var match = getFirstMatch("FogBar", "FBB"); + + assert.isTrue(match === undefined); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => { + var match = getFirstMatch("FogBar", "FoooB"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchPartiallyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "FZ"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchCompletelyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "ZZ"); + + assert.isTrue(match === undefined); + }); + + it("TwoUppercaseCharacters", () => { + var match = getFirstMatch("SimpleUIElement", "SiUI"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern", () => { + debugger; + var match = getFirstMatch("FogBar", "b"); + + assert.equal(ts.PatternMatchKind.Substring, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern2", () => { + var match = getFirstMatch("FogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName", () => { + var match = getFirstMatch("_fogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName2", () => { + var match = getFirstMatch("_fogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => { + var match = getFirstMatch("_FogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore", () => { + var match = getFirstMatch("Fog_Bar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore2", () => { + var match = getFirstMatch("Fog_Bar", "F_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore3", () => { + var match = getFirstMatch("Fog_Bar", "F__B"); + + assert.isTrue(undefined === match); + }); + + it("PreferCaseSensitiveMiddleUnderscore4", () => { + var match = getFirstMatch("Fog_Bar", "f_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore5", () => { + var match = getFirstMatch("Fog_Bar", "F_b"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveRelativeWeights1", () => { + var match1 = getFirstMatch("FogBarBaz", "FB"); + var match2 = getFirstMatch("FooFlobBaz", "FB"); + + // We should prefer something that starts at the beginning if possible + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights2", () => { + var match1 = getFirstMatch("BazBarFooFooFoo", "FFF"); + var match2 = getFirstMatch("BazFogBarFooFoo", "FFF"); + + // Contiguous things should also be preferred + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights3", () => { + var match1 = getFirstMatch("FogBarFooFoo", "FFF"); + var match2 = getFirstMatch("BarFooFooFoo", "FFF"); + + // The weight of being first should be greater than the weight of being contiguous + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("AllLowerPattern1", () => { + debugger; + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern2", () => { + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh"); + + assert.isTrue(undefined === match); + }); + + it("AllLowerPattern3", () => { + var match = getFirstMatch("ABCDEFGH", "bcd"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern4", () => { + var match = getFirstMatch("AbcdefghijEfgHij", "efghij"); + + assert.isTrue(undefined === match); + }); + }); + + describe("MultiWordPattern", () => { + it("ExactWithLowercase", () => { + var matches = getAllMatches("AddMetadataReference", "addmetadatareference"); + + assertContainsKind(ts.PatternMatchKind.Exact, matches); + }); + + it("SingleLowercasedSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleLowercasedSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "Add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "Metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchLetter1", () => { + var matches = getAllMatches("AddMetadataReference", "A"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchLetter2", () => { + var matches = getAllMatches("AddMetadataReference", "M"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "add metadata"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "A M"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "AM"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref Metadata") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref M") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("MixedCamelCase", () => { + var matches = getAllMatches("AddMetadataReference", "AMRe"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("BlankPattern", () => { + var matches = getAllMatches("AddMetadataReference", ""); + + assert.isTrue(matches === undefined); + }); + + it("WhitespaceOnlyPattern", () => { + var matches = getAllMatches("AddMetadataReference", " "); + + assert.isTrue(matches === undefined); + }); + + it("EachWordSeparately1", () => { + var matches = getAllMatches("AddMetadataReference", "add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately2", () => { + var matches = getAllMatches("AddMetadataReference", "Add meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately3", () => { + var matches = getAllMatches("AddMetadataReference", "Add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("MixedCasing", () => { + var matches = getAllMatches("AddMetadataReference", "mEta"); + + assert.isTrue(matches === undefined); + }); + + it("MixedCasing2", () => { + var matches = getAllMatches("AddMetadataReference", "Data"); + + assert.isTrue(matches === undefined); + }); + + it("AsteriskSplit", () => { + var matches = getAllMatches("GetKeyWord", "K*W"); + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("LowercaseSubstring1", () => { + var matches = getAllMatches("Operator", "a"); + + assert.isTrue(matches === undefined); + }); + + it("LowercaseSubstring2", () => { + var matches = getAllMatches("FooAttribute", "a"); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + assert.isFalse(matches[0].isCaseSensitive); + }); + }); + + describe("DottedPattern", () => { + it("DottedPattern1", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern2", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern3", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q"); + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern4", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern5", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern6", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern7", () => { + debugger; + var match = getFirstMatch("UIElement", "UIElement"); + var match = getFirstMatch("GetKeyword", "UIElement"); + assert.isTrue(match === undefined); + }); + }); + + function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + return matches ? matches[0] : undefined; + } + + function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] { + return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + } + + function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatches(candidate, dottedContainer); + return matches ? matches[0] : undefined; + } + + function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) { + return ts.map(spans, s => identifier.substr(s.start, s.length)); + } + + function breakIntoCharacterSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoCharacterSpans(identifier)); + } + + function breakIntoWordSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier)); + } + function assertArrayEquals(array1: T[], array2: T[]) { + assert.equal(array1.length, array2.length); + + for (var i = 0, n = array1.length; i < n; i++) { + assert.equal(array1[i], array2[i]); + } + } + + function assertInRange(val: number, low: number, high: number) { + assert.isTrue(val >= low); + assert.isTrue(val <= high); + } + + function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoCharacterSpans(original)); + } + + function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoWordSpans(original)); + } + + function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) { + assert.isTrue(ts.forEach(results, r => r.kind === kind)); + } +}); \ No newline at end of file