| Index: pkg/analyzer/lib/src/summary/resynthesize.dart
|
| diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
|
| index fc1054f97072d868676287603796e11170c4a122..b3f32cda59e956432f621e97ecfe8babf2e68a28 100644
|
| --- a/pkg/analyzer/lib/src/summary/resynthesize.dart
|
| +++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
|
| @@ -1229,6 +1229,9 @@ class _ReferenceInfo {
|
| */
|
| final int numTypeParameters;
|
|
|
| + bool _isBeingInstantiatedToBounds = false;
|
| + bool _isRecursiveWhileInstantiateToBounds = false;
|
| +
|
| /**
|
| * Create a new [_ReferenceInfo] object referring to an element called [name]
|
| * via the element handle [element], and having [numTypeParameters] type
|
| @@ -1262,6 +1265,9 @@ class _ReferenceInfo {
|
| return _type;
|
| }
|
|
|
| + List<DartType> get _dynamicTypeArguments =>
|
| + new List<DartType>.filled(numTypeParameters, DynamicTypeImpl.instance);
|
| +
|
| /**
|
| * Build a [DartType] corresponding to the result of applying some type
|
| * arguments to the entity referred to by this [_ReferenceInfo]. The type
|
| @@ -1322,8 +1328,7 @@ class _ReferenceInfo {
|
| .instantiateToBounds(element.type) as InterfaceType;
|
| return instantiatedToBounds.typeArguments;
|
| } else {
|
| - return new List<DartType>.filled(
|
| - numTypeParameters, DynamicTypeImpl.instance);
|
| + return _dynamicTypeArguments;
|
| }
|
| }
|
| return typeArguments;
|
| @@ -1348,13 +1353,27 @@ class _ReferenceInfo {
|
| _buildTypeArguments(numTypeArguments, getTypeArgument);
|
| } else if (libraryResynthesizer.summaryResynthesizer.strongMode &&
|
| instantiateToBoundsAllowed) {
|
| - FunctionType instantiatedToBounds = libraryResynthesizer
|
| - .summaryResynthesizer.context.typeSystem
|
| - .instantiateToBounds(element.type) as FunctionType;
|
| - typeArguments = instantiatedToBounds.typeArguments;
|
| + if (!_isBeingInstantiatedToBounds) {
|
| + _isBeingInstantiatedToBounds = true;
|
| + _isRecursiveWhileInstantiateToBounds = false;
|
| + try {
|
| + FunctionType instantiatedToBounds = libraryResynthesizer
|
| + .summaryResynthesizer.context.typeSystem
|
| + .instantiateToBounds(element.type) as FunctionType;
|
| + if (!_isRecursiveWhileInstantiateToBounds) {
|
| + typeArguments = instantiatedToBounds.typeArguments;
|
| + } else {
|
| + typeArguments = _dynamicTypeArguments;
|
| + }
|
| + } finally {
|
| + _isBeingInstantiatedToBounds = false;
|
| + }
|
| + } else {
|
| + _isRecursiveWhileInstantiateToBounds = true;
|
| + typeArguments = _dynamicTypeArguments;
|
| + }
|
| } else {
|
| - typeArguments = new List<DartType>.filled(
|
| - numTypeParameters, DynamicTypeImpl.instance);
|
| + typeArguments = _dynamicTypeArguments;
|
| }
|
| return new FunctionTypeImpl.elementWithNameAndArgs(
|
| element, name, typeArguments, numTypeParameters != 0);
|
|
|