| Index: pkg/analyzer/test/src/summary/summary_common.dart
|
| diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
|
| index cfde5e914235cb605781ff1f3de86bad8442111f..3768185d4c2acc5bf93e3344f65e6f451fbec5cf 100644
|
| --- a/pkg/analyzer/test/src/summary/summary_common.dart
|
| +++ b/pkg/analyzer/test/src/summary/summary_common.dart
|
| @@ -7298,6 +7298,21 @@ p.B b;
|
| expect(unlinkedUnits[0].imports[0].uri, 'dart:async');
|
| }
|
|
|
| + test_inferred_type_keeps_leading_dynamic() {
|
| + if (!strongMode || skipFullyLinkedData) {
|
| + return;
|
| + }
|
| + UnlinkedClass cls =
|
| + serializeClassText('class C { final x = <dynamic, int>{}; }');
|
| + EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot);
|
| + // Check that x has inferred type `Map<dynamic, int>`.
|
| + checkLinkedTypeRef(type, 'dart:core', 'dart:core', 'Map',
|
| + allowTypeArguments: true, numTypeParameters: 2);
|
| + expect(type.typeArguments, hasLength(2));
|
| + checkLinkedTypeRef(type.typeArguments[0], null, null, 'dynamic');
|
| + checkLinkedTypeRef(type.typeArguments[1], 'dart:core', 'dart:core', 'int');
|
| + }
|
| +
|
| test_inferred_type_refers_to_bound_type_param() {
|
| if (!strongMode || skipFullyLinkedData) {
|
| return;
|
| @@ -7435,6 +7450,32 @@ p.B b;
|
| checkReferenceIndex(linkedReference.containingReference, null, null, 'D');
|
| }
|
|
|
| + test_inferred_type_skips_trailing_dynamic() {
|
| + if (!strongMode || skipFullyLinkedData) {
|
| + return;
|
| + }
|
| + UnlinkedClass cls =
|
| + serializeClassText('class C { final x = <int, dynamic>{}; }');
|
| + EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot);
|
| + // Check that x has inferred type `Map<int>`. The trailing type argument
|
| + // `dynamic` is omitted.
|
| + checkLinkedTypeRef(type, 'dart:core', 'dart:core', 'Map',
|
| + allowTypeArguments: true, numTypeParameters: 2);
|
| + expect(type.typeArguments, hasLength(1));
|
| + checkLinkedTypeRef(type.typeArguments[0], 'dart:core', 'dart:core', 'int');
|
| + }
|
| +
|
| + test_inferred_type_skips_unnecessary_dynamic() {
|
| + if (!strongMode || skipFullyLinkedData) {
|
| + return;
|
| + }
|
| + UnlinkedClass cls = serializeClassText('class C { final x = []; }');
|
| + EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot);
|
| + // Check that x has inferred type `List`, not `List<dynamic>`.
|
| + checkLinkedTypeRef(type, 'dart:core', 'dart:core', 'List',
|
| + numTypeParameters: 1);
|
| + }
|
| +
|
| test_initializer_executable_with_bottom_return_type() {
|
| // The synthetic executable for `v` has type `() => Bottom`.
|
| UnlinkedVariable variable = serializeVariableText('int v = null;');
|
|
|