Skip to content

Commit

Permalink
Version 3.6.0-17.0.dev
Browse files Browse the repository at this point in the history
Merge b5d6c50 into dev
  • Loading branch information
Dart CI committed Jul 9, 2024
2 parents 0ecada9 + b5d6c50 commit 80f799b
Show file tree
Hide file tree
Showing 27 changed files with 1,567 additions and 1,269 deletions.
38 changes: 19 additions & 19 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ vars = {
# EOL comment after a dependency to disable this and pin it at its current
# revision.

"args_rev": "6a5a2e6b1f0020b873c7ffbdd36a784c4f9ee300",
"args_rev": "1a24d614423e7861ae2e341bfb19050959cef0cd",
"async_rev": "c0d81f8699682d01d657a9bf827107d11904a247",
"bazel_worker_rev": "c76d7c86381a6ed594641ba03b55c65b84ee11a6",
"benchmark_harness_rev": "f6ef33dc88d7cbc9e4a8a087f1e652eb0d6cc254",
"bazel_worker_rev": "02f190b88df771fc8e05c07d4b64ae942c02f456",
"benchmark_harness_rev": "a06785cdfc51538e3556c1d59bb4f03426e9e1c5",
"boolean_selector_rev": "c5468f44fd9ca0ea3435e1a0a84ff9b6fac38261",
"browser_launcher_rev": "60126904a26b761d29b4f2d76292ff3c089160de",
"characters_rev": "7633a16a22c626e19ca750223237396315268a06",
"cli_util_rev": "64192706344d0598784bebe1abc4a9bfc2608de0",
"clock_rev": "ad428ea8b75fa0d7ba629791552d40478745c54a",
"collection_rev": "9354f386de3c57f5486b01ab4dfa1a2f033307d9",
"collection_rev": "0c1f829c29da1d63488be774f430b2035a565d6f",
"convert_rev": "9035cafefc1da4315f26058734d0c2a19d5ab56a",
"crypto_rev": "1216790ba704a0ab194f9cd0da2d65e1767f3342",
"csslib_rev": "192d720f121792ab05ca157ea280edc7e0410e9c",
Expand All @@ -145,44 +145,44 @@ vars = {
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
"dart_style_rev": "a6ad7693555a9add6f98ad6fd94de80d35c89415", # disable tools/rev_sdk_deps.dart
"dartdoc_rev": "7e5da6090e6a48cebaee8789ca0fc396b34fd8a4", # https://github.com/dart-lang/dartdoc/issues/3808
"ecosystem_rev": "54ca01abe4b7b62419ee88814d3dc98df36ff8ff",
"file_rev": "07cacaed6679a173e29176747e6ce0325742749f",
"ecosystem_rev": "4171189c0dd0f5e02426fcded7d1fa2d09be6133",
"file_rev": "855831c242a17c2dee163828d52710d9043c7c8d",
"fixnum_rev": "6c19e60366ce3d5edfaed51a7c12c98e7977977e",
"flute_rev": "a531c96a8b43d015c6bfbbfe3ab54867b0763b8b",
"glob_rev": "6d3ba5ec02817e62d17ace040590bb81a3e1242f",
"glob_rev": "8b05be87f84f74d90dc0c15956f3ff95805322e5",
"html_rev": "0da420ca1e196cda54ede476d0d8d3ecf55375ef",
"http_rev": "8d893851904d8cd292a66e39812b59aca2cc4d96",
"http_multi_server_rev": "25941e260658efb324de857e6022f418faf9bdd1",
"http_parser_rev": "9bf7bd981a39137da1e5d7fe64f4652b078c7aa9",
"http_rev": "4178b67e7970ff02926e79649db5ab473b46cf30",
"http_multi_server_rev": "8348be1bf8fd17881e2643086e68c9d2b28dd9ce",
"http_parser_rev": "ce528cf82f3d26ac761e29b2494a9e0c270d4939",
"intl_rev": "5d65e3808ce40e6282e40881492607df4e35669f",
"json_rpc_2_rev": "616937f6d3837e38a2a287653ddaf722de260702",
"json_rpc_2_rev": "b4810dc7bee5828f240586c81f3f34853cacdbce",
"leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # manually rolled
"lints_rev": "f6b5d36485f6f067ac0f5a7193006ebe82ee6113",
"logging_rev": "6c3fb37fecb2e30415072f327b834a3e95517fa9",
"logging_rev": "8752902b75a476d2c7b64dcf01aaaee885f35c4c",
"markdown_rev": "62424376d0b5fe35a2957b3caed4b75db010ba82",
"matcher_rev": "d6d573d0f8d65b36550ce62aad3ce6b5e987b642",
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
"mime_rev": "11fec7d6df509a4efd554051cc27e3bf82df9c96",
"mockito_rev": "a7fdf7101fbd31132a59188a6057d21004345927",
"mockito_rev": "eb4d1daa20c105c94ac29689c1975f0850fa18f2",
"native_rev": "cd8eddf8ad5b953127acf884f2b8a614482a8b0f", # mosum@ and dacoharkes@ are rolling breaking changes manually while the assets features are in experimental.
"package_config_rev": "903a0e528f91aef90821c8f5eaafbc1ae27198ab",
"package_config_rev": "f0b72567d85b827aa0f53991fe8a4a8bf36eb479",
"path_rev": "e969f42ed112dd702a9453beb9df6c12ae2d3805",
"pool_rev": "924fb04353cec915d927f9f1aed88e2eda92b98a",
"protobuf_rev": "ccf104dbc36929c0f8708285d5f3a8fae206343e",
"pub_rev": "ea4a1c854690d3abceb92c8cc2c6454470f9d5a7", # disable tools/rev_sdk_deps.dart
"pub_semver_rev": "d9e5ee68a350fbf4319bd4dfcb895fc016337d3a",
"shelf_rev": "9f2dffecbe8f219146a077e401758602752d486a",
"source_map_stack_trace_rev": "741b6ceb4b6cdb8ff620664337d7ecc63ca52cc1",
"source_maps_rev": "caa79c2011015759c6cf3299f299f5cccdf8bb61",
"source_span_rev": "89520f3009e332ce2b6675f71dca166521c36cc4",
"source_maps_rev": "5f82c613664ade03c7a6d0e6c59687c69dec894b",
"source_span_rev": "f81cd4a2df630a97264fb4015fb93944b5b98b11",
"sse_rev": "52d042ff9ab2d0e5bc26805d74a03077a67861e1",
"stack_trace_rev": "4fd3e2a2dc6611febf4cfb9197ebf9e60fc6a34d",
"stream_channel_rev": "28a65331aa2d66a5e953205aa462bcdb1e240a5b",
"string_scanner_rev": "0de03b5279a04aa05052ce306f90fca473c6fd1a",
"sync_http_rev": "7622bdd07501f3f279212e355325b7c84a2b0a08",
"sync_http_rev": "ab8377eba79baff3d77e8c75d502efc2b85a9342",
"tar_rev": "552a49d7595e444184d4f91e9afd533aa253a31d",
"term_glyph_rev": "38a158f55006cf30942c928171ea601ee5e0308f",
"test_rev": "3256c23cc753a184bb3bf27610a7c8410735e3ac",
"test_rev": "14f9b3ec7e06f987dd70bb1f47267462ce218048",
"test_descriptor_rev": "90743bc16bc00526a1b9a64f813614be9b2479d9",
"test_process_rev": "6223572ca16d7585d5f08d9281de6a5734e45150",
"test_reflective_loader_rev": "6e648863b39aab8d0204e769d25805eea9db0ac4",
Expand All @@ -196,7 +196,7 @@ vars = {
"webdriver_rev": "718e4c37d004fceb9856de980782c46bf9576df5",
"webkit_inspection_protocol_rev": "32fffa53df3f54005c742ddf4f859fb585a6b254",
"yaml_rev": "30fd9e0cd49b2e04f74769f9b24a0300e400403e",
"yaml_edit_rev": "57a28daea82a3f00f57a90d5ea6df6a458b2f781",
"yaml_edit_rev": "d605cce3946828253a97f4b3de1a43260b6edf3b",

# Windows deps
"crashpad_rev": "bf327d8ceb6a669607b0dbab5a83a275d03f99ed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ class RemoveInitializer extends ResolvedCorrectionProducer {
range.endEnd(variable.name, initializer),
);
});
// Delete the `late` keyword if present.
if (variable.isLate) {
var parent = node.parent;
if (parent != null) {
await builder.addDartFileEdit(file, (builder) {
builder.addDeletion(
range.startLength(
parent.beginToken, parent.beginToken.length + 1),
);
});
}
}
} else {
var initializer =
node.thisOrAncestorOfType<ConstructorFieldInitializer>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ class Test {
''');
}

Future<void> test_field_late() async {
await resolveTestCode('''
class Test {
/// field example
late int? x = null;
}
''');
await assertHasFix('''
class Test {
/// field example
int? x;
}
''');
}

Future<void> test_forLoop() async {
await resolveTestCode('''
void f() {
Expand Down
3 changes: 3 additions & 0 deletions pkg/analyzer/lib/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ abstract class AugmentedExtensionElement implements AugmentedInstanceElement {
/// Clients may not extend, implement or mix-in this class.
abstract class AugmentedExtensionTypeElement
implements AugmentedInterfaceElement {
@override
ExtensionTypeElement get declaration;

/// The primary constructor of this extension.
ConstructorElement get primaryConstructor;

Expand Down
8 changes: 8 additions & 0 deletions pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import 'package:analyzer/src/error/best_practices_verifier.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/error/constructor_fields_verifier.dart';
import 'package:analyzer/src/error/dead_code_verifier.dart';
import 'package:analyzer/src/error/duplicate_definition_verifier.dart';
import 'package:analyzer/src/error/ignore_validator.dart';
import 'package:analyzer/src/error/imports_verifier.dart';
import 'package:analyzer/src/error/inheritance_override.dart';
Expand Down Expand Up @@ -292,6 +293,13 @@ class LibraryAnalyzer {
_computeVerifyErrors(unitAnalysis);
}

MemberDuplicateDefinitionVerifier.checkLibrary(
inheritance: _inheritance,
libraryVerificationContext: _libraryVerificationContext,
libraryElement: _libraryElement,
units: _libraryUnits,
);

_libraryVerificationContext.constructorFieldsVerifier.report();

if (_analysisOptions.warning) {
Expand Down
25 changes: 11 additions & 14 deletions pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {
/// The type provider used to access the known types.
final TypeProvider _typeProvider;

/// The set of variables declared using '-D' on the command line.
final DeclaredVariables declaredVariables;

/// The current library that is being analyzed.
final LibraryElementImpl _currentLibrary;

Expand All @@ -70,7 +67,7 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {

Map<Expression, DartObjectImpl>? _mapPatternKeyValues;

late final ExhaustivenessDataForTesting? exhaustivenessDataForTesting;
final ExhaustivenessDataForTesting? exhaustivenessDataForTesting;

/// Initialize a newly created constant verifier.
ConstantVerifier(ErrorReporter errorReporter,
Expand All @@ -82,26 +79,26 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {
currentLibrary.typeSystem,
currentLibrary.typeProvider,
declaredVariables,
retainDataForTesting,
AnalyzerExhaustivenessCache(
currentLibrary.typeSystem, currentLibrary),
retainDataForTesting: retainDataForTesting,
);

ConstantVerifier._(
this._errorReporter,
this._currentLibrary,
this._typeSystem,
this._typeProvider,
this.declaredVariables,
bool retainDataForTesting,
) : _evaluationEngine = ConstantEvaluationEngine(
DeclaredVariables declaredVariables,
this._exhaustivenessCache, {
required bool retainDataForTesting,
}) : _evaluationEngine = ConstantEvaluationEngine(
declaredVariables: declaredVariables,
configuration: ConstantEvaluationConfiguration(),
),
_exhaustivenessCache =
AnalyzerExhaustivenessCache(_typeSystem, _currentLibrary) {
exhaustivenessDataForTesting = retainDataForTesting
? ExhaustivenessDataForTesting(_exhaustivenessCache)
: null;
}
exhaustivenessDataForTesting = retainDataForTesting
? ExhaustivenessDataForTesting(_exhaustivenessCache)
: null;

@override
void visitAnnotation(Annotation node) {
Expand Down
47 changes: 32 additions & 15 deletions pkg/analyzer/lib/src/dart/constant/evaluation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class ConstantEvaluationEngine {
constantVisitor.evaluateConstant(constantInitializer);
if (dartConstant is DartObjectImpl) {
// Only check the type for truly const declarations (don't check final
// fields with initializers, since their types may be generic. The type
// of the final field will be checked later, when the constructor is
// invoked).
// fields with initializers, since their types may be generic. The
// type of the final field will be checked later, when the constructor
// is invoked).
if (constant.isConst) {
if (!library.typeSystem
.runtimeTypeMatch(dartConstant, constant.type)) {
Expand Down Expand Up @@ -202,8 +202,8 @@ class ConstantEvaluationEngine {
constant.evaluationResult = null;
}
} else if (constant is VariableElement) {
// constant is a VariableElement but not a VariableElementImpl. This can
// happen sometimes in the case of invalid user code (for example, a
// `constant` is a VariableElement but not a VariableElementImpl. This
// can happen sometimes in the case of invalid user code (for example, a
// constant expression that refers to a non-static field inside a generic
// class will wind up referring to a FieldMember). The error is detected
// elsewhere, so just silently ignore it here.
Expand Down Expand Up @@ -317,8 +317,8 @@ class ConstantEvaluationEngine {
constNode.arguments!.accept(referenceFinder);
}
} else if (constant is VariableElement) {
// constant is a VariableElement but not a VariableElementImpl. This can
// happen sometimes in the case of invalid user code (for example, a
// `constant` is a VariableElement but not a VariableElementImpl. This
// can happen sometimes in the case of invalid user code (for example, a
// constant expression that refers to a non-static field inside a generic
// class will wind up referring to a FieldMember). So just don't bother
// computing any dependencies.
Expand Down Expand Up @@ -525,7 +525,7 @@ abstract class ConstantEvaluationTarget extends AnalysisTarget {
class ConstantVisitor extends UnifyingAstVisitor<Constant> {
/// The evaluation engine used to access the feature set, type system, and
/// type provider.
final ConstantEvaluationEngine evaluationEngine;
final ConstantEvaluationEngine _evaluationEngine;

/// The library that contains the constant expression being evaluated.
final LibraryElementImpl _library;
Expand Down Expand Up @@ -554,7 +554,7 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
///
/// The [substitution] is specified for instance creations.
ConstantVisitor(
this.evaluationEngine,
this._evaluationEngine,
this._library,
this._errorReporter, {
Map<String, DartObjectImpl>? lexicalEnvironment,
Expand Down Expand Up @@ -938,7 +938,7 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
node, CompileTimeErrorCode.INVALID_CONSTANT);
}

return evaluationEngine.evaluateAndFormatErrorsInConstructorCall(
return _evaluationEngine.evaluateAndFormatErrorsInConstructorCall(
_library,
node,
constructor.returnType.typeArguments,
Expand Down Expand Up @@ -1113,7 +1113,7 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
var prefixNode = node.prefix;
var prefixElement = prefixNode.staticElement;

// importPrefix.CONST
// A top-level constant, imported with a prefix.
if (prefixElement is PrefixElement) {
if (node.isDeferred) {
return _getDeferredLibraryError(node, node.identifier) ??
Expand All @@ -1126,7 +1126,7 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
return prefixResult;
}

// String.length
// For example, `String.length`.
if (prefixElement is! InterfaceElement) {
var propertyAccessResult =
_evaluatePropertyAccess(prefixResult, node.identifier, node);
Expand Down Expand Up @@ -1183,6 +1183,23 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
Constant visitPropertyAccess(PropertyAccess node) {
var target = node.target;
if (target != null) {
if (target is PrefixedIdentifier &&
target.staticElement is ExtensionElement) {
var prefix = target.prefix;
if (prefix.staticElement is PrefixElement && target.isDeferred) {
return _getDeferredLibraryError(node, target.identifier) ??
InvalidConstant.forEntity(
node, CompileTimeErrorCode.INVALID_CONSTANT);
}

// For example, `async.FutureExtensions.wait`.
return _getConstantValue(
errorNode: node,
expression: node,
identifier: node.propertyName,
element: node.propertyName.staticElement,
);
}
var prefixResult = evaluateConstant(target);
if (prefixResult is! DartObjectImpl) {
return prefixResult;
Expand Down Expand Up @@ -1695,7 +1712,7 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
required Element? element,
DartType? givenType,
}) {
var errorNode2 = evaluationEngine.configuration.errorNode(errorNode);
var errorNode2 = _evaluationEngine.configuration.errorNode(errorNode);
element = element?.declaration;

var variableElement =
Expand Down Expand Up @@ -1732,8 +1749,8 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
return _instantiateFunctionTypeForSimpleIdentifier(
identifier, evaluationResult);
case InvalidConstant():
// TODO(kallentu): Investigate and fix the test failures that occur if
// we remove `avoidReporting`
// TODO(kallentu): Investigate and fix the test failures that occur
// if we remove `avoidReporting`.
return InvalidConstant.forEntity(
errorNode, CompileTimeErrorCode.INVALID_CONSTANT,
isUnresolved: true, avoidReporting: true);
Expand Down
Loading

0 comments on commit 80f799b

Please sign in to comment.