@@ -3832,16 +3832,15 @@ module ts {
3832
3832
// but we are not including call signatures that may have been added to the Object or
3833
3833
// Function interface, since they have none by default. This is a bit of a leap of faith
3834
3834
// that the user will not add any.
3835
- var signatures = getSignaturesOfType ( apparentType , SignatureKind . Call ) ;
3835
+ var callSignatures = getSignaturesOfType ( apparentType , SignatureKind . Call ) ;
3836
3836
3837
3837
var constructSignatures = getSignaturesOfType ( apparentType , SignatureKind . Construct ) ;
3838
3838
// 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
3842
3842
// 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 ) ) ) {
3845
3844
if ( node . typeArguments ) {
3846
3845
error ( node , Diagnostics . Untyped_function_calls_may_not_accept_type_arguments ) ;
3847
3846
}
@@ -3850,7 +3849,7 @@ module ts {
3850
3849
// If FuncExpr's apparent type(section 3.8.1) is a function type, the call is a typed function call.
3851
3850
// TypeScript employs overload resolution in typed function calls in order to support functions
3852
3851
// with multiple call signatures.
3853
- if ( ! signatures . length ) {
3852
+ if ( ! callSignatures . length ) {
3854
3853
if ( constructSignatures . length ) {
3855
3854
error ( node , Diagnostics . Value_of_type_0_is_not_callable_Did_you_mean_to_include_new , typeToString ( funcType ) ) ;
3856
3855
}
@@ -3859,7 +3858,7 @@ module ts {
3859
3858
}
3860
3859
return checkErrorCall ( node ) ;
3861
3860
}
3862
- return checkCall ( node , signatures ) ;
3861
+ return checkCall ( node , callSignatures ) ;
3863
3862
}
3864
3863
3865
3864
function checkNewExpression ( node : NewExpression ) : Type {
0 commit comments