Version 1.20.0-dev.10.1
Cherry-pick b0d8f475635b4fcfd613aa6090034adcc2a294dc into dev
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 4118d8d..9cb2c7b 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -8130,21 +8130,6 @@
List<UnlinkedTypeParam> get unlinkedTypeParams;
/**
- * Determine the default value of type argument [i]. in most cases this will
- * be `dynamic`, but sometimes it will be the bound of the ith type parameter.
- */
- DartType computeDefaultTypeArgument(int i) {
- // If strong mode is off, or we can tell quickly from the summary that there
- // is no bound, then the default type argument is `dynamic`; we don't have
- // to call `typeParameters` to find that out.
- if (!context.analysisOptions.strongMode ||
- (unlinkedTypeParams != null && unlinkedTypeParams[i].bound == null)) {
- return DynamicTypeImpl.instance;
- }
- return typeParameters[i].bound ?? DynamicTypeImpl.instance;
- }
-
- /**
* Convert the given [index] into a type parameter type.
*/
TypeParameterType getTypeParameterType(int index) {
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 41b01150..42f2994 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -606,14 +606,14 @@
DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) {
int numTypeParameters = _unlinkedClass.typeParameters.length;
if (numTypeParameters != 0) {
- return new InterfaceTypeImpl.elementWithNameAndArgs(this, name, () {
- List<DartType> typeArguments = new List<DartType>(numTypeParameters);
- for (int i = 0; i < numTypeParameters; i++) {
- typeArguments[i] =
- getTypeArgument(i) ?? computeDefaultTypeArgument(i);
- }
- return typeArguments;
- });
+ List<DartType> typeArguments =
+ new List<DartType>.generate(numTypeParameters, getTypeArgument);
+ if (typeArguments.contains(null)) {
+ return context.typeSystem.instantiateToBounds(this.type);
+ } else {
+ return new InterfaceTypeImpl.elementWithNameAndArgs(
+ this, name, () => typeArguments);
+ }
} else {
return _type ??= new InterfaceTypeImpl(this);
}
@@ -3177,12 +3177,15 @@
DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) {
int numTypeParameters = _unlinkedTypedef.typeParameters.length;
if (numTypeParameters != 0) {
- List<DartType> typeArguments = new List<DartType>(numTypeParameters);
- for (int i = 0; i < numTypeParameters; i++) {
- typeArguments[i] = getTypeArgument(i) ?? computeDefaultTypeArgument(i);
+ List<DartType> typeArguments =
+ new List<DartType>.generate(numTypeParameters, getTypeArgument);
+ if (typeArguments.contains(null)) {
+ return context.typeSystem
+ .instantiateToBounds(new FunctionTypeImpl.forTypedef(this));
+ } else {
+ return new FunctionTypeImpl.elementWithNameAndArgs(
+ this, name, typeArguments, true);
}
- return new FunctionTypeImpl.elementWithNameAndArgs(
- this, name, typeArguments, true);
} else {
return _type ??= new FunctionTypeImpl.forTypedef(this);
}
@@ -4407,6 +4410,9 @@
*/
TypeInferenceNode get asTypeInferenceNode => null;
+ @override
+ ElementLocation get location => new ElementLocationImpl.con1(this);
+
/**
* Return the type indicated by this element when it is used in a
* type instantiation context. If this element can't legally be
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
index 126abe5..d547b6b 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
@@ -154,12 +154,6 @@
@override
@failingTest
- void test_constructors_inferenceFBounded() {
- super.test_constructors_inferenceFBounded();
- }
-
- @override
- @failingTest
void test_constructors_inferFromArguments() {
// TODO(jmesserly): does this need to be implemented in AST summaries?
// The test might need a change as well to not be based on local variable
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index aeebef5..88b8985 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -3578,6 +3578,10 @@
checkLibrary('''
class C<T extends C<T>> {}
C c;
+var c2 = new C();
+class B {
+ var c3 = new C();
+}
''');
}
diff --git a/tools/VERSION b/tools/VERSION
index d6fd7e3..42a48fd 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 20
PATCH 0
PRERELEASE 10
-PRERELEASE_PATCH 0
+PRERELEASE_PATCH 1