Version 2.17.0-243.0.dev
Merge commit 'e5f118d19451a9af525e963e2d4d0a3585709121' into 'dev'
diff --git a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart
index ab989d5..cbf06cd 100644
--- a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart
@@ -158,7 +158,6 @@
serverPath = normalize(join(dirname(Platform.resolvedExecutable),
'dart-sdk', 'bin', 'snapshots', 'analysis_server.dart.snapshot'));
}
- // ignore: dead_code
} else {
final rootDir =
findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
diff --git a/pkg/analysis_server/test/integration/support/integration_tests.dart b/pkg/analysis_server/test/integration/support/integration_tests.dart
index 82b7c4a1..46858e0 100644
--- a/pkg/analysis_server/test/integration/support/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/support/integration_tests.dart
@@ -639,7 +639,6 @@
'snapshots',
'analysis_server.dart.snapshot'));
}
- // ignore: dead_code
} else {
var rootDir =
findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
diff --git a/pkg/analyzer/lib/dart/analysis/features.dart b/pkg/analyzer/lib/dart/analysis/features.dart
index 211cc17..effa404 100644
--- a/pkg/analyzer/lib/dart/analysis/features.dart
+++ b/pkg/analyzer/lib/dart/analysis/features.dart
@@ -5,9 +5,6 @@
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:pub_semver/pub_semver.dart';
-// We use snake_case for these constants.
-// ignore_for_file: non_constant_identifier_names
-
/// Information about a single language feature whose presence or absence
/// depends on the supported Dart SDK version, and possibly on the presence of
/// experimental flags.
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index fcbceef..3a393c3 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -51,9 +51,6 @@
import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
import 'package:pub_semver/pub_semver.dart';
-// TODO(srawlins): Fix these in a presumably breaking change.
-// ignore_for_file: constant_identifier_names
-
/// An element that represents a class or a mixin. The class can be defined by
/// either a class declaration (with a class body), a mixin application (without
/// a class body), a mixin declaration, or an enum declaration.
diff --git a/pkg/analyzer/lib/instrumentation/log_adapter.dart b/pkg/analyzer/lib/instrumentation/log_adapter.dart
index 2199242..cd1393c 100644
--- a/pkg/analyzer/lib/instrumentation/log_adapter.dart
+++ b/pkg/analyzer/lib/instrumentation/log_adapter.dart
@@ -6,9 +6,6 @@
import 'package:analyzer/instrumentation/plugin_data.dart';
import 'package:analyzer/instrumentation/service.dart';
-// TODO(srawlins): Fix these in a presumably breaking change.
-// ignore_for_file: constant_identifier_names
-
/// A class to adapt an [InstrumentationService] into a log using an [InstrumentationLogger].
class InstrumentationLogAdapter implements InstrumentationService {
static const String TAG_ERROR = 'Err';
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index f203ac3..da1e123 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -7902,7 +7902,6 @@
///
/// typeName ::=
/// [Identifier] typeArguments? '?'?
-/// ignore: deprecated_member_use_from_same_package
class NamedTypeImpl extends TypeAnnotationImpl implements NamedType {
/// The name of the type.
IdentifierImpl _name;
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index 34aee9e..47ca3ea 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -178,15 +178,15 @@
_tryMatchSubtypeOf(declaredType, contextType, origin, covariant: true);
}
- /// Performs downwards inference, producing a set of inferred types that may
- /// contain references to the "unknown type".
- List<DartType> downwardsInfer() => _chooseTypes(downwardsInferPhase: true);
+ /// Performs partial (either downwards or horizontal) inference, producing a
+ /// set of inferred types that may contain references to the "unknown type".
+ List<DartType> partialInfer() => _chooseTypes(partial: true);
/// Same as [upwardsInfer], but if [failAtError] is `true` (the default) and
/// inference fails, returns `null` rather than trying to perform error
/// recovery.
List<DartType>? tryUpwardsInfer({bool failAtError = true}) {
- var inferredTypes = _chooseTypes(downwardsInferPhase: false);
+ var inferredTypes = _chooseTypes(partial: false);
// Check the inferred types against all of the constraints.
var knownTypes = <TypeParameterElement, DartType>{};
var hasErrorReported = false;
@@ -424,7 +424,7 @@
/// Computes (or recomputes) a set of [inferredTypes] based on the constraints
/// that have been recorded so far.
- List<DartType> _chooseTypes({required bool downwardsInferPhase}) {
+ List<DartType> _chooseTypes({required bool partial}) {
var inferredTypes = List<DartType>.filled(
_typeFormals.length, UnknownInferredType.instance);
for (int i = 0; i < _typeFormals.length; i++) {
@@ -443,7 +443,7 @@
}
var constraints = _constraints[typeParam]!;
- if (downwardsInferPhase) {
+ if (partial) {
var inferredType = _inferTypeParameterFromContext(
constraints, extendsClause,
isContravariant: typeParam.variance.isContravariant);
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
index 52fb27d..128c1cf 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
@@ -157,8 +157,8 @@
genericMetadataIsEnabled: resolver.genericMetadataIsEnabled,
);
- substitution = Substitution.fromPairs(
- rawType.typeFormals, inferrer.downwardsInfer());
+ substitution =
+ Substitution.fromPairs(rawType.typeFormals, inferrer.partialInfer());
}
List<EqualityInfo<PromotableElement, DartType>?>? identicalInfo =
@@ -174,6 +174,10 @@
substitution: substitution,
inferrer: inferrer);
if (deferredClosures != null) {
+ if (inferrer != null) {
+ substitution = Substitution.fromPairs(
+ rawType!.typeFormals, inferrer.partialInfer());
+ }
_resolveDeferredClosures(
resolver: resolver,
node: node,
diff --git a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
index 747b7f0..ad94d27 100644
--- a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
@@ -112,7 +112,7 @@
} else {
inferrer = _inferListTypeDownwards(node, contextType: contextType);
if (contextType != null) {
- var typeArguments = inferrer.downwardsInfer();
+ var typeArguments = inferrer.partialInfer();
listType = _typeProvider.listElement.instantiate(
typeArguments: typeArguments, nullabilitySuffix: _noneOrStarSuffix);
}
@@ -146,7 +146,7 @@
} else {
inferrer = _inferSetTypeDownwards(node, literalResolution.contextType);
if (literalResolution.contextType != null) {
- var typeArguments = inferrer.downwardsInfer();
+ var typeArguments = inferrer.partialInfer();
literalType = _typeProvider.setElement.instantiate(
typeArguments: typeArguments,
nullabilitySuffix: _noneOrStarSuffix);
@@ -160,7 +160,7 @@
} else {
inferrer = _inferMapTypeDownwards(node, literalResolution.contextType);
if (literalResolution.contextType != null) {
- var typeArguments = inferrer.downwardsInfer();
+ var typeArguments = inferrer.partialInfer();
literalType = _typeProvider.mapElement.instantiate(
typeArguments: typeArguments,
nullabilitySuffix: _noneOrStarSuffix);
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index f6e73c7..20996fa 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -84,11 +84,6 @@
import 'package:collection/collection.dart';
import 'package:pub_semver/pub_semver.dart';
-// Many of the super-types in this file come from 'package:_fe_analyzer_shared'
-// and we've chosen more specific / meaningful parameter names. Leaving these as
-// they are for now.
-// ignore_for_file: avoid_renaming_method_parameters
-
const _invalidCollectionElement = _InvalidCollectionElement._();
/// A parser listener that builds the analyzer's AST structure.
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart
index 209ee0f..be66958 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart
@@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../context_collection_resolution.dart';
@@ -41,6 +43,82 @@
// lead to a crash.
}
+ test_fold_inference() async {
+ var code = '''
+example(List<int> list) {
+ var a = list.fold(0, (x, y) => x + y);
+}
+''';
+ if (_isEnabled) {
+ await assertErrorsInCode(code, [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 32, 1),
+ ]);
+ assertType(findElement.localVar('a').type, 'int');
+ assertType(findElement.parameter('x').type, 'int');
+ assertType(findElement.parameter('y').type, 'int');
+ expect(
+ findNode.binary('x + y').staticElement!.enclosingElement.name, 'num');
+ } else {
+ await assertErrorsInCode(code, [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 32, 1),
+ error(
+ CompileTimeErrorCode
+ .UNCHECKED_OPERATOR_INVOCATION_OF_NULLABLE_VALUE,
+ 61,
+ 1),
+ ]);
+ }
+ }
+
+ test_horizontal_inference_propagate_to_return_type() async {
+ await assertErrorsInCode('''
+U f<T, U>(T t, U Function(T) g) => throw '';
+test() {
+ var a = f(0, (x) => [x]);
+}
+''', [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 60, 1),
+ ]);
+ assertType(findNode.methodInvocation('f(').typeArgumentTypes![0], 'int');
+ assertType(findNode.methodInvocation('f(').typeArgumentTypes![1],
+ _isEnabled ? 'List<int>' : 'List<Object?>');
+ assertType(
+ findNode.methodInvocation('f(').staticInvokeType,
+ _isEnabled
+ ? 'List<int> Function(int, List<int> Function(int))'
+ : 'List<Object?> Function(int, List<Object?> Function(int))');
+ assertType(findNode.simpleParameter('x)').declaredElement!.type,
+ _isEnabled ? 'int' : 'Object?');
+ assertType(findNode.variableDeclaration('a =').declaredElement!.type,
+ _isEnabled ? 'List<int>' : 'List<Object?>');
+ }
+
+ test_horizontal_inference_simple() async {
+ await assertNoErrorsInCode('''
+void f<T>(T t, void Function(T) g) {}
+test() => f(0, (x) {});
+''');
+ assertType(
+ findNode.methodInvocation('f(').typeArgumentTypes!.single, 'int');
+ assertType(findNode.methodInvocation('f(').staticInvokeType,
+ 'void Function(int, void Function(int))');
+ assertType(findNode.simpleParameter('x').declaredElement!.type,
+ _isEnabled ? 'int' : 'Object?');
+ }
+
+ test_horizontal_inference_simple_named() async {
+ await assertNoErrorsInCode('''
+void f<T>({required T t, required void Function(T) g}) {}
+test() => f(t: 0, g: (x) {});
+''');
+ assertType(
+ findNode.methodInvocation('f(').typeArgumentTypes!.single, 'int');
+ assertType(findNode.methodInvocation('f(').staticInvokeType,
+ 'void Function({required void Function(int) g, required int t})');
+ assertType(findNode.simpleParameter('x').declaredElement!.type,
+ _isEnabled ? 'int' : 'Object?');
+ }
+
test_write_capture_deferred() async {
await assertNoErrorsInCode('''
test(int? i) {
diff --git a/pkg/compiler/test/analyses/analysis_helper.dart b/pkg/compiler/test/analyses/analysis_helper.dart
index fecbbef..f7a975c 100644
--- a/pkg/compiler/test/analyses/analysis_helper.dart
+++ b/pkg/compiler/test/analyses/analysis_helper.dart
@@ -4,6 +4,7 @@
// @dart = 2.7
+import 'dart:collection' show SplayTreeMap;
import 'dart:convert' as json;
import 'dart:io';
@@ -170,10 +171,10 @@
}
component.accept(this);
if (generate && _allowedListPath != null) {
- Map<String, Map<String, int>> actualJson = {};
+ Map<String, Map<String, int>> actualJson = SplayTreeMap();
_actualMessages.forEach(
(String uri, Map<String, List<DiagnosticMessage>> actualMessagesMap) {
- Map<String, int> map = {};
+ Map<String, int> map = SplayTreeMap();
actualMessagesMap
.forEach((String message, List<DiagnosticMessage> actualMessages) {
map[message] = actualMessages.length;
@@ -181,8 +182,8 @@
actualJson[uri] = map;
});
- new File(_allowedListPath).writeAsStringSync(
- new json.JsonEncoder.withIndent(' ').convert(actualJson));
+ File(_allowedListPath).writeAsStringSync(
+ json.JsonEncoder.withIndent(' ').convert(actualJson));
return;
}
diff --git a/pkg/compiler/test/analyses/dart2js_allowed.json b/pkg/compiler/test/analyses/dart2js_allowed.json
index 118826f..da1fbe1 100644
--- a/pkg/compiler/test/analyses/dart2js_allowed.json
+++ b/pkg/compiler/test/analyses/dart2js_allowed.json
@@ -1,129 +1,129 @@
{
+ "pkg/compiler/lib/src/constants/constant_system.dart": {
+ "Dynamic invocation of '%'.": 1,
+ "Dynamic invocation of '&'.": 1,
+ "Dynamic invocation of '*'.": 1,
+ "Dynamic invocation of '+'.": 1,
+ "Dynamic invocation of '-'.": 1,
+ "Dynamic invocation of '/'.": 1,
+ "Dynamic invocation of '<'.": 1,
+ "Dynamic invocation of '<<'.": 1,
+ "Dynamic invocation of '<='.": 1,
+ "Dynamic invocation of '>'.": 1,
+ "Dynamic invocation of '>='.": 1,
+ "Dynamic invocation of '>>'.": 1,
+ "Dynamic invocation of '^'.": 1,
+ "Dynamic invocation of 'codeUnitAt'.": 1,
+ "Dynamic invocation of 'remainder'.": 1,
+ "Dynamic invocation of '|'.": 1,
+ "Dynamic invocation of '~/'.": 1
+ },
"pkg/compiler/lib/src/dart2js.dart": {
"Dynamic invocation of 'call'.": 1,
- "Dynamic invocation of 'resume'.": 1,
- "Dynamic invocation of 'pause'.": 1
- },
- "pkg/compiler/lib/src/util/maplet.dart": {
- "Dynamic access of 'isEmpty'.": 1,
- "Dynamic access of 'length'.": 1,
- "Dynamic invocation of 'containsKey'.": 1,
- "Dynamic invocation of '[]'.": 11,
- "Dynamic invocation of '[]='.": 12,
- "Dynamic invocation of '+'.": 2,
- "Dynamic invocation of '<'.": 1,
- "Dynamic invocation of 'remove'.": 1,
- "Dynamic invocation of '-'.": 1,
- "Dynamic invocation of 'forEach'.": 1,
- "Dynamic access of 'keys'.": 1,
- "Dynamic access of 'iterator'.": 1
- },
- "pkg/compiler/lib/src/util/setlet.dart": {
- "Dynamic access of 'iterator'.": 1,
- "Dynamic access of 'length'.": 1,
- "Dynamic access of 'isEmpty'.": 1,
- "Dynamic invocation of 'contains'.": 1,
- "Dynamic invocation of '[]'.": 7,
- "Dynamic invocation of 'add'.": 1,
- "Dynamic invocation of '[]='.": 6,
- "Dynamic invocation of '+'.": 2,
- "Dynamic invocation of '<'.": 1,
- "Dynamic invocation of 'lookup'.": 1,
- "Dynamic invocation of 'remove'.": 1,
- "Dynamic invocation of '-'.": 2,
- "Dynamic invocation of 'removeWhere'.": 1,
- "Dynamic invocation of 'forEach'.": 1,
- "Dynamic invocation of 'toSet'.": 1,
- "Dynamic invocation of 'toList'.": 1
+ "Dynamic invocation of 'pause'.": 1,
+ "Dynamic invocation of 'resume'.": 1
},
"pkg/compiler/lib/src/deferred_load/deferred_load.dart": {
"Dynamic access of 'memberContext'.": 1,
"Dynamic access of 'name'.": 1
},
+ "pkg/compiler/lib/src/inferrer/locals_handler.dart": {
+ "Dynamic access of 'length'.": 2,
+ "Dynamic access of 'named'.": 2,
+ "Dynamic access of 'positional'.": 2,
+ "Dynamic invocation of '[]'.": 2
+ },
+ "pkg/compiler/lib/src/inferrer/type_graph_nodes.dart": {
+ "Dynamic access of 'type'.": 4,
+ "Dynamic invocation of 'add'.": 1,
+ "Dynamic invocation of 'remove'.": 1
+ },
"pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart": {
- "Dynamic access of 'isForwarding'.": 1,
- "Dynamic access of 'forwardTo'.": 1
- },
- "pkg/compiler/lib/src/serialization/binary_sink.dart": {
- "Dynamic access of 'index'.": 1
- },
- "pkg/compiler/lib/src/util/enumset.dart": {
- "Dynamic access of 'index'.": 4
- },
- "pkg/compiler/lib/src/constants/constant_system.dart": {
- "Dynamic invocation of '&'.": 1,
- "Dynamic invocation of '|'.": 1,
- "Dynamic invocation of '^'.": 1,
- "Dynamic invocation of '<<'.": 1,
- "Dynamic invocation of '>>'.": 1,
- "Dynamic invocation of '-'.": 1,
- "Dynamic invocation of '*'.": 1,
- "Dynamic invocation of '%'.": 1,
- "Dynamic invocation of 'remainder'.": 1,
- "Dynamic invocation of '~/'.": 1,
- "Dynamic invocation of '/'.": 1,
- "Dynamic invocation of '+'.": 1,
- "Dynamic invocation of '<'.": 1,
- "Dynamic invocation of '<='.": 1,
- "Dynamic invocation of '>'.": 1,
- "Dynamic invocation of '>='.": 1,
- "Dynamic invocation of 'codeUnitAt'.": 1
- },
- "pkg/dart2js_info/lib/json_info_codec.dart": {
- "Dynamic invocation of '[]'.": 12,
- "Dynamic invocation of 'forEach'.": 2,
- "Dynamic invocation of 'map'.": 2,
- "Dynamic invocation of 'compareTo'.": 1
- },
- "pkg/dart2js_info/lib/binary_serialization.dart": {
- "Dynamic invocation of 'cast'.": 1
- },
- "pkg/js_ast/lib/src/builder.dart": {
- "Dynamic invocation of 'call'.": 2
- },
- "pkg/js_ast/lib/src/template.dart": {
- "Dynamic access of 'length'.": 1,
- "Dynamic access of 'keys'.": 1,
- "Dynamic invocation of 'where'.": 1,
- "Dynamic invocation of 'join'.": 1,
- "Dynamic invocation of 'containsKey'.": 2,
- "Dynamic invocation of '[]'.": 9,
- "Dynamic invocation of 'toStatement'.": 3
+ "Dynamic access of 'forwardTo'.": 1,
+ "Dynamic access of 'isForwarding'.": 1
},
"pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart": {
"Dynamic invocation of '[]='.": 1,
"Dynamic invocation of 'add'.": 1
},
+ "pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart": {
+ "Dynamic access of 'needsTearOff'.": 1,
+ "Dynamic access of 'superclass'.": 1
+ },
"pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_merger.dart": {
"Dynamic invocation of '[]='.": 1
},
+ "pkg/compiler/lib/src/serialization/binary_sink.dart": {
+ "Dynamic access of 'index'.": 1
+ },
+ "pkg/compiler/lib/src/ssa/value_range_analyzer.dart": {
+ "Dynamic access of 'isZero'.": 2,
+ "Dynamic invocation of '+'.": 2,
+ "Dynamic invocation of 'max'.": 1,
+ "Dynamic invocation of 'min'.": 1,
+ "Dynamic invocation of 'unary-'.": 1
+ },
+ "pkg/compiler/lib/src/util/enumset.dart": {
+ "Dynamic access of 'index'.": 4
+ },
+ "pkg/compiler/lib/src/util/maplet.dart": {
+ "Dynamic access of 'isEmpty'.": 1,
+ "Dynamic access of 'iterator'.": 1,
+ "Dynamic access of 'keys'.": 1,
+ "Dynamic access of 'length'.": 1,
+ "Dynamic invocation of '+'.": 2,
+ "Dynamic invocation of '-'.": 1,
+ "Dynamic invocation of '<'.": 1,
+ "Dynamic invocation of '[]'.": 11,
+ "Dynamic invocation of '[]='.": 12,
+ "Dynamic invocation of 'containsKey'.": 1,
+ "Dynamic invocation of 'forEach'.": 1,
+ "Dynamic invocation of 'remove'.": 1
+ },
+ "pkg/compiler/lib/src/util/setlet.dart": {
+ "Dynamic access of 'isEmpty'.": 1,
+ "Dynamic access of 'iterator'.": 1,
+ "Dynamic access of 'length'.": 1,
+ "Dynamic invocation of '+'.": 2,
+ "Dynamic invocation of '-'.": 2,
+ "Dynamic invocation of '<'.": 1,
+ "Dynamic invocation of '[]'.": 7,
+ "Dynamic invocation of '[]='.": 6,
+ "Dynamic invocation of 'add'.": 1,
+ "Dynamic invocation of 'contains'.": 1,
+ "Dynamic invocation of 'forEach'.": 1,
+ "Dynamic invocation of 'lookup'.": 1,
+ "Dynamic invocation of 'remove'.": 1,
+ "Dynamic invocation of 'removeWhere'.": 1,
+ "Dynamic invocation of 'toList'.": 1,
+ "Dynamic invocation of 'toSet'.": 1
+ },
+ "pkg/dart2js_info/lib/binary_serialization.dart": {
+ "Dynamic invocation of 'cast'.": 1
+ },
+ "pkg/dart2js_info/lib/json_info_codec.dart": {
+ "Dynamic invocation of '[]'.": 12,
+ "Dynamic invocation of 'compareTo'.": 1,
+ "Dynamic invocation of 'forEach'.": 2,
+ "Dynamic invocation of 'map'.": 2
+ },
+ "pkg/dart2js_info/lib/src/binary/sink.dart": {
+ "Dynamic access of 'index'.": 1
+ },
"pkg/dart2js_info/lib/src/util.dart": {
"Dynamic access of 'name'.": 1,
"Dynamic invocation of '-'.": 1
},
- "pkg/dart2js_info/lib/src/binary/sink.dart": {
- "Dynamic access of 'index'.": 1
+ "pkg/js_ast/lib/src/builder.dart": {
+ "Dynamic invocation of 'call'.": 2
},
- "pkg/compiler/lib/src/inferrer/type_graph_nodes.dart": {
- "Dynamic invocation of 'add'.": 1,
- "Dynamic invocation of 'remove'.": 1,
- "Dynamic access of 'type'.": 4
- },
- "pkg/compiler/lib/src/inferrer/locals_handler.dart": {
- "Dynamic access of 'positional'.": 2,
- "Dynamic access of 'length'.": 2,
- "Dynamic access of 'named'.": 2,
- "Dynamic invocation of '[]'.": 2
- },
- "pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart": {
- "Dynamic access of 'superclass'.": 1,
- "Dynamic access of 'needsTearOff'.": 1
- },
- "pkg/compiler/lib/src/ssa/value_range_analyzer.dart": {
- "Dynamic access of 'isZero'.": 2,
- "Dynamic invocation of '+'.": 2,
- "Dynamic invocation of 'unary-'.": 1,
- "Dynamic invocation of 'min'.": 1,
- "Dynamic invocation of 'max'.": 1
+ "pkg/js_ast/lib/src/template.dart": {
+ "Dynamic access of 'keys'.": 1,
+ "Dynamic access of 'length'.": 1,
+ "Dynamic invocation of '[]'.": 9,
+ "Dynamic invocation of 'containsKey'.": 2,
+ "Dynamic invocation of 'join'.": 1,
+ "Dynamic invocation of 'toStatement'.": 3,
+ "Dynamic invocation of 'where'.": 1
}
-}
+}
\ No newline at end of file
diff --git a/pkg/dev_compiler/lib/src/js_ast/js_ast.dart b/pkg/dev_compiler/lib/src/js_ast/js_ast.dart
index 8cb165e..d059a14 100644
--- a/pkg/dev_compiler/lib/src/js_ast/js_ast.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/js_ast.dart
@@ -5,7 +5,6 @@
// @dart = 2.9
// ignore_for_file: directives_ordering
-// ignore_for_file: library_prefixes
library js_ast;
diff --git a/pkg/vm_service/test/breakpoint_in_enhanced_enums_test.dart b/pkg/vm_service/test/breakpoint_in_enhanced_enums_test.dart
index ebedeeb..2383312 100644
--- a/pkg/vm_service/test/breakpoint_in_enhanced_enums_test.dart
+++ b/pkg/vm_service/test/breakpoint_in_enhanced_enums_test.dart
@@ -4,13 +4,12 @@
//
// SharedOptions=--enable-experiment=enhanced-enums
-// ignore_for_file: experiment_not_enabled
// @dart=2.17
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
-const int LINE_A = 24;
+const int LINE_A = 23;
const int LINE_B = LINE_A + 11;
const int LINE_C = LINE_B + 4;
const int LINE_D = LINE_C + 4;
diff --git a/pkg/vm_service/test/developer_extension_test.dart b/pkg/vm_service/test/developer_extension_test.dart
index baa5115..ca5aee8 100644
--- a/pkg/vm_service/test/developer_extension_test.dart
+++ b/pkg/vm_service/test/developer_extension_test.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
-// ignore: import_of_legacy_library_into_null_safe
import 'package:expect/expect.dart';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
diff --git a/pkg/vm_service/test/enhanced_enum_test.dart b/pkg/vm_service/test/enhanced_enum_test.dart
index 633caa5..bde5221 100644
--- a/pkg/vm_service/test/enhanced_enum_test.dart
+++ b/pkg/vm_service/test/enhanced_enum_test.dart
@@ -4,7 +4,6 @@
//
// SharedOptions=--enable-experiment=enhanced-enums
-// ignore_for_file: experiment_not_enabled
// @dart=2.17
import 'dart:developer';
diff --git a/pkg/vm_service/test/super_constructor_invocation_test.dart b/pkg/vm_service/test/super_constructor_invocation_test.dart
index 7a0d300..ae8239f 100644
--- a/pkg/vm_service/test/super_constructor_invocation_test.dart
+++ b/pkg/vm_service/test/super_constructor_invocation_test.dart
@@ -4,7 +4,6 @@
//
// SharedOptions=--enable-experiment=super-parameters
-// ignore_for_file: experiment_not_enabled
// @dart=2.17
import 'dart:developer';
@@ -40,7 +39,6 @@
}
class B<T> extends R<T> {
- // ignore: no_default_super_constructor
B(super.f1, super.v1, super.i1, super.t1) {
debugger();
}
diff --git a/tests/language/inference_update_1/horizontal_inference_disabled_test.dart b/tests/language/inference_update_1/horizontal_inference_disabled_test.dart
new file mode 100644
index 0000000..e335aee
--- /dev/null
+++ b/tests/language/inference_update_1/horizontal_inference_disabled_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Tests that when the feature is disabled, inferred types do not flow
+// "horizontally" from a non-closure argument of an invocation to a closure
+// argument.
+
+// @dart=2.17
+
+import '../static_type_helper.dart';
+
+testLaterUnnamedParameter(void Function<T>(T, void Function(T)) f) {
+ f(0, (x) {
+ x.expectStaticType<Exactly<Object?>>();
+ });
+}
+
+testEarlierUnnamedParameter(void Function<T>(void Function(T), T) f) {
+ f((x) {
+ x.expectStaticType<Exactly<Object?>>();
+ }, 0);
+}
+
+testLaterNamedParameter(
+ void Function<T>({required T a, required void Function(T) b}) f) {
+ f(
+ a: 0,
+ b: (x) {
+ x.expectStaticType<Exactly<Object?>>();
+ });
+}
+
+testEarlierNamedParameter(
+ void Function<T>({required void Function(T) a, required T b}) f) {
+ f(
+ a: (x) {
+ x.expectStaticType<Exactly<Object?>>();
+ },
+ b: 0);
+}
+
+testPropagateToReturnType(U Function<T, U>(T, U Function(T)) f) {
+ f(0, (x) => [x]).expectStaticType<Exactly<List<Object?>>>();
+}
+
+main() {}
diff --git a/tests/language/inference_update_1/horizontal_inference_enabled_test.dart b/tests/language/inference_update_1/horizontal_inference_enabled_test.dart
new file mode 100644
index 0000000..fc18f0f
--- /dev/null
+++ b/tests/language/inference_update_1/horizontal_inference_enabled_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Tests that when the feature is enabled, inferred types can flow
+// "horizontally" from a non-closure argument of an invocation to a closure
+// argument.
+
+// SharedOptions=--enable-experiment=inference-update-1
+
+import '../static_type_helper.dart';
+
+testLaterUnnamedParameter(void Function<T>(T, void Function(T)) f) {
+ f(0, (x) {
+ x.expectStaticType<Exactly<int>>();
+ });
+}
+
+testEarlierUnnamedParameter(void Function<T>(void Function(T), T) f) {
+ f((x) {
+ x.expectStaticType<Exactly<int>>();
+ }, 0);
+}
+
+testLaterNamedParameter(
+ void Function<T>({required T a, required void Function(T) b}) f) {
+ f(
+ a: 0,
+ b: (x) {
+ x.expectStaticType<Exactly<int>>();
+ });
+}
+
+testEarlierNamedParameter(
+ void Function<T>({required void Function(T) a, required T b}) f) {
+ f(
+ a: (x) {
+ x.expectStaticType<Exactly<int>>();
+ },
+ b: 0);
+}
+
+testPropagateToReturnType(U Function<T, U>(T, U Function(T)) f) {
+ f(0, (x) => [x]).expectStaticType<Exactly<List<int>>>();
+}
+
+testFold(List<int> list) {
+ var a = list.fold(
+ 0,
+ (x, y) =>
+ (x..expectStaticType<Exactly<int>>()) +
+ (y..expectStaticType<Exactly<int>>()));
+ a.expectStaticType<Exactly<int>>();
+}
+
+main() {}
diff --git a/tools/VERSION b/tools/VERSION
index f0cd312..cc9989e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 242
+PRERELEASE 243
PRERELEASE_PATCH 0
\ No newline at end of file