@@ -799,11 +799,11 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
799799 InstanceCreationExpression node) {
800800 var callee = node.staticElement;
801801 var typeParameters = callee.enclosingElement.typeParameters;
802- List <DartType > typeArgumentTypes;
802+ Iterable <DartType > typeArgumentTypes;
803803 List <DecoratedType > decoratedTypeArguments;
804804 var typeArguments = node.constructorName.type.typeArguments;
805805 if (typeArguments != null ) {
806- typeArgumentTypes = typeArguments.arguments.map ((t) => t.type). toList () ;
806+ typeArgumentTypes = typeArguments.arguments.map ((t) => t.type);
807807 decoratedTypeArguments = typeArguments.arguments
808808 .map ((t) => _variables.decoratedTypeAnnotation (source, t))
809809 .toList ();
@@ -1267,15 +1267,28 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
12671267 SuperConstructorInvocation node) {
12681268 var callee = node.staticElement;
12691269 var nullabilityNode = NullabilityNode .forInferredType ();
1270- var createdType = DecoratedType (callee.returnType, nullabilityNode);
1270+ var class_ = node.thisOrAncestorOfType <ClassDeclaration >();
1271+ var decoratedSupertype = _decoratedClassHierarchy.getDecoratedSupertype (
1272+ class_.declaredElement, callee.enclosingElement);
1273+ var typeArguments = decoratedSupertype.typeArguments;
1274+ Iterable <DartType > typeArgumentTypes;
1275+ if (typeArguments != null ) {
1276+ typeArgumentTypes = typeArguments.map ((t) => t.type);
1277+ } else {
1278+ typeArgumentTypes = [];
1279+ }
1280+ var createdType = DecoratedType (callee.returnType, nullabilityNode,
1281+ typeArguments: typeArguments);
12711282 var calleeType = getOrComputeElementType (callee, targetType: createdType);
1283+ var constructorTypeParameters = callee.enclosingElement.typeParameters;
1284+
12721285 _handleInvocationArguments (
12731286 node,
12741287 node.argumentList.arguments,
1275- null /* typeArguments */ ,
1276- [] /* typeArgumentTypes */ ,
1288+ null /*typeArguments*/ ,
1289+ typeArgumentTypes,
12771290 calleeType,
1278- [] /* constructorTypeParameters */ );
1291+ constructorTypeParameters);
12791292 return null ;
12801293 }
12811294
@@ -1954,15 +1967,18 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
19541967 /// Creates the necessary constraint(s) for an [ArgumentList] when invoking an
19551968 /// executable element whose type is [calleeType] .
19561969 ///
1970+ /// Only pass [typeArguments] or [typeArgumentTypes] depending on the use
1971+ /// case; only one will be used.
1972+ ///
19571973 /// Returns the decorated return type of the invocation, after any necessary
19581974 /// substitutions.
19591975 DecoratedType _handleInvocationArguments (
19601976 AstNode node,
19611977 Iterable <AstNode > arguments,
19621978 TypeArgumentList typeArguments,
1963- List <DartType > typeArgumentTypes,
1979+ Iterable <DartType > typeArgumentTypes,
19641980 DecoratedType calleeType,
1965- List <TypeParameterElement > constructorTypeParameters,
1981+ Iterable <TypeParameterElement > constructorTypeParameters,
19661982 {DartType invokeType}) {
19671983 var typeFormals = constructorTypeParameters ?? calleeType.typeFormals;
19681984 if (typeFormals.isNotEmpty) {
0 commit comments