@@ -3181,18 +3181,18 @@ module ts {
31813181 source : Type ,
31823182 target : Type ,
31833183 errorNode : Node ,
3184- chainedMessage ?: DiagnosticMessage ,
3184+ headMessage ?: DiagnosticMessage ,
31853185 containingMessageChain ?: DiagnosticMessageChain ) : boolean {
31863186
3187- return checkTypeRelatedTo ( source , target , subtypeRelation , errorNode , chainedMessage , containingMessageChain ) ;
3187+ return checkTypeRelatedTo ( source , target , subtypeRelation , errorNode , headMessage , containingMessageChain ) ;
31883188 }
31893189
31903190 function isTypeAssignableTo ( source : Type , target : Type ) : boolean {
31913191 return checkTypeAssignableTo ( source , target , /*errorNode*/ undefined ) ;
31923192 }
31933193
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 ) ;
31963196 }
31973197
31983198 function isTypeRelatedTo ( source : Type , target : Type , relation : Map < boolean > ) : boolean {
@@ -3271,7 +3271,7 @@ module ts {
32713271 target : Type ,
32723272 relation : Map < boolean > ,
32733273 errorNode : Node ,
3274- chainedMessage ?: DiagnosticMessage ,
3274+ headMessage ?: DiagnosticMessage ,
32753275 containingMessageChain ?: DiagnosticMessageChain ) : boolean {
32763276
32773277 var errorInfo : DiagnosticMessageChain ;
@@ -3283,7 +3283,7 @@ module ts {
32833283
32843284 Debug . assert ( relation !== identityRelation || ! errorNode , "no error reporting in identity checking" ) ;
32853285
3286- var result = isRelatedToWithCustomErrors ( source , target , errorNode !== undefined , chainedMessage ) ;
3286+ var result = isRelatedToWithCustomErrors ( source , target , errorNode !== undefined , headMessage ) ;
32873287 if ( overflow ) {
32883288 error ( errorNode , Diagnostics . Excessive_stack_depth_comparing_types_0_and_1 , typeToString ( source ) , typeToString ( target ) ) ;
32893289 }
@@ -3300,10 +3300,10 @@ module ts {
33003300 }
33013301
33023302 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 ) ;
33043304 }
33053305
3306- function isRelatedToWithCustomErrors ( source : Type , target : Type , reportErrors : boolean , chainedMessage : DiagnosticMessage ) : boolean {
3306+ function isRelatedToWithCustomErrors ( source : Type , target : Type , reportErrors : boolean , headMessage : DiagnosticMessage ) : boolean {
33073307 if ( relation === identityRelation ) {
33083308 // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
33093309 if ( source === target ) return true ;
@@ -3355,9 +3355,9 @@ module ts {
33553355 }
33563356 }
33573357 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 ) ) ;
33613361 }
33623362 return false ;
33633363 }
@@ -5778,7 +5778,7 @@ module ts {
57785778 else {
57795779 var exprType = checkExpression ( node . body ) ;
57805780 if ( node . type ) {
5781- checkTypeAssignableTo ( exprType , getTypeFromTypeNode ( node . type ) , node . body , /*chainedMessage */ undefined ) ;
5781+ checkTypeAssignableTo ( exprType , getTypeFromTypeNode ( node . type ) , node . body , /*headMessage */ undefined ) ;
57825782 }
57835783 checkFunctionExpressionBodies ( node . body ) ;
57845784 }
@@ -6084,7 +6084,7 @@ module ts {
60846084 // Use default messages
60856085 if ( ok ) {
60866086 // 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 ) ;
60886088 }
60896089 }
60906090 }
@@ -7107,7 +7107,7 @@ module ts {
71077107 if ( node . initializer ) {
71087108 if ( ! ( getNodeLinks ( node . initializer ) . flags & NodeCheckFlags . TypeChecked ) ) {
71097109 // Use default messages
7110- checkTypeAssignableTo ( checkAndMarkExpression ( node . initializer ) , type , node , /*chainedMessage */ undefined ) ;
7110+ checkTypeAssignableTo ( checkAndMarkExpression ( node . initializer ) , type , node , /*headMessage */ undefined ) ;
71117111 }
71127112 checkCollisionWithConstDeclarations ( node ) ;
71137113 }
@@ -7220,7 +7220,7 @@ module ts {
72207220 func . type ||
72217221 ( func . kind === SyntaxKind . GetAccessor && getSetAccessorTypeAnnotationNode ( < AccessorDeclaration > getDeclarationOfKind ( func . symbol , SyntaxKind . SetAccessor ) ) ) ;
72227222 if ( checkAssignability ) {
7223- checkTypeAssignableTo ( checkExpression ( node . expression ) , returnType , node . expression , /*chainedMessage */ undefined ) ;
7223+ checkTypeAssignableTo ( checkExpression ( node . expression ) , returnType , node . expression , /*headMessage */ undefined ) ;
72247224 }
72257225 else if ( func . kind == SyntaxKind . Constructor ) {
72267226 // constructor doesn't have explicit return type annotation and yet its return type is known - declaring type
@@ -7248,7 +7248,7 @@ module ts {
72487248 var caseType = checkExpression ( clause . expression ) ;
72497249 if ( ! isTypeAssignableTo ( expressionType , caseType ) ) {
72507250 // 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 ) ;
72527252 }
72537253 }
72547254 checkBlock ( clause ) ;
@@ -7604,7 +7604,7 @@ module ts {
76047604 // If it is a constant value (not undefined), it is syntactically constrained to be a number.
76057605 // Also, we do not need to check this for ambients because there is already
76067606 // 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 ) ;
76087608 }
76097609 }
76107610 else if ( ambient ) {
0 commit comments