@@ -3181,18 +3181,18 @@ module ts {
3181
3181
source : Type ,
3182
3182
target : Type ,
3183
3183
errorNode : Node ,
3184
- chainedMessage ?: DiagnosticMessage ,
3184
+ headMessage ?: DiagnosticMessage ,
3185
3185
containingMessageChain ?: DiagnosticMessageChain ) : boolean {
3186
3186
3187
- return checkTypeRelatedTo ( source , target , subtypeRelation , errorNode , chainedMessage , containingMessageChain ) ;
3187
+ return checkTypeRelatedTo ( source , target , subtypeRelation , errorNode , headMessage , containingMessageChain ) ;
3188
3188
}
3189
3189
3190
3190
function isTypeAssignableTo ( source : Type , target : Type ) : boolean {
3191
3191
return checkTypeAssignableTo ( source , target , /*errorNode*/ undefined ) ;
3192
3192
}
3193
3193
3194
- function checkTypeAssignableTo ( source : Type , target : Type , errorNode : Node , chainedMessage ?: DiagnosticMessage ) : boolean {
3195
- return checkTypeRelatedTo ( source , target , assignableRelation , errorNode , chainedMessage ) ;
3194
+ function checkTypeAssignableTo ( source : Type , target : Type , errorNode : Node , headMessage ?: DiagnosticMessage ) : boolean {
3195
+ return checkTypeRelatedTo ( source , target , assignableRelation , errorNode , headMessage ) ;
3196
3196
}
3197
3197
3198
3198
function isTypeRelatedTo ( source : Type , target : Type , relation : Map < boolean > ) : boolean {
@@ -3271,7 +3271,7 @@ module ts {
3271
3271
target : Type ,
3272
3272
relation : Map < boolean > ,
3273
3273
errorNode : Node ,
3274
- chainedMessage ?: DiagnosticMessage ,
3274
+ headMessage ?: DiagnosticMessage ,
3275
3275
containingMessageChain ?: DiagnosticMessageChain ) : boolean {
3276
3276
3277
3277
var errorInfo : DiagnosticMessageChain ;
@@ -3283,7 +3283,7 @@ module ts {
3283
3283
3284
3284
Debug . assert ( relation !== identityRelation || ! errorNode , "no error reporting in identity checking" ) ;
3285
3285
3286
- var result = isRelatedToWithCustomErrors ( source , target , errorNode !== undefined , chainedMessage ) ;
3286
+ var result = isRelatedToWithCustomErrors ( source , target , errorNode !== undefined , headMessage ) ;
3287
3287
if ( overflow ) {
3288
3288
error ( errorNode , Diagnostics . Excessive_stack_depth_comparing_types_0_and_1 , typeToString ( source ) , typeToString ( target ) ) ;
3289
3289
}
@@ -3300,10 +3300,10 @@ module ts {
3300
3300
}
3301
3301
3302
3302
function isRelatedTo ( source : Type , target : Type , reportErrors ?: boolean ) : boolean {
3303
- return isRelatedToWithCustomErrors ( source , target , reportErrors , /*chainedMessage */ undefined ) ;
3303
+ return isRelatedToWithCustomErrors ( source , target , reportErrors , /*headMessage */ undefined ) ;
3304
3304
}
3305
3305
3306
- function isRelatedToWithCustomErrors ( source : Type , target : Type , reportErrors : boolean , chainedMessage : DiagnosticMessage ) : boolean {
3306
+ function isRelatedToWithCustomErrors ( source : Type , target : Type , reportErrors : boolean , headMessage : DiagnosticMessage ) : boolean {
3307
3307
if ( relation === identityRelation ) {
3308
3308
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
3309
3309
if ( source === target ) return true ;
@@ -3355,9 +3355,9 @@ module ts {
3355
3355
}
3356
3356
}
3357
3357
if ( reportErrors ) {
3358
- chainedMessage = chainedMessage || Diagnostics . Type_0_is_not_assignable_to_type_1 ;
3359
- Debug . assert ( chainedMessage ) ;
3360
- reportError ( chainedMessage , typeToString ( source ) , typeToString ( target ) ) ;
3358
+ headMessage = headMessage || Diagnostics . Type_0_is_not_assignable_to_type_1 ;
3359
+ Debug . assert ( headMessage ) ;
3360
+ reportError ( headMessage , typeToString ( source ) , typeToString ( target ) ) ;
3361
3361
}
3362
3362
return false ;
3363
3363
}
@@ -5778,7 +5778,7 @@ module ts {
5778
5778
else {
5779
5779
var exprType = checkExpression ( node . body ) ;
5780
5780
if ( node . type ) {
5781
- checkTypeAssignableTo ( exprType , getTypeFromTypeNode ( node . type ) , node . body , /*chainedMessage */ undefined ) ;
5781
+ checkTypeAssignableTo ( exprType , getTypeFromTypeNode ( node . type ) , node . body , /*headMessage */ undefined ) ;
5782
5782
}
5783
5783
checkFunctionExpressionBodies ( node . body ) ;
5784
5784
}
@@ -6084,7 +6084,7 @@ module ts {
6084
6084
// Use default messages
6085
6085
if ( ok ) {
6086
6086
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
6087
- checkTypeAssignableTo ( valueType , leftType , node . left , /*chainedMessage */ undefined ) ;
6087
+ checkTypeAssignableTo ( valueType , leftType , node . left , /*headMessage */ undefined ) ;
6088
6088
}
6089
6089
}
6090
6090
}
@@ -7107,7 +7107,7 @@ module ts {
7107
7107
if ( node . initializer ) {
7108
7108
if ( ! ( getNodeLinks ( node . initializer ) . flags & NodeCheckFlags . TypeChecked ) ) {
7109
7109
// Use default messages
7110
- checkTypeAssignableTo ( checkAndMarkExpression ( node . initializer ) , type , node , /*chainedMessage */ undefined ) ;
7110
+ checkTypeAssignableTo ( checkAndMarkExpression ( node . initializer ) , type , node , /*headMessage */ undefined ) ;
7111
7111
}
7112
7112
checkCollisionWithConstDeclarations ( node ) ;
7113
7113
}
@@ -7220,7 +7220,7 @@ module ts {
7220
7220
func . type ||
7221
7221
( func . kind === SyntaxKind . GetAccessor && getSetAccessorTypeAnnotationNode ( < AccessorDeclaration > getDeclarationOfKind ( func . symbol , SyntaxKind . SetAccessor ) ) ) ;
7222
7222
if ( checkAssignability ) {
7223
- checkTypeAssignableTo ( checkExpression ( node . expression ) , returnType , node . expression , /*chainedMessage */ undefined ) ;
7223
+ checkTypeAssignableTo ( checkExpression ( node . expression ) , returnType , node . expression , /*headMessage */ undefined ) ;
7224
7224
}
7225
7225
else if ( func . kind == SyntaxKind . Constructor ) {
7226
7226
// constructor doesn't have explicit return type annotation and yet its return type is known - declaring type
@@ -7248,7 +7248,7 @@ module ts {
7248
7248
var caseType = checkExpression ( clause . expression ) ;
7249
7249
if ( ! isTypeAssignableTo ( expressionType , caseType ) ) {
7250
7250
// check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails
7251
- checkTypeAssignableTo ( caseType , expressionType , clause . expression , /*chainedMessage */ undefined ) ;
7251
+ checkTypeAssignableTo ( caseType , expressionType , clause . expression , /*headMessage */ undefined ) ;
7252
7252
}
7253
7253
}
7254
7254
checkBlock ( clause ) ;
@@ -7604,7 +7604,7 @@ module ts {
7604
7604
// If it is a constant value (not undefined), it is syntactically constrained to be a number.
7605
7605
// Also, we do not need to check this for ambients because there is already
7606
7606
// a syntax error if it is not a constant.
7607
- checkTypeAssignableTo ( checkExpression ( initializer ) , enumType , initializer , /*chainedMessage */ undefined ) ;
7607
+ checkTypeAssignableTo ( checkExpression ( initializer ) , enumType , initializer , /*headMessage */ undefined ) ;
7608
7608
}
7609
7609
}
7610
7610
else if ( ambient ) {
0 commit comments