Merge branch 'master' into out-module-concat

This commit is contained in:
Wesley Wigham 2015-10-12 10:21:01 -07:00
commit 1ae7b7c254
549 changed files with 5972 additions and 2957 deletions

View file

@ -3,7 +3,11 @@ doc
scripts
src
tests
internal
tslint.json
Jakefile.js
.travis.yml
.editorconfig
.gitattributes
.settings/
.travis.yml
.vscode/

View file

@ -185,8 +185,9 @@ namespace ts {
function declareSymbol(symbolTable: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
Debug.assert(!hasDynamicName(node));
let isDefaultExport = node.flags & NodeFlags.Default;
// The exported symbol for an export default function/class node is always named "default"
let name = node.flags & NodeFlags.Default && parent ? "default" : getDeclarationName(node);
let name = isDefaultExport && parent ? "default" : getDeclarationName(node);
let symbol: Symbol;
if (name !== undefined) {
@ -227,6 +228,13 @@ namespace ts {
let message = symbol.flags & SymbolFlags.BlockScopedVariable
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
: Diagnostics.Duplicate_identifier_0;
forEach(symbol.declarations, declaration => {
if (declaration.flags & NodeFlags.Default) {
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
}
});
forEach(symbol.declarations, declaration => {
file.bindDiagnostics.push(createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration)));
});

View file

@ -2209,7 +2209,7 @@ namespace ts {
/**
* Push an entry on the type resolution stack. If an entry with the given target and the given property name
* is already on the stack, and no entries in between already have a type, then a circularity has occurred.
* is already on the stack, and no entries in between already have a type, then a circularity has occurred.
* In this case, the result values of the existing entry and all entries pushed after it are changed to false,
* and the value false is returned. Otherwise, the new entry is just pushed onto the stack, and true is returned.
* In order to see if the same query has already been done before, the target object and the propertyName both
@ -5243,7 +5243,7 @@ namespace ts {
// Only want to compare the construct signatures for abstractness guarantees.
// Because the "abstractness" of a class is the same across all construct signatures
// (internally we are checking the corresponding declaration), it is enough to perform
// (internally we are checking the corresponding declaration), it is enough to perform
// the check and report an error once over all pairs of source and target construct signatures.
//
// sourceSig and targetSig are (possibly) undefined.
@ -6642,7 +6642,7 @@ namespace ts {
let needToCaptureLexicalThis = false;
if (!isCallExpression) {
// adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
// adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
while (container && container.kind === SyntaxKind.ArrowFunction) {
container = getSuperContainer(container, /*includeFunctions*/ true);
needToCaptureLexicalThis = languageVersion < ScriptTarget.ES6;
@ -6652,7 +6652,7 @@ namespace ts {
let canUseSuperExpression = isLegalUsageOfSuperExpression(container);
let nodeCheckFlag: NodeCheckFlags = 0;
// always set NodeCheckFlags for 'super' expression node
// always set NodeCheckFlags for 'super' expression node
if (canUseSuperExpression) {
if ((container.flags & NodeFlags.Static) || isCallExpression) {
nodeCheckFlag = NodeCheckFlags.SuperStatic;
@ -7313,15 +7313,15 @@ namespace ts {
}
function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type {
let inDestructuringPattern = isAssignmentTarget(node);
// Grammar checking
checkGrammarObjectLiteralExpression(node);
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
let propertiesTable: SymbolTable = {};
let propertiesArray: Symbol[] = [];
let contextualType = getContextualType(node);
let contextualTypeHasPattern = contextualType && contextualType.pattern &&
(contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression);
let inDestructuringPattern = isAssignmentTarget(node);
let typeFlags: TypeFlags = 0;
for (let memberDecl of node.properties) {
@ -7345,7 +7345,10 @@ namespace ts {
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
if (memberDecl.kind === SyntaxKind.PropertyAssignment && hasDefaultValue((<PropertyAssignment>memberDecl).initializer)) {
const isOptional =
(memberDecl.kind === SyntaxKind.PropertyAssignment && hasDefaultValue((<PropertyAssignment>memberDecl).initializer)) ||
(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment && (<ShorthandPropertyAssignment>memberDecl).objectAssignmentInitializer);
if (isOptional) {
prop.flags |= SymbolFlags.Optional;
}
}
@ -8125,6 +8128,7 @@ namespace ts {
/**
* If indexArgumentExpression is a string literal or number literal, returns its text.
* If indexArgumentExpression is a constant value, returns its string value.
* 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.
@ -8133,6 +8137,12 @@ namespace ts {
if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) {
return (<LiteralExpression>indexArgumentExpression).text;
}
if (indexArgumentExpression.kind === SyntaxKind.ElementAccessExpression || indexArgumentExpression.kind === SyntaxKind.PropertyAccessExpression) {
let value = getConstantValue(<ElementAccessExpression | PropertyAccessExpression>indexArgumentExpression);
if (value !== undefined) {
return value.toString();
}
}
if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) {
let rightHandSideName = (<Identifier>(<PropertyAccessExpression>indexArgumentExpression).name).text;
return getPropertyNameForKnownSymbolName(rightHandSideName);
@ -8568,7 +8578,7 @@ namespace ts {
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts)
// If we are emitting decorators for ES3, we will only pass two arguments.
// If we are emitting decorators for ES3, we will only pass two arguments.
if (languageVersion === ScriptTarget.ES3) {
return 2;
}
@ -9744,7 +9754,7 @@ namespace ts {
return !symbol || symbol === unknownSymbol || (symbol.flags & ~SymbolFlags.EnumMember) !== 0;
}
case SyntaxKind.ElementAccessExpression:
// old compiler doesn't check indexed assess
// old compiler doesn't check indexed access
return true;
case SyntaxKind.ParenthesizedExpression:
return isReferenceOrErrorExpression((<ParenthesizedExpression>n).expression);
@ -9902,32 +9912,32 @@ namespace ts {
return (symbol.flags & SymbolFlags.ConstEnum) !== 0;
}
function checkInstanceOfExpression(node: BinaryExpression, leftType: Type, rightType: Type): Type {
function checkInstanceOfExpression(left: Expression, right: Expression, leftType: Type, rightType: Type): Type {
// TypeScript 1.0 spec (April 2014): 4.15.4
// The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type,
// 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 (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);
error(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
if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
error(node.right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
}
return booleanType;
}
function checkInExpression(node: BinaryExpression, leftType: Type, rightType: Type): Type {
function checkInExpression(left: Expression, right: Expression, leftType: Type, rightType: Type): Type {
// TypeScript 1.0 spec (April 2014): 4.15.5
// 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 (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 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);
error(left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 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);
error(right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
}
@ -9944,7 +9954,12 @@ namespace ts {
isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) ||
getIndexTypeOfType(sourceType, IndexKind.String);
if (type) {
checkDestructuringAssignment((<PropertyAssignment>p).initializer || name, type);
if (p.kind === SyntaxKind.ShorthandPropertyAssignment) {
checkDestructuringAssignment(<ShorthandPropertyAssignment>p, type);
}
else {
checkDestructuringAssignment((<PropertyAssignment>p).initializer || name, type);
}
}
else {
error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), declarationNameToString(name));
@ -10004,7 +10019,19 @@ namespace ts {
return sourceType;
}
function checkDestructuringAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type {
function checkDestructuringAssignment(exprOrAssignment: Expression | ShorthandPropertyAssignment, sourceType: Type, contextualMapper?: TypeMapper): Type {
let target: Expression;
if (exprOrAssignment.kind === SyntaxKind.ShorthandPropertyAssignment) {
const prop = <ShorthandPropertyAssignment>exprOrAssignment;
if (prop.objectAssignmentInitializer) {
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper);
}
target = (<ShorthandPropertyAssignment>exprOrAssignment).name;
}
else {
target = <Expression>exprOrAssignment;
}
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
checkBinaryExpression(<BinaryExpression>target, contextualMapper);
target = (<BinaryExpression>target).left;
@ -10027,12 +10054,16 @@ namespace ts {
}
function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) {
let 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);
return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node);
}
function checkBinaryLikeExpression(left: Expression, operatorToken: Node, right: Expression, contextualMapper?: TypeMapper, errorNode?: Node) {
let operator = operatorToken.kind;
if (operator === SyntaxKind.EqualsToken && (left.kind === SyntaxKind.ObjectLiteralExpression || left.kind === SyntaxKind.ArrayLiteralExpression)) {
return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper);
}
let leftType = checkExpression(node.left, contextualMapper);
let rightType = checkExpression(node.right, contextualMapper);
let leftType = checkExpression(left, contextualMapper);
let rightType = checkExpression(right, contextualMapper);
switch (operator) {
case SyntaxKind.AsteriskToken:
case SyntaxKind.AsteriskEqualsToken:
@ -10068,13 +10099,13 @@ namespace ts {
// try and return them a helpful suggestion
if ((leftType.flags & TypeFlags.Boolean) &&
(rightType.flags & TypeFlags.Boolean) &&
(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));
(suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) {
error(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
}
else {
// otherwise just check each operand separately and report errors as normal
let leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
let rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
let leftOk = checkArithmeticOperandType(left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
let rightOk = checkArithmeticOperandType(right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);
if (leftOk && rightOk) {
checkAssignmentOperator(numberType);
}
@ -10140,9 +10171,9 @@ namespace ts {
}
return booleanType;
case SyntaxKind.InstanceOfKeyword:
return checkInstanceOfExpression(node, leftType, rightType);
return checkInstanceOfExpression(left, right, leftType, rightType);
case SyntaxKind.InKeyword:
return checkInExpression(node, leftType, rightType);
return checkInExpression(left, right, leftType, rightType);
case SyntaxKind.AmpersandAmpersandToken:
return rightType;
case SyntaxKind.BarBarToken:
@ -10157,8 +10188,8 @@ namespace ts {
// Return true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean {
let offendingSymbolOperand =
someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left :
someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right :
someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? left :
someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? right :
undefined;
if (offendingSymbolOperand) {
error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator));
@ -10192,17 +10223,17 @@ namespace ts {
// requires VarExpr to be classified as a reference
// A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1)
// and the type of the non - compound operation to be assignable to the type of VarExpr.
let ok = checkReferenceExpression(node.left, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant);
let ok = checkReferenceExpression(left, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant);
// Use default messages
if (ok) {
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
checkTypeAssignableTo(valueType, leftType, node.left, /*headMessage*/ undefined);
checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);
}
}
}
function reportOperatorError() {
error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType));
error(errorNode || operatorToken, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType));
}
}
@ -11306,7 +11337,8 @@ namespace ts {
}
function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage) {
if (!(type.flags & TypeFlags.Any) && isTypeAssignableTo(type, getGlobalThenableType())) {
type = getWidenedType(type);
if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) {
if (location) {
if (!message) {
message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;
@ -12544,7 +12576,12 @@ namespace ts {
if (isAsyncFunctionLike(func)) {
let promisedType = getPromisedType(returnType);
let awaitedType = checkAwaitedType(exprType, node.expression, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);
checkTypeAssignableTo(awaitedType, promisedType, node.expression);
if (promisedType) {
// If the function has a return type, but promisedType is
// undefined, an error will be reported in checkAsyncFunctionReturnType
// so we don't need to report one here.
checkTypeAssignableTo(awaitedType, promisedType, node.expression);
}
}
else {
checkTypeAssignableTo(exprType, returnType, node.expression);
@ -13154,13 +13191,13 @@ namespace ts {
autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);
}
else if (ambient && !enumIsConst) {
// In ambient enum declarations that specify no const modifier, enum member declarations
// In ambient enum declarations that specify no const modifier, enum member declarations
// that omit a value are considered computed members (as opposed to having auto-incremented values assigned).
autoValue = undefined;
}
else if (previousEnumMemberIsNonConstant) {
// If the member declaration specifies no value, the member is considered a constant enum member.
// If the member is the first member in the enum declaration, it is assigned the value zero.
// If the member declaration specifies no value, the member is considered a constant enum member.
// If the member is the first member in the enum declaration, it is assigned the value zero.
// Otherwise, it is assigned the value of the immediately preceding member plus one,
// and an error occurs if the immediately preceding member is not a constant enum member
error(member.name, Diagnostics.Enum_member_must_have_initializer);
@ -14100,7 +14137,7 @@ namespace ts {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
// Note: that the memberFlags come from previous iteration.
if (!(memberFlags & NodeFlags.Static)) {
@ -14764,31 +14801,6 @@ namespace ts {
return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;
}
function getBlockScopedVariableId(n: Identifier): number {
Debug.assert(!nodeIsSynthesized(n));
let isVariableDeclarationOrBindingElement =
n.parent.kind === SyntaxKind.BindingElement || (n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n);
let symbol =
(isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) ||
getNodeLinks(n).resolvedSymbol ||
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
let isLetOrConst =
symbol &&
(symbol.flags & SymbolFlags.BlockScopedVariable) &&
symbol.valueDeclaration.parent.kind !== SyntaxKind.CatchClause;
if (isLetOrConst) {
// side-effect of calling this method:
// assign id to symbol if it was not yet set
getSymbolLinks(symbol);
return symbol.id;
}
return undefined;
}
function instantiateSingleCallFunctionType(functionType: Type, typeArguments: Type[]): Type {
if (functionType === unknownType) {
return unknownType;
@ -14823,7 +14835,6 @@ namespace ts {
isEntityNameVisible,
getConstantValue,
collectLinkedAliases,
getBlockScopedVariableId,
getReferencedValueDeclaration,
getTypeReferenceSerializationKind,
isOptionalParameter
@ -15434,7 +15445,7 @@ namespace ts {
}
}
function checkGrammarObjectLiteralExpression(node: ObjectLiteralExpression) {
function checkGrammarObjectLiteralExpression(node: ObjectLiteralExpression, inDestructuring: boolean) {
let seen: Map<SymbolFlags> = {};
let Property = 1;
let GetAccessor = 2;
@ -15450,6 +15461,12 @@ namespace ts {
continue;
}
if (prop.kind === SyntaxKind.ShorthandPropertyAssignment && !inDestructuring && (<ShorthandPropertyAssignment>prop).objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode((<ShorthandPropertyAssignment>prop).equalsToken, Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
}
// ECMA-262 11.1.5 Object Initialiser
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and

View file

@ -448,6 +448,9 @@ namespace ts {
}
if (opt.isFilePath) {
value = normalizePath(combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
@ -497,4 +500,4 @@ namespace ts {
return fileNames;
}
}
}
}

View file

@ -800,6 +800,10 @@
"category": "Error",
"code": 1311
},
"'=' can only be used in an object literal property inside a destructuring assignment.": {
"category": "Error",
"code": 1312
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@ -1656,6 +1660,10 @@
"category": "Error",
"code": 2527
},
"A module cannot have multiple default exports.": {
"category": "Error",
"code": 2528
},
"JSX element attributes type '{0}' must be an object type.": {
"category": "Error",
"code": 2600

View file

@ -2333,6 +2333,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(": ");
emit(node.name);
}
if (languageVersion >= ScriptTarget.ES6 && node.objectAssignmentInitializer) {
write(" = ");
emit(node.objectAssignmentInitializer);
}
}
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
@ -3596,7 +3601,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
for (let p of properties) {
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
let propName = <Identifier | LiteralExpression>(<PropertyAssignment>p).name;
emitDestructuringAssignment((<PropertyAssignment>p).initializer || propName, createPropertyAccessForDestructuringProperty(value, propName));
let target = p.kind === SyntaxKind.ShorthandPropertyAssignment ? <ShorthandPropertyAssignment>p : (<PropertyAssignment>p).initializer || propName;
emitDestructuringAssignment(target, createPropertyAccessForDestructuringProperty(value, propName));
}
}
}
@ -3621,8 +3627,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function emitDestructuringAssignment(target: Expression, value: Expression) {
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
function emitDestructuringAssignment(target: Expression | ShorthandPropertyAssignment, value: Expression) {
if (target.kind === SyntaxKind.ShorthandPropertyAssignment) {
if ((<ShorthandPropertyAssignment>target).objectAssignmentInitializer) {
value = createDefaultValueCheck(value, (<ShorthandPropertyAssignment>target).objectAssignmentInitializer);
}
target = (<ShorthandPropertyAssignment>target).name;
}
else if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
value = createDefaultValueCheck(value, (<BinaryExpression>target).right);
target = (<BinaryExpression>target).left;
}
@ -3807,7 +3819,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(";");
}
}
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) {
if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile) {
forEach(node.declarationList.declarations, emitExportVariableAssignments);
}
}
@ -4033,7 +4045,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
emitSignatureAndBody(node);
if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
if (modulekind !== ModuleKind.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
emitExportMemberAssignments((<FunctionDeclaration>node).name);
}
@ -4709,6 +4721,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
else {
emitClassLikeDeclarationForES6AndHigher(node);
}
if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile && node.name) {
emitExportMemberAssignments(node.name);
}
}
function emitClassLikeDeclarationForES6AndHigher(node: ClassLikeDeclaration) {
@ -4807,8 +4822,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// emit name if
// - node has a name
// - this is default export and target is not ES6 (for ES6 `export default` does not need to be compiled downlevel)
if ((node.name || (node.flags & NodeFlags.Default && languageVersion < ScriptTarget.ES6)) && !thisNodeIsDecorated) {
// - this is default export with static initializers
if ((node.name || (node.flags & NodeFlags.Default && staticProperties.length > 0)) && !thisNodeIsDecorated) {
write(" ");
emitDeclarationName(node);
}
@ -4956,10 +4971,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (node.kind === SyntaxKind.ClassDeclaration) {
emitExportMemberAssignment(<ClassDeclaration>node);
}
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile && node.name) {
emitExportMemberAssignments(node.name);
}
}
function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) {
@ -5531,7 +5542,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitEnd(node);
write(";");
}
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) {
if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile) {
if (modulekind === ModuleKind.System && (node.flags & NodeFlags.Export)) {
// write the call to exporter for enum
writeLine();
@ -5667,8 +5678,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
/*
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
* Here we check if alternative name was provided for a given moduleName and return it if possible.
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
* Here we check if alternative name was provided for a given moduleName and return it if possible.
*/
function tryRenameExternalModule(moduleName: LiteralExpression): string {
if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) {
@ -7108,7 +7119,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return shouldEmitEnumDeclaration(<EnumDeclaration>node);
}
// If the node is emitted in specialized fashion, dont emit comments as this node will handle
// If the node is emitted in specialized fashion, dont emit comments as this node will handle
// emitting comments when emitting itself
Debug.assert(!isSpecializedCommentHandling(node));

View file

@ -57,11 +57,17 @@ namespace ts {
return visitNode(cbNode, (<TypeParameterDeclaration>node).name) ||
visitNode(cbNode, (<TypeParameterDeclaration>node).constraint) ||
visitNode(cbNode, (<TypeParameterDeclaration>node).expression);
case SyntaxKind.ShorthandPropertyAssignment:
return visitNodes(cbNodes, node.decorators) ||
visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).name) ||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).questionToken) ||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).equalsToken) ||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).objectAssignmentInitializer);
case SyntaxKind.Parameter:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.PropertyAssignment:
case SyntaxKind.ShorthandPropertyAssignment:
case SyntaxKind.VariableDeclaration:
case SyntaxKind.BindingElement:
return visitNodes(cbNodes, node.decorators) ||
@ -3758,11 +3764,23 @@ namespace ts {
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);
}
// Parse to check if it is short-hand property assignment or normal property assignment
if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) {
// check if it is short-hand property assignment or normal property assignment
// NOTE: if token is EqualsToken it is interpreted as CoverInitializedName production
// CoverInitializedName[Yield] :
// IdentifierReference[?Yield] Initializer[In, ?Yield]
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
const isShorthandPropertyAssignment =
tokenIsIdentifier && (token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken || token === SyntaxKind.EqualsToken);
if (isShorthandPropertyAssignment) {
let shorthandDeclaration = <ShorthandPropertyAssignment>createNode(SyntaxKind.ShorthandPropertyAssignment, fullStart);
shorthandDeclaration.name = <Identifier>propertyName;
shorthandDeclaration.questionToken = questionToken;
const equalsToken = parseOptionalToken(SyntaxKind.EqualsToken);
if (equalsToken) {
shorthandDeclaration.equalsToken = equalsToken;
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(shorthandDeclaration);
}
else {

View file

@ -562,6 +562,10 @@ namespace ts {
export interface ShorthandPropertyAssignment extends ObjectLiteralElement {
name: Identifier;
questionToken?: Node;
// used when ObjectLiteralExpression is used in ObjectAssignmentPattern
// it is grammar error to appear in actual object initializer
equalsToken?: Node;
objectAssignmentInitializer?: Expression;
}
// SyntaxKind.VariableDeclaration
@ -1598,7 +1602,6 @@ namespace ts {
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
getBlockScopedVariableId(node: Identifier): number;
getReferencedValueDeclaration(reference: Identifier): Declaration;
getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind;
isOptionalParameter(node: ParameterDeclaration): boolean;

View file

@ -100,6 +100,8 @@ namespace FourSlash {
end: number;
}
export import IndentStyle = ts.IndentStyle;
let entityMap: ts.Map<string> = {
"&": "&amp;",
"\"": "&quot;",
@ -309,6 +311,7 @@ namespace FourSlash {
TabSize: 4,
NewLineCharacter: Harness.IO.newLine(),
ConvertTabsToSpaces: true,
IndentStyle: ts.IndentStyle.Smart,
InsertSpaceAfterCommaDelimiter: true,
InsertSpaceAfterSemicolonInForStatements: true,
InsertSpaceBeforeAndAfterBinaryOperators: true,
@ -1695,24 +1698,28 @@ namespace FourSlash {
}
}
private getIndentation(fileName: string, position: number): number {
return this.languageService.getIndentationAtPosition(fileName, position, this.formatCodeOptions);
private getIndentation(fileName: string, position: number, indentStyle: ts.IndentStyle): number {
let formatOptions = ts.clone(this.formatCodeOptions);
formatOptions.IndentStyle = indentStyle;
return this.languageService.getIndentationAtPosition(fileName, position, formatOptions);
}
public verifyIndentationAtCurrentPosition(numberOfSpaces: number) {
public verifyIndentationAtCurrentPosition(numberOfSpaces: number, indentStyle: ts.IndentStyle = ts.IndentStyle.Smart) {
this.taoInvalidReason = "verifyIndentationAtCurrentPosition NYI";
let actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition);
let actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition, indentStyle);
let lineCol = this.getLineColStringAtPosition(this.currentCaretPosition);
if (actual !== numberOfSpaces) {
this.raiseError(`verifyIndentationAtCurrentPosition failed at ${lineCol} - expected: ${numberOfSpaces}, actual: ${actual}`);
}
}
public verifyIndentationAtPosition(fileName: string, position: number, numberOfSpaces: number) {
public verifyIndentationAtPosition(fileName: string, position: number, numberOfSpaces: number, indentStyle: ts.IndentStyle = ts.IndentStyle.Smart) {
this.taoInvalidReason = "verifyIndentationAtPosition NYI";
let actual = this.getIndentation(fileName, position);
let actual = this.getIndentation(fileName, position, indentStyle);
let lineCol = this.getLineColStringAtPosition(position);
if (actual !== numberOfSpaces) {
this.raiseError(`verifyIndentationAtPosition failed at ${lineCol} - expected: ${numberOfSpaces}, actual: ${actual}`);

View file

@ -57,7 +57,9 @@ class TypeWriterWalker {
symbolString += ", ";
let declSourceFile = declaration.getSourceFile();
let declLineAndCharacter = declSourceFile.getLineAndCharacterOfPosition(declaration.pos);
symbolString += `Decl(${ ts.getBaseFileName(declSourceFile.fileName) }, ${ declLineAndCharacter.line }, ${ declLineAndCharacter.character })`;
let fileName = ts.getBaseFileName(declSourceFile.fileName);
let isLibFile = /lib(.*)\.d\.ts/i.test(fileName);
symbolString += `Decl(${ fileName }, ${ isLibFile ? "--" : declLineAndCharacter.line }, ${ isLibFile ? "--" : declLineAndCharacter.character })`;
}
}
symbolString += ")";

View file

@ -1067,7 +1067,7 @@ declare var CanvasPattern: {
interface CanvasRenderingContext2D {
canvas: HTMLCanvasElement;
fillStyle: any;
fillStyle: string | CanvasGradient | CanvasPattern;
font: string;
globalAlpha: number;
globalCompositeOperation: string;
@ -1082,7 +1082,7 @@ interface CanvasRenderingContext2D {
shadowColor: string;
shadowOffsetX: number;
shadowOffsetY: number;
strokeStyle: any;
strokeStyle: string | CanvasGradient | CanvasPattern;
textAlign: string;
textBaseline: string;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
@ -2450,8 +2450,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
importNode(importedNode: Node, deep: boolean): Node;
msElementsFromPoint(x: number, y: number): NodeList;
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
msGetPrintDocumentForNamedFlow(flowName: string): Document;
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
/**
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
* @param url Specifies a MIME type for the document.
@ -7273,27 +7271,6 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
interface MSHeaderFooter {
URL: string;
dateLong: string;
dateShort: string;
font: string;
htmlFoot: string;
htmlHead: string;
page: number;
pageTotal: number;
textFoot: string;
textHead: string;
timeLong: string;
timeShort: string;
title: string;
}
declare var MSHeaderFooter: {
prototype: MSHeaderFooter;
new(): MSHeaderFooter;
}
interface MSInputMethodContext extends EventTarget {
compositionEndOffset: number;
compositionStartOffset: number;
@ -7452,24 +7429,6 @@ declare var MSPointerEvent: {
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
}
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
percentScale: number;
showHeaderFooter: boolean;
shrinkToFit: boolean;
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
endPrint(): void;
getPrintTaskOptionValue(key: string): any;
invalidatePreview(): void;
setPageCount(pageCount: number): void;
startPrint(): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSPrintManagerTemplatePrinter: {
prototype: MSPrintManagerTemplatePrinter;
new(): MSPrintManagerTemplatePrinter;
}
interface MSRangeCollection {
length: number;
item(index: number): Range;
@ -7517,63 +7476,6 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
interface MSTemplatePrinter {
collate: boolean;
copies: number;
currentPage: boolean;
currentPageAvail: boolean;
duplex: boolean;
footer: string;
frameActive: boolean;
frameActiveEnabled: boolean;
frameAsShown: boolean;
framesetDocument: boolean;
header: string;
headerFooterFont: string;
marginBottom: number;
marginLeft: number;
marginRight: number;
marginTop: number;
orientation: string;
pageFrom: number;
pageHeight: number;
pageTo: number;
pageWidth: number;
selectedPages: boolean;
selection: boolean;
selectionEnabled: boolean;
unprintableBottom: number;
unprintableLeft: number;
unprintableRight: number;
unprintableTop: number;
usePrinterCopyCollate: boolean;
createHeaderFooter(): MSHeaderFooter;
deviceSupports(property: string): any;
ensurePrintDialogDefaults(): boolean;
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
printBlankPage(): void;
printNonNative(document: any): boolean;
printNonNativeFrames(document: any, activeFrame: boolean): void;
printPage(element: HTMLElement): void;
showPageSetupDialog(): boolean;
showPrintDialog(): boolean;
startDoc(title: string): boolean;
stopDoc(): void;
updatePageStatus(status: number): void;
}
declare var MSTemplatePrinter: {
prototype: MSTemplatePrinter;
new(): MSTemplatePrinter;
}
interface MSWebViewAsyncOperation extends EventTarget {
error: DOMError;
oncomplete: (ev: Event) => any;
@ -8718,7 +8620,6 @@ declare var SVGDescElement: {
interface SVGElement extends Element {
id: string;
className: any;
onclick: (ev: MouseEvent) => any;
ondblclick: (ev: MouseEvent) => any;
onfocusin: (ev: FocusEvent) => any;
@ -8732,6 +8633,7 @@ interface SVGElement extends Element {
ownerSVGElement: SVGSVGElement;
viewportElement: SVGElement;
xmlbase: string;
className: any;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@ -11871,7 +11773,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
locationbar: BarProp;
menubar: BarProp;
msAnimationStartTime: number;
msTemplatePrinter: MSTemplatePrinter;
name: string;
navigator: Navigator;
offscreenBuffering: string | boolean;
@ -12608,7 +12509,6 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface NodeListOf<TNode extends Node> extends NodeList {
length: number;
item(index: number): TNode;
@ -12629,8 +12529,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@ -12646,6 +12544,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}
@ -12706,7 +12606,6 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msAnimationStartTime: number;
declare var msTemplatePrinter: MSTemplatePrinter;
declare var name: string;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;

View file

@ -894,7 +894,6 @@ interface WorkerUtils extends Object, WindowBase64 {
setTimeout(handler: any, timeout?: any, ...args: any[]): number;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
@ -909,8 +908,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@ -926,6 +923,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}

View file

@ -1177,6 +1177,7 @@ namespace ts.server {
TabSize: 4,
NewLineCharacter: ts.sys ? ts.sys.newLine : '\n',
ConvertTabsToSpaces: true,
IndentStyle: ts.IndentStyle.Smart,
InsertSpaceAfterCommaDelimiter: true,
InsertSpaceAfterSemicolonInForStatements: true,
InsertSpaceBeforeAndAfterBinaryOperators: true,
@ -1187,7 +1188,6 @@ namespace ts.server {
PlaceOpenBraceOnNewLineForFunctions: false,
PlaceOpenBraceOnNewLineForControlBlocks: false,
}
}
export interface LineCollection {

View file

@ -606,6 +606,7 @@ namespace ts.server {
TabSize: formatOptions.TabSize,
NewLineCharacter: "\n",
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces,
IndentStyle: ts.IndentStyle.Smart,
};
var indentPosition =
compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);

View file

@ -216,8 +216,10 @@ namespace ts.formatting {
// Async functions
public SpaceBetweenAsyncAndFunctionKeyword: Rule;
// Tagged template string
// Template strings
public SpaceBetweenTagAndTemplateString: Rule;
public NoSpaceAfterTemplateHeadAndMiddle: Rule;
public NoSpaceBeforeTemplateMiddleAndTail: Rule;
constructor() {
///
@ -371,6 +373,8 @@ namespace ts.formatting {
// template string
this.SpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
// These rules are higher in priority than user-configurable rules.
this.HighPriorityCommonRules =
@ -399,7 +403,7 @@ namespace ts.formatting {
this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,
this.SpaceAfterVoidOperator,
this.SpaceBetweenAsyncAndFunctionKeyword,
this.SpaceBetweenTagAndTemplateString,
this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail,
// TypeScript-specific rules
this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,

View file

@ -13,6 +13,12 @@ namespace ts.formatting {
return 0; // past EOF
}
// no indentation when the indent style is set to none,
// so we can return fast
if (options.IndentStyle === IndentStyle.None) {
return 0;
}
let precedingToken = findPrecedingToken(position, sourceFile);
if (!precedingToken) {
return 0;
@ -26,6 +32,26 @@ namespace ts.formatting {
let lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
// indentation is first non-whitespace character in a previous line
// for block indentation, we should look for a line which contains something that's not
// whitespace.
if (options.IndentStyle === IndentStyle.Block) {
// move backwards until we find a line with a non-whitespace character,
// then find the first non-whitespace character for that line.
let current = position;
while (current > 0){
let char = sourceFile.text.charCodeAt(current);
if (!isWhiteSpace(char) && !isLineBreak(char)) {
break;
}
current--;
}
let lineStart = ts.getLineStartPositionForPosition(current, sourceFile);
return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current, sourceFile, options);
}
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
let actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
@ -218,7 +244,7 @@ namespace ts.formatting {
function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter {
return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
}
export function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean {
if (parent.kind === SyntaxKind.IfStatement && (<IfStatement>parent).elseStatement === child) {
let elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile);
@ -319,7 +345,7 @@ namespace ts.formatting {
}
return Value.Unknown;
function getStartingExpression(node: PropertyAccessExpression | CallExpression | ElementAccessExpression) {
while (true) {
switch (node.kind) {
@ -465,4 +491,4 @@ namespace ts.formatting {
}
}
}
}
}

View file

@ -1189,6 +1189,13 @@ namespace ts {
TabSize: number;
NewLineCharacter: string;
ConvertTabsToSpaces: boolean;
IndentStyle: IndentStyle;
}
export enum IndentStyle {
None = 0,
Block = 1,
Smart = 2,
}
export interface FormatCodeOptions extends EditorOptions {
@ -1850,8 +1857,8 @@ namespace ts {
// so pass --noResolve to avoid reporting missing file errors.
options.noResolve = true;
// Parse
let inputFileName = transpileOptions.fileName || "module.ts";
// if jsx is specified then treat file as .tsx
let inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts");
let sourceFile = createSourceFile(inputFileName, input, options.target);
if (transpileOptions.moduleName) {
sourceFile.moduleName = transpileOptions.moduleName;

View file

@ -25,11 +25,11 @@ class Board {
>allShipsSunk : Symbol(allShipsSunk, Decl(2dArrays.ts, 9, 18))
return this.ships.every(function (val) { return val.isSunk; });
>this.ships.every : Symbol(Array.every, Decl(lib.d.ts, 1094, 62))
>this.ships.every : Symbol(Array.every, Decl(lib.d.ts, --, --))
>this.ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
>this : Symbol(Board, Decl(2dArrays.ts, 5, 1))
>ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
>every : Symbol(Array.every, Decl(lib.d.ts, 1094, 62))
>every : Symbol(Array.every, Decl(lib.d.ts, --, --))
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))
>val.isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))

View file

@ -3,7 +3,7 @@ var s: symbol;
>s : Symbol(s, Decl(ES5SymbolType1.ts, 0, 3))
s.toString();
>s.toString : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>s.toString : Symbol(Object.toString, Decl(lib.d.ts, --, --))
>s : Symbol(s, Decl(ES5SymbolType1.ts, 0, 3))
>toString : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>toString : Symbol(Object.toString, Decl(lib.d.ts, --, --))

View file

@ -11,11 +11,11 @@ module A {
export var beez: Array<B>;
>beez : Symbol(beez, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 5, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10))
export var beez2 = new Array<B>();
>beez2 : Symbol(beez2, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 6, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10))
}

View file

@ -14,12 +14,12 @@ function saySize(message: Message | Message[]) {
if (message instanceof Array) {
>message : Symbol(message, Decl(TypeGuardWithArrayUnion.ts, 4, 17))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
return message.length; // Should have type Message[] here
>message.length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20))
>message.length : Symbol(Array.length, Decl(lib.d.ts, --, --))
>message : Symbol(message, Decl(TypeGuardWithArrayUnion.ts, 4, 17))
>length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20))
>length : Symbol(Array.length, Decl(lib.d.ts, --, --))
}
}

View file

@ -35,7 +35,7 @@ var d: string;
var e: Object;
>e : Symbol(e, Decl(additionOperatorWithAnyAndEveryType.ts, 12, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
// any as left operand, result is type Any except plusing string
var r1 = a + a;

View file

@ -19,7 +19,7 @@ var d: string;
var e: Object;
>e : Symbol(e, Decl(additionOperatorWithStringAndEveryType.ts, 6, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var f: void;
>f : Symbol(f, Decl(additionOperatorWithStringAndEveryType.ts, 7, 3))

View file

@ -56,8 +56,8 @@ var r3 = foo3(a); // any
declare function foo5(x: Date): Date;
>foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 21, 22))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function foo5(x: any): any;
>foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37))
@ -71,8 +71,8 @@ var r3 = foo3(a); // any
declare function foo6(x: RegExp): RegExp;
>foo6 : Symbol(foo6, Decl(anyAssignabilityInInheritance.ts, 23, 17), Decl(anyAssignabilityInInheritance.ts, 25, 41))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 25, 22))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, 825, 1), Decl(lib.d.ts, 876, 11))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, 825, 1), Decl(lib.d.ts, 876, 11))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function foo6(x: any): any;
>foo6 : Symbol(foo6, Decl(anyAssignabilityInInheritance.ts, 23, 17), Decl(anyAssignabilityInInheritance.ts, 25, 41))
@ -277,8 +277,8 @@ var r3 = foo3(a); // any
declare function foo17(x: Object): Object;
>foo17 : Symbol(foo17, Decl(anyAssignabilityInInheritance.ts, 79, 17), Decl(anyAssignabilityInInheritance.ts, 81, 42))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 81, 23))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function foo17(x: any): any;
>foo17 : Symbol(foo17, Decl(anyAssignabilityInInheritance.ts, 79, 17), Decl(anyAssignabilityInInheritance.ts, 81, 42))

View file

@ -44,7 +44,7 @@ var d: boolean = a;
var e: Date = a;
>e : Symbol(e, Decl(anyAssignableToEveryType.ts, 17, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var f: any = a;
@ -57,7 +57,7 @@ var g: void = a;
var h: Object = a;
>h : Symbol(h, Decl(anyAssignableToEveryType.ts, 20, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var i: {} = a;
@ -70,7 +70,7 @@ var j: () => {} = a;
var k: Function = a;
>k : Symbol(k, Decl(anyAssignableToEveryType.ts, 23, 3))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var l: (x: number) => string = a;
@ -109,12 +109,12 @@ var o: <T>(x: T) => T = a;
var p: Number = a;
>p : Symbol(p, Decl(anyAssignableToEveryType.ts, 31, 3))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var q: String = a;
>q : Symbol(q, Decl(anyAssignableToEveryType.ts, 32, 3))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
@ -122,7 +122,7 @@ function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
>T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13))
>U : Symbol(U, Decl(anyAssignableToEveryType.ts, 34, 15))
>V : Symbol(V, Decl(anyAssignableToEveryType.ts, 34, 32))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(anyAssignableToEveryType.ts, 34, 49))
>T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13))
>y : Symbol(y, Decl(anyAssignableToEveryType.ts, 34, 54))

View file

@ -3,9 +3,9 @@ var paired: any[];
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
paired.reduce(function (a1, a2) {
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, 1129, 93), Decl(lib.d.ts, 1136, 120))
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, 1129, 93), Decl(lib.d.ts, 1136, 120))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a1 : Symbol(a1, Decl(anyInferenceAnonymousFunctions.ts, 2, 24))
>a2 : Symbol(a2, Decl(anyInferenceAnonymousFunctions.ts, 2, 27))
@ -15,9 +15,9 @@ paired.reduce(function (a1, a2) {
} , []);
paired.reduce((b1, b2) => {
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, 1129, 93), Decl(lib.d.ts, 1136, 120))
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, 1129, 93), Decl(lib.d.ts, 1136, 120))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b1 : Symbol(b1, Decl(anyInferenceAnonymousFunctions.ts, 8, 15))
>b2 : Symbol(b2, Decl(anyInferenceAnonymousFunctions.ts, 8, 18))
@ -27,24 +27,24 @@ paired.reduce((b1, b2) => {
} , []);
paired.reduce((b3, b4) => b3.concat({}), []);
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, 1129, 93), Decl(lib.d.ts, 1136, 120))
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, 1129, 93), Decl(lib.d.ts, 1136, 120))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b3 : Symbol(b3, Decl(anyInferenceAnonymousFunctions.ts, 13, 15))
>b4 : Symbol(b4, Decl(anyInferenceAnonymousFunctions.ts, 13, 18))
>b3 : Symbol(b3, Decl(anyInferenceAnonymousFunctions.ts, 13, 15))
paired.map((c1) => c1.count);
>paired.map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>paired.map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>c1 : Symbol(c1, Decl(anyInferenceAnonymousFunctions.ts, 15, 12))
>c1 : Symbol(c1, Decl(anyInferenceAnonymousFunctions.ts, 15, 12))
paired.map(function (c2) { return c2.count; });
>paired.map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>paired.map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>c2 : Symbol(c2, Decl(anyInferenceAnonymousFunctions.ts, 16, 21))
>c2 : Symbol(c2, Decl(anyInferenceAnonymousFunctions.ts, 16, 21))

View file

@ -11,9 +11,9 @@ class C {
for (var i = 0; i < arguments.length; i++) {
>i : Symbol(i, Decl(argsInScope.ts, 2, 15))
>i : Symbol(i, Decl(argsInScope.ts, 2, 15))
>arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, 272, 25))
>arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>arguments : Symbol(arguments)
>length : Symbol(IArguments.length, Decl(lib.d.ts, 272, 25))
>length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>i : Symbol(i, Decl(argsInScope.ts, 2, 15))
// WScript.Echo("param: " + arguments[i]);

View file

@ -14,9 +14,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>arguments : Symbol(arguments)
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>result.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 2, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12))
}

View file

@ -9,9 +9,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
let blah = arguments[Symbol.iterator];
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7))
>arguments : Symbol(arguments)
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3890, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3840, 52), Decl(lib.d.ts, 3946, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3890, 31))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --))
let result = [];
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
@ -21,9 +21,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7))
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>result.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12))
}

View file

@ -10,9 +10,9 @@ class A {
return {
selectedValue: arguments.length
>selectedValue : Symbol(selectedValue, Decl(argumentsUsedInObjectLiteralProperty.ts, 2, 16))
>arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, 272, 25))
>arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>arguments : Symbol(arguments)
>length : Symbol(IArguments.length, Decl(lib.d.ts, 272, 25))
>length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
};
}

View file

@ -1,12 +1,12 @@
=== tests/cases/compiler/arrayAugment.ts ===
interface Array<T> {
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(arrayAugment.ts, 0, 0))
>T : Symbol(T, Decl(lib.d.ts, 1007, 16), Decl(arrayAugment.ts, 0, 16))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 0))
>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 16))
split: (parts: number) => T[][];
>split : Symbol(split, Decl(arrayAugment.ts, 0, 20))
>parts : Symbol(parts, Decl(arrayAugment.ts, 1, 12))
>T : Symbol(T, Decl(lib.d.ts, 1007, 16), Decl(arrayAugment.ts, 0, 16))
>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 16))
}
var x = [''];

View file

@ -3,21 +3,21 @@ var a: string[] = [];
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
a.concat("hello", 'world');
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
a.concat('Hello');
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var b = new Array<string>();
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
b.concat('hello');
>b.concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View file

@ -1,14 +1,14 @@
=== tests/cases/compiler/arrayConcatMap.ts ===
var x = [].concat([{ a: 1 }], [{ a: 2 }])
>x : Symbol(x, Decl(arrayConcatMap.ts, 0, 3))
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>[].concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>concat : Symbol(Array.concat, Decl(lib.d.ts, 1025, 13), Decl(lib.d.ts, 1030, 46))
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>[].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 20))
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 32))
.map(b => b.a);
>map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>b : Symbol(b, Decl(arrayConcatMap.ts, 1, 15))
>b : Symbol(b, Decl(arrayConcatMap.ts, 1, 15))

View file

@ -4,28 +4,28 @@ var x: string[];
x = new Array(1);
>x : Symbol(x, Decl(arrayConstructors1.ts, 0, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
x = new Array('hi', 'bye');
>x : Symbol(x, Decl(arrayConstructors1.ts, 0, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
x = new Array<string>('hi', 'bye');
>x : Symbol(x, Decl(arrayConstructors1.ts, 0, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var y: number[];
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
y = new Array(1);
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
y = new Array(1,2);
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
y = new Array<number>(1, 2);
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View file

@ -6,7 +6,7 @@ var x = [];
var x = new Array(1);
>x : Symbol(x, Decl(arrayLiteral.ts, 2, 3), Decl(arrayLiteral.ts, 3, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var y = [1];
>y : Symbol(y, Decl(arrayLiteral.ts, 5, 3), Decl(arrayLiteral.ts, 6, 3), Decl(arrayLiteral.ts, 7, 3))
@ -16,14 +16,14 @@ var y = [1, 2];
var y = new Array<number>();
>y : Symbol(y, Decl(arrayLiteral.ts, 5, 3), Decl(arrayLiteral.ts, 6, 3), Decl(arrayLiteral.ts, 7, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var x2: number[] = [];
>x2 : Symbol(x2, Decl(arrayLiteral.ts, 9, 3), Decl(arrayLiteral.ts, 10, 3))
var x2: number[] = new Array(1);
>x2 : Symbol(x2, Decl(arrayLiteral.ts, 9, 3), Decl(arrayLiteral.ts, 10, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var y2: number[] = [1];
>y2 : Symbol(y2, Decl(arrayLiteral.ts, 12, 3), Decl(arrayLiteral.ts, 13, 3), Decl(arrayLiteral.ts, 14, 3))
@ -33,5 +33,5 @@ var y2: number[] = [1, 2];
var y2: number[] = new Array<number>();
>y2 : Symbol(y2, Decl(arrayLiteral.ts, 12, 3), Decl(arrayLiteral.ts, 13, 3), Decl(arrayLiteral.ts, 14, 3))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View file

@ -35,14 +35,14 @@ var cs = [a, b, c]; // { x: number; y?: number };[]
var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
>ds : Symbol(ds, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 10, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 10, 11))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 10, 29))
var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[]
>es : Symbol(es, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 11, 3))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 11, 11))
>x : Symbol(x, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 11, 29))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var fs = [(a: { x: number; y?: number }) => 1, (b: { x: number; z?: number }) => 2]; // (a: { x: number; y?: number }) => number[]
>fs : Symbol(fs, Decl(arrayLiteralWithMultipleBestCommonTypes.ts, 12, 3))

View file

@ -80,14 +80,14 @@ var temp4 = [];
interface myArray extends Array<Number> { }
>myArray : Symbol(myArray, Decl(arrayLiterals2ES5.ts, 42, 15))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
interface myArray2 extends Array<Number|String> { }
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES5.ts, 44, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[]
>d0 : Symbol(d0, Decl(arrayLiterals2ES5.ts, 46, 3))

View file

@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];
interface myArray extends Array<Number> { }
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
interface myArray2 extends Array<Number|String> { }
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))

View file

@ -39,29 +39,29 @@ class parser {
>this.options : Symbol(options, Decl(arrayconcat.ts, 10, 14))
>this : Symbol(parser, Decl(arrayconcat.ts, 8, 1))
>options : Symbol(options, Decl(arrayconcat.ts, 10, 14))
>this.options.sort : Symbol(Array.sort, Decl(lib.d.ts, 1054, 45))
>this.options.sort : Symbol(Array.sort, Decl(lib.d.ts, --, --))
>this.options : Symbol(options, Decl(arrayconcat.ts, 10, 14))
>this : Symbol(parser, Decl(arrayconcat.ts, 8, 1))
>options : Symbol(options, Decl(arrayconcat.ts, 10, 14))
>sort : Symbol(Array.sort, Decl(lib.d.ts, 1054, 45))
>sort : Symbol(Array.sort, Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(arrayconcat.ts, 14, 44))
>b : Symbol(b, Decl(arrayconcat.ts, 14, 46))
var aName = a.name.toLowerCase();
>aName : Symbol(aName, Decl(arrayconcat.ts, 15, 15))
>a.name.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>a.name.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>a.name : Symbol(IOptions.name, Decl(arrayconcat.ts, 0, 20))
>a : Symbol(a, Decl(arrayconcat.ts, 14, 44))
>name : Symbol(IOptions.name, Decl(arrayconcat.ts, 0, 20))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
var bName = b.name.toLowerCase();
>bName : Symbol(bName, Decl(arrayconcat.ts, 16, 15))
>b.name.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>b.name.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>b.name : Symbol(IOptions.name, Decl(arrayconcat.ts, 0, 20))
>b : Symbol(b, Decl(arrayconcat.ts, 14, 46))
>name : Symbol(IOptions.name, Decl(arrayconcat.ts, 0, 20))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
if (aName > bName) {
>aName : Symbol(aName, Decl(arrayconcat.ts, 15, 15))

View file

@ -3,16 +3,16 @@
var a = (p: string) => p.length;
>a : Symbol(a, Decl(arrowFunctionExpressions.ts, 1, 3), Decl(arrowFunctionExpressions.ts, 2, 3))
>p : Symbol(p, Decl(arrowFunctionExpressions.ts, 1, 9))
>p.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>p.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>p : Symbol(p, Decl(arrowFunctionExpressions.ts, 1, 9))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
var a = (p: string) => { return p.length; }
>a : Symbol(a, Decl(arrowFunctionExpressions.ts, 1, 3), Decl(arrowFunctionExpressions.ts, 2, 3))
>p : Symbol(p, Decl(arrowFunctionExpressions.ts, 2, 9))
>p.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>p.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>p : Symbol(p, Decl(arrowFunctionExpressions.ts, 2, 9))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
// Identifier => Block is equivalent to(Identifier) => Block
var b = j => { return 0; }
@ -147,9 +147,9 @@ function someFn() {
>n : Symbol(n, Decl(arrowFunctionExpressions.ts, 45, 15))
arr(3)(4).toExponential();
>arr(3)(4).toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, 469, 45))
>arr(3)(4).toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --))
>arr : Symbol(arr, Decl(arrowFunctionExpressions.ts, 45, 7))
>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, 469, 45))
>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --))
}
// Arrow function used in function
@ -162,9 +162,9 @@ function someOtherFn() {
>n : Symbol(n, Decl(arrowFunctionExpressions.ts, 51, 15))
arr(4).charAt(0);
>arr(4).charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>arr(4).charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>arr : Symbol(arr, Decl(arrowFunctionExpressions.ts, 51, 7))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
}
// Arrow function used in nested function in function
@ -222,9 +222,9 @@ function someOuterFn() {
>innerFn : Symbol(innerFn, Decl(arrowFunctionExpressions.ts, 77, 30))
return () => n.length;
>n.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>n.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>n : Symbol(n, Decl(arrowFunctionExpressions.ts, 77, 15))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}
return innerFn;
>innerFn : Symbol(innerFn, Decl(arrowFunctionExpressions.ts, 77, 30))
@ -237,9 +237,9 @@ var h = someOuterFn()('')()();
>someOuterFn : Symbol(someOuterFn, Decl(arrowFunctionExpressions.ts, 72, 14))
h.toExponential();
>h.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, 469, 45))
>h.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --))
>h : Symbol(h, Decl(arrowFunctionExpressions.ts, 85, 3))
>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, 469, 45))
>toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --))
// Arrow function used in try/catch/finally in function
function tryCatchFn() {

View file

@ -1,13 +1,13 @@
=== tests/cases/compiler/arrowFunctionWithObjectLiteralBody5.ts ===
var a = () => <Error>{ name: "foo", message: "bar" };
>a : Symbol(a, Decl(arrowFunctionWithObjectLiteralBody5.ts, 0, 3))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody5.ts, 0, 22))
>message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody5.ts, 0, 35))
var b = () => (<Error>{ name: "foo", message: "bar" });
>b : Symbol(b, Decl(arrowFunctionWithObjectLiteralBody5.ts, 2, 3))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody5.ts, 2, 23))
>message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody5.ts, 2, 36))
@ -18,7 +18,7 @@ var c = () => ({ name: "foo", message: "bar" });
var d = () => ((<Error>({ name: "foo", message: "bar" })));
>d : Symbol(d, Decl(arrowFunctionWithObjectLiteralBody5.ts, 6, 3))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody5.ts, 6, 25))
>message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody5.ts, 6, 38))

View file

@ -1,13 +1,13 @@
=== tests/cases/compiler/arrowFunctionWithObjectLiteralBody6.ts ===
var a = () => <Error>{ name: "foo", message: "bar" };
>a : Symbol(a, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 3))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 22))
>message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 35))
var b = () => (<Error>{ name: "foo", message: "bar" });
>b : Symbol(b, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 3))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 23))
>message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 36))
@ -18,7 +18,7 @@ var c = () => ({ name: "foo", message: "bar" });
var d = () => ((<Error>({ name: "foo", message: "bar" })));
>d : Symbol(d, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 3))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 25))
>message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 38))

View file

@ -8,12 +8,12 @@ var x = undefined as number;
var y = (null as string).length;
>y : Symbol(y, Decl(asOperator1.ts, 2, 3))
>(null as string).length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>(null as string).length : Symbol(String.length, Decl(lib.d.ts, --, --))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
var z = Date as any as string;
>z : Symbol(z, Decl(asOperator1.ts, 3, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;

View file

@ -106,23 +106,23 @@ var a11: (x: { foo: string }, y: { foo: string; bar: string }) => Base;
var a12: (x: Array<Base>, y: Array<Derived2>) => Array<Derived>;
>a12 : Symbol(a12, Decl(assignmentCompatWithCallSignatures3.ts, 18, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures3.ts, 18, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithCallSignatures3.ts, 18, 25))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithCallSignatures3.ts, 3, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27))
var a13: (x: Array<Base>, y: Array<Derived>) => Array<Derived>;
>a13 : Symbol(a13, Decl(assignmentCompatWithCallSignatures3.ts, 19, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures3.ts, 19, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithCallSignatures3.ts, 19, 25))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27))
var a14: (x: { a: string; b: number }) => Object;
@ -130,7 +130,7 @@ var a14: (x: { a: string; b: number }) => Object;
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures3.ts, 20, 10))
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures3.ts, 20, 14))
>b : Symbol(b, Decl(assignmentCompatWithCallSignatures3.ts, 20, 25))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var a15: {
>a15 : Symbol(a15, Decl(assignmentCompatWithCallSignatures3.ts, 21, 3))
@ -189,8 +189,8 @@ var a18: {
(a: Date): Date;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures3.ts, 40, 9))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}): any[];
}
@ -407,14 +407,14 @@ b11 = a11; // ok
var b12: <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>;
>b12 : Symbol(b12, Decl(assignmentCompatWithCallSignatures3.ts, 77, 3))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures3.ts, 77, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures3.ts, 77, 33))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithCallSignatures3.ts, 77, 48))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures3.ts, 77, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27))
a12 = b12; // ok
@ -428,10 +428,10 @@ b12 = a12; // ok
var b13: <T extends Array<Derived>>(x: Array<Base>, y: T) => T;
>b13 : Symbol(b13, Decl(assignmentCompatWithCallSignatures3.ts, 80, 3))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures3.ts, 80, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithCallSignatures3.ts, 2, 27))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures3.ts, 80, 36))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithCallSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithCallSignatures3.ts, 80, 51))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures3.ts, 80, 10))

View file

@ -106,23 +106,23 @@ var a11: new (x: { foo: string }, y: { foo: string; bar: string }) => Base;
var a12: new (x: Array<Base>, y: Array<Derived2>) => Array<Derived>;
>a12 : Symbol(a12, Decl(assignmentCompatWithConstructSignatures3.ts, 18, 3))
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures3.ts, 18, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithConstructSignatures3.ts, 18, 29))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithConstructSignatures3.ts, 3, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27))
var a13: new (x: Array<Base>, y: Array<Derived>) => Array<Derived>;
>a13 : Symbol(a13, Decl(assignmentCompatWithConstructSignatures3.ts, 19, 3))
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures3.ts, 19, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithConstructSignatures3.ts, 19, 29))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27))
var a14: new (x: { a: string; b: number }) => Object;
@ -130,7 +130,7 @@ var a14: new (x: { a: string; b: number }) => Object;
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures3.ts, 20, 14))
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures3.ts, 20, 18))
>b : Symbol(b, Decl(assignmentCompatWithConstructSignatures3.ts, 20, 29))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var a15: {
>a15 : Symbol(a15, Decl(assignmentCompatWithConstructSignatures3.ts, 21, 3))
@ -189,8 +189,8 @@ var a18: {
new (a: Date): Date;
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures3.ts, 40, 13))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}): any[];
}
@ -407,14 +407,14 @@ b11 = a11; // ok
var b12: new <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>;
>b12 : Symbol(b12, Decl(assignmentCompatWithConstructSignatures3.ts, 77, 3))
>T : Symbol(T, Decl(assignmentCompatWithConstructSignatures3.ts, 77, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0))
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures3.ts, 77, 37))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithConstructSignatures3.ts, 77, 52))
>T : Symbol(T, Decl(assignmentCompatWithConstructSignatures3.ts, 77, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27))
a12 = b12; // ok
@ -428,10 +428,10 @@ b12 = a12; // ok
var b13: new <T extends Array<Derived>>(x: Array<Base>, y: T) => T;
>b13 : Symbol(b13, Decl(assignmentCompatWithConstructSignatures3.ts, 80, 3))
>T : Symbol(T, Decl(assignmentCompatWithConstructSignatures3.ts, 80, 14))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(assignmentCompatWithConstructSignatures3.ts, 2, 27))
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures3.ts, 80, 40))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(assignmentCompatWithConstructSignatures3.ts, 0, 0))
>y : Symbol(y, Decl(assignmentCompatWithConstructSignatures3.ts, 80, 55))
>T : Symbol(T, Decl(assignmentCompatWithConstructSignatures3.ts, 80, 14))

View file

@ -2,6 +2,6 @@
var foo = async (): Promise<void> => {
>foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
};

View file

@ -10,9 +10,9 @@ class C {
var fn = async () => await other.apply(this, arguments);
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 3, 9))
>other.apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
>other.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13))
>apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0))
>arguments : Symbol(arguments)
}

View file

@ -2,16 +2,16 @@
type MyPromise<T> = Promise<T>;
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
>T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15))
declare var MyPromise: typeof Promise;
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare var p: Promise<number>;
>p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare var mp: MyPromise<number>;
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
@ -22,7 +22,7 @@ async function f0() { }
async function f1(): Promise<void> { }
>f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async function f3(): MyPromise<void> { }
>f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38))
@ -33,7 +33,7 @@ let f4 = async function() { }
let f5 = async function(): Promise<void> { }
>f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
let f6 = async function(): MyPromise<void> { }
>f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3))
@ -44,7 +44,7 @@ let f7 = async () => { };
let f8 = async (): Promise<void> => { };
>f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
let f9 = async (): MyPromise<void> => { };
>f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3))
@ -60,7 +60,7 @@ let f11 = async () => mp;
let f12 = async (): Promise<number> => mp;
>f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
let f13 = async (): MyPromise<number> => p;
@ -76,7 +76,7 @@ let o = {
async m2(): Promise<void> { },
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async m3(): MyPromise<void> { }
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31))
@ -92,7 +92,7 @@ class C {
async m2(): Promise<void> { }
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async m3(): MyPromise<void> { }
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30))
@ -103,7 +103,7 @@ class C {
static async m5(): Promise<void> { }
>m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
static async m6(): MyPromise<void> { }
>m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37))

View file

@ -1,5 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
async function await(): Promise<void> {
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}

View file

@ -1,7 +1,7 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
async function foo(): Promise<void> {
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
return;
}

View file

@ -0,0 +1,56 @@
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,16): error TS1055: Type '{}' is not a valid async function return type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(7,16): error TS1055: Type 'any' is not a valid async function return type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,16): error TS1055: Type 'number' is not a valid async function return type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,16): error TS1055: Type 'PromiseLike<void>' is not a valid async function return type.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,16): error TS1055: Type 'typeof Thenable' is not a valid async function return type.
Type 'Thenable' is not assignable to type 'PromiseLike<any>'.
Types of property 'then' are incompatible.
Type '() => void' is not assignable to type '{ <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; }'.
Type 'void' is not assignable to type 'PromiseLike<any>'.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member.
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member.
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts (7 errors) ====
declare class Thenable { then(): void; }
declare let a: any;
declare let obj: { then: string; };
declare let thenable: Thenable;
async function fn1() { } // valid: Promise<void>
async function fn2(): { } { } // error
~~~
!!! error TS1055: Type '{}' is not a valid async function return type.
async function fn3(): any { } // error
~~~
!!! error TS1055: Type 'any' is not a valid async function return type.
async function fn4(): number { } // error
~~~
!!! error TS1055: Type 'number' is not a valid async function return type.
async function fn5(): PromiseLike<void> { } // error
~~~
!!! error TS1055: Type 'PromiseLike<void>' is not a valid async function return type.
async function fn6(): Thenable { } // error
~~~
!!! error TS1055: Type 'typeof Thenable' is not a valid async function return type.
!!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike<any>'.
!!! error TS1055: Types of property 'then' are incompatible.
!!! error TS1055: Type '() => void' is not assignable to type '{ <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; }'.
!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike<any>'.
async function fn7() { return; } // valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>
async function fn10() { return undefined; } // valid: Promise<any>
async function fn11() { return a; } // valid: Promise<any>
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
async function fn13() { return thenable; } // error
~~~~
!!! error TS1059: Return expression in async function does not have a valid callable 'then' member.
async function fn14() { await 1; } // valid: Promise<void>
async function fn15() { await null; } // valid: Promise<void>
async function fn16() { await undefined; } // valid: Promise<void>
async function fn17() { await a; } // valid: Promise<void>
async function fn18() { await obj; } // valid: Promise<void>
async function fn19() { await thenable; } // error
~~~~~~~~~~~~~~
!!! error TS1058: Operand for 'await' does not have a valid callable 'then' member.

View file

@ -0,0 +1,84 @@
//// [asyncFunctionDeclaration15_es6.ts]
declare class Thenable { then(): void; }
declare let a: any;
declare let obj: { then: string; };
declare let thenable: Thenable;
async function fn1() { } // valid: Promise<void>
async function fn2(): { } { } // error
async function fn3(): any { } // error
async function fn4(): number { } // error
async function fn5(): PromiseLike<void> { } // error
async function fn6(): Thenable { } // error
async function fn7() { return; } // valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>
async function fn10() { return undefined; } // valid: Promise<any>
async function fn11() { return a; } // valid: Promise<any>
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
async function fn13() { return thenable; } // error
async function fn14() { await 1; } // valid: Promise<void>
async function fn15() { await null; } // valid: Promise<void>
async function fn16() { await undefined; } // valid: Promise<void>
async function fn17() { await a; } // valid: Promise<void>
async function fn18() { await obj; } // valid: Promise<void>
async function fn19() { await thenable; } // error
//// [asyncFunctionDeclaration15_es6.js]
function fn1() {
return __awaiter(this, void 0, Promise, function* () { });
} // valid: Promise<void>
function fn2() {
return __awaiter(this, void 0, Promise, function* () { });
} // error
function fn3() {
return __awaiter(this, void 0, Promise, function* () { });
} // error
function fn4() {
return __awaiter(this, void 0, Promise, function* () { });
} // error
function fn5() {
return __awaiter(this, void 0, PromiseLike, function* () { });
} // error
function fn6() {
return __awaiter(this, void 0, Thenable, function* () { });
} // error
function fn7() {
return __awaiter(this, void 0, Promise, function* () { return; });
} // valid: Promise<void>
function fn8() {
return __awaiter(this, void 0, Promise, function* () { return 1; });
} // valid: Promise<number>
function fn9() {
return __awaiter(this, void 0, Promise, function* () { return null; });
} // valid: Promise<any>
function fn10() {
return __awaiter(this, void 0, Promise, function* () { return undefined; });
} // valid: Promise<any>
function fn11() {
return __awaiter(this, void 0, Promise, function* () { return a; });
} // valid: Promise<any>
function fn12() {
return __awaiter(this, void 0, Promise, function* () { return obj; });
} // valid: Promise<{ then: string; }>
function fn13() {
return __awaiter(this, void 0, Promise, function* () { return thenable; });
} // error
function fn14() {
return __awaiter(this, void 0, Promise, function* () { yield 1; });
} // valid: Promise<void>
function fn15() {
return __awaiter(this, void 0, Promise, function* () { yield null; });
} // valid: Promise<void>
function fn16() {
return __awaiter(this, void 0, Promise, function* () { yield undefined; });
} // valid: Promise<void>
function fn17() {
return __awaiter(this, void 0, Promise, function* () { yield a; });
} // valid: Promise<void>
function fn18() {
return __awaiter(this, void 0, Promise, function* () { yield obj; });
} // valid: Promise<void>
function fn19() {
return __awaiter(this, void 0, Promise, function* () { yield thenable; });
} // error

View file

@ -1,5 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
async function foo(): Promise<void> {
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}

View file

@ -1,7 +1,7 @@
=== tests/cases/compiler/augmentArray.ts ===
interface Array<T> {
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(augmentArray.ts, 0, 0))
>T : Symbol(T, Decl(lib.d.ts, 1007, 16), Decl(augmentArray.ts, 0, 16))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentArray.ts, 0, 0))
>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(augmentArray.ts, 0, 16))
(): any[];
}

View file

@ -8,7 +8,7 @@ interface Bar { b }
>b : Symbol(b, Decl(augmentedTypeBracketAccessIndexSignature.ts, 1, 15))
interface Object {
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11), Decl(augmentedTypeBracketAccessIndexSignature.ts, 1, 19))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketAccessIndexSignature.ts, 1, 19))
[n: number]: Foo;
>n : Symbol(n, Decl(augmentedTypeBracketAccessIndexSignature.ts, 4, 5))
@ -16,7 +16,7 @@ interface Object {
}
interface Function {
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(augmentedTypeBracketAccessIndexSignature.ts, 5, 1))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketAccessIndexSignature.ts, 5, 1))
[n: number]: Bar;
>n : Symbol(n, Decl(augmentedTypeBracketAccessIndexSignature.ts, 8, 5))

View file

@ -1,12 +1,12 @@
=== tests/cases/compiler/augmentedTypeBracketNamedPropertyAccess.ts ===
interface Object {
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11), Decl(augmentedTypeBracketNamedPropertyAccess.ts, 0, 0))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketNamedPropertyAccess.ts, 0, 0))
data: number;
>data : Symbol(data, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 0, 18))
}
interface Function {
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(augmentedTypeBracketNamedPropertyAccess.ts, 2, 1))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(augmentedTypeBracketNamedPropertyAccess.ts, 2, 1))
functionData: string;
>functionData : Symbol(functionData, Decl(augmentedTypeBracketNamedPropertyAccess.ts, 3, 20))

View file

@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = await p || a;

View file

@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = await p && a;

View file

@ -4,11 +4,11 @@ declare var a: number;
declare var p: Promise<number>;
>p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = await p + a;

View file

@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = await p, a;

View file

@ -4,11 +4,11 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var o: { a: boolean; };

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = fn(a, a, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = fn(await p, a, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = fn(a, await p, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = (await pfn)(a, a, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = o.fn(a, a, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = o.fn(await p, a, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = o.fn(a, await p, a);

View file

@ -4,7 +4,7 @@ declare var a: boolean;
declare var p: Promise<boolean>;
>p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32))
@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; };
declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28))
>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42))
>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57))
declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>;
>po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25))
>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29))
>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43))
@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void;
async function func(): Promise<void> {
>func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84))
>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
"before";
var b = (await po).fn(a, a, a);

View file

@ -4,20 +4,20 @@ declare let a: number | string;
declare let b: PromiseLike<number> | PromiseLike<string>;
>b : Symbol(b, Decl(awaitUnion_es6.ts, 1, 11))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, 1187, 163))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, 1187, 163))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --))
declare let c: PromiseLike<number | string>;
>c : Symbol(c, Decl(awaitUnion_es6.ts, 2, 11))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, 1187, 163))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --))
declare let d: number | PromiseLike<string>;
>d : Symbol(d, Decl(awaitUnion_es6.ts, 3, 11))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, 1187, 163))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --))
declare let e: number | PromiseLike<number | string>;
>e : Symbol(e, Decl(awaitUnion_es6.ts, 4, 11))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, 1187, 163))
>PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --))
async function f() {
>f : Symbol(f, Decl(awaitUnion_es6.ts, 4, 53))

View file

@ -58,20 +58,20 @@ var r6 = true ? (x: number) => { } : (x: Object) => { }; // returns number => vo
>r6 : Symbol(r6, Decl(bestCommonTypeOfConditionalExpressions.ts, 17, 3))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 17, 17))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 17, 38))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { };
>r7 : Symbol(r7, Decl(bestCommonTypeOfConditionalExpressions.ts, 18, 3))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 18, 9))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 18, 38))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 18, 59))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => void
>r8 : Symbol(r8, Decl(bestCommonTypeOfConditionalExpressions.ts, 19, 3))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 19, 17))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(bestCommonTypeOfConditionalExpressions.ts, 19, 38))
var r10: Base = true ? derived : derived2; // no error since we use the contextual type in BCT
@ -93,7 +93,7 @@ function foo5<T, U>(t: T, u: U): Object {
>T : Symbol(T, Decl(bestCommonTypeOfConditionalExpressions.ts, 23, 14))
>u : Symbol(u, Decl(bestCommonTypeOfConditionalExpressions.ts, 23, 25))
>U : Symbol(U, Decl(bestCommonTypeOfConditionalExpressions.ts, 23, 16))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
return true ? t : u; // BCT is Object
>t : Symbol(t, Decl(bestCommonTypeOfConditionalExpressions.ts, 23, 20))

View file

@ -21,12 +21,12 @@ module Test {
>name : Symbol(name, Decl(binopAssignmentShouldHaveType.ts, 8, 6))
if ((name= this.getName()).length > 0) {
>(name= this.getName()).length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>(name= this.getName()).length : Symbol(String.length, Decl(lib.d.ts, --, --))
>name : Symbol(name, Decl(binopAssignmentShouldHaveType.ts, 8, 6))
>this.getName : Symbol(getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19))
>this : Symbol(Bug, Decl(binopAssignmentShouldHaveType.ts, 2, 13))
>getName : Symbol(getName, Decl(binopAssignmentShouldHaveType.ts, 3, 19))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
console.log(name);
>console : Symbol(console, Decl(binopAssignmentShouldHaveType.ts, 0, 11))

View file

@ -88,9 +88,9 @@ var ResultIsNumber11 = ~(STRING + STRING);
var ResultIsNumber12 = ~STRING.charAt(0);
>ResultIsNumber12 : Symbol(ResultIsNumber12, Decl(bitwiseNotOperatorWithStringType.ts, 32, 3))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(bitwiseNotOperatorWithStringType.ts, 1, 3))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
// multiple ~ operators
var ResultIsNumber13 = ~~STRING;

View file

@ -4,12 +4,12 @@ var x = true;
var a = x.toString();
>a : Symbol(a, Decl(booleanPropertyAccess.ts, 2, 3))
>x.toString : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>x.toString : Symbol(Object.toString, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(booleanPropertyAccess.ts, 0, 3))
>toString : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>toString : Symbol(Object.toString, Decl(lib.d.ts, --, --))
var b = x['toString']();
>b : Symbol(b, Decl(booleanPropertyAccess.ts, 3, 3))
>x : Symbol(x, Decl(booleanPropertyAccess.ts, 0, 3))
>'toString' : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>'toString' : Symbol(Object.toString, Decl(lib.d.ts, --, --))

View file

@ -110,23 +110,23 @@ interface A { // T
a12: (x: Array<Base>, y: Array<Derived2>) => Array<Derived>;
>a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance2.ts, 19, 71))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 20, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance2.ts, 20, 25))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived2 : Symbol(Derived2, Decl(callSignatureAssignabilityInInheritance2.ts, 3, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27))
a13: (x: Array<Base>, y: Array<Derived>) => Array<Derived>;
>a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance2.ts, 20, 64))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 21, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance2.ts, 21, 25))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27))
a14: (x: { a: string; b: number }) => Object;
@ -134,7 +134,7 @@ interface A { // T
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 10))
>a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 14))
>b : Symbol(b, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 25))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
a15: {
>a15 : Symbol(a15, Decl(callSignatureAssignabilityInInheritance2.ts, 22, 49))
@ -195,8 +195,8 @@ interface A { // T
(a: Date): Date;
>a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 42, 13))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}): any[];
};
@ -332,23 +332,23 @@ interface I extends A {
a12: <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>; // ok, less specific parameter type
>a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance2.ts, 60, 43))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 33))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 48))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27))
a13: <T extends Array<Derived>>(x: Array<Base>, y: T) => T; // ok, T = Array<Derived>, satisfies constraint, contextual signature instantiation succeeds
>a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance2.ts, 61, 73))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance2.ts, 2, 27))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 36))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance2.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 51))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance2.ts, 62, 10))

View file

@ -111,23 +111,23 @@ interface A { // T
a12: (x: Array<Base>, y: Array<Derived2>) => Array<Derived>;
>a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance5.ts, 20, 71))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 21, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance5.ts, 21, 25))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived2 : Symbol(Derived2, Decl(callSignatureAssignabilityInInheritance5.ts, 4, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27))
a13: (x: Array<Base>, y: Array<Derived>) => Array<Derived>;
>a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance5.ts, 21, 64))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 22, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance5.ts, 22, 25))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27))
a14: (x: { a: string; b: number }) => Object;
@ -135,7 +135,7 @@ interface A { // T
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 23, 10))
>a : Symbol(a, Decl(callSignatureAssignabilityInInheritance5.ts, 23, 14))
>b : Symbol(b, Decl(callSignatureAssignabilityInInheritance5.ts, 23, 25))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
}
interface B extends A {
@ -280,23 +280,23 @@ interface I extends B {
a12: <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>; // ok, less specific parameter type
>a12 : Symbol(a12, Decl(callSignatureAssignabilityInInheritance5.ts, 43, 43))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 33))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 48))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27))
a13: <T extends Array<Derived>>(x: Array<Base>, y: T) => T; // ok, T = Array<Derived>, satisfies constraint, contextual signature instantiation succeeds
>a13 : Symbol(a13, Decl(callSignatureAssignabilityInInheritance5.ts, 44, 73))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 10))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Derived : Symbol(Derived, Decl(callSignatureAssignabilityInInheritance5.ts, 3, 27))
>x : Symbol(x, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 36))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Base : Symbol(Base, Decl(callSignatureAssignabilityInInheritance5.ts, 0, 0))
>y : Symbol(y, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 51))
>T : Symbol(T, Decl(callSignatureAssignabilityInInheritance5.ts, 45, 10))

View file

@ -54,7 +54,7 @@ var a: {
(x, y): Object;
>x : Symbol(x, Decl(callSignaturesThatDifferOnlyByReturnType.ts, 20, 5))
>y : Symbol(y, Decl(callSignaturesThatDifferOnlyByReturnType.ts, 20, 7))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
(x, y): any; // error
>x : Symbol(x, Decl(callSignaturesThatDifferOnlyByReturnType.ts, 21, 5))

View file

@ -93,7 +93,7 @@ xa[1].foo(1, 2, ...a, "abc");
>a : Symbol(a, Decl(callWithSpread.ts, 7, 3))
(<Function>xa[1].foo)(...[1, 2, "abc"]);
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))
>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3))
>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13))

View file

@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc");
>a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3))
(<Function>xa[1].foo)(...[1, 2, "abc"]);
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 4036, 1))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13))
>xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3))
>foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13))

View file

@ -56,9 +56,9 @@ var c2: Collection<number>;
var rf1 = (x: number) => { return x.toFixed() };
>rf1 : Symbol(rf1, Decl(callbacksDontShareTypes.ts, 13, 3))
>x : Symbol(x, Decl(callbacksDontShareTypes.ts, 13, 11))
>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, 463, 37))
>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(callbacksDontShareTypes.ts, 13, 11))
>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, 463, 37))
>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --))
var r1a = _.map(c2, (x) => { return x.toFixed() });
>r1a : Symbol(r1a, Decl(callbacksDontShareTypes.ts, 14, 3))
@ -67,9 +67,9 @@ var r1a = _.map(c2, (x) => { return x.toFixed() });
>map : Symbol(Combinators.map, Decl(callbacksDontShareTypes.ts, 5, 23), Decl(callbacksDontShareTypes.ts, 6, 63))
>c2 : Symbol(c2, Decl(callbacksDontShareTypes.ts, 11, 3))
>x : Symbol(x, Decl(callbacksDontShareTypes.ts, 14, 21))
>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, 463, 37))
>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(callbacksDontShareTypes.ts, 14, 21))
>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, 463, 37))
>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --))
var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors
>r1b : Symbol(r1b, Decl(callbacksDontShareTypes.ts, 15, 3))
@ -86,9 +86,9 @@ var r5a = _.map<number, string>(c2, (x) => { return x.toFixed() });
>map : Symbol(Combinators.map, Decl(callbacksDontShareTypes.ts, 5, 23), Decl(callbacksDontShareTypes.ts, 6, 63))
>c2 : Symbol(c2, Decl(callbacksDontShareTypes.ts, 11, 3))
>x : Symbol(x, Decl(callbacksDontShareTypes.ts, 16, 37))
>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, 463, 37))
>x.toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(callbacksDontShareTypes.ts, 16, 37))
>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, 463, 37))
>toFixed : Symbol(Number.toFixed, Decl(lib.d.ts, --, --))
var r5b = _.map<number, string>(c2, rf1);
>r5b : Symbol(r5b, Decl(callbacksDontShareTypes.ts, 17, 3))

View file

@ -5,5 +5,5 @@ interface Foo { }
var xx = <Foo> new Object();
>xx : Symbol(xx, Decl(castNewObjectBug.ts, 1, 3))
>Foo : Symbol(Foo, Decl(castNewObjectBug.ts, 0, 0))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View file

@ -10,11 +10,11 @@ var c: boolean;
var d: Date;
>d : Symbol(d, Decl(chainedAssignment2.ts, 3, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var e: RegExp;
>e : Symbol(e, Decl(chainedAssignment2.ts, 4, 3))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, 825, 1), Decl(lib.d.ts, 876, 11))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
a = b = c = d = e = null;
>a : Symbol(a, Decl(chainedAssignment2.ts, 0, 3))

View file

@ -51,9 +51,9 @@ var s2 = s.groupBy(s => s.length);
>s : Symbol(s, Decl(chainedSpecializationToObjectTypeLiteral.ts, 7, 3))
>groupBy : Symbol(Sequence.groupBy, Decl(chainedSpecializationToObjectTypeLiteral.ts, 3, 57))
>s : Symbol(s, Decl(chainedSpecializationToObjectTypeLiteral.ts, 8, 19))
>s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>s.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>s : Symbol(s, Decl(chainedSpecializationToObjectTypeLiteral.ts, 8, 19))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
var s3 = s2.each(x => { x.key /* Type is K, should be number */ });
>s3 : Symbol(s3, Decl(chainedSpecializationToObjectTypeLiteral.ts, 9, 3))

View file

@ -29,12 +29,12 @@ class Bar extends Foo.Object { // should work
class Baz extends Object {
>Baz : Symbol(Baz, Decl(checkForObjectTooStrict.ts, 18, 1))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
constructor () { // ERROR, as expected
super();
>super : Symbol(ObjectConstructor, Decl(lib.d.ts, 124, 1))
>super : Symbol(ObjectConstructor, Decl(lib.d.ts, --, --))
}

View file

@ -9,19 +9,19 @@ var c: C;
var r = c.toString();
>r : Symbol(r, Decl(classAppearsToHaveMembersOfObject.ts, 3, 3))
>c.toString : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>c.toString : Symbol(Object.toString, Decl(lib.d.ts, --, --))
>c : Symbol(c, Decl(classAppearsToHaveMembersOfObject.ts, 2, 3))
>toString : Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>toString : Symbol(Object.toString, Decl(lib.d.ts, --, --))
var r2 = c.hasOwnProperty('');
>r2 : Symbol(r2, Decl(classAppearsToHaveMembersOfObject.ts, 4, 3))
>c.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.d.ts, 105, 22))
>c.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.d.ts, --, --))
>c : Symbol(c, Decl(classAppearsToHaveMembersOfObject.ts, 2, 3))
>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.d.ts, 105, 22))
>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.d.ts, --, --))
var o: Object = c;
>o : Symbol(o, Decl(classAppearsToHaveMembersOfObject.ts, 5, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>c : Symbol(c, Decl(classAppearsToHaveMembersOfObject.ts, 2, 3))
var o2: {} = c;

View file

@ -1,41 +1,41 @@
=== tests/cases/conformance/classes/classDeclarations/classExtendingBuiltinType.ts ===
class C1 extends Object { }
>C1 : Symbol(C1, Decl(classExtendingBuiltinType.ts, 0, 0))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C2 extends Function { }
>C2 : Symbol(C2, Decl(classExtendingBuiltinType.ts, 0, 27))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C3 extends String { }
>C3 : Symbol(C3, Decl(classExtendingBuiltinType.ts, 1, 29))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C4 extends Boolean { }
>C4 : Symbol(C4, Decl(classExtendingBuiltinType.ts, 2, 27))
>Boolean : Symbol(Boolean, Decl(lib.d.ts, 443, 38), Decl(lib.d.ts, 456, 11))
>Boolean : Symbol(Boolean, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C5 extends Number { }
>C5 : Symbol(C5, Decl(classExtendingBuiltinType.ts, 3, 28))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C6 extends Date { }
>C6 : Symbol(C6, Decl(classExtendingBuiltinType.ts, 4, 27))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C7 extends RegExp { }
>C7 : Symbol(C7, Decl(classExtendingBuiltinType.ts, 5, 25))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, 825, 1), Decl(lib.d.ts, 876, 11))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C8 extends Error { }
>C8 : Symbol(C8, Decl(classExtendingBuiltinType.ts, 6, 27))
>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11))
>Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C9 extends Array { }
>C9 : Symbol(C9, Decl(classExtendingBuiltinType.ts, 7, 26))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class C10 extends Array<number> { }
>C10 : Symbol(C10, Decl(classExtendingBuiltinType.ts, 8, 26))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View file

@ -20,11 +20,11 @@ class C {
[x: string]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 7, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
[x: number]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 8, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
0: number;
}
@ -44,11 +44,11 @@ interface I {
[x: string]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 16, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
[x: number]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface.ts, 17, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
0: number;
}

View file

@ -20,11 +20,11 @@ class C {
[x: string]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 7, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
[x: number]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 8, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
0: number;
@ -47,11 +47,11 @@ interface I {
[x: string]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 18, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
[x: number]: Object;
>x : Symbol(x, Decl(classWithOnlyPublicMembersEquivalentToInterface2.ts, 19, 5))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
0: number;
}

View file

@ -13,7 +13,7 @@ var STRING: string;
var OBJECT: Object;
>OBJECT : Symbol(OBJECT, Decl(commaOperatorWithSecondOperandAnyType.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
//The second operand type is any
ANY, ANY;
@ -75,8 +75,8 @@ var x: any;
"string", [null, 1];
"string".charAt(0), [null, 1];
>"string".charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>"string".charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
true, x("any");
>x : Symbol(x, Decl(commaOperatorWithSecondOperandAnyType.ts, 21, 3))
@ -99,8 +99,8 @@ var resultIsAny8 = ("string", null);
var resultIsAny9 = ("string".charAt(0), undefined);
>resultIsAny9 : Symbol(resultIsAny9, Decl(commaOperatorWithSecondOperandAnyType.ts, 33, 3))
>"string".charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>"string".charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>undefined : Symbol(undefined)
var resultIsAny10 = (true, x("any"));

View file

@ -13,7 +13,7 @@ var STRING: string;
var OBJECT: Object;
>OBJECT : Symbol(OBJECT, Decl(commaOperatorWithSecondOperandBooleanType.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
//The second operand type is boolean
ANY, BOOLEAN;

View file

@ -13,7 +13,7 @@ var STRING: string;
var OBJECT: Object;
>OBJECT : Symbol(OBJECT, Decl(commaOperatorWithSecondOperandNumberType.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
//The second operand type is number
ANY, NUMBER;
@ -79,9 +79,9 @@ BOOLEAN = false, 1;
>NUMBER : Symbol(NUMBER, Decl(commaOperatorWithSecondOperandNumberType.ts, 2, 3))
STRING.trim(), NUMBER = 1;
>STRING.trim : Symbol(String.trim, Decl(lib.d.ts, 411, 32))
>STRING.trim : Symbol(String.trim, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandNumberType.ts, 3, 3))
>trim : Symbol(String.trim, Decl(lib.d.ts, 411, 32))
>trim : Symbol(String.trim, Decl(lib.d.ts, --, --))
>NUMBER : Symbol(NUMBER, Decl(commaOperatorWithSecondOperandNumberType.ts, 2, 3))
var resultIsNumber6 = (null, NUMBER);
@ -107,8 +107,8 @@ var resultIsNumber10 = ("", NUMBER = 1);
var resultIsNumber11 = (STRING.trim(), NUMBER = 1);
>resultIsNumber11 : Symbol(resultIsNumber11, Decl(commaOperatorWithSecondOperandNumberType.ts, 33, 3))
>STRING.trim : Symbol(String.trim, Decl(lib.d.ts, 411, 32))
>STRING.trim : Symbol(String.trim, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandNumberType.ts, 3, 3))
>trim : Symbol(String.trim, Decl(lib.d.ts, 411, 32))
>trim : Symbol(String.trim, Decl(lib.d.ts, --, --))
>NUMBER : Symbol(NUMBER, Decl(commaOperatorWithSecondOperandNumberType.ts, 2, 3))

View file

@ -13,7 +13,7 @@ var STRING: string;
var OBJECT: Object;
>OBJECT : Symbol(OBJECT, Decl(commaOperatorWithSecondOperandObjectType.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
class CLASS {
>CLASS : Symbol(CLASS, Decl(commaOperatorWithSecondOperandObjectType.ts, 4, 19))
@ -82,12 +82,12 @@ true, {}
>BOOLEAN : Symbol(BOOLEAN, Decl(commaOperatorWithSecondOperandObjectType.ts, 1, 3))
"string", new Date()
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
STRING.toLowerCase(), new CLASS()
>STRING.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>STRING.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandObjectType.ts, 3, 3))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>CLASS : Symbol(CLASS, Decl(commaOperatorWithSecondOperandObjectType.ts, 4, 19))
var resultIsObject6 = (null, OBJECT);
@ -110,12 +110,12 @@ var resultIsObject9 = (!BOOLEAN, { a: 1, b: "s" });
var resultIsObject10 = ("string", new Date());
>resultIsObject10 : Symbol(resultIsObject10, Decl(commaOperatorWithSecondOperandObjectType.ts, 36, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var resultIsObject11 = (STRING.toLowerCase(), new CLASS());
>resultIsObject11 : Symbol(resultIsObject11, Decl(commaOperatorWithSecondOperandObjectType.ts, 37, 3))
>STRING.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>STRING.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandObjectType.ts, 3, 3))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, 399, 51))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>CLASS : Symbol(CLASS, Decl(commaOperatorWithSecondOperandObjectType.ts, 4, 19))

View file

@ -13,7 +13,7 @@ var STRING: string;
var OBJECT: Object;
>OBJECT : Symbol(OBJECT, Decl(commaOperatorWithSecondOperandStringType.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var resultIsString: string;
>resultIsString : Symbol(resultIsString, Decl(commaOperatorWithSecondOperandStringType.ts, 6, 3))
@ -71,7 +71,7 @@ null, STRING;
ANY = new Date(), STRING;
>ANY : Symbol(ANY, Decl(commaOperatorWithSecondOperandStringType.ts, 0, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3))
true, "";
@ -80,13 +80,13 @@ BOOLEAN == undefined, "";
>undefined : Symbol(undefined)
["a", "b"], NUMBER.toString();
>NUMBER.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
>NUMBER.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
>NUMBER : Symbol(NUMBER, Decl(commaOperatorWithSecondOperandStringType.ts, 2, 3))
>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
OBJECT = new Object, STRING + "string";
>OBJECT : Symbol(OBJECT, Decl(commaOperatorWithSecondOperandStringType.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3))
var resultIsString6 = (null, STRING);
@ -96,7 +96,7 @@ var resultIsString6 = (null, STRING);
var resultIsString7 = (ANY = new Date(), STRING);
>resultIsString7 : Symbol(resultIsString7, Decl(commaOperatorWithSecondOperandStringType.ts, 31, 3))
>ANY : Symbol(ANY, Decl(commaOperatorWithSecondOperandStringType.ts, 0, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3))
var resultIsString8 = (true, "");
@ -109,12 +109,12 @@ var resultIsString9 = (BOOLEAN == undefined, "");
var resultIsString10 = (["a", "b"], NUMBER.toString());
>resultIsString10 : Symbol(resultIsString10, Decl(commaOperatorWithSecondOperandStringType.ts, 34, 3))
>NUMBER.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
>NUMBER.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
>NUMBER : Symbol(NUMBER, Decl(commaOperatorWithSecondOperandStringType.ts, 2, 3))
>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18))
>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
var resultIsString11 = (new Object, STRING + "string");
>resultIsString11 : Symbol(resultIsString11, Decl(commaOperatorWithSecondOperandStringType.ts, 35, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3))

View file

@ -13,7 +13,7 @@ var STRING: string;
var OBJECT: Object;
>OBJECT : Symbol(OBJECT, Decl(commaOperatorsMultipleOperators.ts, 4, 3))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
//Expected: work well
ANY, BOOLEAN, NUMBER;
@ -76,10 +76,10 @@ var resultIsObject1 = (NUMBER, STRING, OBJECT);
null, true, 1;
++NUMBER, STRING.charAt(0), new Object();
>NUMBER : Symbol(NUMBER, Decl(commaOperatorsMultipleOperators.ts, 2, 3))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorsMultipleOperators.ts, 3, 3))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var resultIsNumber2 = (null, true, 1);
>resultIsNumber2 : Symbol(resultIsNumber2, Decl(commaOperatorsMultipleOperators.ts, 24, 3))
@ -87,8 +87,8 @@ var resultIsNumber2 = (null, true, 1);
var resultIsObject2 = (++NUMBER, STRING.charAt(0), new Object());
>resultIsObject2 : Symbol(resultIsObject2, Decl(commaOperatorsMultipleOperators.ts, 25, 3))
>NUMBER : Symbol(NUMBER, Decl(commaOperatorsMultipleOperators.ts, 2, 3))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(commaOperatorsMultipleOperators.ts, 3, 3))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View file

@ -4,9 +4,9 @@ var s: string[];
>s : Symbol(s, Decl(commentInMethodCall.ts, 1, 3))
s.map(// do something
>s.map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>s.map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>s : Symbol(s, Decl(commentInMethodCall.ts, 1, 3))
>map : Symbol(Array.map, Decl(lib.d.ts, 1115, 92))
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
function () { });

View file

@ -16,7 +16,7 @@ class A1 {
public e: Object;
>e : Symbol(e, Decl(comparisonOperatorWithIdenticalObjects.ts, 4, 18))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
public fn(a: string): string {
>fn : Symbol(fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 5, 21))
@ -42,7 +42,7 @@ class B1 {
public e: Object;
>e : Symbol(e, Decl(comparisonOperatorWithIdenticalObjects.ts, 14, 18))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
public fn(b: string): string {
>fn : Symbol(fn, Decl(comparisonOperatorWithIdenticalObjects.ts, 15, 21))

View file

@ -17,13 +17,13 @@ var o: I = {
["" + 0](y) { return y.length; },
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES5.ts, 6, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES5.ts, 6, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
["" + 1]: y => y.length
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES5.ts, 7, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES5.ts, 7, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}

View file

@ -17,13 +17,13 @@ var o: I = {
["" + 0](y) { return y.length; },
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 6, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 6, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
["" + 1]: y => y.length
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 7, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 7, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}

View file

@ -17,13 +17,13 @@ var o: I = {
[+"foo"](y) { return y.length; },
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES5.ts, 6, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES5.ts, 6, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
[+"bar"]: y => y.length
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES5.ts, 7, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES5.ts, 7, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}

View file

@ -17,13 +17,13 @@ var o: I = {
[+"foo"](y) { return y.length; },
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 6, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 6, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
[+"bar"]: y => y.length
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 7, 13))
>y.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>y.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 7, 13))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}

Some files were not shown because too many files have changed in this diff Show more