Skip to content

Commit aa40dc5

Browse files
committed
Fix up comment about bug #236 in checkCallExpression
1 parent 2843b82 commit aa40dc5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/compiler/checker.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -3832,16 +3832,15 @@ module ts {
38323832
// but we are not including call signatures that may have been added to the Object or
38333833
// Function interface, since they have none by default. This is a bit of a leap of faith
38343834
// that the user will not add any.
3835-
var signatures = getSignaturesOfType(apparentType, SignatureKind.Call);
3835+
var callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call);
38363836

38373837
var constructSignatures = getSignaturesOfType(apparentType, SignatureKind.Construct);
38383838
// TS 1.0 spec: 4.12
3839-
// If FuncExpr is of type Any, or of an object type that has no call signatures but is a
3840-
// subtype of the Function interface, the call is an untyped function call. In an untyped
3841-
// function call no TypeArgs are permitted, Args can be any argument list, no contextual
3839+
// If FuncExpr is of type Any, or of an object type that has no call or construct signatures
3840+
// but is a subtype of the Function interface, the call is an untyped function call. In an
3841+
// untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual
38423842
// types are provided for the argument expressions, and the result is always of type Any.
3843-
// NOTE (not in spec yet): permit untyped call only if type has no both call and construct signatures
3844-
if ((funcType === anyType) || (!signatures.length && !constructSignatures.length && isTypeAssignableTo(funcType, globalFunctionType))) {
3843+
if ((funcType === anyType) || (!callSignatures.length && !constructSignatures.length && isTypeAssignableTo(funcType, globalFunctionType))) {
38453844
if (node.typeArguments) {
38463845
error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
38473846
}
@@ -3850,7 +3849,7 @@ module ts {
38503849
// If FuncExpr's apparent type(section 3.8.1) is a function type, the call is a typed function call.
38513850
// TypeScript employs overload resolution in typed function calls in order to support functions
38523851
// with multiple call signatures.
3853-
if (!signatures.length) {
3852+
if (!callSignatures.length) {
38543853
if (constructSignatures.length) {
38553854
error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
38563855
}
@@ -3859,7 +3858,7 @@ module ts {
38593858
}
38603859
return checkErrorCall(node);
38613860
}
3862-
return checkCall(node, signatures);
3861+
return checkCall(node, callSignatures);
38633862
}
38643863

38653864
function checkNewExpression(node: NewExpression): Type {

0 commit comments

Comments
 (0)