@@ -744,7 +744,7 @@ export class Resolver extends DiagnosticEmitter {
744744 let typeNode = parameterNodes [ i ] . type ;
745745 if ( typeNode . hasGenericComponent ( typeParameterNodes ) ) {
746746 let type = this . resolveExpression ( argumentExpression , ctxFlow , Type . auto , ReportMode . SWALLOW ) ;
747- if ( type ) this . propagateInferredGenericTypes ( typeNode , type , ctxFlow , contextualTypeArguments , typeParameterNames ) ;
747+ if ( type ) this . propagateInferredGenericTypes ( typeNode , type , prototype , contextualTypeArguments , typeParameterNames ) ;
748748 }
749749 }
750750
@@ -795,8 +795,8 @@ export class Resolver extends DiagnosticEmitter {
795795 node : TypeNode ,
796796 /** The inferred type. */
797797 type : Type ,
798- /** Contextual flow . */
799- ctxFlow : Flow ,
798+ /** Contextual element . */
799+ ctxElement : Element ,
800800 /** Contextual types, i.e. `T`, with unknown types initialized to `auto`. */
801801 ctxTypes : Map < string , Type > ,
802802 /** The names of the type parameters being inferred. */
@@ -808,13 +808,13 @@ export class Resolver extends DiagnosticEmitter {
808808 if ( typeArgumentNodes && typeArgumentNodes . length > 0 ) { // foo<T>(bar: Array<T>)
809809 let classReference = type . classReference ;
810810 if ( classReference ) {
811- let classPrototype = this . resolveTypeName ( namedTypeNode . name , ctxFlow . actualFunction ) ;
811+ let classPrototype = this . resolveTypeName ( namedTypeNode . name , ctxElement ) ;
812812 if ( ! classPrototype || classPrototype . kind != ElementKind . CLASS_PROTOTYPE ) return ;
813813 if ( classReference . prototype == < ClassPrototype > classPrototype ) {
814814 let typeArguments = classReference . typeArguments ;
815815 if ( typeArguments && typeArguments . length == typeArgumentNodes . length ) {
816816 for ( let i = 0 , k = typeArguments . length ; i < k ; ++ i ) {
817- this . propagateInferredGenericTypes ( typeArgumentNodes [ i ] , typeArguments [ i ] , ctxFlow , ctxTypes , typeParameterNames ) ;
817+ this . propagateInferredGenericTypes ( typeArgumentNodes [ i ] , typeArguments [ i ] , ctxElement , ctxTypes , typeParameterNames ) ;
818818 }
819819 return ;
820820 }
@@ -839,10 +839,10 @@ export class Resolver extends DiagnosticEmitter {
839839 let thisType = signatureReference . thisType ;
840840 if ( parameterTypes . length == parameterNodes . length && ! thisType == ! functionTypeNode . explicitThisType ) {
841841 for ( let i = 0 , k = parameterTypes . length ; i < k ; ++ i ) {
842- this . propagateInferredGenericTypes ( parameterNodes [ i ] . type , parameterTypes [ i ] , ctxFlow , ctxTypes , typeParameterNames ) ;
842+ this . propagateInferredGenericTypes ( parameterNodes [ i ] . type , parameterTypes [ i ] , ctxElement , ctxTypes , typeParameterNames ) ;
843843 }
844- this . propagateInferredGenericTypes ( functionTypeNode . returnType , signatureReference . returnType , ctxFlow , ctxTypes , typeParameterNames ) ;
845- if ( thisType ) this . propagateInferredGenericTypes ( functionTypeNode . explicitThisType ! , thisType , ctxFlow , ctxTypes , typeParameterNames ) ;
844+ this . propagateInferredGenericTypes ( functionTypeNode . returnType , signatureReference . returnType , ctxElement , ctxTypes , typeParameterNames ) ;
845+ if ( thisType ) this . propagateInferredGenericTypes ( functionTypeNode . explicitThisType ! , thisType , ctxElement , ctxTypes , typeParameterNames ) ;
846846 return ;
847847 }
848848 }
0 commit comments