mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into test262RunnerUpdates
This commit is contained in:
@@ -411,7 +411,12 @@ module ts {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.ConstructSignature, 0, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Method, SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
|
||||
// If this is an ObjectLiteralExpression method, then it sits in the same space
|
||||
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
|
||||
// so that it will conflict with any other object literal members with the same
|
||||
// name.
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Method,
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.IndexSignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.IndexSignature, 0, /*isBlockScopeContainer*/ false);
|
||||
|
||||
+122
-70
@@ -2839,7 +2839,7 @@ module ts {
|
||||
// The expression is processed as an identifier expression (section 4.3)
|
||||
// or property access expression(section 4.10),
|
||||
// the widened type(section 3.9) of which becomes the result.
|
||||
links.resolvedType = getWidenedType(checkExpression(node.exprName));
|
||||
links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName));
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -3240,26 +3240,35 @@ module ts {
|
||||
|
||||
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
|
||||
// that is subject to contextual typing.
|
||||
function isContextSensitiveExpression(node: Expression): boolean {
|
||||
function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElement): boolean {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return !(<FunctionExpression>node).typeParameters && !forEach((<FunctionExpression>node).parameters, p => p.type);
|
||||
return isContextSensitiveFunctionLikeDeclaration(<FunctionExpression>node);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return forEach((<ObjectLiteralExpression>node).properties, p =>
|
||||
p.kind === SyntaxKind.PropertyAssignment && isContextSensitiveExpression((<PropertyDeclaration>p).initializer));
|
||||
return forEach((<ObjectLiteralExpression>node).properties, isContextSensitive);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return forEach((<ArrayLiteralExpression>node).elements, e => isContextSensitiveExpression(e));
|
||||
return forEach((<ArrayLiteralExpression>node).elements, isContextSensitive);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return isContextSensitiveExpression((<ConditionalExpression>node).whenTrue) ||
|
||||
isContextSensitiveExpression((<ConditionalExpression>node).whenFalse);
|
||||
return isContextSensitive((<ConditionalExpression>node).whenTrue) ||
|
||||
isContextSensitive((<ConditionalExpression>node).whenFalse);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return (<BinaryExpression>node).operator === SyntaxKind.BarBarToken &&
|
||||
(isContextSensitiveExpression((<BinaryExpression>node).left) || isContextSensitiveExpression((<BinaryExpression>node).right));
|
||||
(isContextSensitive((<BinaryExpression>node).left) || isContextSensitive((<BinaryExpression>node).right));
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return isContextSensitive((<PropertyAssignment>node).initializer);
|
||||
case SyntaxKind.Method:
|
||||
return isContextSensitiveFunctionLikeDeclaration(<MethodDeclaration>node);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isContextSensitiveFunctionLikeDeclaration(node: FunctionLikeDeclaration) {
|
||||
return !node.typeParameters && !forEach(node.parameters, p => p.type);
|
||||
}
|
||||
|
||||
function getTypeWithoutConstructors(type: Type): Type {
|
||||
if (type.flags & TypeFlags.ObjectType) {
|
||||
var resolved = resolveObjectOrUnionTypeMembers(<ObjectType>type);
|
||||
@@ -4750,7 +4759,7 @@ module ts {
|
||||
function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type {
|
||||
if (isFunctionExpressionOrArrowFunction(parameter.parent)) {
|
||||
var func = <FunctionExpression>parameter.parent;
|
||||
if (isContextSensitiveExpression(func)) {
|
||||
if (isContextSensitive(func)) {
|
||||
var contextualSignature = getContextualSignature(func);
|
||||
if (contextualSignature) {
|
||||
|
||||
@@ -4890,12 +4899,21 @@ module ts {
|
||||
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
|
||||
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
|
||||
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
|
||||
function getContextualTypeForPropertyExpression(node: Expression): Type {
|
||||
var declaration = <PropertyDeclaration>node.parent;
|
||||
var objectLiteral = <ObjectLiteralExpression>declaration.parent;
|
||||
function getContextualTypeForObjectLiteralMethod(node: MethodDeclaration): Type {
|
||||
Debug.assert(isObjectLiteralMethod(node));
|
||||
if (isInsideWithStatementBody(node)) {
|
||||
// We cannot answer semantic questions within a with block, do not proceed any further
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getContextualTypeForObjectLiteralElement(node);
|
||||
}
|
||||
|
||||
function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) {
|
||||
var objectLiteral = <ObjectLiteralExpression>element.parent;
|
||||
var type = getContextualType(objectLiteral);
|
||||
// TODO(jfreeman): Handle this case for computed names and symbols
|
||||
var name = (<Identifier>declaration.name).text;
|
||||
var name = (<Identifier>element.name).text;
|
||||
if (type && name) {
|
||||
return getTypeOfPropertyOfContextualType(type, name) ||
|
||||
isNumericName(name) && getIndexTypeOfContextualType(type, IndexKind.Number) ||
|
||||
@@ -4950,7 +4968,7 @@ module ts {
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return getContextualTypeForBinaryOperand(node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return getContextualTypeForPropertyExpression(node);
|
||||
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElement>parent);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return getContextualTypeForElementExpression(node);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
@@ -4985,8 +5003,11 @@ module ts {
|
||||
// If the contextual type is a union type, get the signature from each type possible and if they are
|
||||
// all identical ignoring their return type, the result is same signature but with return type as
|
||||
// union type of return types from these signatures
|
||||
function getContextualSignature(node: FunctionExpression): Signature {
|
||||
var type = getContextualType(node);
|
||||
function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
var type = isObjectLiteralMethod(node)
|
||||
? getContextualTypeForObjectLiteralMethod(<MethodDeclaration>node)
|
||||
: getContextualType(<FunctionExpression>node);
|
||||
if (!type) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -5082,11 +5103,14 @@ module ts {
|
||||
for (var id in members) {
|
||||
if (hasProperty(members, id)) {
|
||||
var member = members[id];
|
||||
if (member.flags & SymbolFlags.Property) {
|
||||
var memberDecl = <PropertyDeclaration>member.declarations[0];
|
||||
if (member.flags & SymbolFlags.Property || isObjectLiteralMethod(member.declarations[0])) {
|
||||
var memberDecl = <ObjectLiteralElement>member.declarations[0];
|
||||
var type: Type;
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
|
||||
type = checkExpression(memberDecl.initializer, contextualMapper);
|
||||
type = checkExpression((<PropertyAssignment>memberDecl).initializer, contextualMapper);
|
||||
}
|
||||
else if (memberDecl.kind === SyntaxKind.Method) {
|
||||
type = checkObjectLiteralMethod(<MethodDeclaration>memberDecl, contextualMapper);
|
||||
}
|
||||
else {
|
||||
Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment);
|
||||
@@ -5097,7 +5121,10 @@ module ts {
|
||||
var prop = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
|
||||
prop.declarations = member.declarations;
|
||||
prop.parent = member.parent;
|
||||
if (member.valueDeclaration) prop.valueDeclaration = member.valueDeclaration;
|
||||
if (member.valueDeclaration) {
|
||||
prop.valueDeclaration = member.valueDeclaration;
|
||||
}
|
||||
|
||||
prop.type = type;
|
||||
prop.target = member;
|
||||
member = prop;
|
||||
@@ -5201,7 +5228,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkPropertyAccessExpressionOrQualifiedName(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, right: Identifier) {
|
||||
var type = checkExpression(left);
|
||||
var type = checkExpressionOrQualifiedName(left);
|
||||
if (type === unknownType) return type;
|
||||
if (type !== anyType) {
|
||||
var apparentType = getApparentType(getWidenedType(type));
|
||||
@@ -5242,7 +5269,7 @@ module ts {
|
||||
? (<PropertyAccessExpression>node).expression
|
||||
: (<QualifiedName>node).left;
|
||||
|
||||
var type = checkExpression(left);
|
||||
var type = checkExpressionOrQualifiedName(left);
|
||||
if (type !== unknownType && type !== anyType) {
|
||||
var prop = getPropertyOfType(getWidenedType(type), propertyName);
|
||||
if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) {
|
||||
@@ -5601,7 +5628,7 @@ module ts {
|
||||
// because it represents a TemplateStringsArray.
|
||||
var excludeArgument: boolean[];
|
||||
for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) {
|
||||
if (isContextSensitiveExpression(args[i])) {
|
||||
if (isContextSensitive(args[i])) {
|
||||
if (!excludeArgument) {
|
||||
excludeArgument = new Array(args.length);
|
||||
}
|
||||
@@ -6024,7 +6051,7 @@ module ts {
|
||||
|
||||
function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type {
|
||||
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
|
||||
if (func.body.kind !== SyntaxKind.FunctionBlock) {
|
||||
if (func.body.kind !== SyntaxKind.Block) {
|
||||
var unwidenedType = checkAndMarkExpression(<Expression>func.body, contextualMapper);
|
||||
var widenedType = getWidenedType(unwidenedType);
|
||||
|
||||
@@ -6111,7 +6138,7 @@ module ts {
|
||||
}
|
||||
|
||||
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
|
||||
if (!func.body || func.body.kind !== SyntaxKind.FunctionBlock) {
|
||||
if (!func.body || func.body.kind !== SyntaxKind.Block) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6133,7 +6160,9 @@ module ts {
|
||||
error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement);
|
||||
}
|
||||
|
||||
function checkFunctionExpression(node: FunctionExpression, contextualMapper?: TypeMapper): Type {
|
||||
function checkFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | MethodDeclaration, contextualMapper?: TypeMapper): Type {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
|
||||
// The identityMapper object is used to indicate that function expressions are wildcards
|
||||
if (contextualMapper === identityMapper) {
|
||||
return anyFunctionType;
|
||||
@@ -6150,7 +6179,7 @@ module ts {
|
||||
links.flags |= NodeCheckFlags.ContextChecked;
|
||||
if (contextualSignature) {
|
||||
var signature = getSignaturesOfType(type, SignatureKind.Call)[0];
|
||||
if (isContextSensitiveExpression(node)) {
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
@@ -6165,27 +6194,31 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (fullTypeCheck) {
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
if (fullTypeCheck && node.kind !== SyntaxKind.Method) {
|
||||
checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
|
||||
checkCollisionWithCapturedThisVariable(node,(<FunctionExpression>node).name);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
function checkFunctionExpressionBody(node: FunctionExpression) {
|
||||
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
if (node.type) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
|
||||
}
|
||||
if (node.body.kind === SyntaxKind.FunctionBlock) {
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
else {
|
||||
var exprType = checkExpression(<Expression>node.body);
|
||||
if (node.type) {
|
||||
checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined);
|
||||
|
||||
if (node.body) {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
else {
|
||||
var exprType = checkExpression(<Expression>node.body);
|
||||
if (node.type) {
|
||||
checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined);
|
||||
}
|
||||
checkFunctionExpressionBodies(node.body);
|
||||
}
|
||||
checkFunctionExpressionBodies(node.body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6552,6 +6585,32 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type {
|
||||
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
|
||||
return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);
|
||||
}
|
||||
|
||||
function instantiateTypeWithSingleGenericCallSignature(node: Expression | MethodDeclaration, type: Type, contextualMapper?: TypeMapper) {
|
||||
if (contextualMapper && contextualMapper !== identityMapper) {
|
||||
var signature = getSingleCallSignature(type);
|
||||
if (signature && signature.typeParameters) {
|
||||
var contextualType = getContextualType(<Expression>node);
|
||||
if (contextualType) {
|
||||
var contextualSignature = getSingleCallSignature(contextualType);
|
||||
if (contextualSignature && !contextualSignature.typeParameters) {
|
||||
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
function checkExpression(node: Expression, contextualMapper?: TypeMapper): Type {
|
||||
return checkExpressionOrQualifiedName(node, contextualMapper);
|
||||
}
|
||||
|
||||
// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
|
||||
// contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the
|
||||
// expression is being inferentially typed (section 4.12.2 in spec) and provides the type mapper to use in
|
||||
@@ -6559,19 +6618,14 @@ module ts {
|
||||
// object, it serves as an indicator that all contained function and arrow expressions should be considered to
|
||||
// have the wildcard function type; this form of type check is used during overload resolution to exclude
|
||||
// contextually typed function and arrow expressions in the initial phase.
|
||||
function checkExpression(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type {
|
||||
var type = checkExpressionNode(node, contextualMapper);
|
||||
if (contextualMapper && contextualMapper !== identityMapper && node.kind !== SyntaxKind.QualifiedName) {
|
||||
var signature = getSingleCallSignature(type);
|
||||
if (signature && signature.typeParameters) {
|
||||
var contextualType = getContextualType(<Expression>node);
|
||||
if (contextualType) {
|
||||
var contextualSignature = getSingleCallSignature(contextualType);
|
||||
if (contextualSignature && !contextualSignature.typeParameters) {
|
||||
type = getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkExpressionOrQualifiedName(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type {
|
||||
var type: Type;
|
||||
if (node.kind == SyntaxKind.QualifiedName) {
|
||||
type = checkQualifiedName(<QualifiedName>node);
|
||||
}
|
||||
else {
|
||||
var uninstantiatedType = checkExpressionWorker(<Expression>node, contextualMapper);
|
||||
type = instantiateTypeWithSingleGenericCallSignature(<Expression>node, uninstantiatedType, contextualMapper);
|
||||
}
|
||||
|
||||
if (isConstEnumObjectType(type)) {
|
||||
@@ -6591,7 +6645,7 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function checkExpressionNode(node: Expression | QualifiedName, contextualMapper: TypeMapper): Type {
|
||||
function checkExpressionWorker(node: Expression, contextualMapper: TypeMapper): Type {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
return checkIdentifier(<Identifier>node);
|
||||
@@ -6613,8 +6667,6 @@ module ts {
|
||||
return stringType;
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
return globalRegExpType;
|
||||
case SyntaxKind.QualifiedName:
|
||||
return checkQualifiedName(<QualifiedName>node);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return checkArrayLiteral(<ArrayLiteralExpression>node, contextualMapper);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
@@ -6634,7 +6686,7 @@ module ts {
|
||||
return checkExpression((<ParenthesizedExpression>node).expression);
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return checkFunctionExpression(<FunctionExpression>node, contextualMapper);
|
||||
return checkFunctionExpressionOrObjectLiteralMethod(<FunctionExpression>node, contextualMapper);
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
return checkTypeOfExpression(<TypeOfExpression>node);
|
||||
case SyntaxKind.DeleteExpression:
|
||||
@@ -7360,6 +7412,9 @@ module ts {
|
||||
|
||||
function checkBlock(node: Block) {
|
||||
forEach(node.statements, checkSourceElement);
|
||||
if (isFunctionBlock(node) || node.kind === SyntaxKind.ModuleBlock) {
|
||||
checkFunctionExpressionBodies(node);
|
||||
}
|
||||
}
|
||||
|
||||
function checkCollisionWithArgumentsInGeneratedCode(node: SignatureDeclaration) {
|
||||
@@ -7904,7 +7959,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Check that base type can be evaluated as expression
|
||||
checkExpression(baseTypeNode.typeName);
|
||||
checkExpressionOrQualifiedName(baseTypeNode.typeName);
|
||||
}
|
||||
|
||||
var implementedTypeNodes = getClassImplementedTypeNodes(node);
|
||||
@@ -8393,7 +8448,7 @@ module ts {
|
||||
// ensure it can be evaluated as an expression
|
||||
var moduleName = getFirstIdentifier(<EntityName>node.moduleReference);
|
||||
if (resolveEntityName(node, moduleName, SymbolFlags.Value | SymbolFlags.Namespace).flags & SymbolFlags.Namespace) {
|
||||
checkExpression(<EntityName>node.moduleReference);
|
||||
checkExpressionOrQualifiedName(<EntityName>node.moduleReference);
|
||||
}
|
||||
else {
|
||||
error(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
|
||||
@@ -8491,10 +8546,8 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return checkFunctionDeclaration(<FunctionDeclaration>node);
|
||||
case SyntaxKind.Block:
|
||||
return checkBlock(<Block>node);
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return checkBody(<Block>node);
|
||||
return checkBlock(<Block>node);
|
||||
case SyntaxKind.VariableStatement:
|
||||
return checkVariableStatement(<VariableStatement>node);
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
@@ -8557,9 +8610,14 @@ module ts {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
forEach((<FunctionLikeDeclaration>node).parameters, checkFunctionExpressionBodies);
|
||||
checkFunctionExpressionBody(<FunctionExpression>node);
|
||||
checkFunctionExpressionOrObjectLiteralMethodBody(<FunctionExpression>node);
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
forEach((<MethodDeclaration>node).parameters, checkFunctionExpressionBodies);
|
||||
if (isObjectLiteralMethod(node)) {
|
||||
checkFunctionExpressionOrObjectLiteralMethodBody(<MethodDeclaration>node);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -8589,7 +8647,6 @@ module ts {
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
@@ -8620,11 +8677,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkBody(node: Block) {
|
||||
checkBlock(node);
|
||||
checkFunctionExpressionBodies(node);
|
||||
}
|
||||
|
||||
// Fully type check a source file and collect the relevant diagnostics.
|
||||
function checkSourceFile(node: SourceFile) {
|
||||
var links = getNodeLinks(node);
|
||||
@@ -9022,7 +9074,7 @@ module ts {
|
||||
// This is necessary as an identifier in short-hand property assignment can contains two meaning:
|
||||
// property name and property value.
|
||||
if (location && location.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
return resolveEntityName(location, (<ShorthandPropertyDeclaration>location).name, SymbolFlags.Value);
|
||||
return resolveEntityName(location, (<ShorthandPropertyAssignment>location).name, SymbolFlags.Value);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+37
-10
@@ -2227,6 +2227,30 @@ module ts {
|
||||
emit(node.expression);
|
||||
write("]");
|
||||
}
|
||||
|
||||
function emitDownlevelMethod(node: MethodDeclaration) {
|
||||
if (!isObjectLiteralMethod(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
write(": ");
|
||||
write("function ");
|
||||
emitSignatureAndBody(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitMethod(node: MethodDeclaration) {
|
||||
if (!isObjectLiteralMethod(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
emitLeadingComments(node);
|
||||
emit(node.name);
|
||||
emitSignatureAndBody(node);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitPropertyAssignment(node: PropertyDeclaration) {
|
||||
emitLeadingComments(node);
|
||||
@@ -2236,7 +2260,7 @@ module ts {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitDownlevelShorthandPropertyAssignment(node: ShorthandPropertyDeclaration) {
|
||||
function emitDownlevelShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
emitLeadingComments(node);
|
||||
// Emit identifier as an identifier
|
||||
emit(node.name);
|
||||
@@ -2247,7 +2271,7 @@ module ts {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyDeclaration) {
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
// If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example:
|
||||
// module m {
|
||||
// export var y;
|
||||
@@ -2841,17 +2865,17 @@ module ts {
|
||||
scopeEmitStart(node);
|
||||
increaseIndent();
|
||||
|
||||
emitDetachedComments(node.body.kind === SyntaxKind.FunctionBlock ? (<Block>node.body).statements : node.body);
|
||||
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
|
||||
|
||||
var startIndex = 0;
|
||||
if (node.body.kind === SyntaxKind.FunctionBlock) {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
|
||||
}
|
||||
var outPos = writer.getTextPos();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
emitDefaultValueAssignments(node);
|
||||
emitRestParameter(node);
|
||||
if (node.body.kind !== SyntaxKind.FunctionBlock && outPos === writer.getTextPos()) {
|
||||
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
|
||||
decreaseIndent();
|
||||
write(" ");
|
||||
emitStart(node.body);
|
||||
@@ -2864,7 +2888,7 @@ module ts {
|
||||
emitEnd(node.body);
|
||||
}
|
||||
else {
|
||||
if (node.body.kind === SyntaxKind.FunctionBlock) {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitLinesStartingAt((<Block>node.body).statements, startIndex);
|
||||
}
|
||||
else {
|
||||
@@ -2876,7 +2900,7 @@ module ts {
|
||||
emitTrailingComments(node.body);
|
||||
}
|
||||
writeLine();
|
||||
if (node.body.kind === SyntaxKind.FunctionBlock) {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
|
||||
decreaseIndent();
|
||||
emitToken(SyntaxKind.CloseBraceToken, (<Block>node.body).statements.end);
|
||||
@@ -3566,7 +3590,6 @@ module ts {
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return emitBlock(<Block>node);
|
||||
case SyntaxKind.VariableStatement:
|
||||
@@ -3628,7 +3651,9 @@ module ts {
|
||||
// Emit node down-level
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return emitDownlevelShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
|
||||
return emitDownlevelShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
case SyntaxKind.Method:
|
||||
return emitDownlevelMethod(<MethodDeclaration>node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3636,7 +3661,9 @@ module ts {
|
||||
Debug.assert(compilerOptions.target >= ScriptTarget.ES6, "Invalid ScriptTarget. We should emit as ES6 or above");
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return emitShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
|
||||
return emitShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
case SyntaxKind.Method:
|
||||
return emitMethod(<MethodDeclaration>node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+64
-86
@@ -311,7 +311,6 @@ module ts {
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return children((<Block>node).statements);
|
||||
case SyntaxKind.SourceFile:
|
||||
@@ -435,7 +434,6 @@ module ts {
|
||||
case SyntaxKind.ReturnStatement:
|
||||
return visitor(<ReturnStatement>node);
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
@@ -472,6 +470,14 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isFunctionBlock(node: Node) {
|
||||
return node !== undefined && node.kind === SyntaxKind.Block && isAnyFunction(node.parent);
|
||||
}
|
||||
|
||||
export function isObjectLiteralMethod(node: Node) {
|
||||
return node !== undefined && node.kind === SyntaxKind.Method && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
}
|
||||
|
||||
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
@@ -1918,16 +1924,10 @@ module ts {
|
||||
return parseInitializer(/*inParameter*/ true);
|
||||
}
|
||||
|
||||
function parseSignature(yieldAndGeneratorParameterContext: boolean): ParsedSignature {
|
||||
var signature = <ParsedSignature>{};
|
||||
fillSignature(SyntaxKind.ColonToken, yieldAndGeneratorParameterContext, signature);
|
||||
return signature;
|
||||
}
|
||||
|
||||
function fillSignature(
|
||||
returnToken: SyntaxKind,
|
||||
yieldAndGeneratorParameterContext: boolean,
|
||||
signature: ParsedSignature): void {
|
||||
signature: SignatureDeclaration): void {
|
||||
var returnTokenRequired = returnToken === SyntaxKind.EqualsGreaterThanToken;
|
||||
signature.typeParameters = parseTypeParameters();
|
||||
signature.parameters = parseParameterList(yieldAndGeneratorParameterContext);
|
||||
@@ -3166,26 +3166,21 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parsePropertyAssignment(): Declaration {
|
||||
var nodePos = scanner.getStartPos();
|
||||
function parseObjectLiteralElement(): ObjectLiteralElement {
|
||||
var fullStart = scanner.getStartPos();
|
||||
var initialToken = token;
|
||||
|
||||
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
||||
return parseAccessorDeclaration(kind, fullStart, /*modifiers*/undefined);
|
||||
}
|
||||
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var tokenIsIdentifier = isIdentifier();
|
||||
var nameToken = token;
|
||||
var propertyName = parsePropertyName();
|
||||
var node: Declaration;
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
node = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
node.name = propertyName;
|
||||
var sig = parseSignature(/*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
|
||||
|
||||
var body = parseFunctionBlock(!!asteriskToken, /* ignoreMissingOpenBrace */ false);
|
||||
// do not propagate property name as name for function expression
|
||||
// for scenarios like
|
||||
// var x = 1;
|
||||
// var y = { x() { } }
|
||||
// otherwise this will bring y.x into the scope of x which is incorrect
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, asteriskToken, undefined, sig, body);
|
||||
return finishNode(node);
|
||||
return parseMethodDeclaration(fullStart, /*modifiers:*/ undefined, asteriskToken, propertyName, /*questionToken:*/ undefined, /*requireBlock:*/ true);
|
||||
}
|
||||
|
||||
// Disallowing of optional property assignments happens in the grammar checker.
|
||||
@@ -3193,31 +3188,21 @@ module ts {
|
||||
|
||||
// Parse to check if it is short-hand property assignment or normal property assignment
|
||||
if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) {
|
||||
var shorthandDeclaration = <ShorthandPropertyDeclaration>createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos);
|
||||
var shorthandDeclaration = <ShorthandPropertyAssignment>createNode(SyntaxKind.ShorthandPropertyAssignment, fullStart);
|
||||
shorthandDeclaration.name = <Identifier>propertyName;
|
||||
shorthandDeclaration.questionToken = questionToken;
|
||||
return finishNode(shorthandDeclaration);
|
||||
}
|
||||
else {
|
||||
var propertyDeclaration = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
propertyDeclaration.name = propertyName;
|
||||
propertyDeclaration.questionToken = questionToken;
|
||||
var propertyAssignment = <PropertyAssignment>createNode(SyntaxKind.PropertyAssignment, fullStart);
|
||||
propertyAssignment.name = propertyName;
|
||||
propertyAssignment.questionToken = questionToken;
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
propertyDeclaration.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
return finishNode(propertyDeclaration);
|
||||
propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
return finishNode(propertyAssignment);
|
||||
}
|
||||
}
|
||||
|
||||
function parseObjectLiteralMember(): Declaration {
|
||||
var initialPos = getNodePos();
|
||||
var initialToken = token;
|
||||
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
||||
return parseMemberAccessorDeclaration(kind, initialPos, /*modifiers*/ undefined);
|
||||
}
|
||||
return parsePropertyAssignment();
|
||||
}
|
||||
|
||||
function parseObjectLiteralExpression(): ObjectLiteralExpression {
|
||||
var node = <ObjectLiteralExpression>createNode(SyntaxKind.ObjectLiteralExpression);
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
@@ -3225,7 +3210,7 @@ module ts {
|
||||
node.flags |= NodeFlags.MultiLine;
|
||||
}
|
||||
|
||||
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember);
|
||||
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement);
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -3248,17 +3233,6 @@ module ts {
|
||||
return isIdentifier() ? parseIdentifier() : undefined;
|
||||
}
|
||||
|
||||
function makeFunctionExpression(kind: SyntaxKind, pos: number, asteriskToken: Node, name: Identifier, sig: ParsedSignature, body: Block | Expression): FunctionExpression {
|
||||
var node = <FunctionExpression>createNode(kind, pos);
|
||||
node.asteriskToken = asteriskToken;
|
||||
node.name = name;
|
||||
node.typeParameters = sig.typeParameters;
|
||||
node.parameters = sig.parameters;
|
||||
node.type = sig.type;
|
||||
node.body = body;
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseNewExpression(): NewExpression {
|
||||
var node = <NewExpression>createNode(SyntaxKind.NewExpression);
|
||||
parseExpected(SyntaxKind.NewKeyword);
|
||||
@@ -3291,7 +3265,7 @@ module ts {
|
||||
var savedYieldContext = inYieldContext();
|
||||
setYieldContext(allowYield);
|
||||
|
||||
var block = parseBlock(SyntaxKind.FunctionBlock, ignoreMissingOpenBrace, /*checkForStrictMode*/ true);
|
||||
var block = parseBlock(SyntaxKind.Block, ignoreMissingOpenBrace, /*checkForStrictMode*/ true);
|
||||
|
||||
setYieldContext(savedYieldContext);
|
||||
|
||||
@@ -3668,7 +3642,7 @@ module ts {
|
||||
|
||||
function parseFunctionBlockOrSemicolon(isGenerator: boolean): Block {
|
||||
if (token === SyntaxKind.OpenBraceToken) {
|
||||
return parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false);
|
||||
return parseFunctionBlock(isGenerator, /*ignoreMissingOpenBrace:*/ false);
|
||||
}
|
||||
|
||||
parseSemicolon(Diagnostics.or_expected);
|
||||
@@ -3739,7 +3713,18 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement {
|
||||
function parseMethodDeclaration(fullStart: number, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, requireBlock: boolean): MethodDeclaration {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
setModifiers(method, modifiers);
|
||||
method.asteriskToken = asteriskToken;
|
||||
method.name = name;
|
||||
method.questionToken = questionToken;
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
|
||||
method.body = requireBlock ? parseFunctionBlock(!!asteriskToken, /*ignoreMissingOpenBrace:*/ false) : parseFunctionBlockOrSemicolon(!!asteriskToken);
|
||||
return finishNode(method);
|
||||
}
|
||||
|
||||
function parsePropertyOrMethodDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement {
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var name = parsePropertyName();
|
||||
|
||||
@@ -3747,14 +3732,7 @@ module ts {
|
||||
// report an error in the grammar checker.
|
||||
var questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
setModifiers(method, modifiers);
|
||||
method.asteriskToken = asteriskToken;
|
||||
method.name = name;
|
||||
method.questionToken = questionToken;
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken);
|
||||
return finishNode(method);
|
||||
return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, /*requireBlock:*/ false);
|
||||
}
|
||||
else {
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, fullStart);
|
||||
@@ -3772,8 +3750,8 @@ module ts {
|
||||
return parseInitializer(/*inParameter*/ false);
|
||||
}
|
||||
|
||||
function parseMemberAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): MethodDeclaration {
|
||||
var node = <MethodDeclaration>createNode(kind, fullStart);
|
||||
function parseAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): AccessorDeclaration {
|
||||
var node = <AccessorDeclaration>createNode(kind, fullStart);
|
||||
setModifiers(node, modifiers);
|
||||
node.name = parsePropertyName();
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, node);
|
||||
@@ -3864,10 +3842,10 @@ module ts {
|
||||
var fullStart = getNodePos();
|
||||
var modifiers = parseModifiers();
|
||||
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
|
||||
return parseMemberAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
|
||||
return parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
|
||||
}
|
||||
if (parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||
return parseMemberAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
|
||||
return parseAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
|
||||
}
|
||||
if (token === SyntaxKind.ConstructorKeyword) {
|
||||
return parseConstructorDeclaration(fullStart, modifiers);
|
||||
@@ -3879,7 +3857,7 @@ module ts {
|
||||
// the [ token can start an index signature or a computed property name
|
||||
if (isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral ||
|
||||
token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBracketToken) {
|
||||
return parsePropertyMemberDeclaration(fullStart, modifiers);
|
||||
return parsePropertyOrMethodDeclaration(fullStart, modifiers);
|
||||
}
|
||||
|
||||
// 'isClassMemberStart' should have hinted not to attempt parsing.
|
||||
@@ -4364,7 +4342,7 @@ module ts {
|
||||
|
||||
if (!checkModifiers(node)) {
|
||||
var savedInFunctionBlock = inFunctionBlock;
|
||||
if (node.kind === SyntaxKind.FunctionBlock) {
|
||||
if (isFunctionBlock(node)) {
|
||||
inFunctionBlock = true;
|
||||
}
|
||||
|
||||
@@ -4408,7 +4386,7 @@ module ts {
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.FunctionType:
|
||||
return checkAnyParsedSignature(<FunctionLikeDeclaration>node);
|
||||
return checkAnySignatureDeclaration(<FunctionLikeDeclaration>node);
|
||||
case SyntaxKind.BreakStatement:
|
||||
case SyntaxKind.ContinueStatement:
|
||||
return checkBreakOrContinueStatement(<BreakOrContinueStatement>node);
|
||||
@@ -4435,6 +4413,7 @@ module ts {
|
||||
case SyntaxKind.IndexSignature: return checkIndexSignature(<SignatureDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
|
||||
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyAssignment>node);
|
||||
case SyntaxKind.Method: return checkMethod(<MethodDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(<ObjectLiteralExpression>node);
|
||||
@@ -4443,11 +4422,10 @@ module ts {
|
||||
case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(<PostfixUnaryExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
case SyntaxKind.Property: return checkProperty(<PropertyDeclaration>node);
|
||||
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyDeclaration>node);
|
||||
case SyntaxKind.ReturnStatement: return checkReturnStatement(<ReturnStatement>node);
|
||||
case SyntaxKind.SetAccessor: return checkSetAccessor(<MethodDeclaration>node);
|
||||
case SyntaxKind.SourceFile: return checkSourceFile(<SourceFile>node);
|
||||
case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
|
||||
case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
case SyntaxKind.SwitchStatement: return checkSwitchStatement(<SwitchStatement>node);
|
||||
case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
|
||||
case SyntaxKind.ThrowStatement: return checkThrowStatement(<ThrowStatement>node);
|
||||
@@ -4523,7 +4501,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkAnyParsedSignature(node: ParsedSignature): boolean {
|
||||
function checkAnySignatureDeclaration(node: SignatureDeclaration): boolean {
|
||||
return checkTypeParameterList(node.typeParameters) ||
|
||||
checkParameterList(node.parameters);
|
||||
}
|
||||
@@ -4737,7 +4715,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkConstructor(node: ConstructorDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
return checkAnySignatureDeclaration(node) ||
|
||||
checkConstructorTypeParameters(node) ||
|
||||
checkConstructorTypeAnnotation(node) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ true);
|
||||
@@ -4845,7 +4823,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
return checkAnySignatureDeclaration(node) ||
|
||||
checkFunctionName(node.name) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
|
||||
checkForGenerator(node);
|
||||
@@ -4858,7 +4836,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkFunctionExpression(node: FunctionExpression) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
return checkAnySignatureDeclaration(node) ||
|
||||
checkFunctionName(node.name) ||
|
||||
checkForGenerator(node);
|
||||
}
|
||||
@@ -4872,7 +4850,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkGetAccessor(node: MethodDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
return checkAnySignatureDeclaration(node) ||
|
||||
checkAccessor(node);
|
||||
}
|
||||
|
||||
@@ -4970,11 +4948,12 @@ module ts {
|
||||
}
|
||||
|
||||
function checkMethod(node: MethodDeclaration) {
|
||||
if (checkAnyParsedSignature(node) ||
|
||||
if (checkAnySignatureDeclaration(node) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
|
||||
checkForGenerator(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional)) {
|
||||
return true;
|
||||
@@ -5000,7 +4979,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean {
|
||||
if (inAmbientContext && body && body.kind === SyntaxKind.FunctionBlock) {
|
||||
if (inAmbientContext && body && body.kind === SyntaxKind.Block) {
|
||||
var diagnostic = isConstructor
|
||||
? Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context
|
||||
: Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context;
|
||||
@@ -5060,10 +5039,9 @@ module ts {
|
||||
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
||||
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
||||
var currentKind: number;
|
||||
if (prop.kind === SyntaxKind.PropertyAssignment) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
if (prop.kind === SyntaxKind.PropertyAssignment ||
|
||||
prop.kind === SyntaxKind.ShorthandPropertyAssignment ||
|
||||
prop.kind === SyntaxKind.Method) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (prop.kind === SyntaxKind.GetAccessor) {
|
||||
@@ -5364,7 +5342,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkPropertyAssignment(node: PropertyDeclaration) {
|
||||
function checkPropertyAssignment(node: PropertyAssignment) {
|
||||
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
}
|
||||
|
||||
@@ -5381,7 +5359,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkSetAccessor(node: MethodDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
return checkAnySignatureDeclaration(node) ||
|
||||
checkAccessor(node);
|
||||
}
|
||||
|
||||
@@ -5464,7 +5442,7 @@ module ts {
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
|
||||
}
|
||||
|
||||
function checkShorthandPropertyAssignment(node: ShorthandPropertyDeclaration): boolean {
|
||||
function checkShorthandPropertyAssignment(node: ShorthandPropertyAssignment): boolean {
|
||||
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
}
|
||||
|
||||
|
||||
+35
-15
@@ -212,7 +212,6 @@ module ts {
|
||||
DebuggerStatement,
|
||||
VariableDeclaration,
|
||||
FunctionDeclaration,
|
||||
FunctionBlock,
|
||||
ClassDeclaration,
|
||||
InterfaceDeclaration,
|
||||
TypeAliasDeclaration,
|
||||
@@ -234,6 +233,7 @@ module ts {
|
||||
// Property assignments
|
||||
PropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
|
||||
// Enum
|
||||
EnumMember,
|
||||
// Top-level nodes
|
||||
@@ -334,13 +334,6 @@ module ts {
|
||||
}
|
||||
|
||||
export type EntityName = Identifier | QualifiedName;
|
||||
|
||||
export interface ParsedSignature {
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
parameters: NodeArray<ParameterDeclaration>;
|
||||
type?: TypeNode;
|
||||
}
|
||||
|
||||
export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName;
|
||||
|
||||
export interface Declaration extends Node {
|
||||
@@ -360,7 +353,10 @@ module ts {
|
||||
expression?: Expression;
|
||||
}
|
||||
|
||||
export interface SignatureDeclaration extends Declaration, ParsedSignature {
|
||||
export interface SignatureDeclaration extends Declaration {
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
parameters: NodeArray<ParameterDeclaration>;
|
||||
type?: TypeNode;
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends Declaration {
|
||||
@@ -378,6 +374,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface PropertyDeclaration extends Declaration, ClassElement {
|
||||
_propertyDeclarationBrand: any;
|
||||
questionToken?: Node;
|
||||
type?: TypeNode;
|
||||
initializer?: Expression;
|
||||
@@ -386,11 +383,22 @@ module ts {
|
||||
export type VariableOrParameterDeclaration = VariableDeclaration | ParameterDeclaration;
|
||||
export type VariableOrParameterOrPropertyDeclaration = VariableOrParameterDeclaration | PropertyDeclaration;
|
||||
|
||||
export interface ShorthandPropertyDeclaration extends Declaration {
|
||||
export interface ObjectLiteralElement extends Declaration {
|
||||
_objectLiteralBrandBrand: any;
|
||||
}
|
||||
|
||||
export interface ShorthandPropertyAssignment extends ObjectLiteralElement {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
}
|
||||
|
||||
export interface PropertyAssignment extends ObjectLiteralElement {
|
||||
_propertyAssignmentBrand: any;
|
||||
name: DeclarationName;
|
||||
questionToken?: Node;
|
||||
initializer: Expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
@@ -412,7 +420,16 @@ module ts {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
// Note that a MethodDeclaration is considered both a ClassElement and an ObjectLiteralElement.
|
||||
// Both the grammars for ClassDeclaration and ObjectLiteralExpression allow for MethodDeclarations
|
||||
// as child elements, and so a MethodDeclaration satisfies both interfaces. This avoids the
|
||||
// alternative where we would need separate kinds/types for ClassMethodDeclaration and
|
||||
// ObjectLiteralMethodDeclaration, which would look identical.
|
||||
//
|
||||
// Because of this, it may be necessary to determine what sort of MethodDeclaration you have
|
||||
// at later stages of the compiler pipeline. In that case, you can either check the parent kind
|
||||
// of the method, or use helpers like isObjectLiteralMethodDeclaration
|
||||
export interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
@@ -420,8 +437,11 @@ module ts {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
|
||||
// ClassElement and an ObjectLiteralElement.
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
_accessorDeclarationBrand: any;
|
||||
body: Block;
|
||||
}
|
||||
|
||||
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
|
||||
@@ -576,7 +596,7 @@ module ts {
|
||||
|
||||
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
|
||||
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
|
||||
properties: NodeArray<Declaration>;
|
||||
properties: NodeArray<ObjectLiteralElement>;
|
||||
}
|
||||
|
||||
export interface PropertyAccessExpression extends MemberExpression {
|
||||
@@ -901,7 +921,7 @@ module ts {
|
||||
getFullyQualifiedName(symbol: Symbol): string;
|
||||
getAugmentedPropertiesOfType(type: Type): Symbol[];
|
||||
getRootSymbols(symbol: Symbol): Symbol[];
|
||||
getContextualType(node: Node): Type;
|
||||
getContextualType(node: Expression): Type;
|
||||
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
|
||||
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
|
||||
@@ -769,7 +769,7 @@ module FourSlash {
|
||||
return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
|
||||
}
|
||||
|
||||
public verifyQuickInfo(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
|
||||
public verifyQuickInfoString(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
|
||||
[expectedText, expectedDocumentation].forEach(str => {
|
||||
if (str) {
|
||||
this.scenarioActions.push('<ShowQuickInfo />');
|
||||
@@ -798,6 +798,39 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public verifyQuickInfoDisplayParts(kind: string, kindModifiers: string, textSpan: { start: number; length: number; },
|
||||
displayParts: ts.SymbolDisplayPart[],
|
||||
documentation: ts.SymbolDisplayPart[]) {
|
||||
this.scenarioActions.push('<ShowQuickInfo />');
|
||||
this.scenarioActions.push('<Verify return values of quickInfo="' + JSON.stringify(displayParts) + '"/>');
|
||||
|
||||
function getDisplayPartsJson(displayParts: ts.SymbolDisplayPart[]) {
|
||||
var result = "";
|
||||
ts.forEach(displayParts, part => {
|
||||
if (result) {
|
||||
result += ",\n ";
|
||||
}
|
||||
else {
|
||||
result = "[\n ";
|
||||
}
|
||||
result += JSON.stringify(part);
|
||||
});
|
||||
if (result) {
|
||||
result += "\n]";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
assert.equal(actualQuickInfo.kind, kind, this.messageAtLastKnownMarker("QuickInfo kind"));
|
||||
assert.equal(actualQuickInfo.kindModifiers, kindModifiers, this.messageAtLastKnownMarker("QuickInfo kindModifiers"));
|
||||
assert.equal(JSON.stringify(actualQuickInfo.textSpan), JSON.stringify(textSpan), this.messageAtLastKnownMarker("QuickInfo textSpan"));
|
||||
assert.equal(getDisplayPartsJson(actualQuickInfo.displayParts), getDisplayPartsJson(displayParts), this.messageAtLastKnownMarker("QuickInfo displayParts"));
|
||||
assert.equal(getDisplayPartsJson(actualQuickInfo.documentation), getDisplayPartsJson(documentation), this.messageAtLastKnownMarker("QuickInfo documentation"));
|
||||
}
|
||||
|
||||
public verifyRenameLocations(findInStrings: boolean, findInComments: boolean) {
|
||||
var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (renameInfo.canRename) {
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
declare type PropertyKey = string | number | Symbol;
|
||||
declare type PropertyKey = string | number | Symbol;
|
||||
|
||||
interface Symbol {
|
||||
/** Returns a string representation of an object. */
|
||||
|
||||
@@ -101,10 +101,11 @@ module ts.BreakpointResolver {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return spanInFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
|
||||
case SyntaxKind.FunctionBlock:
|
||||
return spanInFunctionBlock(<Block>node);
|
||||
|
||||
case SyntaxKind.Block:
|
||||
if (isFunctionBlock(node)) {
|
||||
return spanInFunctionBlock(<Block>node);
|
||||
}
|
||||
// Fall through
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
@@ -414,13 +415,18 @@ module ts.BreakpointResolver {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
// Span on close brace token
|
||||
return textSpan(node);
|
||||
|
||||
case SyntaxKind.Block:
|
||||
if (isFunctionBlock(node.parent)) {
|
||||
// Span on close brace token
|
||||
return textSpan(node);
|
||||
}
|
||||
// fall through.
|
||||
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
|
||||
@@ -897,7 +897,7 @@ module ts.formatting {
|
||||
function isSomeBlock(kind: SyntaxKind): boolean {
|
||||
switch (kind) {
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
|
||||
@@ -526,7 +526,6 @@ module ts.formatting {
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return true;
|
||||
}
|
||||
@@ -582,7 +581,6 @@ module ts.formatting {
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return true;
|
||||
|
||||
@@ -120,7 +120,7 @@ module ts.NavigationBar {
|
||||
if (functionDeclaration.kind === SyntaxKind.FunctionDeclaration) {
|
||||
// A function declaration is 'top level' if it contains any function declarations
|
||||
// within it.
|
||||
if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.FunctionBlock) {
|
||||
if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.Block) {
|
||||
// Proper function declarations can only have identifier names
|
||||
if (forEach((<Block>functionDeclaration.body).statements,
|
||||
s => s.kind === SyntaxKind.FunctionDeclaration && !isEmpty((<FunctionDeclaration>s).name.text))) {
|
||||
@@ -130,7 +130,7 @@ module ts.NavigationBar {
|
||||
|
||||
// Or if it is not parented by another function. i.e all functions
|
||||
// at module scope are 'top level'.
|
||||
if (functionDeclaration.parent.kind !== SyntaxKind.FunctionBlock) {
|
||||
if (!isFunctionBlock(functionDeclaration.parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createFunctionItem(node: FunctionDeclaration) {
|
||||
if (node.name && node.body && node.body.kind === SyntaxKind.FunctionBlock) {
|
||||
if (node.name && node.body && node.body.kind === SyntaxKind.Block) {
|
||||
var childItems = getItemsWorker(sortNodes((<Block>node.body).statements), createChildItem);
|
||||
|
||||
return getNavigationBarItem(node.name.text,
|
||||
|
||||
@@ -67,38 +67,39 @@ module ts {
|
||||
}
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.Block:
|
||||
var parent = n.parent;
|
||||
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
if (!isFunctionBlock(n)) {
|
||||
var parent = n.parent;
|
||||
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collaps the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent.kind === SyntaxKind.DoStatement ||
|
||||
parent.kind === SyntaxKind.ForInStatement ||
|
||||
parent.kind === SyntaxKind.ForStatement ||
|
||||
parent.kind === SyntaxKind.IfStatement ||
|
||||
parent.kind === SyntaxKind.WhileStatement ||
|
||||
parent.kind === SyntaxKind.WithStatement ||
|
||||
parent.kind === SyntaxKind.CatchClause) {
|
||||
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collaps the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent.kind === SyntaxKind.DoStatement ||
|
||||
parent.kind === SyntaxKind.ForInStatement ||
|
||||
parent.kind === SyntaxKind.ForStatement ||
|
||||
parent.kind === SyntaxKind.IfStatement ||
|
||||
parent.kind === SyntaxKind.WhileStatement ||
|
||||
parent.kind === SyntaxKind.WithStatement ||
|
||||
parent.kind === SyntaxKind.CatchClause) {
|
||||
|
||||
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
|
||||
}
|
||||
else {
|
||||
// Block was a standalone block. In this case we want to only collapse
|
||||
// the span of the block, independent of any parent span.
|
||||
var span = TextSpan.fromBounds(n.getStart(), n.end);
|
||||
elements.push({
|
||||
textSpan: span,
|
||||
hintSpan: span,
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse(n)
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// Block was a standalone block. In this case we want to only collapse
|
||||
// the span of the block, independent of any parent span.
|
||||
var span = TextSpan.fromBounds(n.getStart(), n.end);
|
||||
elements.push({
|
||||
textSpan: span,
|
||||
hintSpan: span,
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse(n)
|
||||
});
|
||||
}
|
||||
break;
|
||||
// Fallthrough.
|
||||
|
||||
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
|
||||
+37
-12
@@ -806,10 +806,15 @@ module ts {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
forEachChild(node, visit);
|
||||
break;
|
||||
|
||||
case SyntaxKind.Block:
|
||||
if (isFunctionBlock(node)) {
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// Only consider properties defined as constructor parameters
|
||||
if (!(node.flags & NodeFlags.AccessibilityModifier)) {
|
||||
@@ -1363,7 +1368,10 @@ module ts {
|
||||
|
||||
function writeIndent() {
|
||||
if (lineStart) {
|
||||
displayParts.push(displayPart(getIndentString(indent), SymbolDisplayPartKind.space));
|
||||
var indentString = getIndentString(indent);
|
||||
if (indentString) {
|
||||
displayParts.push(displayPart(indentString, SymbolDisplayPartKind.space));
|
||||
}
|
||||
lineStart = false;
|
||||
}
|
||||
}
|
||||
@@ -1441,7 +1449,7 @@ module ts {
|
||||
}
|
||||
|
||||
// If the parent is not sourceFile or module block it is local variable
|
||||
for (var parent = declaration.parent; parent.kind !== SyntaxKind.FunctionBlock; parent = parent.parent) {
|
||||
for (var parent = declaration.parent; !isFunctionBlock(parent); parent = parent.parent) {
|
||||
// Reached source file or module block
|
||||
if (parent.kind === SyntaxKind.SourceFile || parent.kind === SyntaxKind.ModuleBlock) {
|
||||
return false;
|
||||
@@ -1463,6 +1471,8 @@ module ts {
|
||||
return isFirstDeclarationOfSymbolParameter(symbol) ? SymbolDisplayPartKind.parameterName : SymbolDisplayPartKind.localName;
|
||||
}
|
||||
else if (flags & SymbolFlags.Property) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.GetAccessor) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.SetAccessor) { return SymbolDisplayPartKind.propertyName; }
|
||||
else if (flags & SymbolFlags.EnumMember) { return SymbolDisplayPartKind.enumMemberName; }
|
||||
else if (flags & SymbolFlags.Function) { return SymbolDisplayPartKind.functionName; }
|
||||
else if (flags & SymbolFlags.Class) { return SymbolDisplayPartKind.className; }
|
||||
@@ -1471,6 +1481,9 @@ module ts {
|
||||
else if (flags & SymbolFlags.Module) { return SymbolDisplayPartKind.moduleName; }
|
||||
else if (flags & SymbolFlags.Method) { return SymbolDisplayPartKind.methodName; }
|
||||
else if (flags & SymbolFlags.TypeParameter) { return SymbolDisplayPartKind.typeParameterName; }
|
||||
else if (flags & SymbolFlags.TypeAlias) { return SymbolDisplayPartKind.aliasName; }
|
||||
else if (flags & SymbolFlags.Import) { return SymbolDisplayPartKind.aliasName; }
|
||||
|
||||
|
||||
return SymbolDisplayPartKind.text;
|
||||
}
|
||||
@@ -2748,6 +2761,7 @@ module ts {
|
||||
if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement;
|
||||
if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement;
|
||||
if (flags & SymbolFlags.Import) return ScriptElementKind.alias;
|
||||
if (flags & SymbolFlags.Module) return ScriptElementKind.moduleElement;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2929,6 +2943,7 @@ module ts {
|
||||
case ScriptElementKind.memberVariableElement:
|
||||
case ScriptElementKind.variableElement:
|
||||
case ScriptElementKind.constElement:
|
||||
case ScriptElementKind.letElement:
|
||||
case ScriptElementKind.parameterElement:
|
||||
case ScriptElementKind.localVariableElement:
|
||||
// If it is call or construct signature of lambda's write type name
|
||||
@@ -2966,7 +2981,8 @@ module ts {
|
||||
|
||||
if (functionDeclaration.kind === SyntaxKind.Constructor) {
|
||||
// show (constructor) Type(...) signature
|
||||
addPrefixForAnyFunctionOrVar(type.symbol, ScriptElementKind.constructorImplementationElement);
|
||||
symbolKind = ScriptElementKind.constructorImplementationElement;
|
||||
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
|
||||
}
|
||||
else {
|
||||
// (function/method) symbol(..signature)
|
||||
@@ -2998,7 +3014,7 @@ module ts {
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(symbol);
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration));
|
||||
}
|
||||
@@ -3070,7 +3086,7 @@ module ts {
|
||||
var importDeclaration = <ImportDeclaration>declaration;
|
||||
if (isExternalModuleImportDeclaration(importDeclaration)) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(keywordPart(SyntaxKind.RequireKeyword));
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
@@ -3081,7 +3097,7 @@ module ts {
|
||||
var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.moduleReference);
|
||||
if (internalAliasSymbol) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
|
||||
}
|
||||
@@ -3515,7 +3531,7 @@ module ts {
|
||||
var func = <FunctionLikeDeclaration>getContainingFunction(returnStatement);
|
||||
|
||||
// If we didn't find a containing function with a block body, bail out.
|
||||
if (!(func && hasKind(func.body, SyntaxKind.FunctionBlock))) {
|
||||
if (!(func && hasKind(func.body, SyntaxKind.Block))) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -3547,7 +3563,7 @@ module ts {
|
||||
|
||||
// If the "owner" is a function, then we equate 'return' and 'throw' statements in their
|
||||
// ability to "jump out" of the function, and include occurrences for both.
|
||||
if (owner.kind === SyntaxKind.FunctionBlock) {
|
||||
if (isFunctionBlock(owner)) {
|
||||
forEachReturnStatement(<Block>owner, returnStatement => {
|
||||
pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword);
|
||||
});
|
||||
@@ -3603,7 +3619,7 @@ module ts {
|
||||
while (child.parent) {
|
||||
var parent = child.parent;
|
||||
|
||||
if (parent.kind === SyntaxKind.FunctionBlock || parent.kind === SyntaxKind.SourceFile) {
|
||||
if (isFunctionBlock(parent) || parent.kind === SyntaxKind.SourceFile) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@@ -4300,8 +4316,12 @@ module ts {
|
||||
var staticFlag = NodeFlags.Static;
|
||||
|
||||
switch (searchSpaceNode.kind) {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
if (isObjectLiteralMethod(searchSpaceNode)) {
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -4354,6 +4374,11 @@ module ts {
|
||||
result.push(getReferenceEntryFromNode(node));
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
|
||||
result.push(getReferenceEntryFromNode(node));
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
// Make sure the container belongs to the same class
|
||||
// and has the appropriate static modifier from the original container.
|
||||
@@ -4482,7 +4507,7 @@ module ts {
|
||||
|
||||
function getPropertySymbolsFromContextualType(node: Node): Symbol[] {
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var objectLiteral = <ObjectLiteralExpression>node.parent.parent;
|
||||
var contextualType = typeInfoResolver.getContextualType(objectLiteral);
|
||||
var name = (<Identifier>node).text;
|
||||
if (contextualType) {
|
||||
|
||||
@@ -396,7 +396,7 @@ module ts.SignatureHelp {
|
||||
|
||||
function getContainingArgumentInfo(node: Node): ArgumentListInfo {
|
||||
for (var n = node; n.kind !== SyntaxKind.SourceFile; n = n.parent) {
|
||||
if (n.kind === SyntaxKind.FunctionBlock) {
|
||||
if (isFunctionBlock(n)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,6 @@ module ts.formatting {
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
@@ -357,7 +356,6 @@ module ts.formatting {
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
return child !== SyntaxKind.Block;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Method:
|
||||
@@ -365,7 +363,7 @@ module ts.formatting {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return child !== SyntaxKind.FunctionBlock;
|
||||
return child !== SyntaxKind.Block;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -404,7 +402,6 @@ module ts.formatting {
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
|
||||
@@ -3444,7 +3444,7 @@ module TypeScript.Parser {
|
||||
parseArrowFunctionBody(/*asyncContext:*/ !!asyncKeyword));
|
||||
}
|
||||
|
||||
function isFunctionBlock(): boolean {
|
||||
function isStartOfFunctionBlock(): boolean {
|
||||
var currentTokenKind = currentToken().kind;
|
||||
return currentTokenKind === SyntaxKind.OpenBraceToken || currentTokenKind === SyntaxKind.EqualsGreaterThanToken;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ====
|
||||
var v = { *[foo()]() { } }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
~~~~~~~
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -132,18 +132,16 @@ x = i;
|
||||
>i : () => string
|
||||
|
||||
x = { f() { return 1; } }
|
||||
>x = { f() { return 1; } } : { f: () => number; }
|
||||
>x = { f() { return 1; } } : { f(): number; }
|
||||
>x : any
|
||||
>{ f() { return 1; } } : { f: () => number; }
|
||||
>{ f() { return 1; } } : { f(): number; }
|
||||
>f : () => number
|
||||
>f() { return 1; } : () => number
|
||||
|
||||
x = { f<T>(x: T) { return x; } }
|
||||
>x = { f<T>(x: T) { return x; } } : { f: <T>(x: T) => T; }
|
||||
>x = { f<T>(x: T) { return x; } } : { f<T>(x: T): T; }
|
||||
>x : any
|
||||
>{ f<T>(x: T) { return x; } } : { f: <T>(x: T) => T; }
|
||||
>{ f<T>(x: T) { return x; } } : { f<T>(x: T): T; }
|
||||
>f : <T>(x: T) => T
|
||||
>f<T>(x: T) { return x; } : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
@@ -133,12 +133,11 @@ a.foo(1);
|
||||
>foo : (x?: number) => any
|
||||
|
||||
var b = {
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>{ foo(x?: number) { }, a: function foo(x: number, y?: number) { }, b: (x?: number) => { }} : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>{ foo(x?: number) { }, a: function foo(x: number, y?: number) { }, b: (x?: number) => { }} : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
|
||||
foo(x?: number) { },
|
||||
>foo : (x?: number) => void
|
||||
>foo(x?: number) { } : (x?: number) => void
|
||||
>x : number
|
||||
|
||||
a: function foo(x: number, y?: number) { },
|
||||
@@ -157,36 +156,36 @@ var b = {
|
||||
b.foo();
|
||||
>b.foo() : void
|
||||
>b.foo : (x?: number) => void
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>foo : (x?: number) => void
|
||||
|
||||
b.foo(1);
|
||||
>b.foo(1) : void
|
||||
>b.foo : (x?: number) => void
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>foo : (x?: number) => void
|
||||
|
||||
b.a(1);
|
||||
>b.a(1) : void
|
||||
>b.a : (x: number, y?: number) => void
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>a : (x: number, y?: number) => void
|
||||
|
||||
b.a(1, 2);
|
||||
>b.a(1, 2) : void
|
||||
>b.a : (x: number, y?: number) => void
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>a : (x: number, y?: number) => void
|
||||
|
||||
b.b();
|
||||
>b.b() : void
|
||||
>b.b : (x?: number) => void
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : (x?: number) => void
|
||||
|
||||
b.b(1);
|
||||
>b.b(1) : void
|
||||
>b.b : (x?: number) => void
|
||||
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
|
||||
>b : (x?: number) => void
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/commentsOnObjectLiteral3.ts ===
|
||||
|
||||
var v = {
|
||||
>v : { prop: number; func: () => void; func1: () => void; a: any; }
|
||||
>{ //property prop: 1 /* multiple trailing comments */ /*trailing comments*/, //property func: function () { }, //PropertyName + CallSignature func1() { }, //getter get a() { return this.prop; } /*trailing 1*/, //setter set a(value) { this.prop = value; } // trailing 2} : { prop: number; func: () => void; func1: () => void; a: any; }
|
||||
>v : { prop: number; func: () => void; func1(): void; a: any; }
|
||||
>{ //property prop: 1 /* multiple trailing comments */ /*trailing comments*/, //property func: function () { }, //PropertyName + CallSignature func1() { }, //getter get a() { return this.prop; } /*trailing 1*/, //setter set a(value) { this.prop = value; } // trailing 2} : { prop: number; func: () => void; func1(): void; a: any; }
|
||||
|
||||
//property
|
||||
prop: 1 /* multiple trailing comments */ /*trailing comments*/,
|
||||
@@ -17,7 +17,6 @@ var v = {
|
||||
//PropertyName + CallSignature
|
||||
func1() { },
|
||||
>func1 : () => void
|
||||
>func1() { } : () => void
|
||||
|
||||
//getter
|
||||
get a() {
|
||||
|
||||
@@ -265,7 +265,7 @@ var C = (function () {
|
||||
})();
|
||||
// object literals
|
||||
var o = {
|
||||
f: function () {
|
||||
f() {
|
||||
const c = 0;
|
||||
n = c;
|
||||
},
|
||||
|
||||
@@ -220,7 +220,7 @@ var C = (function () {
|
||||
})();
|
||||
// object literals
|
||||
var o = {
|
||||
f: function () {
|
||||
f() {
|
||||
const c28 = 0;
|
||||
},
|
||||
f2: function () {
|
||||
|
||||
@@ -68,11 +68,10 @@ x = M;
|
||||
>M : typeof M
|
||||
|
||||
x = { f() { } }
|
||||
>x = { f() { } } : { f: () => void; }
|
||||
>x = { f() { } } : { f(): void; }
|
||||
>x : any
|
||||
>{ f() { } } : { f: () => void; }
|
||||
>{ f() { } } : { f(): void; }
|
||||
>f : () => void
|
||||
>f() { } : () => void
|
||||
|
||||
function f<T>(a: T) {
|
||||
>f : <T>(a: T) => void
|
||||
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(21,5): e
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(26,1): error TS2322: Type 'typeof E' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(27,1): error TS2322: Type 'E' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts (13 errors) ====
|
||||
@@ -72,4 +72,4 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): e
|
||||
|
||||
x = { f() { } }
|
||||
~
|
||||
!!! error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
|
||||
!!! error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(7,1): error T
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(8,1): error TS2322: Type 'E' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(12,1): error TS2322: Type 'C' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(16,1): error TS2322: Type 'I' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(18,1): error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(18,1): error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(21,1): error TS2322: Type 'typeof M' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(24,5): error TS2322: Type 'T' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(26,1): error TS2322: Type '<T>(a: T) => void' is not assignable to type 'void'.
|
||||
@@ -45,7 +45,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(26,1): error
|
||||
|
||||
x = { f() {} }
|
||||
~
|
||||
!!! error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
|
||||
!!! error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
|
||||
|
||||
module M { export var x = 1; }
|
||||
x = M;
|
||||
|
||||
@@ -282,7 +282,7 @@ var C = (function () {
|
||||
})();
|
||||
// object literals
|
||||
var o = {
|
||||
f: function () {
|
||||
f() {
|
||||
let l = 0;
|
||||
n = l;
|
||||
},
|
||||
|
||||
@@ -240,7 +240,7 @@ var C = (function () {
|
||||
})();
|
||||
// object literals
|
||||
var o = {
|
||||
f: function () {
|
||||
f() {
|
||||
let l28 = 0;
|
||||
},
|
||||
f2: function () {
|
||||
|
||||
@@ -3,10 +3,9 @@ var x = 1
|
||||
>x : number
|
||||
|
||||
var y = { x() { x++; } };
|
||||
>y : { x: () => void; }
|
||||
>{ x() { x++; } } : { x: () => void; }
|
||||
>y : { x(): void; }
|
||||
>{ x() { x++; } } : { x(): void; }
|
||||
>x : () => void
|
||||
>x() { x++; } : () => void
|
||||
>x++ : number
|
||||
>x : number
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -108,7 +108,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
// error
|
||||
var b: { [x: number]: string; } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -23,7 +23,7 @@ var x2 = {
|
||||
|
||||
var x3 = {
|
||||
>x3 : any
|
||||
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d: () => void; x3: any; parent: any; }
|
||||
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d(): void; x3: any; parent: any; }
|
||||
|
||||
a: 0,
|
||||
>a : number
|
||||
@@ -36,7 +36,6 @@ var x3 = {
|
||||
|
||||
d() { },
|
||||
>d : () => void
|
||||
>d() { } : () => void
|
||||
|
||||
x3,
|
||||
>x3 : any
|
||||
|
||||
@@ -32,7 +32,7 @@ var x3 = {
|
||||
a: 0,
|
||||
b,
|
||||
c,
|
||||
d: function () {
|
||||
d() {
|
||||
},
|
||||
x3,
|
||||
parent: x3
|
||||
|
||||
@@ -23,7 +23,7 @@ var x2 = {
|
||||
|
||||
var x3 = {
|
||||
>x3 : any
|
||||
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d: () => void; x3: any; parent: any; }
|
||||
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d(): void; x3: any; parent: any; }
|
||||
|
||||
a: 0,
|
||||
>a : number
|
||||
@@ -36,7 +36,6 @@ var x3 = {
|
||||
|
||||
d() { },
|
||||
>d : () => void
|
||||
>d() { } : () => void
|
||||
|
||||
x3,
|
||||
>x3 : any
|
||||
|
||||
@@ -53,10 +53,9 @@ var a: { foo(x: string): string }
|
||||
>x : string
|
||||
|
||||
var b = { foo(x: string) { return ''; } };
|
||||
>b : { foo: (x: string) => string; }
|
||||
>{ foo(x: string) { return ''; } } : { foo: (x: string) => string; }
|
||||
>b : { foo(x: string): string; }
|
||||
>{ foo(x: string) { return ''; } } : { foo(x: string): string; }
|
||||
>foo : (x: string) => string
|
||||
>foo(x: string) { return ''; } : (x: string) => string
|
||||
>x : string
|
||||
|
||||
function foo1(x: A);
|
||||
@@ -130,17 +129,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -242,17 +241,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B);
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : B
|
||||
>B : B
|
||||
|
||||
function foo11(x: typeof b); // error
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I);
|
||||
@@ -298,17 +297,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I);
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function foo14(x: typeof b); // error
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2<string>);
|
||||
|
||||
@@ -54,10 +54,9 @@ var a: { foo(x: Date): string }
|
||||
>Date : Date
|
||||
|
||||
var b = { foo(x: RegExp) { return ''; } };
|
||||
>b : { foo: (x: RegExp) => string; }
|
||||
>{ foo(x: RegExp) { return ''; } } : { foo: (x: RegExp) => string; }
|
||||
>b : { foo(x: RegExp): string; }
|
||||
>{ foo(x: RegExp) { return ''; } } : { foo(x: RegExp): string; }
|
||||
>foo : (x: RegExp) => string
|
||||
>foo(x: RegExp) { return ''; } : (x: RegExp) => string
|
||||
>x : RegExp
|
||||
>RegExp : RegExp
|
||||
|
||||
@@ -132,17 +131,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>x : { foo: (x: RegExp) => string; }
|
||||
>b : { foo: (x: RegExp) => string; }
|
||||
>foo4 : { (x: { foo(x: RegExp): string; }): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : { foo(x: RegExp): string; }
|
||||
>b : { foo(x: RegExp): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>x : { foo: (x: RegExp) => string; }
|
||||
>b : { foo: (x: RegExp) => string; }
|
||||
>foo4 : { (x: { foo(x: RegExp): string; }): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : { foo(x: RegExp): string; }
|
||||
>b : { foo(x: RegExp): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>foo4 : { (x: { foo(x: RegExp): string; }): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -244,17 +243,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B);
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : B
|
||||
>B : B
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>x : { foo: (x: RegExp) => string; }
|
||||
>b : { foo: (x: RegExp) => string; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : { foo(x: RegExp): string; }
|
||||
>b : { foo(x: RegExp): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I);
|
||||
@@ -300,17 +299,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I);
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>x : { foo: (x: RegExp) => string; }
|
||||
>b : { foo: (x: RegExp) => string; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : { foo(x: RegExp): string; }
|
||||
>b : { foo(x: RegExp): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: RegExp): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2<string>);
|
||||
|
||||
+19
-20
@@ -57,10 +57,9 @@ var a: { foo(x: string, y: string): string }
|
||||
>y : string
|
||||
|
||||
var b = { foo(x: string) { return ''; } };
|
||||
>b : { foo: (x: string) => string; }
|
||||
>{ foo(x: string) { return ''; } } : { foo: (x: string) => string; }
|
||||
>b : { foo(x: string): string; }
|
||||
>{ foo(x: string) { return ''; } } : { foo(x: string): string; }
|
||||
>foo : (x: string) => string
|
||||
>foo(x: string) { return ''; } : (x: string) => string
|
||||
>x : string
|
||||
|
||||
function foo1(x: A);
|
||||
@@ -134,17 +133,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -246,17 +245,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B);
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : B
|
||||
>B : B
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I);
|
||||
@@ -302,17 +301,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I);
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function foo14(x: typeof b); // error
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>x : { foo: (x: string) => string; }
|
||||
>b : { foo: (x: string) => string; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : { foo(x: string): string; }
|
||||
>b : { foo(x: string): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2<string>);
|
||||
|
||||
+19
-20
@@ -100,12 +100,11 @@ var a: {
|
||||
}
|
||||
|
||||
var b = {
|
||||
>b : { foo: (x: any) => any; }
|
||||
>{ foo(x: any) { return <any>''; }} : { foo: (x: any) => any; }
|
||||
>b : { foo(x: any): any; }
|
||||
>{ foo(x: any) { return <any>''; }} : { foo(x: any): any; }
|
||||
|
||||
foo(x: any) { return <any>''; }
|
||||
>foo : (x: any) => any
|
||||
>foo(x: any) { return <any>''; } : (x: any) => any
|
||||
>x : any
|
||||
><any>'' : any
|
||||
|
||||
@@ -182,17 +181,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>x : { foo: (x: any) => any; }
|
||||
>b : { foo: (x: any) => any; }
|
||||
>foo4 : { (x: { foo(x: any): any; }): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : { foo(x: any): any; }
|
||||
>b : { foo(x: any): any; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>x : { foo: (x: any) => any; }
|
||||
>b : { foo: (x: any) => any; }
|
||||
>foo4 : { (x: { foo(x: any): any; }): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : { foo(x: any): any; }
|
||||
>b : { foo(x: any): any; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>foo4 : { (x: { foo(x: any): any; }): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -294,17 +293,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B);
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : B
|
||||
>B : B
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>x : { foo: (x: any) => any; }
|
||||
>b : { foo: (x: any) => any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : { foo(x: any): any; }
|
||||
>b : { foo(x: any): any; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I);
|
||||
@@ -350,17 +349,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I);
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>x : { foo: (x: any) => any; }
|
||||
>b : { foo: (x: any) => any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : { foo(x: any): any; }
|
||||
>b : { foo(x: any): any; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { foo(x: any): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2<string>);
|
||||
|
||||
@@ -40,10 +40,9 @@ var a: { new(x: Date): string }
|
||||
>Date : Date
|
||||
|
||||
var b = { new(x: RegExp) { return ''; } }; // not a construct signature, function called new
|
||||
>b : { new: (x: RegExp) => string; }
|
||||
>{ new(x: RegExp) { return ''; } } : { new: (x: RegExp) => string; }
|
||||
>b : { new(x: RegExp): string; }
|
||||
>{ new(x: RegExp) { return ''; } } : { new(x: RegExp): string; }
|
||||
>new : (x: RegExp) => string
|
||||
>new(x: RegExp) { return ''; } : (x: RegExp) => string
|
||||
>x : RegExp
|
||||
>RegExp : RegExp
|
||||
|
||||
@@ -104,17 +103,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>x : { new: (x: RegExp) => string; }
|
||||
>b : { new: (x: RegExp) => string; }
|
||||
>foo4 : { (x: { new(x: RegExp): string; }): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : { new(x: RegExp): string; }
|
||||
>b : { new(x: RegExp): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>x : { new: (x: RegExp) => string; }
|
||||
>b : { new: (x: RegExp) => string; }
|
||||
>foo4 : { (x: { new(x: RegExp): string; }): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : { new(x: RegExp): string; }
|
||||
>b : { new(x: RegExp): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>foo4 : { (x: { new(x: RegExp): string; }): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B);
|
||||
@@ -160,17 +159,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B);
|
||||
>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : B
|
||||
>B : B
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>x : { new: (x: RegExp) => string; }
|
||||
>b : { new: (x: RegExp) => string; }
|
||||
>foo11 : { (x: B): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : { new(x: RegExp): string; }
|
||||
>b : { new(x: RegExp): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I);
|
||||
@@ -216,17 +215,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I);
|
||||
>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>x : { new: (x: RegExp) => string; }
|
||||
>b : { new: (x: RegExp) => string; }
|
||||
>foo14 : { (x: I): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : { new(x: RegExp): string; }
|
||||
>b : { new(x: RegExp): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { new(x: RegExp): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2<string>);
|
||||
|
||||
+19
-20
@@ -43,10 +43,9 @@ var a: { new(x: string, y: string): string }
|
||||
>y : string
|
||||
|
||||
var b = { new(x: string) { return ''; } }; // not a construct signature, function called new
|
||||
>b : { new: (x: string) => string; }
|
||||
>{ new(x: string) { return ''; } } : { new: (x: string) => string; }
|
||||
>b : { new(x: string): string; }
|
||||
>{ new(x: string) { return ''; } } : { new(x: string): string; }
|
||||
>new : (x: string) => string
|
||||
>new(x: string) { return ''; } : (x: string) => string
|
||||
>x : string
|
||||
|
||||
function foo1b(x: B);
|
||||
@@ -106,17 +105,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; }
|
||||
>x : { new: (x: string) => string; }
|
||||
>b : { new: (x: string) => string; }
|
||||
>foo4 : { (x: { new(x: string): string; }): any; (x: { new(x: string): string; }): any; }
|
||||
>x : { new(x: string): string; }
|
||||
>b : { new(x: string): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; }
|
||||
>x : { new: (x: string) => string; }
|
||||
>b : { new: (x: string) => string; }
|
||||
>foo4 : { (x: { new(x: string): string; }): any; (x: { new(x: string): string; }): any; }
|
||||
>x : { new(x: string): string; }
|
||||
>b : { new(x: string): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; }
|
||||
>foo4 : { (x: { new(x: string): string; }): any; (x: { new(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B);
|
||||
@@ -162,17 +161,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B);
|
||||
>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { new(x: string): string; }): any; }
|
||||
>x : B
|
||||
>B : B
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; }
|
||||
>x : { new: (x: string) => string; }
|
||||
>b : { new: (x: string) => string; }
|
||||
>foo11 : { (x: B): any; (x: { new(x: string): string; }): any; }
|
||||
>x : { new(x: string): string; }
|
||||
>b : { new(x: string): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; }
|
||||
>foo11 : { (x: B): any; (x: { new(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I);
|
||||
@@ -218,17 +217,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I);
|
||||
>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { new(x: string): string; }): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; }
|
||||
>x : { new: (x: string) => string; }
|
||||
>b : { new: (x: string) => string; }
|
||||
>foo14 : { (x: I): any; (x: { new(x: string): string; }): any; }
|
||||
>x : { new(x: string): string; }
|
||||
>b : { new(x: string): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; }
|
||||
>foo14 : { (x: I): any; (x: { new(x: string): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2<string>);
|
||||
|
||||
@@ -65,10 +65,9 @@ var a: { foo<T>(x: T): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T>(x: T) { return x; } };
|
||||
>b : { foo: <T>(x: T) => T; }
|
||||
>{ foo<T>(x: T) { return x; } } : { foo: <T>(x: T) => T; }
|
||||
>b : { foo<T>(x: T): T; }
|
||||
>{ foo<T>(x: T) { return x; } } : { foo<T>(x: T): T; }
|
||||
>foo : <T>(x: T) => T
|
||||
>foo<T>(x: T) { return x; } : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
@@ -145,17 +144,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T>(x: T) => T; }): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T) => T; }
|
||||
>b : { foo: <T>(x: T) => T; }
|
||||
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : { foo<T>(x: T): T; }
|
||||
>b : { foo<T>(x: T): T; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T>(x: T) => T; }): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T) => T; }
|
||||
>b : { foo: <T>(x: T) => T; }
|
||||
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : { foo<T>(x: T): T; }
|
||||
>b : { foo<T>(x: T): T; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T>(x: T) => T; }): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -257,17 +256,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<T>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T) => T; }
|
||||
>b : { foo: <T>(x: T) => T; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : { foo<T>(x: T): T; }
|
||||
>b : { foo<T>(x: T): T; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -313,17 +312,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<T>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T) => T; }
|
||||
>b : { foo: <T>(x: T) => T; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : { foo<T>(x: T): T; }
|
||||
>b : { foo<T>(x: T): T; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
@@ -83,10 +83,9 @@ var a: { foo<T, U>(x: T, y: U): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T, U>(x: T, y: U) { return x; } };
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo<T, U>(x: T, y: U): T; }
|
||||
>foo : <T, U>(x: T, y: U) => T
|
||||
>foo<T, U>(x: T, y: U) { return x; } : <T, U>(x: T, y: U) => T
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
@@ -166,17 +165,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -278,17 +277,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, number>);
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : B<string, number>
|
||||
>B : B<T, U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string, number>);
|
||||
@@ -334,17 +333,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, number>);
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : I<string, number>
|
||||
>I : I<T, U>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -67,10 +67,9 @@ var a: { foo<T extends Array<string>>(x: T): string }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T extends RegExp>(x: T) { return ''; } };
|
||||
>b : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>{ foo<T extends RegExp>(x: T) { return ''; } } : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>b : { foo<T extends RegExp>(x: T): string; }
|
||||
>{ foo<T extends RegExp>(x: T) { return ''; } } : { foo<T extends RegExp>(x: T): string; }
|
||||
>foo : <T extends RegExp>(x: T) => string
|
||||
>foo<T extends RegExp>(x: T) { return ''; } : <T extends RegExp>(x: T) => string
|
||||
>T : T
|
||||
>RegExp : RegExp
|
||||
>x : T
|
||||
@@ -153,17 +152,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T extends RegExp>(x: T) => string; }): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>b : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>foo4 : { (x: { foo<T extends RegExp>(x: T): string; }): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { foo<T extends RegExp>(x: T): string; }
|
||||
>b : { foo<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T extends RegExp>(x: T) => string; }): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>b : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>foo4 : { (x: { foo<T extends RegExp>(x: T): string; }): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { foo<T extends RegExp>(x: T): string; }
|
||||
>b : { foo<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T extends RegExp>(x: T) => string; }): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo4 : { (x: { foo<T extends RegExp>(x: T): string; }): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -273,18 +272,18 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<Array<number>>);
|
||||
>foo11 : { (x: B<number[]>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : B<number[]>
|
||||
>B : B<T>
|
||||
>Array : T[]
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<number[]>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>b : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { foo<T extends RegExp>(x: T): string; }
|
||||
>b : { foo<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<Number>);
|
||||
@@ -334,18 +333,18 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<Number>);
|
||||
>foo14 : { (x: I<Number>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo14 : { (x: I<Number>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : I<Number>
|
||||
>I : I<T>
|
||||
>Number : Number
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<Number>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>b : { foo: <T extends RegExp>(x: T) => string; }
|
||||
>foo14 : { (x: I<Number>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { foo<T extends RegExp>(x: T): string; }
|
||||
>b : { foo<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<Number>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo14 : { (x: I<Number>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -64,10 +64,9 @@ var a: { foo<T>(x: T): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T>(x: T) { return null; } };
|
||||
>b : { foo: <T>(x: T) => any; }
|
||||
>{ foo<T>(x: T) { return null; } } : { foo: <T>(x: T) => any; }
|
||||
>b : { foo<T>(x: T): any; }
|
||||
>{ foo<T>(x: T) { return null; } } : { foo<T>(x: T): any; }
|
||||
>foo : <T>(x: T) => any
|
||||
>foo<T>(x: T) { return null; } : <T>(x: T) => any
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
@@ -143,17 +142,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T>(x: T) => any; }): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>x : { foo: <T>(x: T) => any; }
|
||||
>b : { foo: <T>(x: T) => any; }
|
||||
>foo4 : { (x: { foo<T>(x: T): any; }): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : { foo<T>(x: T): any; }
|
||||
>b : { foo<T>(x: T): any; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T>(x: T) => any; }): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>x : { foo: <T>(x: T) => any; }
|
||||
>b : { foo: <T>(x: T) => any; }
|
||||
>foo4 : { (x: { foo<T>(x: T): any; }): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : { foo<T>(x: T): any; }
|
||||
>b : { foo<T>(x: T): any; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T>(x: T) => any; }): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>foo4 : { (x: { foo<T>(x: T): any; }): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -255,17 +254,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<T>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>x : { foo: <T>(x: T) => any; }
|
||||
>b : { foo: <T>(x: T) => any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : { foo<T>(x: T): any; }
|
||||
>b : { foo<T>(x: T): any; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -311,17 +310,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<T>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>x : { foo: <T>(x: T) => any; }
|
||||
>b : { foo: <T>(x: T) => any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : { foo<T>(x: T): any; }
|
||||
>b : { foo<T>(x: T): any; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -70,10 +70,9 @@ var a: { foo<T extends Date>(x: T): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T extends Date>(x: T) { return null; } };
|
||||
>b : { foo: <T extends Date>(x: T) => any; }
|
||||
>{ foo<T extends Date>(x: T) { return null; } } : { foo: <T extends Date>(x: T) => any; }
|
||||
>b : { foo<T extends Date>(x: T): any; }
|
||||
>{ foo<T extends Date>(x: T) { return null; } } : { foo<T extends Date>(x: T): any; }
|
||||
>foo : <T extends Date>(x: T) => any
|
||||
>foo<T extends Date>(x: T) { return null; } : <T extends Date>(x: T) => any
|
||||
>T : T
|
||||
>Date : Date
|
||||
>x : T
|
||||
@@ -156,17 +155,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T extends Date>(x: T) => any; }): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { foo: <T extends Date>(x: T) => any; }
|
||||
>b : { foo: <T extends Date>(x: T) => any; }
|
||||
>foo4 : { (x: { foo<T extends Date>(x: T): any; }): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : { foo<T extends Date>(x: T): any; }
|
||||
>b : { foo<T extends Date>(x: T): any; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T extends Date>(x: T) => any; }): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { foo: <T extends Date>(x: T) => any; }
|
||||
>b : { foo: <T extends Date>(x: T) => any; }
|
||||
>foo4 : { (x: { foo<T extends Date>(x: T): any; }): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : { foo<T extends Date>(x: T): any; }
|
||||
>b : { foo<T extends Date>(x: T): any; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T extends Date>(x: T) => any; }): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo4 : { (x: { foo<T extends Date>(x: T): any; }): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -276,18 +275,18 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<Date>);
|
||||
>foo11 : { (x: B<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo11 : { (x: B<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : B<Date>
|
||||
>B : B<T>
|
||||
>Date : Date
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { foo: <T extends Date>(x: T) => any; }
|
||||
>b : { foo: <T extends Date>(x: T) => any; }
|
||||
>foo11 : { (x: B<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : { foo<T extends Date>(x: T): any; }
|
||||
>b : { foo<T extends Date>(x: T): any; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo11 : { (x: B<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<Date>);
|
||||
@@ -337,18 +336,18 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<Date>);
|
||||
>foo14 : { (x: I<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo14 : { (x: I<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : I<Date>
|
||||
>I : I<T>
|
||||
>Date : Date
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { foo: <T extends Date>(x: T) => any; }
|
||||
>b : { foo: <T extends Date>(x: T) => any; }
|
||||
>foo14 : { (x: I<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : { foo<T extends Date>(x: T): any; }
|
||||
>b : { foo<T extends Date>(x: T): any; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo14 : { (x: I<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -78,10 +78,9 @@ var a: { foo<Z, A, B, C, D>(x: Z): Z }
|
||||
>Z : Z
|
||||
|
||||
var b = { foo<A, B, C, D, E, F>(x: A) { return x; } };
|
||||
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>{ foo<A, B, C, D, E, F>(x: A) { return x; } } : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
>{ foo<A, B, C, D, E, F>(x: A) { return x; } } : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
>foo : <A, B, C, D, E, F>(x: A) => A
|
||||
>foo<A, B, C, D, E, F>(x: A) { return x; } : <A, B, C, D, E, F>(x: A) => A
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
@@ -163,17 +162,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -278,17 +277,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, boolean>);
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : B<string, boolean>
|
||||
>B : B<U, V>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<B<string, number>, number, Date, string>);
|
||||
@@ -341,19 +340,19 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, Date, RegExp, boolean>);
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : I<string, Date, RegExp, boolean>
|
||||
>I : I<X, Y, Z, A>
|
||||
>Date : Date
|
||||
>RegExp : RegExp
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { foo<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -65,10 +65,9 @@ var a: { foo<Z>(x: Z): Z }
|
||||
>Z : Z
|
||||
|
||||
var b = { foo<A>(x: A) { return x; } };
|
||||
>b : { foo: <A>(x: A) => A; }
|
||||
>{ foo<A>(x: A) { return x; } } : { foo: <A>(x: A) => A; }
|
||||
>b : { foo<A>(x: A): A; }
|
||||
>{ foo<A>(x: A) { return x; } } : { foo<A>(x: A): A; }
|
||||
>foo : <A>(x: A) => A
|
||||
>foo<A>(x: A) { return x; } : <A>(x: A) => A
|
||||
>A : A
|
||||
>x : A
|
||||
>A : A
|
||||
@@ -145,17 +144,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <A>(x: A) => A; }): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>x : { foo: <A>(x: A) => A; }
|
||||
>b : { foo: <A>(x: A) => A; }
|
||||
>foo4 : { (x: { foo<A>(x: A): A; }): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : { foo<A>(x: A): A; }
|
||||
>b : { foo<A>(x: A): A; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <A>(x: A) => A; }): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>x : { foo: <A>(x: A) => A; }
|
||||
>b : { foo: <A>(x: A) => A; }
|
||||
>foo4 : { (x: { foo<A>(x: A): A; }): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : { foo<A>(x: A): A; }
|
||||
>b : { foo<A>(x: A): A; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <A>(x: A) => A; }): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>foo4 : { (x: { foo<A>(x: A): A; }): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -257,17 +256,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>x : { foo: <A>(x: A) => A; }
|
||||
>b : { foo: <A>(x: A) => A; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : { foo<A>(x: A): A; }
|
||||
>b : { foo<A>(x: A): A; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -313,17 +312,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<X>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>x : { foo: <A>(x: A) => A; }
|
||||
>b : { foo: <A>(x: A) => A; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : { foo<A>(x: A): A; }
|
||||
>b : { foo<A>(x: A): A; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<A>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -79,10 +79,9 @@ var a: { foo<T>(x: T, y?: T): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T>(x: T, y?: T) { return x; } };
|
||||
>b : { foo: <T>(x: T, y?: T) => T; }
|
||||
>{ foo<T>(x: T, y?: T) { return x; } } : { foo: <T>(x: T, y?: T) => T; }
|
||||
>b : { foo<T>(x: T, y?: T): T; }
|
||||
>{ foo<T>(x: T, y?: T) { return x; } } : { foo<T>(x: T, y?: T): T; }
|
||||
>foo : <T>(x: T, y?: T) => T
|
||||
>foo<T>(x: T, y?: T) { return x; } : <T>(x: T, y?: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
@@ -161,17 +160,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T>(x: T, y?: T) => T; }): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T, y?: T) => T; }
|
||||
>b : { foo: <T>(x: T, y?: T) => T; }
|
||||
>foo4 : { (x: { foo<T>(x: T, y?: T): T; }): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : { foo<T>(x: T, y?: T): T; }
|
||||
>b : { foo<T>(x: T, y?: T): T; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T>(x: T, y?: T) => T; }): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T, y?: T) => T; }
|
||||
>b : { foo: <T>(x: T, y?: T) => T; }
|
||||
>foo4 : { (x: { foo<T>(x: T, y?: T): T; }): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : { foo<T>(x: T, y?: T): T; }
|
||||
>b : { foo<T>(x: T, y?: T): T; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T>(x: T, y?: T) => T; }): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>foo4 : { (x: { foo<T>(x: T, y?: T): T; }): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -273,17 +272,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<T>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T, y?: T) => T; }
|
||||
>b : { foo: <T>(x: T, y?: T) => T; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : { foo<T>(x: T, y?: T): T; }
|
||||
>b : { foo<T>(x: T, y?: T): T; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -329,17 +328,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<T>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>x : { foo: <T>(x: T, y?: T) => T; }
|
||||
>b : { foo: <T>(x: T, y?: T) => T; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : { foo<T>(x: T, y?: T): T; }
|
||||
>b : { foo<T>(x: T, y?: T): T; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -85,10 +85,9 @@ var a: { foo<T, U>(x: T, y?: U): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T, U>(x: T, y?: U) { return x; } };
|
||||
>b : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>{ foo<T, U>(x: T, y?: U) { return x; } } : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>b : { foo<T, U>(x: T, y?: U): T; }
|
||||
>{ foo<T, U>(x: T, y?: U) { return x; } } : { foo<T, U>(x: T, y?: U): T; }
|
||||
>foo : <T, U>(x: T, y?: U) => T
|
||||
>foo<T, U>(x: T, y?: U) { return x; } : <T, U>(x: T, y?: U) => T
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
@@ -168,17 +167,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y?: U) => T; }): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y?: U): T; }): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y?: U): T; }
|
||||
>b : { foo<T, U>(x: T, y?: U): T; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y?: U) => T; }): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y?: U): T; }): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y?: U): T; }
|
||||
>b : { foo<T, U>(x: T, y?: U): T; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y?: U) => T; }): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y?: U): T; }): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -280,17 +279,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, number>);
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : B<string, number>
|
||||
>B : B<T, U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y?: U): T; }
|
||||
>b : { foo<T, U>(x: T, y?: U): T; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string, number>);
|
||||
@@ -336,17 +335,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, number>);
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : I<string, number>
|
||||
>I : I<T, U>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y?: U) => T; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y?: U): T; }
|
||||
>b : { foo<T, U>(x: T, y?: U): T; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -85,10 +85,9 @@ var a: { foo<T, U>(x: T, y?: U): T }
|
||||
>T : T
|
||||
|
||||
var b = { foo<T, U>(x: T, y: U) { return x; } };
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo<T, U>(x: T, y: U): T; }
|
||||
>foo : <T, U>(x: T, y: U) => T
|
||||
>foo<T, U>(x: T, y: U) { return x; } : <T, U>(x: T, y: U) => T
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
@@ -168,17 +167,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: A);
|
||||
@@ -280,17 +279,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, number>);
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : B<string, number>
|
||||
>B : B<T, U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string, number>);
|
||||
@@ -336,17 +335,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, number>);
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : I<string, number>
|
||||
>I : I<T, U>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>x : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>b : { foo: <T, U>(x: T, y: U) => T; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : { foo<T, U>(x: T, y: U): T; }
|
||||
>b : { foo<T, U>(x: T, y: U): T; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -51,10 +51,9 @@ var a: { new<T extends Array<string>>(x: T): string }
|
||||
>T : T
|
||||
|
||||
var b = { new<T extends RegExp>(x: T) { return ''; } }; // not a construct signature, function called new
|
||||
>b : { new: <T extends RegExp>(x: T) => string; }
|
||||
>{ new<T extends RegExp>(x: T) { return ''; } } : { new: <T extends RegExp>(x: T) => string; }
|
||||
>b : { new<T extends RegExp>(x: T): string; }
|
||||
>{ new<T extends RegExp>(x: T) { return ''; } } : { new<T extends RegExp>(x: T): string; }
|
||||
>new : <T extends RegExp>(x: T) => string
|
||||
>new<T extends RegExp>(x: T) { return ''; } : <T extends RegExp>(x: T) => string
|
||||
>T : T
|
||||
>RegExp : RegExp
|
||||
>x : T
|
||||
@@ -123,17 +122,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <T extends RegExp>(x: T) => string; }): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { new: <T extends RegExp>(x: T) => string; }
|
||||
>b : { new: <T extends RegExp>(x: T) => string; }
|
||||
>foo4 : { (x: { new<T extends RegExp>(x: T): string; }): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { new<T extends RegExp>(x: T): string; }
|
||||
>b : { new<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <T extends RegExp>(x: T) => string; }): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { new: <T extends RegExp>(x: T) => string; }
|
||||
>b : { new: <T extends RegExp>(x: T) => string; }
|
||||
>foo4 : { (x: { new<T extends RegExp>(x: T): string; }): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { new<T extends RegExp>(x: T): string; }
|
||||
>b : { new<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <T extends RegExp>(x: T) => string; }): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo4 : { (x: { new<T extends RegExp>(x: T): string; }): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<Array<number>>);
|
||||
@@ -184,18 +183,18 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<Array<number>>);
|
||||
>foo11 : { (x: B<number[]>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : B<number[]>
|
||||
>B : B<T>
|
||||
>Array : T[]
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<number[]>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { new: <T extends RegExp>(x: T) => string; }
|
||||
>b : { new: <T extends RegExp>(x: T) => string; }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { new<T extends RegExp>(x: T): string; }
|
||||
>b : { new<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo11 : { (x: B<number[]>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<Number>);
|
||||
@@ -245,17 +244,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<Number>);
|
||||
>foo14 : { (x: I<Number>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo14 : { (x: I<Number>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : I<Number>
|
||||
>I : I<T>
|
||||
>Number : Number
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<Number>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>x : { new: <T extends RegExp>(x: T) => string; }
|
||||
>b : { new: <T extends RegExp>(x: T) => string; }
|
||||
>foo14 : { (x: I<Number>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : { new<T extends RegExp>(x: T): string; }
|
||||
>b : { new<T extends RegExp>(x: T): string; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<Number>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
|
||||
>foo14 : { (x: I<Number>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
|
||||
>x : any
|
||||
|
||||
|
||||
+24
-25
@@ -49,10 +49,9 @@ var a: { new<T>(x: T): T }
|
||||
>T : T
|
||||
|
||||
var b = { new<T>(x: T): T { return null; } }; // not a construct signature, function called new
|
||||
>b : { new: <T>(x: T) => T; }
|
||||
>{ new<T>(x: T): T { return null; } } : { new: <T>(x: T) => T; }
|
||||
>b : { new<T>(x: T): T; }
|
||||
>{ new<T>(x: T): T { return null; } } : { new<T>(x: T): T; }
|
||||
>new : <T>(x: T) => T
|
||||
>new<T>(x: T): T { return null; } : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
@@ -115,31 +114,31 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <T>(x: T) => T; }): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>x : { new: <T>(x: T) => T; }
|
||||
>b : { new: <T>(x: T) => T; }
|
||||
>foo4 : { (x: { new<T>(x: T): T; }): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : { new<T>(x: T): T; }
|
||||
>b : { new<T>(x: T): T; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <T>(x: T) => T; }): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>x : { new: <T>(x: T) => T; }
|
||||
>b : { new: <T>(x: T) => T; }
|
||||
>foo4 : { (x: { new<T>(x: T): T; }): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : { new<T>(x: T): T; }
|
||||
>b : { new<T>(x: T): T; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <T>(x: T) => T; }): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>foo4 : { (x: { new<T>(x: T): T; }): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo5(x: typeof a): number;
|
||||
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new: <T>(x: T) => T; }): string; }
|
||||
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new<T>(x: T): T; }): string; }
|
||||
>x : new <T>(x: T) => T
|
||||
>a : new <T>(x: T) => T
|
||||
|
||||
function foo5(x: typeof b): string; // ok
|
||||
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new: <T>(x: T) => T; }): string; }
|
||||
>x : { new: <T>(x: T) => T; }
|
||||
>b : { new: <T>(x: T) => T; }
|
||||
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new<T>(x: T): T; }): string; }
|
||||
>x : { new<T>(x: T): T; }
|
||||
>b : { new<T>(x: T): T; }
|
||||
|
||||
function foo5(x: any): any { }
|
||||
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new: <T>(x: T) => T; }): string; }
|
||||
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new<T>(x: T): T; }): string; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<string>);
|
||||
@@ -185,17 +184,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<T>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>x : { new: <T>(x: T) => T; }
|
||||
>b : { new: <T>(x: T) => T; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : { new<T>(x: T): T; }
|
||||
>b : { new<T>(x: T): T; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -241,17 +240,17 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<T>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>x : { new: <T>(x: T) => T; }
|
||||
>b : { new: <T>(x: T) => T; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : { new<T>(x: T): T; }
|
||||
>b : { new<T>(x: T): T; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T) => T; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T): T; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -54,10 +54,9 @@ var a: { new<T extends Date>(x: T): T }
|
||||
>T : T
|
||||
|
||||
var b = { new<T extends Date>(x: T) { return null; } }; // not a construct signature, function called new
|
||||
>b : { new: <T extends Date>(x: T) => any; }
|
||||
>{ new<T extends Date>(x: T) { return null; } } : { new: <T extends Date>(x: T) => any; }
|
||||
>b : { new<T extends Date>(x: T): any; }
|
||||
>{ new<T extends Date>(x: T) { return null; } } : { new<T extends Date>(x: T): any; }
|
||||
>new : <T extends Date>(x: T) => any
|
||||
>new<T extends Date>(x: T) { return null; } : <T extends Date>(x: T) => any
|
||||
>T : T
|
||||
>Date : Date
|
||||
>x : T
|
||||
@@ -126,17 +125,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <T extends Date>(x: T) => any; }): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { new: <T extends Date>(x: T) => any; }
|
||||
>b : { new: <T extends Date>(x: T) => any; }
|
||||
>foo4 : { (x: { new<T extends Date>(x: T): any; }): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : { new<T extends Date>(x: T): any; }
|
||||
>b : { new<T extends Date>(x: T): any; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <T extends Date>(x: T) => any; }): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { new: <T extends Date>(x: T) => any; }
|
||||
>b : { new: <T extends Date>(x: T) => any; }
|
||||
>foo4 : { (x: { new<T extends Date>(x: T): any; }): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : { new<T extends Date>(x: T): any; }
|
||||
>b : { new<T extends Date>(x: T): any; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <T extends Date>(x: T) => any; }): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo4 : { (x: { new<T extends Date>(x: T): any; }): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<Date>);
|
||||
@@ -187,18 +186,18 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<Date>);
|
||||
>foo11 : { (x: B<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo11 : { (x: B<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : B<Date>
|
||||
>B : B<T>
|
||||
>Date : Date
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { new: <T extends Date>(x: T) => any; }
|
||||
>b : { new: <T extends Date>(x: T) => any; }
|
||||
>foo11 : { (x: B<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : { new<T extends Date>(x: T): any; }
|
||||
>b : { new<T extends Date>(x: T): any; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo11 : { (x: B<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<Date>);
|
||||
@@ -248,18 +247,18 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<Date>);
|
||||
>foo14 : { (x: I<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo14 : { (x: I<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : I<Date>
|
||||
>I : I<T>
|
||||
>Date : Date
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>x : { new: <T extends Date>(x: T) => any; }
|
||||
>b : { new: <T extends Date>(x: T) => any; }
|
||||
>foo14 : { (x: I<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : { new<T extends Date>(x: T): any; }
|
||||
>b : { new<T extends Date>(x: T): any; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
|
||||
>foo14 : { (x: I<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo15(x: I2);
|
||||
|
||||
+19
-20
@@ -68,10 +68,9 @@ var a: { new <Z, A, B, CC, D>(x: Z): C<Z, A, B>; }
|
||||
>B : B
|
||||
|
||||
var b = { new<A, B, C, D, E, F>(x: A) { return x; } };
|
||||
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>{ new<A, B, C, D, E, F>(x: A) { return x; } } : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
>{ new<A, B, C, D, E, F>(x: A) { return x; } } : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
>new : <A, B, C, D, E, F>(x: A) => A
|
||||
>new<A, B, C, D, E, F>(x: A) { return x; } : <A, B, C, D, E, F>(x: A) => A
|
||||
>A : A
|
||||
>B : B
|
||||
>C : C
|
||||
@@ -139,17 +138,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<string, string>);
|
||||
@@ -197,17 +196,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, boolean>);
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : B<string, boolean>
|
||||
>B : B<U, V>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<B<string, number>, number, Date, string>);
|
||||
@@ -260,18 +259,18 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, Date, RegExp, boolean>);
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : I<string, Date, RegExp, boolean>
|
||||
>I : I<X, Y, Z, A>
|
||||
>Date : Date
|
||||
>RegExp : RegExp
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
>b : { new<A, B, C, D, E, F>(x: A): A; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
|
||||
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
|
||||
>x : any
|
||||
|
||||
|
||||
+19
-20
@@ -50,10 +50,9 @@ var a: { new<Z>(x: Z): B<Z> }
|
||||
>Z : Z
|
||||
|
||||
var b = { new<A>(x: A) { return new C<A>(x); } };
|
||||
>b : { new: <A>(x: A) => C<A>; }
|
||||
>{ new<A>(x: A) { return new C<A>(x); } } : { new: <A>(x: A) => C<A>; }
|
||||
>b : { new<A>(x: A): C<A>; }
|
||||
>{ new<A>(x: A) { return new C<A>(x); } } : { new<A>(x: A): C<A>; }
|
||||
>new : <A>(x: A) => C<A>
|
||||
>new<A>(x: A) { return new C<A>(x); } : <A>(x: A) => C<A>
|
||||
>A : A
|
||||
>x : A
|
||||
>A : A
|
||||
@@ -119,17 +118,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <A>(x: A) => C<A>; }): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>x : { new: <A>(x: A) => C<A>; }
|
||||
>b : { new: <A>(x: A) => C<A>; }
|
||||
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : { new<A>(x: A): C<A>; }
|
||||
>b : { new<A>(x: A): C<A>; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <A>(x: A) => C<A>; }): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>x : { new: <A>(x: A) => C<A>; }
|
||||
>b : { new: <A>(x: A) => C<A>; }
|
||||
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : { new<A>(x: A): C<A>; }
|
||||
>b : { new<A>(x: A): C<A>; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <A>(x: A) => C<A>; }): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<string>);
|
||||
@@ -175,17 +174,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>x : { new: <A>(x: A) => C<A>; }
|
||||
>b : { new: <A>(x: A) => C<A>; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : { new<A>(x: A): C<A>; }
|
||||
>b : { new<A>(x: A): C<A>; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -231,16 +230,16 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<X>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>x : { new: <A>(x: A) => C<A>; }
|
||||
>b : { new: <A>(x: A) => C<A>; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : { new<A>(x: A): C<A>; }
|
||||
>b : { new<A>(x: A): C<A>; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
||||
>x : any
|
||||
|
||||
|
||||
+19
-20
@@ -62,10 +62,9 @@ var a: { new<T>(x: T, y?: T): B<T> }
|
||||
>T : T
|
||||
|
||||
var b = { new<T>(x: T, y?: T) { return new C<T>(x, y); } }; // not a construct signature, function called new
|
||||
>b : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>{ new<T>(x: T, y?: T) { return new C<T>(x, y); } } : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>b : { new<T>(x: T, y?: T): C<T>; }
|
||||
>{ new<T>(x: T, y?: T) { return new C<T>(x, y); } } : { new<T>(x: T, y?: T): C<T>; }
|
||||
>new : <T>(x: T, y?: T) => C<T>
|
||||
>new<T>(x: T, y?: T) { return new C<T>(x, y); } : <T>(x: T, y?: T) => C<T>
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
@@ -134,17 +133,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <T>(x: T, y?: T) => C<T>; }): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>x : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>b : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>foo4 : { (x: { new<T>(x: T, y?: T): C<T>; }): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : { new<T>(x: T, y?: T): C<T>; }
|
||||
>b : { new<T>(x: T, y?: T): C<T>; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <T>(x: T, y?: T) => C<T>; }): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>x : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>b : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>foo4 : { (x: { new<T>(x: T, y?: T): C<T>; }): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : { new<T>(x: T, y?: T): C<T>; }
|
||||
>b : { new<T>(x: T, y?: T): C<T>; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <T>(x: T, y?: T) => C<T>; }): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>foo4 : { (x: { new<T>(x: T, y?: T): C<T>; }): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<string>): string;
|
||||
@@ -190,17 +189,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string>);
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : B<string>
|
||||
>B : B<T>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>x : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>b : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : { new<T>(x: T, y?: T): C<T>; }
|
||||
>b : { new<T>(x: T, y?: T): C<T>; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string>);
|
||||
@@ -246,16 +245,16 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string>);
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : I<string>
|
||||
>I : I<T>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>x : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>b : { new: <T>(x: T, y?: T) => C<T>; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : { new<T>(x: T, y?: T): C<T>; }
|
||||
>b : { new<T>(x: T, y?: T): C<T>; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
|
||||
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
|
||||
>x : any
|
||||
|
||||
|
||||
+19
-20
@@ -70,10 +70,9 @@ var a: { new<T, U>(x: T, y?: U): B<T,U> }
|
||||
>U : U
|
||||
|
||||
var b = { new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } }; // not a construct signature, function called new
|
||||
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>{ new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } } : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
>{ new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } } : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
>new : <T, U>(x: T, y?: U) => C<T, U>
|
||||
>new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } : <T, U>(x: T, y?: U) => C<T, U>
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
@@ -144,17 +143,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>foo4 : { (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>foo4 : { (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>foo4 : { (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<string, number>);
|
||||
@@ -200,17 +199,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, number>);
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : B<string, number>
|
||||
>B : B<T, U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string, number>);
|
||||
@@ -256,16 +255,16 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, number>);
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : I<string, number>
|
||||
>I : I<T, U>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
|
||||
>x : any
|
||||
|
||||
|
||||
+19
-20
@@ -70,10 +70,9 @@ var a: { new <T, U>(x: T, y?: U): B<T, U> };
|
||||
>U : U
|
||||
|
||||
var b = { new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } }; // not a construct signature, function called new
|
||||
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>{ new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } } : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
>{ new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } } : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
>new : <T, U>(x: T, y: U) => C<T, U>
|
||||
>new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } : <T, U>(x: T, y: U) => C<T, U>
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
@@ -144,17 +143,17 @@ function foo3(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo4(x: typeof b);
|
||||
>foo4 : { (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>foo4 : { (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
|
||||
function foo4(x: typeof b); // error
|
||||
>foo4 : { (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>foo4 : { (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
|
||||
function foo4(x: any) { }
|
||||
>foo4 : { (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>foo4 : { (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo8(x: B<string, number>);
|
||||
@@ -200,17 +199,17 @@ function foo10(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo11(x: B<string, number>);
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : B<string, number>
|
||||
>B : B<T, U>
|
||||
|
||||
function foo11(x: typeof b); // ok
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
|
||||
function foo11(x: any) { }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : any
|
||||
|
||||
function foo12(x: I<string, number>);
|
||||
@@ -256,16 +255,16 @@ function foo13(x: any) { }
|
||||
>x : any
|
||||
|
||||
function foo14(x: I<string, number>);
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : I<string, number>
|
||||
>I : I<T, U>
|
||||
|
||||
function foo14(x: typeof b); // ok
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
>b : { new<T, U>(x: T, y: U): C<T, U>; }
|
||||
|
||||
function foo14(x: any) { }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
|
||||
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
|
||||
>x : any
|
||||
|
||||
|
||||
@@ -58,12 +58,11 @@ var a: {
|
||||
}
|
||||
|
||||
var b = {
|
||||
>b : { foo: (x: any) => any; a: (x: any) => any; b: (x: any) => any; }
|
||||
>{ foo(x) { return x; }, a: function foo(x) { return x; }, b: (x) => x} : { foo: (x: any) => any; a: (x: any) => any; b: (x: any) => any; }
|
||||
>b : { foo(x: any): any; a: (x: any) => any; b: (x: any) => any; }
|
||||
>{ foo(x) { return x; }, a: function foo(x) { return x; }, b: (x) => x} : { foo(x: any): any; a: (x: any) => any; b: (x: any) => any; }
|
||||
|
||||
foo(x) {
|
||||
>foo : (x: any) => any
|
||||
>foo(x) { return x; } : (x: any) => any
|
||||
>x : any
|
||||
|
||||
return x;
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
var v = { [e]() { } };
|
||||
|
||||
//// [parserComputedPropertyName3.js]
|
||||
var v = { [e]: function () {
|
||||
var v = { [e]() {
|
||||
} };
|
||||
|
||||
@@ -3,5 +3,4 @@ var v = { [e]() { } };
|
||||
>v : {}
|
||||
>{ [e]() { } } : {}
|
||||
>e : unknown
|
||||
>[e]() { } : () => void
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment1.ts ===
|
||||
var v = { foo() { } };
|
||||
>v : { foo: () => void; }
|
||||
>{ foo() { } } : { foo: () => void; }
|
||||
>v : { foo(): void; }
|
||||
>{ foo() { } } : { foo(): void; }
|
||||
>foo : () => void
|
||||
>foo() { } : () => void
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment2.ts ===
|
||||
var v = { 0() { } };
|
||||
>v : { 0: () => void; }
|
||||
>{ 0() { } } : { 0: () => void; }
|
||||
>0() { } : () => void
|
||||
>v : { 0(): void; }
|
||||
>{ 0() { } } : { 0(): void; }
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment3.ts ===
|
||||
var v = { "foo"() { } };
|
||||
>v : { "foo": () => void; }
|
||||
>{ "foo"() { } } : { "foo": () => void; }
|
||||
>"foo"() { } : () => void
|
||||
>v : { "foo"(): void; }
|
||||
>{ "foo"() { } } : { "foo"(): void; }
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment4.ts ===
|
||||
var v = { 0<T>() { } };
|
||||
>v : { 0: <T>() => void; }
|
||||
>{ 0<T>() { } } : { 0: <T>() => void; }
|
||||
>0<T>() { } : <T>() => void
|
||||
>v : { 0<T>(): void; }
|
||||
>{ 0<T>() { } } : { 0<T>(): void; }
|
||||
>T : T
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [sourceMapValidationFunctionPropertyAssignment.js.map]
|
||||
{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,EAAD;AAAM,CAAC,EAAE,CAAC"}
|
||||
{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":["n"],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AAAKA,CAACA,EAAE,CAAC"}
|
||||
+3
-6
@@ -15,21 +15,18 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^
|
||||
7 > ^^
|
||||
1 >
|
||||
2 >var
|
||||
3 > x
|
||||
4 > =
|
||||
5 > {
|
||||
6 > n
|
||||
7 >
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
|
||||
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
|
||||
5 >Emitted(1, 11) Source(1, 11) + SourceIndex(0)
|
||||
6 >Emitted(1, 12) Source(1, 12) + SourceIndex(0)
|
||||
7 >Emitted(1, 14) Source(1, 11) + SourceIndex(0)
|
||||
---
|
||||
>>>} };
|
||||
1 >
|
||||
@@ -37,12 +34,12 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts
|
||||
3 > ^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >n() {
|
||||
1 >() {
|
||||
2 >}
|
||||
3 > }
|
||||
4 > ;
|
||||
1 >Emitted(2, 1) Source(1, 17) + SourceIndex(0)
|
||||
2 >Emitted(2, 2) Source(1, 18) + SourceIndex(0)
|
||||
1 >Emitted(2, 1) Source(1, 17) + SourceIndex(0) name (n)
|
||||
2 >Emitted(2, 2) Source(1, 18) + SourceIndex(0) name (n)
|
||||
3 >Emitted(2, 4) Source(1, 20) + SourceIndex(0)
|
||||
4 >Emitted(2, 5) Source(1, 21) + SourceIndex(0)
|
||||
---
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
=== tests/cases/compiler/sourceMapValidationFunctionPropertyAssignment.ts ===
|
||||
var x = { n() { } };
|
||||
>x : { n: () => void; }
|
||||
>{ n() { } } : { n: () => void; }
|
||||
>x : { n(): void; }
|
||||
>{ n() { } } : { n(): void; }
|
||||
>n : () => void
|
||||
>n() { } : () => void
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo: () => string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number | MyString | (() => void)' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -160,7 +160,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
// error
|
||||
var b: { [x: string]: string; } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo: () => string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number | MyString | (() => void)' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -29,12 +29,11 @@ class MyClass {
|
||||
|
||||
//type of 'this' in an object literal property of a function type is Any
|
||||
var obj = {
|
||||
>obj : { f: () => any; }
|
||||
>{ f() { return this.spaaace; }} : { f: () => any; }
|
||||
>obj : { f(): any; }
|
||||
>{ f() { return this.spaaace; }} : { f(): any; }
|
||||
|
||||
f() {
|
||||
>f : () => any
|
||||
>f() { return this.spaaace; } : () => any
|
||||
|
||||
return this.spaaace;
|
||||
>this.spaaace : any
|
||||
@@ -43,6 +42,6 @@ var obj = {
|
||||
}
|
||||
};
|
||||
var obj: { f: () => any; };
|
||||
>obj : { f: () => any; }
|
||||
>obj : { f(): any; }
|
||||
>f : () => any
|
||||
|
||||
|
||||
@@ -83,15 +83,14 @@ class C<T> {
|
||||
}
|
||||
|
||||
var aa = {
|
||||
>aa : { id: number; biz: () => void; }
|
||||
>{ id:12, biz() { throw this; }} : { id: number; biz: () => void; }
|
||||
>aa : { id: number; biz(): void; }
|
||||
>{ id:12, biz() { throw this; }} : { id: number; biz(): void; }
|
||||
|
||||
id:12,
|
||||
>id : number
|
||||
|
||||
biz() {
|
||||
>biz : () => void
|
||||
>biz() { throw this; } : () => void
|
||||
|
||||
throw this;
|
||||
>this : any
|
||||
|
||||
@@ -14,13 +14,12 @@ var var1: string | number;
|
||||
>var1 : string | number
|
||||
|
||||
var obj1 = {
|
||||
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
|
||||
>{ // Inside method method(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string return strOrNum; }, get prop() { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string return strOrNum; }, set prop(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string }} : { method: (param: string | number) => string | number; prop: string | number; }
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
>{ // Inside method method(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string return strOrNum; }, get prop() { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string return strOrNum; }, set prop(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string }} : { method(param: string | number): string | number; prop: string | number; }
|
||||
|
||||
// Inside method
|
||||
method(param: string | number) {
|
||||
>method : (param: string | number) => string | number
|
||||
>method(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string return strOrNum; } : (param: string | number) => string | number
|
||||
>param : string | number
|
||||
|
||||
// global vars in function declaration
|
||||
@@ -153,12 +152,12 @@ strOrNum = typeof obj1.method(strOrNum) === "string" && obj1.method(strOrNum);
|
||||
>typeof obj1.method(strOrNum) : string
|
||||
>obj1.method(strOrNum) : string | number
|
||||
>obj1.method : (param: string | number) => string | number
|
||||
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
>method : (param: string | number) => string | number
|
||||
>strOrNum : string | number
|
||||
>obj1.method(strOrNum) : string | number
|
||||
>obj1.method : (param: string | number) => string | number
|
||||
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
>method : (param: string | number) => string | number
|
||||
>strOrNum : string | number
|
||||
|
||||
@@ -170,9 +169,9 @@ strOrNum = typeof obj1.prop === "string" && obj1.prop;
|
||||
>typeof obj1.prop === "string" : boolean
|
||||
>typeof obj1.prop : string
|
||||
>obj1.prop : string | number
|
||||
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
>prop : string | number
|
||||
>obj1.prop : string | number
|
||||
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
|
||||
>obj1 : { method(param: string | number): string | number; prop: string | number; }
|
||||
>prop : string | number
|
||||
|
||||
|
||||
@@ -87,6 +87,10 @@ module FourSlashInterface {
|
||||
public ranges(): Range[] {
|
||||
return FourSlash.currentTestState.getRanges();
|
||||
}
|
||||
|
||||
public markerByName(s: string): Marker {
|
||||
return FourSlash.currentTestState.getMarkerByName(s);
|
||||
}
|
||||
}
|
||||
|
||||
export class diagnostics {
|
||||
@@ -227,7 +231,7 @@ module FourSlashInterface {
|
||||
}
|
||||
|
||||
public quickInfoIs(expectedText?: string, expectedDocumentation?: string) {
|
||||
FourSlash.currentTestState.verifyQuickInfo(this.negative, expectedText, expectedDocumentation);
|
||||
FourSlash.currentTestState.verifyQuickInfoString(this.negative, expectedText, expectedDocumentation);
|
||||
}
|
||||
|
||||
public quickInfoExists() {
|
||||
@@ -430,6 +434,11 @@ module FourSlashInterface {
|
||||
public renameLocations(findInStrings: boolean, findInComments: boolean) {
|
||||
FourSlash.currentTestState.verifyRenameLocations(findInStrings, findInComments);
|
||||
}
|
||||
|
||||
public verifyQuickInfoDisplayParts(kind: string, kindModifiers: string, textSpan: { start: number; length: number; },
|
||||
displayParts: ts.SymbolDisplayPart[], documentation: ts.SymbolDisplayPart[]) {
|
||||
FourSlash.currentTestState.verifyQuickInfoDisplayParts(kind, kindModifiers, textSpan, displayParts, documentation);
|
||||
}
|
||||
}
|
||||
|
||||
export class edit {
|
||||
@@ -650,6 +659,12 @@ module fs {
|
||||
export var diagnostics = new FourSlashInterface.diagnostics();
|
||||
export var cancellation = new FourSlashInterface.cancellation();
|
||||
}
|
||||
module ts {
|
||||
export interface SymbolDisplayPart {
|
||||
text: string;
|
||||
kind: string;
|
||||
}
|
||||
}
|
||||
function verifyOperationIsCancelled(f) {
|
||||
FourSlash.verifyOperationIsCancelled(f);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ goTo.marker('signatureC');
|
||||
verify.currentSignatureHelpIs('x(a: number): void');
|
||||
|
||||
goTo.marker('completionA');
|
||||
verify.completionListContains("x", "(property) x: (a: number) => void");
|
||||
verify.completionListContains("x", "(method) x(a: number): void");
|
||||
|
||||
goTo.marker('completionB');
|
||||
verify.completionListContains("x", "(property) x: (a: number) => void");
|
||||
@@ -40,7 +40,7 @@ goTo.marker('completionC');
|
||||
verify.completionListContains("x", "(property) x: (a: number) => void");
|
||||
|
||||
goTo.marker('quickInfoA');
|
||||
verify.quickInfoIs("(property) x: (a: number) => void", undefined);
|
||||
verify.quickInfoIs("(method) x(a: number): void", undefined);
|
||||
|
||||
goTo.marker('quickInfoB');
|
||||
verify.quickInfoIs("(property) x: (a: number) => void", undefined);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var /*1*/x = /*5*/a => 10;
|
||||
////var /*2*/y = (/*6*/a, /*7*/b) => 10;
|
||||
////var /*3*/z = (/*8*/a: number) => 10;
|
||||
////var /*4*/z2 = () => 10;
|
||||
|
||||
var marker = 0;
|
||||
function verifyInstance(instanceName: string, paramCount: number, type: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
var displayParts = [{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" }];
|
||||
|
||||
for (var i = 0; i < paramCount; i++) {
|
||||
if (i) {
|
||||
displayParts.push({ text: ",", kind: "punctuation" }, { text: " ", kind: "space" });
|
||||
}
|
||||
displayParts.push({ text: !i ? "a" : "b", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: type, kind: "keyword" });
|
||||
}
|
||||
displayParts.push({ text: ")", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "=>", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "number", kind: "keyword" });
|
||||
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: instanceName.length },
|
||||
displayParts, []);
|
||||
}
|
||||
|
||||
function verifyParameter(parameterName: string, type: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(marker.toString()).position, length: parameterName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: parameterName, kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: type, kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyInstance("x", 1, "any");
|
||||
verifyInstance("y", 2, "any");
|
||||
verifyInstance("z", 1, "number");
|
||||
verifyInstance("z2", 0, "any");
|
||||
|
||||
verifyParameter("a", "any");
|
||||
verifyParameter("a", "any");
|
||||
verifyParameter("b", "any");
|
||||
verifyParameter("a", "number");
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class /*1*/c {
|
||||
////}
|
||||
////var /*2*/cInstance = new /*3*/c();
|
||||
////var /*4*/cVal = /*5*/c;
|
||||
|
||||
goTo.marker('1');
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName("1").position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
goTo.marker('2');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("2").position, length: "cInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
goTo.marker('3');
|
||||
verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName("3").position, length: "c".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "constructor", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
goTo.marker('4');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("4").position, length: "cVal".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cVal", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
goTo.marker('5');
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName("5").position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
@@ -0,0 +1,129 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class c {
|
||||
//// public get /*1*/publicProperty() { return ""; }
|
||||
//// public set /*1s*/publicProperty(x: string) { }
|
||||
//// private get /*2*/privateProperty() { return ""; }
|
||||
//// private set /*2s*/privateProperty(x: string) { }
|
||||
//// protected get /*21*/protectedProperty() { return ""; }
|
||||
//// protected set /*21s*/protectedProperty(x: string) { }
|
||||
//// static get /*3*/staticProperty() { return ""; }
|
||||
//// static set /*3s*/staticProperty(x: string) { }
|
||||
//// private static get /*4*/privateStaticProperty() { return ""; }
|
||||
//// private static set /*4s*/privateStaticProperty(x: string) { }
|
||||
//// protected static get /*41*/protectedStaticProperty() { return ""; }
|
||||
//// protected static set /*41s*/protectedStaticProperty(x: string) { }
|
||||
//// method() {
|
||||
//// var x : string;
|
||||
//// x = this./*5*/publicProperty;
|
||||
//// x = this./*6*/privateProperty;
|
||||
//// x = this./*61*/protectedProperty;
|
||||
//// x = c./*7*/staticProperty;
|
||||
//// x = c./*8*/privateStaticProperty;
|
||||
//// x = c./*81*/protectedStaticProperty;
|
||||
//// this./*5s*/publicProperty = "";
|
||||
//// this./*6s*/privateProperty = "";
|
||||
//// this./*61s*/protectedProperty = "";
|
||||
//// c./*7s*/staticProperty = "";
|
||||
//// c./*8s*/privateStaticProperty = "";
|
||||
//// c./*81s*/protectedStaticProperty = "";
|
||||
//// }
|
||||
////}
|
||||
////var cInstance = new c();
|
||||
////var y: string;
|
||||
////y = /*9*/cInstance./*10*/publicProperty;
|
||||
////y = /*11*/c./*12*/staticProperty;
|
||||
/////*9s*/cInstance./*10s*/publicProperty = y;
|
||||
/////*11s*/c./*12s*/staticProperty = y;
|
||||
|
||||
function verifyClassProperty(markerName: string, kindModifiers: string, propertyName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("property", kindModifiers, { start: test.markerByName(markerName).position, length: propertyName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "property", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "c", kind: "className" }, { text: ".", kind: "punctuation" }, { text: propertyName, kind: "propertyName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyPublicProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "public", "publicProperty");
|
||||
}
|
||||
|
||||
function verifyPrivateProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "private", "privateProperty");
|
||||
}
|
||||
|
||||
function verifyProtectedProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "protected", "protectedProperty");
|
||||
}
|
||||
|
||||
function verifyStaticProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "static", "staticProperty");
|
||||
}
|
||||
|
||||
function verifyPrivateStaticProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "private,static", "privateStaticProperty");
|
||||
}
|
||||
|
||||
function verifyProtectedStaticProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "protected,static", "protectedStaticProperty");
|
||||
}
|
||||
|
||||
verifyPublicProperty('1');
|
||||
verifyPublicProperty('1s');
|
||||
verifyPrivateProperty('2');
|
||||
verifyPrivateProperty('2s');
|
||||
verifyProtectedProperty('21');
|
||||
verifyProtectedProperty('21s');
|
||||
verifyStaticProperty('3');
|
||||
verifyStaticProperty('3s');
|
||||
verifyPrivateStaticProperty('4');
|
||||
verifyPrivateStaticProperty('4s');
|
||||
verifyProtectedStaticProperty('41');
|
||||
verifyProtectedStaticProperty('41s');
|
||||
|
||||
verifyPublicProperty('5');
|
||||
verifyPublicProperty('5s');
|
||||
verifyPrivateProperty('6');
|
||||
verifyPrivateProperty('6s');
|
||||
verifyProtectedProperty('61');
|
||||
verifyProtectedProperty('61s');
|
||||
verifyStaticProperty('7');
|
||||
verifyStaticProperty('7s');
|
||||
verifyPrivateStaticProperty('8');
|
||||
verifyPrivateStaticProperty('8s');
|
||||
verifyProtectedStaticProperty('81');
|
||||
verifyProtectedStaticProperty('81s');
|
||||
|
||||
goTo.marker('9');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("9").position, length: "cInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyPublicProperty('10');
|
||||
|
||||
goTo.marker('11');
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName("11").position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyStaticProperty('12');
|
||||
|
||||
goTo.marker('9s');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("9s").position, length: "cInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyPublicProperty('10s');
|
||||
|
||||
goTo.marker('11s');
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName("11s").position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyStaticProperty('12s');
|
||||
@@ -0,0 +1,126 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class c {
|
||||
//// /*1*/constructor() {
|
||||
//// }
|
||||
////}
|
||||
////var /*2*/cInstance = new /*3*/c();
|
||||
////var /*4*/cVal = /*5*/c;
|
||||
////class cWithOverloads {
|
||||
//// /*6*/constructor(x: string);
|
||||
//// /*7*/constructor(x: number);
|
||||
//// /*8*/constructor(x: any) {
|
||||
//// }
|
||||
////}
|
||||
////var /*9*/cWithOverloadsInstance = new /*10*/cWithOverloads("hello");
|
||||
////var /*11*/cWithOverloadsInstance2 = new /*12*/cWithOverloads(10);
|
||||
////var /*13*/cWithOverloadsVal = /*14*/cWithOverloads;
|
||||
////class cWithMultipleOverloads {
|
||||
//// /*15*/constructor(x: string);
|
||||
//// /*16*/constructor(x: number);
|
||||
//// /*17*/constructor(x: boolean);
|
||||
//// /*18*/constructor(x: any) {
|
||||
//// }
|
||||
////}
|
||||
////var /*19*/cWithMultipleOverloadsInstance = new /*20*/cWithMultipleOverloads("hello");
|
||||
////var /*21*/cWithMultipleOverloadsInstance2 = new /*22*/cWithMultipleOverloads(10);
|
||||
////var /*23*/cWithMultipleOverloadsInstance3 = new /*24*/cWithMultipleOverloads(true);
|
||||
////var /*25*/cWithMultipleOverloadsVal = /*26*/cWithMultipleOverloads;
|
||||
|
||||
function verifyNonOverloadSignature(marker: string, textSpanLength: number) {
|
||||
goTo.marker(marker);
|
||||
verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName(marker).position, length: textSpanLength },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "constructor", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyClassInstance(markerName: string, instanceName: string, className: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: instanceName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: className, kind: "className" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyClass(markerName: string, className: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName(markerName).position, length: className.length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: className, kind: "className" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyTypeOfClass(markerName: string, typeOfVarName: string, className: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: typeOfVarName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: typeOfVarName, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" }, { text: className, kind: "className" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifySingleOverloadSignature(marker: string, textSpanLength: number, parameterType: string) {
|
||||
goTo.marker(marker);
|
||||
verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName(marker).position, length: textSpanLength },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "constructor", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cWithOverloads", kind: "className" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "x", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: parameterType, kind: "keyword" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cWithOverloads", kind: "className" },
|
||||
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "+", kind: "operator" }, { text: "1", kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: "overload", kind: "text" },
|
||||
{ text: ")", kind: "punctuation" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyMultipleOverloadSignature(marker: string, textSpanLength: number, parameterType: string) {
|
||||
goTo.marker(marker);
|
||||
verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName(marker).position, length: textSpanLength },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "constructor", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cWithMultipleOverloads", kind: "className" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "x", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: parameterType, kind: "keyword" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cWithMultipleOverloads", kind: "className" },
|
||||
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "+", kind: "operator" }, { text: "2", kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: "overloads", kind: "text" },
|
||||
{ text: ")", kind: "punctuation" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
|
||||
verifyNonOverloadSignature("1", "constructor".length);
|
||||
verifyClassInstance("2", "cInstance", "c");
|
||||
verifyNonOverloadSignature("3", "c".length);
|
||||
verifyTypeOfClass("4", "cVal", "c");
|
||||
verifyClass("5", "c");
|
||||
|
||||
verifySingleOverloadSignature("6", "constructor".length, "string");
|
||||
verifySingleOverloadSignature("7", "constructor".length, "number");
|
||||
verifySingleOverloadSignature("8", "constructor".length, "string");
|
||||
verifyClassInstance("9", "cWithOverloadsInstance", "cWithOverloads");
|
||||
verifySingleOverloadSignature("10", "cWithOverloads".length, "string");
|
||||
verifyClassInstance("11", "cWithOverloadsInstance2", "cWithOverloads");
|
||||
verifySingleOverloadSignature("12", "cWithOverloads".length, "number");
|
||||
verifyTypeOfClass("13", "cWithOverloadsVal", "cWithOverloads");
|
||||
verifyClass("14", "cWithOverloads");
|
||||
|
||||
verifyMultipleOverloadSignature("15", "constructor".length, "string");
|
||||
verifyMultipleOverloadSignature("16", "constructor".length, "number");
|
||||
verifyMultipleOverloadSignature("17", "constructor".length, "boolean");
|
||||
verifyMultipleOverloadSignature("18", "constructor".length, "string");
|
||||
verifyClassInstance("19", "cWithMultipleOverloadsInstance", "cWithMultipleOverloads");
|
||||
verifyMultipleOverloadSignature("20", "cWithMultipleOverloads".length, "string");
|
||||
verifyClassInstance("21", "cWithMultipleOverloadsInstance2", "cWithMultipleOverloads");
|
||||
verifyMultipleOverloadSignature("22", "cWithMultipleOverloads".length, "number");
|
||||
verifyClassInstance("23", "cWithMultipleOverloadsInstance3", "cWithMultipleOverloads");
|
||||
verifyMultipleOverloadSignature("24", "cWithMultipleOverloads".length, "boolean");
|
||||
verifyTypeOfClass("25", "cWithMultipleOverloadsVal", "cWithMultipleOverloads");
|
||||
verifyClass("26", "cWithMultipleOverloads");
|
||||
@@ -0,0 +1,86 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class c {
|
||||
//// public /*1*/publicMethod() { }
|
||||
//// private /*2*/privateMethod() { }
|
||||
//// protected /*21*/protectedMethod() { }
|
||||
//// static /*3*/staticMethod() { }
|
||||
//// private static /*4*/privateStaticMethod() { }
|
||||
//// protected static /*41*/protectedStaticMethod() { }
|
||||
//// method() {
|
||||
//// this./*5*/publicMethod();
|
||||
//// this./*6*/privateMethod();
|
||||
//// this./*61*/protectedMethod();
|
||||
//// c./*7*/staticMethod();
|
||||
//// c./*8*/privateStaticMethod();
|
||||
//// c./*81*/protectedStaticMethod();
|
||||
//// }
|
||||
////}
|
||||
////var cInstance = new c();
|
||||
/////*9*/cInstance./*10*/publicMethod();
|
||||
/////*11*/c./*12*/staticMethod();
|
||||
|
||||
function verifyClassMethod(markerName: string, kindModifiers: string, methodName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("method", kindModifiers, { start: test.markerByName(markerName).position, length: methodName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "c", kind: "className" }, { text: ".", kind: "punctuation" }, { text: methodName, kind: "methodName" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyPublicMethod(markerName: string) {
|
||||
verifyClassMethod(markerName, "public", "publicMethod");
|
||||
}
|
||||
|
||||
function verifyPrivateMethod(markerName: string) {
|
||||
verifyClassMethod(markerName, "private", "privateMethod");
|
||||
}
|
||||
|
||||
function verifyProtectedMethod(markerName: string) {
|
||||
verifyClassMethod(markerName, "protected", "protectedMethod");
|
||||
}
|
||||
|
||||
function verifyStaticMethod(markerName: string) {
|
||||
verifyClassMethod(markerName, "static", "staticMethod");
|
||||
}
|
||||
|
||||
function verifyPrivateStaticMethod(markerName: string) {
|
||||
verifyClassMethod(markerName, "private,static", "privateStaticMethod");
|
||||
}
|
||||
|
||||
function verifyProtectedStaticMethod(markerName: string) {
|
||||
verifyClassMethod(markerName, "protected,static", "protectedStaticMethod");
|
||||
}
|
||||
|
||||
verifyPublicMethod('1');
|
||||
verifyPrivateMethod('2');
|
||||
verifyProtectedMethod('21');
|
||||
verifyStaticMethod('3');
|
||||
verifyPrivateStaticMethod('4');
|
||||
verifyProtectedStaticMethod('41');
|
||||
|
||||
verifyPublicMethod('5');
|
||||
verifyPrivateMethod('6');
|
||||
verifyProtectedMethod('61');
|
||||
verifyStaticMethod('7');
|
||||
verifyPrivateStaticMethod('8');
|
||||
verifyProtectedStaticMethod('81');
|
||||
|
||||
goTo.marker('9');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("9").position, length: "cInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyPublicMethod('10');
|
||||
|
||||
goTo.marker('11');
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName("11").position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyStaticMethod('12');
|
||||
@@ -0,0 +1,85 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class c {
|
||||
//// public /*1*/publicProperty: string;
|
||||
//// private /*2*/privateProperty: string;
|
||||
//// protected /*21*/protectedProperty: string;
|
||||
//// static /*3*/staticProperty: string;
|
||||
//// private static /*4*/privateStaticProperty: string;
|
||||
//// protected static /*41*/protectedStaticProperty: string;
|
||||
//// method() {
|
||||
//// this./*5*/publicProperty;
|
||||
//// this./*6*/privateProperty;
|
||||
//// this./*61*/protectedProperty;
|
||||
//// c./*7*/staticProperty;
|
||||
//// c./*8*/privateStaticProperty;
|
||||
//// c./*81*/protectedStaticProperty;
|
||||
//// }
|
||||
////}
|
||||
////var cInstance = new c();
|
||||
/////*9*/cInstance./*10*/publicProperty;
|
||||
/////*11*/c./*12*/staticProperty;
|
||||
|
||||
function verifyClassProperty(markerName: string, kindModifiers: string, propertyName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("property", kindModifiers, { start: test.markerByName(markerName).position, length: propertyName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "property", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "c", kind: "className" }, { text: ".", kind: "punctuation" }, { text: propertyName, kind: "propertyName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyPublicProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "public", "publicProperty");
|
||||
}
|
||||
|
||||
function verifyPrivateProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "private", "privateProperty");
|
||||
}
|
||||
|
||||
function verifyProtectedProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "protected", "protectedProperty");
|
||||
}
|
||||
|
||||
function verifyStaticProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "static", "staticProperty");
|
||||
}
|
||||
|
||||
function verifyPrivateStaticProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "private,static", "privateStaticProperty");
|
||||
}
|
||||
|
||||
function verifyProtectedStaticProperty(markerName: string) {
|
||||
verifyClassProperty(markerName, "protected,static", "protectedStaticProperty");
|
||||
}
|
||||
|
||||
verifyPublicProperty('1');
|
||||
verifyPrivateProperty('2');
|
||||
verifyProtectedProperty('21');
|
||||
verifyStaticProperty('3');
|
||||
verifyPrivateStaticProperty('4');
|
||||
verifyProtectedStaticProperty('41');
|
||||
|
||||
verifyPublicProperty('5');
|
||||
verifyPrivateProperty('6');
|
||||
verifyProtectedProperty('61');
|
||||
verifyStaticProperty('7');
|
||||
verifyPrivateStaticProperty('8');
|
||||
verifyProtectedStaticProperty('81');
|
||||
|
||||
goTo.marker('9');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("9").position, length: "cInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyPublicProperty('10');
|
||||
|
||||
goTo.marker('11');
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName("11").position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyStaticProperty('12');
|
||||
@@ -0,0 +1,83 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////const /*1*/a = 10;
|
||||
////function foo() {
|
||||
//// const /*2*/b = /*3*/a;
|
||||
//// if (b) {
|
||||
//// const /*4*/b1 = 10;
|
||||
//// }
|
||||
////}
|
||||
////module m {
|
||||
//// const /*5*/c = 10;
|
||||
//// export const /*6*/d = 10;
|
||||
//// if (c) {
|
||||
//// const /*7*/e = 10;
|
||||
//// }
|
||||
////}
|
||||
////const /*8*/f: () => number = () => 10;
|
||||
////const /*9*/g = /*10*/f;
|
||||
/////*11*/f();
|
||||
////const /*12*/h: { (a: string): number; (a: number): string; } = a => a;
|
||||
////const /*13*/i = /*14*/h;
|
||||
/////*15*/h(10);
|
||||
/////*16*/h("hello");
|
||||
|
||||
var marker = 0;
|
||||
function verifyConst(name: string, typeDisplay: ts.SymbolDisplayPart[], optionalNameDisplay?: ts.SymbolDisplayPart[], optionalKindModifiers?: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("const", optionalKindModifiers || "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "const", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(optionalNameDisplay || [{ text: name, kind: "localName" }]).concat(
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
var numberTypeDisplay: ts.SymbolDisplayPart[] = [{ text: "number", kind: "keyword" }];
|
||||
|
||||
verifyConst("a", numberTypeDisplay);
|
||||
verifyConst("b", numberTypeDisplay);
|
||||
verifyConst("a", numberTypeDisplay);
|
||||
verifyConst("b1", numberTypeDisplay);
|
||||
verifyConst("c", numberTypeDisplay);
|
||||
verifyConst("d", numberTypeDisplay, [{ text: "m", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "d", kind: "localName" }], "export");
|
||||
verifyConst("e", numberTypeDisplay);
|
||||
|
||||
var functionTypeReturningNumber: ts.SymbolDisplayPart[] = [{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "number", kind: "keyword" }];
|
||||
verifyConst("f", functionTypeReturningNumber);
|
||||
verifyConst("g", functionTypeReturningNumber);
|
||||
verifyConst("f", functionTypeReturningNumber);
|
||||
verifyConst("f", functionTypeReturningNumber);
|
||||
|
||||
|
||||
function getFunctionType(parametertype: string, returnType: string, isArrow?: boolean): ts.SymbolDisplayPart[] {
|
||||
var functionTypeDisplay = [{ text: "(", kind: "punctuation" }, { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: parametertype, kind: "keyword" }, { text: ")", kind: "punctuation" }];
|
||||
|
||||
if (isArrow) {
|
||||
functionTypeDisplay = functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" });
|
||||
}
|
||||
else {
|
||||
functionTypeDisplay = functionTypeDisplay.concat({ text: ":", kind: "punctuation" });
|
||||
}
|
||||
|
||||
return functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: returnType, kind: "keyword" });
|
||||
}
|
||||
|
||||
var typeLiteralWithOverloadCall: ts.SymbolDisplayPart[] = [{ text: "{", kind: "punctuation" }, { text: "\n", kind: "lineBreak" },
|
||||
{ text: " ", kind: "space" }].concat(getFunctionType("string", "number")).concat(
|
||||
{ text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" },
|
||||
{ text: " ", kind: "space" }).concat(getFunctionType("number", "string")).concat(
|
||||
{ text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" }, { text: "}", kind: "punctuation" });
|
||||
|
||||
verifyConst("h", typeLiteralWithOverloadCall);
|
||||
verifyConst("i", typeLiteralWithOverloadCall);
|
||||
verifyConst("h", typeLiteralWithOverloadCall);
|
||||
|
||||
var overloadDisplay: ts.SymbolDisplayPart[] = [{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "+", kind: "operator" }, { text: "1", kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: "overload", kind: "text" }, { text: ")", kind: "punctuation" }];
|
||||
|
||||
verifyConst("h", getFunctionType("number", "string", /*isArrow*/true).concat(overloadDisplay));
|
||||
verifyConst("h", getFunctionType("string", "number", /*isArrow*/true).concat(overloadDisplay));
|
||||
@@ -0,0 +1,76 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////enum /*1*/E {
|
||||
//// /*2*/e1,
|
||||
//// /*3*/e2 = 10,
|
||||
//// /*4*/e3
|
||||
////}
|
||||
////var /*5*/eInstance: /*6*/E;
|
||||
/////*7*/eInstance = /*8*/E./*9*/e1;
|
||||
/////*10*/eInstance = /*11*/E./*12*/e2;
|
||||
/////*13*/eInstance = /*14*/E./*15*/e3;
|
||||
////const enum /*16*/constE {
|
||||
//// /*17*/e1,
|
||||
//// /*18*/e2 = 10,
|
||||
//// /*19*/e3
|
||||
////}
|
||||
////var /*20*/eInstance1: /*21*/constE;
|
||||
/////*22*/eInstance1 = /*23*/constE./*24*/e1;
|
||||
/////*25*/eInstance1 = /*26*/constE./*27*/e2;
|
||||
/////*28*/eInstance1 = /*29*/constE./*30*/e3;
|
||||
|
||||
var marker = 0;
|
||||
function verifyEnumDeclaration(enumName: string, instanceName: string, isConst?: boolean) {
|
||||
verifyEnumDisplay();
|
||||
|
||||
verifyEnumMemberDisplay("e1", 0);
|
||||
verifyEnumMemberDisplay("e2", 10);
|
||||
verifyEnumMemberDisplay("e3", 11);
|
||||
|
||||
verifyInstance();
|
||||
verifyEnumDisplay();
|
||||
|
||||
verifyInstance();
|
||||
verifyEnumDisplay();
|
||||
verifyEnumMemberDisplay("e1", 0);
|
||||
|
||||
verifyInstance();
|
||||
verifyEnumDisplay();
|
||||
verifyEnumMemberDisplay("e2", 10);
|
||||
|
||||
verifyInstance();
|
||||
verifyEnumDisplay();
|
||||
verifyEnumMemberDisplay("e3", 11);
|
||||
|
||||
function verifyEnumDisplay() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("enum", "", { start: test.markerByName(marker.toString()).position, length: enumName.length },
|
||||
(isConst ? [{ text: "const", kind: "keyword" }, { text: " ", kind: "space" }] : []).concat(
|
||||
[{ text: "enum", kind: "keyword" }, { text: " ", kind: "space" }, { text: enumName, kind: "enumName" }]),
|
||||
[]);;
|
||||
}
|
||||
|
||||
function verifyEnumMemberDisplay(enumMemberName: string, initializer: number) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: enumMemberName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "enum member", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: enumName, kind: "enumName" }, { text: ".", kind: "punctuation" }, { text: enumMemberName, kind: "enumMemberName" },
|
||||
{ text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" }, { text: initializer.toString(), kind: "numericLiteral" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyInstance() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: instanceName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: enumName, kind: "enumName" }],
|
||||
[]);
|
||||
}
|
||||
}
|
||||
|
||||
verifyEnumDeclaration("E", "eInstance");
|
||||
verifyEnumDeclaration("constE", "eInstance1", /*isConst*/ true);
|
||||
@@ -0,0 +1,44 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: quickInfoDisplayPartsExternalModuleAlias_file0.ts
|
||||
////export module m1 {
|
||||
//// export class c {
|
||||
//// }
|
||||
////}
|
||||
|
||||
// @Filename: quickInfoDisplayPartsExternalModuleAlias_file1.ts
|
||||
////import /*1*/a1 = require(/*mod1*/"quickInfoDisplayPartsExternalModuleAlias_file0");
|
||||
////new /*2*/a1.m1.c();
|
||||
////export import /*3*/a2 = require(/*mod2*/"quickInfoDisplayPartsExternalModuleAlias_file0");
|
||||
////new /*4*/a2.m1.c();
|
||||
|
||||
var marker = 0;
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
}
|
||||
|
||||
function verifyImport(name: string, isExported: boolean) {
|
||||
goToMarker();
|
||||
verify.verifyQuickInfoDisplayParts("alias", isExported ? "export" : "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "import", kind: "keyword" }, { text: " ", kind: "space" }, { text: name, kind: "aliasName" },
|
||||
{ text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" },
|
||||
{ text: "require", kind: "keyword" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "\"quickInfoDisplayPartsExternalModuleAlias_file0\"", kind: "stringLiteral" },
|
||||
{ text: ")", kind: "punctuation" }],
|
||||
[]);
|
||||
}
|
||||
verifyImport("a1", /*isExported*/false);
|
||||
verifyImport("a1", /*isExported*/false);
|
||||
verifyImport("a2", /*isExported*/true);
|
||||
verifyImport("a2", /*isExported*/true);
|
||||
|
||||
function verifyExternalModuleStringLiteral(marker: string) {
|
||||
goTo.marker(marker);
|
||||
verify.verifyQuickInfoDisplayParts("module", "", { start: test.markerByName(marker).position, length: "\"quickInfoDisplayPartsExternalModuleAlias_file0\"".length },
|
||||
[{ text: "module", kind: "keyword" }, { text: " ", kind: "space" }, { text: "a1", kind: "aliasName" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyExternalModuleStringLiteral("mod1");
|
||||
verifyExternalModuleStringLiteral("mod2");
|
||||
@@ -0,0 +1,63 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////export module /*1*/m {
|
||||
//// var /*2*/moduleElemWithoutExport = 10;
|
||||
//// export var /*3*/moduleElemWithExport = 10;
|
||||
////}
|
||||
////export var /*4*/a = /*5*/m;
|
||||
////export var /*6*/b: typeof /*7*/m;
|
||||
////export module /*8*/m1./*9*/m2 {
|
||||
//// var /*10*/moduleElemWithoutExport = 10;
|
||||
//// export var /*11*/moduleElemWithExport = 10;
|
||||
////}
|
||||
////export var /*12*/x = /*13*/m1./*14*/m2;
|
||||
////export var /*15*/y: typeof /*16*/m1./*17*/m2;
|
||||
|
||||
var marker = 0;
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
}
|
||||
|
||||
function verifyModule(name: string, optionalParentName?: string) {
|
||||
goToMarker();
|
||||
var moduleNameDisplay = [{ text: name, kind: "moduleName" }];
|
||||
if (optionalParentName) {
|
||||
moduleNameDisplay = [{ text: optionalParentName, kind: "moduleName" }, { text: ".", kind: "punctuation" }].concat(moduleNameDisplay);
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("module", "export", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "module", kind: "keyword" }, { text: " ", kind: "space" }].concat(moduleNameDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyVar(name: string, optionalFullName?: ts.SymbolDisplayPart[], typeDisplay: ts.SymbolDisplayPart[]= [{ text: "number", kind: "keyword" }]) {
|
||||
goToMarker();
|
||||
verify.verifyQuickInfoDisplayParts("var", name === "moduleElemWithoutExport" ? "" : "export", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(optionalFullName || [{ text: name, kind: "localName" }]).concat(
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyModule("m");
|
||||
verifyVar("moduleElemWithoutExport");
|
||||
verifyVar("moduleElemWithExport", [{ text: "m", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "moduleElemWithExport", kind: "localName" }]);
|
||||
|
||||
verifyVar("a", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" }, { text: "m", kind: "moduleName" }]);
|
||||
verifyModule("m");
|
||||
verifyVar("b", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" }, { text: "m", kind: "moduleName" }]);
|
||||
verifyModule("m");
|
||||
|
||||
verifyModule("m1");
|
||||
verifyModule("m2", "m1");
|
||||
verifyVar("moduleElemWithoutExport");
|
||||
verifyVar("moduleElemWithExport", [{ text: "m1", kind: "moduleName" }, { text: ".", kind: "punctuation" },
|
||||
{ text: "m2", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "moduleElemWithExport", kind: "localName" }]);
|
||||
verifyVar("x", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" },
|
||||
{ text: "m1", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "m2", kind: "moduleName" }]);
|
||||
verifyModule("m1");
|
||||
verifyModule("m2", "m1");
|
||||
verifyVar("y", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" },
|
||||
{ text: "m1", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "m2", kind: "moduleName" }]);
|
||||
verifyModule("m1");
|
||||
verifyModule("m2", "m1");
|
||||
@@ -0,0 +1,76 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function /*1*/foo(param: string, optionalParam?: string, paramWithInitializer = "hello", ...restParam: string[]) {
|
||||
////}
|
||||
////function /*2*/foowithoverload(a: string): string;
|
||||
////function /*3*/foowithoverload(a: number): number;
|
||||
////function /*4*/foowithoverload(a: any): any {
|
||||
//// return a;
|
||||
////}
|
||||
////function /*5*/foowith3overload(a: string): string;
|
||||
////function /*6*/foowith3overload(a: number): number;
|
||||
////function /*7*/foowith3overload(a: boolean): boolean;
|
||||
////function /*8*/foowith3overload(a: any): any {
|
||||
//// return a;
|
||||
////}
|
||||
/////*9*/foo("hello");
|
||||
/////*10*/foowithoverload("hello");
|
||||
/////*11*/foowithoverload(10);
|
||||
/////*12*/foowith3overload("hello");
|
||||
/////*13*/foowith3overload(10);
|
||||
/////*14*/foowith3overload(true);
|
||||
|
||||
var marker = 0;
|
||||
function verifyFunctionWithoutOverload() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("function", "", { start: test.markerByName(marker.toString()).position, length: "foo".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "foo", kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "param", kind: "parameterName" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "optionalParam", kind: "parameterName" }, { text: "?", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "paramWithInitializer", kind: "parameterName" }, { text: "?", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "...", kind: "punctuation" }, { text: "restParam", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "string", kind: "keyword" }, { text: "[", kind: "punctuation" }, { text: "]", kind: "punctuation" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyFunctionWithOverload(functionName: string, type: string, overloadCount: number) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("function", "", { start: test.markerByName(marker.toString()).position, length: functionName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: functionName, kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: type, kind: "keyword" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: type, kind: "keyword" },
|
||||
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" }, { text: "+", kind: "operator" }, { text: overloadCount.toString(), kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: overloadCount === 1 ? "overload" : "overloads", kind: "text" }, { text: ")", kind: "punctuation" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
|
||||
// Declarations
|
||||
verifyFunctionWithoutOverload();
|
||||
|
||||
verifyFunctionWithOverload("foowithoverload", "string", 1);
|
||||
verifyFunctionWithOverload("foowithoverload", "number", 1);
|
||||
verifyFunctionWithOverload("foowithoverload", "string", 1);
|
||||
|
||||
verifyFunctionWithOverload("foowith3overload", "string", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "number", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "boolean", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "string", 2);
|
||||
|
||||
// Calls
|
||||
verifyFunctionWithoutOverload();
|
||||
|
||||
verifyFunctionWithOverload("foowithoverload", "string", 1);
|
||||
verifyFunctionWithOverload("foowithoverload", "number", 1);
|
||||
|
||||
verifyFunctionWithOverload("foowith3overload", "string", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "number", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "boolean", 2);
|
||||
@@ -0,0 +1,45 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var /*1*/x = function /*2*/foo() {
|
||||
//// /*3*/foo();
|
||||
////};
|
||||
////var /*4*/y = function () {
|
||||
////};
|
||||
////(function /*5*/foo1() {
|
||||
//// /*6*/foo1();
|
||||
////})();
|
||||
|
||||
var marker = 0;
|
||||
function verifyInstance(instanceName: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: instanceName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyNamedFunctionExpression(functionName: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("local function", "", { start: test.markerByName(marker.toString()).position, length: functionName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "local function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: functionName, kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyInstance("x");
|
||||
// Declaration
|
||||
verifyNamedFunctionExpression("foo");
|
||||
// Call
|
||||
verifyNamedFunctionExpression("foo");
|
||||
|
||||
verifyInstance("y");
|
||||
|
||||
// Declaration
|
||||
verifyNamedFunctionExpression("foo1");
|
||||
// Call
|
||||
verifyNamedFunctionExpression("foo1");
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface /*1*/i {
|
||||
////}
|
||||
////var /*2*/iInstance: /*3*/i;
|
||||
|
||||
goTo.marker('1');
|
||||
verify.verifyQuickInfoDisplayParts("interface", "", { start: test.markerByName("1").position, length: "i".length },
|
||||
[{ text: "interface", kind: "keyword" }, { text: " ", kind: "space" }, { text: "i", kind: "interfaceName" }],
|
||||
[]);
|
||||
|
||||
goTo.marker('2');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("2").position, length: "iInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "iInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "i", kind: "interfaceName" }],
|
||||
[]);
|
||||
|
||||
goTo.marker('3');
|
||||
verify.verifyQuickInfoDisplayParts("interface", "", { start: test.markerByName("3").position, length: "i".length },
|
||||
[{ text: "interface", kind: "keyword" }, { text: " ", kind: "space" }, { text: "i", kind: "interfaceName" }],
|
||||
[]);
|
||||
@@ -0,0 +1,75 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// /*1*/property: string;
|
||||
//// /*2*/method(): string;
|
||||
//// (): string;
|
||||
//// new (): I;
|
||||
////}
|
||||
////var iInstance: I;
|
||||
/////*3*/iInstance./*4*/property = /*5*/iInstance./*6*/method();
|
||||
/////*7*/iInstance();
|
||||
////var /*8*/anotherInstance = new /*9*/iInstance();
|
||||
|
||||
function verifyInterfaceProperty(markerName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("property", "", { start: test.markerByName(markerName).position, length: "property".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "property", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "I", kind: "interfaceName" }, { text: ".", kind: "punctuation" }, { text: "property", kind: "propertyName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyInterfaceMethod(markerName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("method", "", { start: test.markerByName(markerName).position, length: "method".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" },
|
||||
{ text: "I", kind: "interfaceName" }, { text: ".", kind: "punctuation" }, { text: "method", kind: "methodName" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyInterfaceInstanceVar(markerName: string, instanceName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: instanceName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "I", kind: "interfaceName" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyInterfaceProperty('1');
|
||||
verifyInterfaceMethod("2");
|
||||
|
||||
verifyInterfaceInstanceVar("3", "iInstance");
|
||||
verifyInterfaceProperty("4");
|
||||
verifyInterfaceInstanceVar("5", "iInstance");
|
||||
verifyInterfaceMethod("6");
|
||||
|
||||
// Call signature
|
||||
goTo.marker("7");
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("7").position, length: "iInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "iInstance", kind: "localName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "I", kind: "interfaceName" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "string", kind: "keyword" }],
|
||||
[]);
|
||||
|
||||
verifyInterfaceInstanceVar("8", "anotherInstance");
|
||||
|
||||
// Cosntruct signature
|
||||
goTo.marker("9");
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("9").position, length: "iInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "iInstance", kind: "localName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "new", kind: "keyword" }, { text: " ", kind: "space" }, { text: "I", kind: "interfaceName" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "I", kind: "interfaceName" }],
|
||||
[]);
|
||||
@@ -0,0 +1,47 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////module m.m1 {
|
||||
//// export class c {
|
||||
//// }
|
||||
////}
|
||||
////module m2 {
|
||||
//// import /*1*/a1 = m;
|
||||
//// new /*2*/a1.m1.c();
|
||||
//// import /*3*/a2 = m.m1;
|
||||
//// new /*4*/a2.c();
|
||||
//// export import /*5*/a3 = m;
|
||||
//// new /*6*/a3.m1.c();
|
||||
//// export import /*7*/a4 = m.m1;
|
||||
//// new /*8*/a4.c();
|
||||
////}
|
||||
|
||||
var marker = 0;
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
}
|
||||
|
||||
function verifyImport(name: string, assigningDisplay:ts.SymbolDisplayPart[], optionalParentName?: string) {
|
||||
goToMarker();
|
||||
var moduleNameDisplay = [{ text: name, kind: "aliasName" }];
|
||||
if (optionalParentName) {
|
||||
moduleNameDisplay = [{ text: optionalParentName, kind: "moduleName" }, { text: ".", kind: "punctuation" }].concat(moduleNameDisplay);
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("alias", optionalParentName ? "export" : "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "import", kind: "keyword" }, { text: " ", kind: "space" }].concat(moduleNameDisplay).concat(
|
||||
{ text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" }).concat(assigningDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
var moduleMDisplay = [{ text: "m", kind: "moduleName" }];
|
||||
var moduleMDotM1Display = moduleMDisplay.concat({ text: ".", kind: "punctuation" }, { text: "m1", kind: "moduleName" });
|
||||
|
||||
verifyImport("a1", moduleMDisplay);
|
||||
verifyImport("a1", moduleMDisplay);
|
||||
verifyImport("a2", moduleMDotM1Display);
|
||||
verifyImport("a2", moduleMDotM1Display);
|
||||
|
||||
verifyImport("a3", moduleMDisplay, "m2");
|
||||
verifyImport("a3", moduleMDisplay, "m2");
|
||||
verifyImport("a4", moduleMDotM1Display, "m2");
|
||||
verifyImport("a4", moduleMDotM1Display, "m2");
|
||||
@@ -0,0 +1,83 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////let /*1*/a = 10;
|
||||
////function foo() {
|
||||
//// let /*2*/b = /*3*/a;
|
||||
//// if (b) {
|
||||
//// let /*4*/b1 = 10;
|
||||
//// }
|
||||
////}
|
||||
////module m {
|
||||
//// let /*5*/c = 10;
|
||||
//// export let /*6*/d = 10;
|
||||
//// if (c) {
|
||||
//// let /*7*/e = 10;
|
||||
//// }
|
||||
////}
|
||||
////let /*8*/f: () => number;
|
||||
////let /*9*/g = /*10*/f;
|
||||
/////*11*/f();
|
||||
////let /*12*/h: { (a: string): number; (a: number): string; };
|
||||
////let /*13*/i = /*14*/h;
|
||||
/////*15*/h(10);
|
||||
/////*16*/h("hello");
|
||||
|
||||
var marker = 0;
|
||||
function verifyVar(name: string, typeDisplay: ts.SymbolDisplayPart[], optionalNameDisplay?: ts.SymbolDisplayPart[], optionalKindModifiers?: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("let", optionalKindModifiers || "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "let", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(optionalNameDisplay || [{ text: name, kind: "localName" }]).concat(
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
var numberTypeDisplay: ts.SymbolDisplayPart[] = [{ text: "number", kind: "keyword" }];
|
||||
|
||||
verifyVar("a", numberTypeDisplay);
|
||||
verifyVar("b", numberTypeDisplay);
|
||||
verifyVar("a", numberTypeDisplay);
|
||||
verifyVar("b1", numberTypeDisplay);
|
||||
verifyVar("c", numberTypeDisplay);
|
||||
verifyVar("d", numberTypeDisplay, [{ text: "m", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "d", kind: "localName" }], "export");
|
||||
verifyVar("e", numberTypeDisplay);
|
||||
|
||||
var functionTypeReturningNumber: ts.SymbolDisplayPart[] = [{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "number", kind: "keyword" }];
|
||||
verifyVar("f", functionTypeReturningNumber);
|
||||
verifyVar("g", functionTypeReturningNumber);
|
||||
verifyVar("f", functionTypeReturningNumber);
|
||||
verifyVar("f", functionTypeReturningNumber);
|
||||
|
||||
|
||||
function getFunctionType(parametertype: string, returnType: string, isArrow?: boolean): ts.SymbolDisplayPart[] {
|
||||
var functionTypeDisplay = [{ text: "(", kind: "punctuation" }, { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: parametertype, kind: "keyword" }, { text: ")", kind: "punctuation" }];
|
||||
|
||||
if (isArrow) {
|
||||
functionTypeDisplay = functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" });
|
||||
}
|
||||
else {
|
||||
functionTypeDisplay = functionTypeDisplay.concat({ text: ":", kind: "punctuation" });
|
||||
}
|
||||
|
||||
return functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: returnType, kind: "keyword" });
|
||||
}
|
||||
|
||||
var typeLiteralWithOverloadCall: ts.SymbolDisplayPart[] = [{ text: "{", kind: "punctuation" }, { text: "\n", kind: "lineBreak" },
|
||||
{ text: " ", kind: "space" }].concat(getFunctionType("string", "number")).concat(
|
||||
{ text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" },
|
||||
{ text: " ", kind: "space" }).concat(getFunctionType("number", "string")).concat(
|
||||
{ text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" }, { text: "}", kind: "punctuation" });
|
||||
|
||||
verifyVar("h", typeLiteralWithOverloadCall);
|
||||
verifyVar("i", typeLiteralWithOverloadCall);
|
||||
verifyVar("h", typeLiteralWithOverloadCall);
|
||||
|
||||
var overloadDisplay: ts.SymbolDisplayPart[] = [{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "+", kind: "operator" }, { text: "1", kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: "overload", kind: "text" }, { text: ")", kind: "punctuation" }];
|
||||
|
||||
verifyVar("h", getFunctionType("number", "string", /*isArrow*/true).concat(overloadDisplay));
|
||||
verifyVar("h", getFunctionType("string", "number", /*isArrow*/true).concat(overloadDisplay));
|
||||
@@ -0,0 +1,92 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function /*1*/outerFoo() {
|
||||
//// function /*2*/foo(param: string, optionalParam?: string, paramWithInitializer = "hello", ...restParam: string[]) {
|
||||
//// }
|
||||
//// function /*3*/foowithoverload(a: string): string;
|
||||
//// function /*4*/foowithoverload(a: number): number;
|
||||
//// function /*5*/foowithoverload(a: any): any {
|
||||
//// return a;
|
||||
//// }
|
||||
//// function /*6*/foowith3overload(a: string): string;
|
||||
//// function /*7*/foowith3overload(a: number): number;
|
||||
//// function /*8*/foowith3overload(a: boolean): boolean;
|
||||
//// function /*9*/foowith3overload(a: any): any {
|
||||
//// return a;
|
||||
//// }
|
||||
//// /*10*/foo("hello");
|
||||
//// /*11*/foowithoverload("hello");
|
||||
//// /*12*/foowithoverload(10);
|
||||
//// /*13*/foowith3overload("hello");
|
||||
//// /*14*/foowith3overload(10);
|
||||
//// /*15*/foowith3overload(true);
|
||||
////}
|
||||
/////*16*/outerFoo();
|
||||
|
||||
var marker = 0;
|
||||
function verifyOuterFunction() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("function", "", { start: test.markerByName(marker.toString()).position, length: "outerFoo".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "outerFoo", kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyFunctionWithoutOverload() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("local function", "", { start: test.markerByName(marker.toString()).position, length: "foo".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "local function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "foo", kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "param", kind: "parameterName" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "optionalParam", kind: "parameterName" }, { text: "?", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "paramWithInitializer", kind: "parameterName" }, { text: "?", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "...", kind: "punctuation" }, { text: "restParam", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "string", kind: "keyword" }, { text: "[", kind: "punctuation" }, { text: "]", kind: "punctuation" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyFunctionWithOverload(functionName: string, type: string, overloadCount: number) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
verify.verifyQuickInfoDisplayParts("local function", "", { start: test.markerByName(marker.toString()).position, length: functionName.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "local function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: functionName, kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: type, kind: "keyword" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: type, kind: "keyword" },
|
||||
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" }, { text: "+", kind: "operator" }, { text: overloadCount.toString(), kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: overloadCount === 1 ? "overload" : "overloads", kind: "text" }, { text: ")", kind: "punctuation" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
|
||||
// Declarations
|
||||
verifyOuterFunction();
|
||||
|
||||
verifyFunctionWithoutOverload();
|
||||
|
||||
verifyFunctionWithOverload("foowithoverload", "string", 1);
|
||||
verifyFunctionWithOverload("foowithoverload", "number", 1);
|
||||
verifyFunctionWithOverload("foowithoverload", "string", 1);
|
||||
|
||||
verifyFunctionWithOverload("foowith3overload", "string", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "number", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "boolean", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "string", 2);
|
||||
|
||||
// Calls
|
||||
verifyFunctionWithoutOverload();
|
||||
|
||||
verifyFunctionWithOverload("foowithoverload", "string", 1);
|
||||
verifyFunctionWithOverload("foowithoverload", "number", 1);
|
||||
|
||||
verifyFunctionWithOverload("foowith3overload", "string", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "number", 2);
|
||||
verifyFunctionWithOverload("foowith3overload", "boolean", 2);
|
||||
verifyOuterFunction();
|
||||
@@ -0,0 +1,63 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////module /*1*/m {
|
||||
//// var /*2*/moduleElemWithoutExport = 10;
|
||||
//// export var /*3*/moduleElemWithExport = 10;
|
||||
////}
|
||||
////var /*4*/a = /*5*/m;
|
||||
////var /*6*/b: typeof /*7*/m;
|
||||
////module /*8*/m1./*9*/m2 {
|
||||
//// var /*10*/moduleElemWithoutExport = 10;
|
||||
//// export var /*11*/moduleElemWithExport = 10;
|
||||
////}
|
||||
////var /*12*/x = /*13*/m1./*14*/m2;
|
||||
////var /*15*/y: typeof /*16*/m1./*17*/m2;
|
||||
|
||||
var marker = 0;
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
}
|
||||
|
||||
function verifyModule(name: string, optionalParentName?: string) {
|
||||
goToMarker();
|
||||
var moduleNameDisplay = [{ text: name, kind: "moduleName" }];
|
||||
if (optionalParentName) {
|
||||
moduleNameDisplay = [{ text: optionalParentName, kind: "moduleName" }, { text: ".", kind: "punctuation" }].concat(moduleNameDisplay);
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("module", optionalParentName ? "export" : "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "module", kind: "keyword" }, { text: " ", kind: "space" }].concat(moduleNameDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyVar(name: string, optionalFullName?: ts.SymbolDisplayPart[], typeDisplay: ts.SymbolDisplayPart[]= [{ text: "number", kind: "keyword" }]) {
|
||||
goToMarker();
|
||||
verify.verifyQuickInfoDisplayParts("var", optionalFullName ? "export" : "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(optionalFullName || [{ text: name, kind: "localName" }]).concat(
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyModule("m");
|
||||
verifyVar("moduleElemWithoutExport");
|
||||
verifyVar("moduleElemWithExport", [{ text: "m", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "moduleElemWithExport", kind: "localName" }]);
|
||||
|
||||
verifyVar("a", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" }, { text: "m", kind: "moduleName" }]);
|
||||
verifyModule("m");
|
||||
verifyVar("b", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" }, { text: "m", kind: "moduleName" }]);
|
||||
verifyModule("m");
|
||||
|
||||
verifyModule("m1");
|
||||
verifyModule("m2", "m1");
|
||||
verifyVar("moduleElemWithoutExport");
|
||||
verifyVar("moduleElemWithExport", [{ text: "m1", kind: "moduleName" }, { text: ".", kind: "punctuation" },
|
||||
{ text: "m2", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "moduleElemWithExport", kind: "localName" }]);
|
||||
verifyVar("x", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" },
|
||||
{ text: "m1", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "m2", kind: "moduleName" }]);
|
||||
verifyModule("m1");
|
||||
verifyModule("m2", "m1");
|
||||
verifyVar("y", /*optionalFullName*/ undefined, [{ text: "typeof", kind: "keyword" }, { text: " ", kind: "space" },
|
||||
{ text: "m1", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "m2", kind: "moduleName" }]);
|
||||
verifyModule("m1");
|
||||
verifyModule("m2", "m1");
|
||||
@@ -0,0 +1,45 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function /*1*/foo(/*2*/param: string, /*3*/optionalParam?: string, /*4*/paramWithInitializer = "hello", .../*5*/restParam: string[]) {
|
||||
//// /*6*/param = "Hello";
|
||||
//// /*7*/optionalParam = "World";
|
||||
//// /*8*/paramWithInitializer = "Hello";
|
||||
//// /*9*/restParam[0] = "World";
|
||||
////}
|
||||
|
||||
goTo.marker("1");
|
||||
verify.verifyQuickInfoDisplayParts("function", "", { start: test.markerByName('1').position, length: "foo".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "function", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "foo", kind: "functionName" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "param", kind: "parameterName" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "optionalParam", kind: "parameterName" }, { text: "?", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "paramWithInitializer", kind: "parameterName" }, { text: "?", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" },
|
||||
{ text: ",", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: "...", kind: "punctuation" }, { text: "restParam", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "string", kind: "keyword" } , { text: "[", kind: "punctuation" }, { text: "]", kind: "punctuation" },
|
||||
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
|
||||
[]);
|
||||
|
||||
var marker = 1;
|
||||
function verifyParam(parameterName: string, isRest: boolean) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
var displayParts = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" }, { text: " ", kind: "space" },
|
||||
{ text: parameterName, kind: "parameterName" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "string", kind: "keyword" }];
|
||||
if (isRest) {
|
||||
displayParts.push({ text: "[", kind: "punctuation" }, { text: "]", kind: "punctuation" });
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(marker.toString()).position, length: parameterName.length }, displayParts, []);
|
||||
}
|
||||
|
||||
verifyParam('param', /*isRest*/false);
|
||||
verifyParam('optionalParam', /*isRest*/false);
|
||||
verifyParam('paramWithInitializer', /*isRest*/false);
|
||||
verifyParam('restParam', /*isRest*/true);
|
||||
|
||||
verifyParam('param', /*isRest*/false);
|
||||
verifyParam('optionalParam', /*isRest*/false);
|
||||
verifyParam('paramWithInitializer', /*isRest*/false);
|
||||
verifyParam('restParam', /*isRest*/true);
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class /*1*/c {
|
||||
////}
|
||||
////type /*2*/t1 = /*3*/c;
|
||||
////var /*4*/cInstance: /*5*/t1 = new /*6*/c();
|
||||
|
||||
function verifyClassDisplay(markerName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName(markerName).position, length: "c".length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyTypeAliasDisplay(markerName: string) {
|
||||
goTo.marker(markerName);
|
||||
verify.verifyQuickInfoDisplayParts("type", "", { start: test.markerByName(markerName).position, length: "t1".length },
|
||||
[{ text: "type", kind: "keyword" }, { text: " ", kind: "space" }, { text: "t1", kind: "aliasName" },
|
||||
{ text: " ", kind: "space" }, { text: "=", kind: "operator" }, { text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
}
|
||||
|
||||
verifyClassDisplay('1');
|
||||
verifyTypeAliasDisplay('2');
|
||||
verifyClassDisplay('3');
|
||||
|
||||
goTo.marker('4');
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName("4").position, length: "cInstance".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "cInstance", kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
|
||||
verifyTypeAliasDisplay('5');
|
||||
|
||||
goTo.marker('6');
|
||||
verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName("6").position, length: "c".length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "constructor", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" },
|
||||
{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "c", kind: "className" }],
|
||||
[]);
|
||||
@@ -0,0 +1,239 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class /*1*/c</*2*/T> {
|
||||
//// /*3*/constructor(/*4*/a: /*5*/T) {
|
||||
//// }
|
||||
//// /*6*/method</*7*/U>(/*8*/a: /*9*/U, /*10*/b: /*11*/T) {
|
||||
//// return /*12*/a;
|
||||
//// }
|
||||
////}
|
||||
////var /*13*/cInstance = new /*14*/c("Hello");
|
||||
////var /*15*/cVal = /*16*/c;
|
||||
/////*17*/cInstance./*18*/method("hello", "cello");
|
||||
////class /*19*/c2</*20*/T extends /*21*/c<string>> {
|
||||
//// /*22*/constructor(/*23*/a: /*24*/T) {
|
||||
//// }
|
||||
//// /*25*/method</*26*/U extends /*27*/c<string>>(/*28*/a: /*29*/U, /*30*/b: /*31*/T) {
|
||||
//// return /*32*/a;
|
||||
//// }
|
||||
////}
|
||||
////var /*33*/cInstance1 = new /*34*/c2(/*35*/cInstance);
|
||||
////var /*36*/cVal2 = /*37*/c2;
|
||||
/////*38*/cInstance1./*39*/method(/*40*/cInstance, /*41*/cInstance);
|
||||
|
||||
var marker = 0;
|
||||
var markerName: string;
|
||||
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
markerName = marker.toString();
|
||||
goTo.marker(markerName);
|
||||
}
|
||||
|
||||
function getTypeParameterDisplay(instanceType: ts.SymbolDisplayPart[],
|
||||
name: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
return instanceType ||
|
||||
function () {
|
||||
var typeParameterDisplay = [{ text: name, kind: "typeParameterName" }];
|
||||
if (optionalExtends) {
|
||||
typeParameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" },
|
||||
{ text: " ", kind: "space" });
|
||||
typeParameterDisplay = typeParameterDisplay.concat(optionalExtends);
|
||||
}
|
||||
return typeParameterDisplay
|
||||
} ();
|
||||
}
|
||||
|
||||
function getClassDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
var classDisplay = [{ text: name, kind: "className" }, { text: "<", kind: "punctuation" }];
|
||||
classDisplay = classDisplay.concat(getTypeParameterDisplay(optionalInstanceType, "T", optionalExtends));
|
||||
classDisplay.push({ text: ">", kind: "punctuation" });
|
||||
return classDisplay;
|
||||
}
|
||||
|
||||
function verifyClassDisplay(name: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
[{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }].concat(
|
||||
getClassDisplay(name, undefined, optionalExtends)), []);
|
||||
}
|
||||
|
||||
function verifyTypeParameter(name: string, inDisplay: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
|
||||
var typeParameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "type parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "typeParameterName" },
|
||||
{ text: " ", kind: "space" }, { text: "in", kind: "keyword" }, { text: " ", kind: "space" }];
|
||||
typeParameterDisplay = typeParameterDisplay.concat(inDisplay);
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("type parameter", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
typeParameterDisplay, []);
|
||||
}
|
||||
|
||||
function verifyConstructor(name: string, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var constructorDisplay = [{ text: "(", kind: "punctuation" }, { text: "constructor", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }];
|
||||
constructorDisplay = constructorDisplay.concat(getClassDisplay(name, optionalInstanceType, optionalExtends));
|
||||
|
||||
constructorDisplay.push({ text: "(", kind: "punctuation" }, { text: "a", kind: "parameterName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" });
|
||||
|
||||
constructorDisplay = constructorDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "T"));
|
||||
|
||||
constructorDisplay.push({ text: ")", kind: "punctuation" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" });
|
||||
|
||||
constructorDisplay = constructorDisplay.concat(getClassDisplay(name, optionalInstanceType));
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName(markerName).position, length: optionalInstanceType ? name.length : "constructor".length },
|
||||
constructorDisplay, []);
|
||||
}
|
||||
|
||||
function verifyParameter(name: string, type: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var parameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: type, kind: "typeParameterName" }];
|
||||
if (optionalExtends) {
|
||||
parameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" },
|
||||
{ text: " ", kind: "space" });
|
||||
parameterDisplay = parameterDisplay.concat(optionalExtends);
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
parameterDisplay, []);
|
||||
}
|
||||
|
||||
function getMethodDisplay(name: string, className: string,
|
||||
optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
var functionDisplay = getClassDisplay(className, optionalInstanceType, optionalExtends);
|
||||
|
||||
functionDisplay.push({ text: ".", kind: "punctuation" }, { text: name, kind: "methodName" },
|
||||
{ text: "<", kind: "punctuation" });
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U", optionalExtends));
|
||||
|
||||
functionDisplay.push({ text: ">", kind: "punctuation" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" });
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U"));
|
||||
functionDisplay.push({ text: ",", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "b", kind: "parameterName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" });
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "T"));
|
||||
|
||||
functionDisplay.push({ text: ")", kind: "punctuation" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" });
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U"));
|
||||
|
||||
return functionDisplay;
|
||||
}
|
||||
|
||||
function verifyMethodDisplay(name: string, className: string,
|
||||
optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var functionDisplay = [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" },
|
||||
{ text: ")", kind: "punctuation" }, { text: " ", kind: "space" }].concat(
|
||||
getMethodDisplay(name, className, optionalInstanceType, optionalExtends));
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("method", "",
|
||||
{ start: test.markerByName(markerName).position, length: name.length },
|
||||
functionDisplay, []);
|
||||
}
|
||||
|
||||
function verifyClassInstance(name: string, typeDisplay: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
function verifyVarTypeOf(name: string, typeOfSymbol: ts.SymbolDisplayPart) {
|
||||
goToMarker();
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "typeof", kind: "keyword" },
|
||||
{ text: " ", kind: "space" }].concat(typeOfSymbol),
|
||||
[]);
|
||||
}
|
||||
|
||||
var stringTypeDisplay = [{ text: "string", kind: "keyword" }];
|
||||
var extendsTypeDisplay = getClassDisplay("c", stringTypeDisplay);
|
||||
|
||||
// Declaration
|
||||
verifyClassDisplay("c");
|
||||
verifyTypeParameter("T", getClassDisplay("c"));
|
||||
|
||||
// Constructor declaration
|
||||
verifyConstructor("c");
|
||||
verifyParameter("a", "T");
|
||||
verifyTypeParameter("T", getClassDisplay("c"));
|
||||
|
||||
// Method declaration
|
||||
verifyMethodDisplay("method", "c");
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "c"));
|
||||
verifyParameter("a", "U");
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "c"));
|
||||
verifyParameter("b", "T");
|
||||
verifyTypeParameter("T", getClassDisplay("c"));
|
||||
verifyParameter("a", "U");
|
||||
|
||||
// Instance creation
|
||||
verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay));
|
||||
verifyConstructor("c", stringTypeDisplay);
|
||||
|
||||
// typeof assignment
|
||||
verifyVarTypeOf("cVal", { text: "c", kind: "className" });
|
||||
verifyClassDisplay("c");
|
||||
|
||||
// Method call
|
||||
verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay));
|
||||
verifyMethodDisplay("method", "c", stringTypeDisplay);
|
||||
|
||||
// With constraint
|
||||
// Declaration
|
||||
verifyClassDisplay("c2", getClassDisplay("c", stringTypeDisplay));
|
||||
verifyTypeParameter("T", getClassDisplay("c2", /*instanceType*/undefined, extendsTypeDisplay));
|
||||
verifyClassDisplay("c");
|
||||
|
||||
// Constructor declaration
|
||||
verifyConstructor("c2", /*instanceType*/undefined, extendsTypeDisplay);
|
||||
verifyParameter("a", "T", extendsTypeDisplay);
|
||||
verifyTypeParameter("T", getClassDisplay("c2", /*instanceType*/undefined, extendsTypeDisplay));
|
||||
|
||||
// Method declaration
|
||||
verifyMethodDisplay("method", "c2", /*instance*/undefined, extendsTypeDisplay);
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "c2", /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyClassDisplay("c");
|
||||
verifyParameter("a", "U", extendsTypeDisplay);
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "c2", /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyParameter("b", "T", extendsTypeDisplay);
|
||||
verifyTypeParameter("T", getClassDisplay("c2", /*instanceType*/undefined, extendsTypeDisplay));
|
||||
verifyParameter("a", "U", extendsTypeDisplay);
|
||||
|
||||
// Instance creation
|
||||
verifyClassInstance("cInstance1", getClassDisplay("c2", extendsTypeDisplay));
|
||||
verifyConstructor("c2", extendsTypeDisplay);
|
||||
verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay));
|
||||
|
||||
// typeof assignment
|
||||
verifyVarTypeOf("cVal2", { text: "c2", kind: "className" });
|
||||
verifyClassDisplay("c2", getClassDisplay("c", stringTypeDisplay));
|
||||
|
||||
// Method call
|
||||
verifyClassInstance("cInstance1", getClassDisplay("c2", extendsTypeDisplay));
|
||||
verifyMethodDisplay("method", "c2", extendsTypeDisplay);
|
||||
verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay));
|
||||
verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay));
|
||||
@@ -0,0 +1,118 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
|
||||
////function /*1*/foo</*2*/U>(/*3*/a: /*4*/U) {
|
||||
//// return /*5*/a;
|
||||
////}
|
||||
/////*6*/foo("Hello");
|
||||
////function /*7*/foo2</*8*/U extends string>(/*9*/a: /*10*/U) {
|
||||
//// return /*11*/a;
|
||||
////}
|
||||
/////*12*/foo2("hello");
|
||||
|
||||
var marker = 0;
|
||||
var markerName: string;
|
||||
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
markerName = marker.toString();
|
||||
goTo.marker(markerName);
|
||||
}
|
||||
|
||||
function getTypeParameterDisplay(instanceType: ts.SymbolDisplayPart[],
|
||||
name: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
return instanceType ||
|
||||
function () {
|
||||
var typeParameterDisplay = [{ text: name, kind: "typeParameterName" }];
|
||||
if (optionalExtends) {
|
||||
typeParameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" },
|
||||
{ text: " ", kind: "space" });
|
||||
typeParameterDisplay = typeParameterDisplay.concat(optionalExtends);
|
||||
}
|
||||
return typeParameterDisplay
|
||||
} ();
|
||||
}
|
||||
|
||||
function verifyTypeParameter(name: string, inDisplay: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
|
||||
var typeParameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "type parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "typeParameterName" },
|
||||
{ text: " ", kind: "space" }, { text: "in", kind: "keyword" }, { text: " ", kind: "space" }];
|
||||
typeParameterDisplay = typeParameterDisplay.concat(inDisplay);
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("type parameter", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
typeParameterDisplay, []);
|
||||
}
|
||||
|
||||
function verifyParameter(name: string, typeParameterName: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var parameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: typeParameterName, kind: "typeParameterName" }];
|
||||
if (optionalExtends) {
|
||||
parameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" },
|
||||
{ text: " ", kind: "space" });
|
||||
parameterDisplay = parameterDisplay.concat(optionalExtends);
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
parameterDisplay, []);
|
||||
}
|
||||
|
||||
function getFunctionDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
var functionDisplay = [{ text: name, kind: "functionName" }, { text: "<", kind: "punctuation" }];
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U", optionalExtends));
|
||||
|
||||
functionDisplay.push({ text: ">", kind: "punctuation" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" });
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U"));
|
||||
|
||||
functionDisplay.push({ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" });
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U"));
|
||||
|
||||
return functionDisplay;
|
||||
}
|
||||
|
||||
function verifyFunctionDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var functionDisplay = [{ text: "(", kind: "punctuation" }, { text: "function", kind: "text" },
|
||||
{ text: ")", kind: "punctuation" }, { text: " ", kind: "space" }].concat(
|
||||
getFunctionDisplay(name, optionalInstanceType, optionalExtends));
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("function", "",
|
||||
{ start: test.markerByName(markerName).position, length: name.length },
|
||||
functionDisplay, []);
|
||||
}
|
||||
|
||||
var stringTypeDisplay = [{ text: "string", kind: "keyword" }];
|
||||
|
||||
// Declaration
|
||||
verifyFunctionDisplay("foo");
|
||||
verifyTypeParameter("U", getFunctionDisplay("foo"));
|
||||
verifyParameter("a", "U");
|
||||
verifyTypeParameter("U", getFunctionDisplay("foo"));
|
||||
verifyParameter("a", "U");
|
||||
|
||||
// Call
|
||||
verifyFunctionDisplay("foo", stringTypeDisplay);
|
||||
|
||||
// With constraint
|
||||
// Declaration
|
||||
verifyFunctionDisplay("foo2", /*instance*/ undefined, stringTypeDisplay);
|
||||
verifyTypeParameter("U", getFunctionDisplay("foo2", /*instance*/ undefined, stringTypeDisplay));
|
||||
verifyParameter("a", "U", stringTypeDisplay);
|
||||
verifyTypeParameter("U", getFunctionDisplay("foo2", /*instance*/ undefined, stringTypeDisplay));
|
||||
verifyParameter("a", "U", stringTypeDisplay);
|
||||
|
||||
// Call
|
||||
verifyFunctionDisplay("foo2", stringTypeDisplay);
|
||||
@@ -0,0 +1,263 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface /*1*/I</*2*/T> {
|
||||
//// new </*3*/U>(/*4*/a: /*5*/U, /*6*/b: /*7*/T): /*8*/U;
|
||||
//// </*9*/U>(/*10*/a: /*11*/U, /*12*/b: /*13*/T): /*14*/U;
|
||||
//// /*15*/method</*16*/U>(/*17*/a: /*18*/U, /*19*/b: /*20*/T): /*21*/U;
|
||||
////}
|
||||
////var /*22*/iVal: /*23*/I<string>;
|
||||
////new /*24*/iVal("hello", "hello");
|
||||
/////*25*/iVal("hello", "hello");
|
||||
/////*26*/iVal./*27*/method("hello", "hello");
|
||||
////interface /*28*/I1</*29*/T extends /*30*/I<string>> {
|
||||
//// new </*31*/U extends /*32*/I<string>>(/*33*/a: /*34*/U, /*35*/b: /*36*/T): /*37*/U;
|
||||
//// </*38*/U extends /*39*/I<string>>(/*40*/a: /*41*/U, /*42*/b: /*43*/T): /*44*/U;
|
||||
//// /*45*/method</*46*/U extends /*47*/I<string>>(/*48*/a: /*49*/U, /*50*/b: /*51*/T): /*52*/U;
|
||||
////}
|
||||
////var /*53*/iVal1: /*54*/I1</*55*/I<string>>;
|
||||
////new /*56*/iVal1(/*57*/iVal, /*58*/iVal);
|
||||
/////*59*/iVal1(/*60*/iVal, /*61*/iVal);
|
||||
/////*62*/iVal1./*63*/method(/*64*/iVal, /*65*/iVal);
|
||||
|
||||
var marker = 0;
|
||||
var markerName: string;
|
||||
|
||||
function goToMarker() {
|
||||
marker++;
|
||||
markerName = marker.toString();
|
||||
goTo.marker(markerName);
|
||||
}
|
||||
|
||||
function getTypeParameterDisplay(instanceType: ts.SymbolDisplayPart[],
|
||||
name: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
return instanceType ||
|
||||
function () {
|
||||
var typeParameterDisplay = [{ text: name, kind: "typeParameterName" }];
|
||||
if (optionalExtends) {
|
||||
typeParameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" },
|
||||
{ text: " ", kind: "space" });
|
||||
typeParameterDisplay = typeParameterDisplay.concat(optionalExtends);
|
||||
}
|
||||
return typeParameterDisplay
|
||||
} ();
|
||||
}
|
||||
|
||||
function getInterfaceDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
var interfaceDisplay = [{ text: name, kind: "interfaceName" }, { text: "<", kind: "punctuation" }];
|
||||
interfaceDisplay = interfaceDisplay.concat(getTypeParameterDisplay(optionalInstanceType, "T", optionalExtends));
|
||||
interfaceDisplay.push({ text: ">", kind: "punctuation" });
|
||||
return interfaceDisplay;
|
||||
}
|
||||
|
||||
function verifyInterfaceDisplay(name: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("interface", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
[{ text: "interface", kind: "keyword" }, { text: " ", kind: "space" }].concat(
|
||||
getInterfaceDisplay(name, undefined, optionalExtends)), []);
|
||||
}
|
||||
|
||||
function verifyTypeParameter(name: string, inDisplay: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
|
||||
var typeParameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "type parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "typeParameterName" },
|
||||
{ text: " ", kind: "space" }, { text: "in", kind: "keyword" }, { text: " ", kind: "space" }];
|
||||
typeParameterDisplay = typeParameterDisplay.concat(inDisplay);
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("type parameter", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
typeParameterDisplay, []);
|
||||
}
|
||||
|
||||
function verifyParameter(name: string, typeParameterName: string, optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var parameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: typeParameterName, kind: "typeParameterName" }];
|
||||
if (optionalExtends) {
|
||||
parameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" },
|
||||
{ text: " ", kind: "space" });
|
||||
parameterDisplay = parameterDisplay.concat(optionalExtends);
|
||||
}
|
||||
verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
parameterDisplay, []);
|
||||
}
|
||||
|
||||
function getSignatureDisplay(isArrow: boolean, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
var functionDisplay: ts.SymbolDisplayPart[] = [];
|
||||
|
||||
functionDisplay.push({ text: "<", kind: "punctuation" });
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U", optionalExtends));
|
||||
|
||||
functionDisplay.push({ text: ">", kind: "punctuation" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" });
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U"));
|
||||
functionDisplay.push({ text: ",", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "b", kind: "parameterName" },
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" });
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "T"));
|
||||
|
||||
functionDisplay.push({ text: ")", kind: "punctuation" });
|
||||
if (isArrow) {
|
||||
functionDisplay.push({ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" });
|
||||
}
|
||||
else {
|
||||
functionDisplay.push({ text: ":", kind: "punctuation" });
|
||||
}
|
||||
functionDisplay.push({ text: " ", kind: "space" });
|
||||
|
||||
functionDisplay = functionDisplay.concat(
|
||||
getTypeParameterDisplay(optionalInstanceType, "U"));
|
||||
|
||||
return functionDisplay;
|
||||
}
|
||||
|
||||
function getMethodDisplay(name: string, interfaceName: string, optionalInstanceType?: ts.SymbolDisplayPart[],
|
||||
optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
return getInterfaceDisplay(interfaceName, optionalInstanceType, optionalExtends).concat(
|
||||
{ text: ".", kind: "punctuation" }, { text: name, kind: "methodName" }).concat(
|
||||
getSignatureDisplay(/*isArrow*/ false, optionalInstanceType, optionalExtends));
|
||||
}
|
||||
|
||||
function getCallOrNewSignatureDisplay(isNew: boolean, isArrow: boolean, interfaceName?: string,
|
||||
optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
var result: ts.SymbolDisplayPart[] = [];
|
||||
if (isNew) {
|
||||
result.push({ text: "new", kind: "keyword" }, { text: " ", kind: "space" });
|
||||
}
|
||||
if (interfaceName) {
|
||||
result.push({ text: interfaceName, kind: "interfaceName" });
|
||||
}
|
||||
|
||||
return result.concat(getSignatureDisplay(isArrow, optionalInstanceType, optionalExtends));
|
||||
}
|
||||
|
||||
function verifyMethodDisplay(name: string, interfaceName: string,
|
||||
optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
var functionDisplay = [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" },
|
||||
{ text: ")", kind: "punctuation" }, { text: " ", kind: "space" }].concat(
|
||||
getMethodDisplay(name, interfaceName, optionalInstanceType, optionalExtends));
|
||||
|
||||
verify.verifyQuickInfoDisplayParts("method", "",
|
||||
{ start: test.markerByName(markerName).position, length: name.length },
|
||||
functionDisplay, []);
|
||||
}
|
||||
|
||||
function verifyInterfaceVar(name: string, typeDisplay: ts.SymbolDisplayPart[]) {
|
||||
goToMarker();
|
||||
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: "var", kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: name, kind: "localName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
var stringTypeDisplay = [{ text: "string", kind: "keyword" }];
|
||||
var extendsTypeDisplay = getInterfaceDisplay("I", stringTypeDisplay);
|
||||
|
||||
|
||||
// Declaration
|
||||
verifyInterfaceDisplay("I");
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I"));
|
||||
|
||||
// New declaration
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false));
|
||||
verifyParameter("a", "U");
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false));
|
||||
verifyParameter("b", "T");
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I"));
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false));
|
||||
|
||||
// Call declaration
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false));
|
||||
verifyParameter("a", "U");
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false));
|
||||
verifyParameter("b", "T");
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I"));
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false));
|
||||
|
||||
// Method declaration
|
||||
verifyMethodDisplay("method", "I");
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "I"));
|
||||
verifyParameter("a", "U");
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "I"));
|
||||
verifyParameter("b", "T");
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I"));
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "I"));
|
||||
|
||||
// Instance
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
verifyInterfaceDisplay("I");
|
||||
|
||||
// new
|
||||
verifyInterfaceVar("iVal", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ true, "I", stringTypeDisplay));
|
||||
|
||||
// call
|
||||
verifyInterfaceVar("iVal", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ true, "I", stringTypeDisplay));
|
||||
|
||||
// Method call
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
verifyMethodDisplay("method", "I", stringTypeDisplay);
|
||||
|
||||
// With constraint
|
||||
// Declaration
|
||||
verifyInterfaceDisplay("I1", extendsTypeDisplay);
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyInterfaceDisplay("I");
|
||||
|
||||
// New declaration
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyInterfaceDisplay("I");
|
||||
verifyParameter("a", "U", extendsTypeDisplay);
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyParameter("b", "T", extendsTypeDisplay);
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay));
|
||||
|
||||
// Call declaration
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyInterfaceDisplay("I");
|
||||
verifyParameter("a", "U", extendsTypeDisplay);
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyParameter("b", "T", extendsTypeDisplay);
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay));
|
||||
|
||||
// Method declaration
|
||||
verifyMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay);
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay));
|
||||
verifyInterfaceDisplay("I");
|
||||
verifyParameter("a", "U", extendsTypeDisplay);
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay));
|
||||
verifyParameter("b", "T", extendsTypeDisplay);
|
||||
verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay));
|
||||
verifyTypeParameter("U", getMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay));
|
||||
|
||||
// Instance
|
||||
verifyInterfaceVar("iVal1", getInterfaceDisplay("I1", extendsTypeDisplay));
|
||||
verifyInterfaceDisplay("I1", extendsTypeDisplay);
|
||||
verifyInterfaceDisplay("I");
|
||||
|
||||
// new
|
||||
verifyInterfaceVar("iVal1", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ true, "I1", extendsTypeDisplay));
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
|
||||
// call
|
||||
verifyInterfaceVar("iVal1", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ true, "I1", extendsTypeDisplay));
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
|
||||
// Method call
|
||||
verifyInterfaceVar("iVal1", getInterfaceDisplay("I1", extendsTypeDisplay));
|
||||
verifyMethodDisplay("method", "I1", extendsTypeDisplay);
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));
|
||||
@@ -0,0 +1,76 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var /*1*/a = 10;
|
||||
////function foo() {
|
||||
//// var /*2*/b = /*3*/a;
|
||||
////}
|
||||
////module m {
|
||||
//// var /*4*/c = 10;
|
||||
//// export var /*5*/d = 10;
|
||||
////}
|
||||
////var /*6*/f: () => number;
|
||||
////var /*7*/g = /*8*/f;
|
||||
/////*9*/f();
|
||||
////var /*10*/h: { (a: string): number; (a: number): string; };
|
||||
////var /*11*/i = /*12*/h;
|
||||
/////*13*/h(10);
|
||||
/////*14*/h("hello");
|
||||
|
||||
var marker = 0;
|
||||
function verifyVar(name: string, isLocal: boolean, typeDisplay: ts.SymbolDisplayPart[], optionalNameDisplay?: ts.SymbolDisplayPart[], optionalKindModifiers?: string) {
|
||||
marker++;
|
||||
goTo.marker(marker.toString());
|
||||
var kind = isLocal ? "local var" : "var";
|
||||
verify.verifyQuickInfoDisplayParts(kind, optionalKindModifiers || "", { start: test.markerByName(marker.toString()).position, length: name.length },
|
||||
[{ text: "(", kind: "punctuation" }, { text: kind, kind: "text" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }].concat(optionalNameDisplay || [{ text: name, kind: "localName" }]).concat(
|
||||
{ text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay),
|
||||
[]);
|
||||
}
|
||||
|
||||
var numberTypeDisplay: ts.SymbolDisplayPart[] = [{ text: "number", kind: "keyword" }];
|
||||
|
||||
verifyVar("a", /*isLocal*/false, numberTypeDisplay);
|
||||
verifyVar("b", /*isLocal*/true, numberTypeDisplay);
|
||||
verifyVar("a", /*isLocal*/false, numberTypeDisplay);
|
||||
verifyVar("c", /*isLocal*/false, numberTypeDisplay);
|
||||
verifyVar("d", /*isLocal*/false, numberTypeDisplay, [{ text: "m", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "d", kind: "localName" }], "export");
|
||||
|
||||
var functionTypeReturningNumber: ts.SymbolDisplayPart[] = [{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "number", kind: "keyword" }];
|
||||
verifyVar("f", /*isLocal*/ false, functionTypeReturningNumber);
|
||||
verifyVar("g", /*isLocal*/ false, functionTypeReturningNumber);
|
||||
verifyVar("f", /*isLocal*/ false, functionTypeReturningNumber);
|
||||
verifyVar("f", /*isLocal*/ false, functionTypeReturningNumber);
|
||||
|
||||
|
||||
function getFunctionType(parametertype: string, returnType: string, isArrow?: boolean): ts.SymbolDisplayPart[] {
|
||||
var functionTypeDisplay = [{ text: "(", kind: "punctuation" }, { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" },
|
||||
{ text: " ", kind: "space" }, { text: parametertype, kind: "keyword" }, { text: ")", kind: "punctuation" }];
|
||||
|
||||
if (isArrow) {
|
||||
functionTypeDisplay = functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" });
|
||||
}
|
||||
else {
|
||||
functionTypeDisplay = functionTypeDisplay.concat({ text: ":", kind: "punctuation" });
|
||||
}
|
||||
|
||||
return functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: returnType, kind: "keyword" });
|
||||
}
|
||||
|
||||
var typeLiteralWithOverloadCall: ts.SymbolDisplayPart[] = [{ text: "{", kind: "punctuation" }, { text: "\n", kind: "lineBreak" },
|
||||
{ text: " ", kind: "space" }].concat(getFunctionType("string", "number")).concat(
|
||||
{ text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" },
|
||||
{ text: " ", kind: "space" }).concat(getFunctionType("number", "string")).concat(
|
||||
{ text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" }, { text: "}", kind: "punctuation" });
|
||||
|
||||
verifyVar("h", /*isLocal*/ false, typeLiteralWithOverloadCall);
|
||||
verifyVar("i", /*isLocal*/ false, typeLiteralWithOverloadCall);
|
||||
verifyVar("h", /*isLocal*/ false, typeLiteralWithOverloadCall);
|
||||
|
||||
var overloadDisplay: ts.SymbolDisplayPart[] = [{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" },
|
||||
{ text: "+", kind: "operator" }, { text: "1", kind: "numericLiteral" },
|
||||
{ text: " ", kind: "space" }, { text: "overload", kind: "text" }, { text: ")", kind: "punctuation" }];
|
||||
|
||||
verifyVar("h", /*isLocal*/ false, getFunctionType("number", "string", /*isArrow*/true).concat(overloadDisplay));
|
||||
verifyVar("h", /*isLocal*/ false, getFunctionType("string", "number", /*isArrow*/true).concat(overloadDisplay));
|
||||
Reference in New Issue
Block a user