@@ -744,7 +744,7 @@ export class Resolver extends DiagnosticEmitter {
744
744
let typeNode = parameterNodes [ i ] . type ;
745
745
if ( typeNode . hasGenericComponent ( typeParameterNodes ) ) {
746
746
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 ) ;
748
748
}
749
749
}
750
750
@@ -795,8 +795,8 @@ export class Resolver extends DiagnosticEmitter {
795
795
node : TypeNode ,
796
796
/** The inferred type. */
797
797
type : Type ,
798
- /** Contextual flow . */
799
- ctxFlow : Flow ,
798
+ /** Contextual element . */
799
+ ctxElement : Element ,
800
800
/** Contextual types, i.e. `T`, with unknown types initialized to `auto`. */
801
801
ctxTypes : Map < string , Type > ,
802
802
/** The names of the type parameters being inferred. */
@@ -808,13 +808,13 @@ export class Resolver extends DiagnosticEmitter {
808
808
if ( typeArgumentNodes && typeArgumentNodes . length > 0 ) { // foo<T>(bar: Array<T>)
809
809
let classReference = type . classReference ;
810
810
if ( classReference ) {
811
- let classPrototype = this . resolveTypeName ( namedTypeNode . name , ctxFlow . actualFunction ) ;
811
+ let classPrototype = this . resolveTypeName ( namedTypeNode . name , ctxElement ) ;
812
812
if ( ! classPrototype || classPrototype . kind != ElementKind . CLASS_PROTOTYPE ) return ;
813
813
if ( classReference . prototype == < ClassPrototype > classPrototype ) {
814
814
let typeArguments = classReference . typeArguments ;
815
815
if ( typeArguments && typeArguments . length == typeArgumentNodes . length ) {
816
816
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 ) ;
818
818
}
819
819
return ;
820
820
}
@@ -839,10 +839,10 @@ export class Resolver extends DiagnosticEmitter {
839
839
let thisType = signatureReference . thisType ;
840
840
if ( parameterTypes . length == parameterNodes . length && ! thisType == ! functionTypeNode . explicitThisType ) {
841
841
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 ) ;
843
843
}
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 ) ;
846
846
return ;
847
847
}
848
848
}
0 commit comments