Version 1.23.0-dev.11.4
Cherry-pick ae22eed515a7855ee3bba3c031faab8332a5c0f4 into dev
Cherry-pick e121d95b1b168a50942a874d66247a3ff72ff892 into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d292a6b..8f0e3f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,10 @@
### Language
* Allow using URI strings in `part of` declarations to refer to the
importing library.
+ A library part now can declare its library either as:
+ `part of name.of.library;` or as `part of "uriReferenceOfLibrary.dart";`.
+ This allows libraries with no library declarations (and therefore no name)
+ to have parts, and it allows tools to easily find the library of a part file.
#### Strong Mode
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 633385c..1c5b999 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -199,7 +199,6 @@
ParameterizedType inferMapType(MapLiteral node, {bool downwards: false}) {
DartType contextType = InferenceContext.getContext(node);
-
List<DartType> elementTypes;
List<ParameterElement> parameters;
if (downwards) {
@@ -229,7 +228,9 @@
var ts = _typeSystem as StrongTypeSystemImpl;
ParameterizedType inferred = ts.inferGenericFunctionOrType(
_typeProvider.mapType, parameters, elementTypes, contextType,
- errorReporter: _resolver.errorReporter, errorNode: node);
+ downwards: downwards,
+ errorReporter: _resolver.errorReporter,
+ errorNode: node);
return inferred;
}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 30188ff..dab4bab 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -1074,6 +1074,47 @@
_isFutureOfNull(invoke.staticType);
}
+ test_generic_partial() async {
+ // Test that upward and downward type inference handles partial
+ // type schemas correctly. Downwards inference in a partial context
+ // (e.g. Map<String, ?>) should still allow upwards inference to fill
+ // in the missing information.
+ String code = r'''
+class A<T> {
+ A(T x);
+ A.fromA(A<T> a) {}
+ A.fromMap(Map<String, T> m) {}
+ A.fromList(List<T> m) {}
+ A.fromT(T t) {}
+ A.fromB(B<T, String> a) {}
+}
+
+class B<S, T> {
+ B(S s);
+}
+
+void test() {
+ var a0 = new A.fromA(new A(3));
+ var a1 = new A.fromMap({'hello' : 3});
+ var a2 = new A.fromList([3]);
+ var a3 = new A.fromT(3);
+ var a4 = new A.fromB(new B(3));
+}
+ ''';
+ CompilationUnit unit = await resolveSource(code);
+ Element elementA = AstFinder.getClass(unit, "A").element;
+ List<Statement> statements =
+ AstFinder.getStatementsInTopLevelFunction(unit, "test");
+ DartType check(int i) {
+ VariableDeclarationStatement stmt = statements[i];
+ VariableDeclaration decl = stmt.variables.variables[0];
+ Expression init = decl.initializer;
+ _isInstantiationOf(_hasElement(elementA))([_isInt])(init.staticType);
+ }
+
+ for (var i = 0; i < 5; i++) check(i);
+ }
+
test_inferConstructor_unknownTypeLowerBound() async {
Source source = addSource(r'''
class C<T> {
diff --git a/tools/VERSION b/tools/VERSION
index d829f83..f52ff92 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 23
PATCH 0
PRERELEASE 11
-PRERELEASE_PATCH 3
+PRERELEASE_PATCH 4