Skip to content

Commit

Permalink
Version 3.3.0-145.0.dev
Browse files Browse the repository at this point in the history
Merge 272b9d2 into dev
  • Loading branch information
Dart CI committed Nov 17, 2023
2 parents 12c5efc + 272b9d2 commit 46e8b18
Show file tree
Hide file tree
Showing 45 changed files with 331 additions and 135 deletions.
15 changes: 7 additions & 8 deletions pkg/analysis_server/lib/src/context_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ import 'package:watcher/watcher.dart';
import 'package:yaml/yaml.dart';

/// Enables watching of files generated by Blaze.
///
// TODO(michalt): This is a temporary flag that we use to disable this
/// functionality due its performance issues. We plan to benchmark and optimize
/// it and re-enable it everywhere.
/// Not private to enable testing.
/// NB: If you set this to `false` remember to disable the
/// `test/integration/serve/blaze_changes_test.dart`.
// functionality due its performance issues. We plan to benchmark and optimize
// it and re-enable it everywhere.
// Not private to enable testing.
// NB: If you set this to `false` remember to disable the
// `test/integration/serve/blaze_changes_test.dart`.
var experimentalEnableBlazeWatching = true;

/// Class that maintains a mapping from included/excluded paths to a set of
Expand Down Expand Up @@ -114,8 +113,8 @@ abstract class ContextManager {
/// analyzed.
///
// TODO(paulberry): eliminate this interface, and instead have [ContextManager]
/// operations return data structures describing how context state should be
/// modified.
// operations return data structures describing how context state should be
// modified.
abstract class ContextManagerCallbacks {
/// Called after analysis contexts are created, usually when new analysis
/// roots are set, or after detecting a change that required rebuilding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ protocol.Notification createExistingImportsNotification(
}

// TODO(dantup): We need to expose this because the Declarations code currently
/// returns declarations with DeclarationKinds but the DartCompletionManager
/// gives us a list of "included ElementKinds". Maybe it would be better to expose
/// includedDeclarationKinds and then just map that list to ElementKinds once in
/// domain_completion for the original protocol?
// returns declarations with DeclarationKinds but the DartCompletionManager
// gives us a list of "included ElementKinds". Maybe it would be better to expose
// includedDeclarationKinds and then just map that list to ElementKinds once in
// domain_completion for the original protocol?
protocol.ElementKind protocolElementKind(DeclarationKind kind) {
return switch (kind) {
DeclarationKind.CLASS => protocol.ElementKind.CLASS,
Expand Down
24 changes: 12 additions & 12 deletions pkg/analysis_server/lib/src/legacy_analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,13 @@ class LegacyAnalysisServer extends AnalysisServer {
/// Implementation for `analysis.setAnalysisRoots`.
///
// TODO(scheglov): implement complete projects/contexts semantics.
///
/// The current implementation is intentionally simplified and expected
/// that only folders are given each given folder corresponds to the exactly
/// one context.
///
/// So, we can start working in parallel on adding services and improving
/// projects/contexts support.
//
// The current implementation is intentionally simplified and expected
// that only folders are given each given folder corresponds to the exactly
// one context.
//
// So, we can start working in parallel on adding services and improving
// projects/contexts support.
Future<void> setAnalysisRoots(String requestId, List<String> includedPaths,
List<String> excludedPaths) async {
final completer = analysisContextRebuildCompleter = Completer();
Expand Down Expand Up @@ -1114,12 +1114,12 @@ class ServerContextManagerCallbacks
/// computer, we want it to run before spending time of sending notifications.
///
// TODO(scheglov): Consider replacing this with full priority based scheduler.
///
//
// TODO(scheglov): Alternatively, if code completion work in a way that does
/// not produce (at first) fully resolved unit, but only part of it - a single
/// method, or a top-level declaration, we would not have this problem - the
/// completion computer would be the only consumer of the partial analysis
/// result.
// not produce (at first) fully resolved unit, but only part of it - a single
// method, or a top-level declaration, we would not have this problem - the
// completion computer would be the only consumer of the partial analysis
// result.
void _runDelayed(Function() f) {
Future(f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class StatementCompletionProcessor {
final CorrectionUtils utils;

// TODO(brianwilkerson): Refactor the code so that the completion is returned
/// from the methods in which it's computed rather than being a field that we
/// have to test.
// from the methods in which it's computed rather than being a field that we
// have to test.
StatementCompletion? completion;
SourceChange change = SourceChange('statement-completion');
List<engine.AnalysisError> errors = [];
Expand Down
3 changes: 1 addition & 2 deletions pkg/analysis_server/lib/src/services/correction/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ List<SimpleIdentifier> findPrefixElementReferences(
}

// TODO(scheglov): replace with nodes once there will be
/// [CompilationUnit.getComments].
///
// [CompilationUnit.getComments].
/// Returns [SourceRange]s of all comments in [unit].
List<SourceRange> getCommentRanges(CompilationUnit unit) {
var ranges = <SourceRange>[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension DartCompletionRequestExtensions on DartCompletionRequest {
/// [element].
///
// TODO(scheglov): Validate that suggesting a tear-off instead of invocation
/// is statistically a good choice.
// is statistically a good choice.
bool shouldSuggestTearOff(InterfaceElement element) {
if (!libraryElement.featureSet.isEnabled(Feature.constructor_tearoffs)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void main() {
}

// TODO(scheglov): This class does not really belong here.
/// Consider merging it into [AbstractContextTest].
// Consider merging it into [AbstractContextTest].
class PubPackageResolutionTest extends AbstractContextTest {
late ResolvedUnitResult result;
late FindNode findNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void main() {
VerificationTests.defineTests();
}

// /todo (pq): update w/ a FixKind that we're sure we want to support as a file fix
// TODO(pq): update w/ a FixKind that we're sure we want to support as a file fix
// @reflectiveTest
// class MultiFixInFileTest extends FixInFileProcessorTest
// with WithNullSafetyMixin {
Expand Down
6 changes: 3 additions & 3 deletions pkg/analyzer/lib/dart/element/type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ abstract class FunctionType implements DartType {
/// For example `<T> T -> T`.
///
// TODO(scheglov): Remove the mention for "typeParameters".
/// These are distinct from the `typeParameters` list, which contains type
/// parameters from surrounding contexts, and thus are free type variables
/// from the perspective of this function type.
// These are distinct from the `typeParameters` list, which contains type
// parameters from surrounding contexts, and thus are free type variables
// from the perspective of this function type.
List<TypeParameterElement> get typeFormals;

/// Produces a new function type by substituting type parameters of this
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import 'package:analyzer/src/utilities/uri_cache.dart';
// TODO(scheglov): Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
static const int DATA_VERSION = 317;
static const int DATA_VERSION = 318;

/// The number of exception contexts allowed to write. Once this field is
/// zero, we stop writing any new exception contexts in this process.
Expand Down
14 changes: 7 additions & 7 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1010,11 +1010,11 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
/// A [FieldElement] for a 'const' or 'final' field that has an initializer.
///
// TODO(paulberry): we should rename this class to reflect the fact that it's
/// used for both const and final fields. However, we shouldn't do so until
/// we've created an API for reading the values of constants; until that API is
/// available, clients are likely to read constant values by casting to
/// ConstFieldElementImpl, so it would be a breaking change to rename this
/// class.
// used for both const and final fields. However, we shouldn't do so until
// we've created an API for reading the values of constants; until that API is
// available, clients are likely to read constant values by casting to
// ConstFieldElementImpl, so it would be a breaking change to rename this
// class.
class ConstFieldElementImpl extends FieldElementImpl with ConstVariableElement {
/// Initialize a newly created synthetic field element to have the given
/// [name] and [offset].
Expand Down Expand Up @@ -1045,7 +1045,7 @@ class ConstructorElementImpl extends ExecutableElementImpl
/// super-constructor is not resolved, or the enclosing class is `Object`.
///
// TODO(scheglov): We cannot have both super and redirecting constructors.
/// So, ideally we should have some kind of "either" or "variant" here.
// So, ideally we should have some kind of "either" or "variant" here.
ConstructorElement? _superConstructor;

/// The constructor to which this constructor is redirecting.
Expand Down Expand Up @@ -1685,7 +1685,7 @@ class ElementAnnotationImpl implements ElementAnnotation {
/// not been resolved.
///
// TODO(kallentu): Remove this field once we fix up g3's dependency on
/// annotations having a valid result as well as unresolved errors.
// annotations having a valid result as well as unresolved errors.
List<AnalysisError>? additionalErrors;

/// Initialize a newly created annotation. The given [compilationUnit] is the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ class InheritanceManager3 {
}

// TODO(scheglov): Instead of merging conflicts we could report them on
/// the corresponding mixins applied in the class.
// the corresponding mixins applied in the class.
for (var mixinConflicts in mixinsConflicts) {
if (mixinConflicts.isNotEmpty) {
conflicts.addAll(mixinConflicts);
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class InterfaceLeastUpperBoundHelper {
/// (or might not) be a well-formed type.
///
// TODO(leafp): Use matchTypes or something similar here to handle the
/// case where one of the types is a superclass (but not supertype) of
/// the other, e.g. LUB(Iterable<double>, List<int>) = Iterable<num>
// case where one of the types is a superclass (but not supertype) of
// the other, e.g. LUB(Iterable<double>, List<int>) = Iterable<num>
// TODO(leafp): Figure out the right final algorithm and implement it.
InterfaceTypeImpl compute(InterfaceTypeImpl type1, InterfaceTypeImpl type2) {
var nullability = _chooseNullability(type1, type2);
Expand Down
10 changes: 5 additions & 5 deletions pkg/analyzer/lib/src/error/ignore_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ class IgnoreValidator {
// }
// }
//
// // `TODO`(brianwilkerson) Uncomment the code below after the unnecessary
// // ignores in the Flutter code base have been cleaned up.
// // _errorReporter.reportErrorForOffset(
// // WarningCode.UNNECESSARY_IGNORE, ignoredName.offset, name.length,
// // [name]);
// TODO(brianwilkerson): Uncomment the code below after the unnecessary
// ignores in the Flutter code base have been cleaned up.
// _errorReporter.reportErrorForOffset(
// WarningCode.UNNECESSARY_IGNORE, ignoredName.offset, name.length,
// [name]);
// }
// }
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/fasta/ast_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ class AstBuilder extends StackListener {
}

// TODO(scheglov): We should not do this.
/// Ideally, we should not test parsing pieces of class, and instead parse
/// the whole unit, and extract pieces that we need to validate.
// Ideally, we should not test parsing pieces of class, and instead parse
// the whole unit, and extract pieces that we need to validate.
_ClassDeclarationBuilder createFakeClassDeclarationBuilder(String className) {
return _classLikeBuilder = _ClassDeclarationBuilder(
comment: null,
Expand Down
6 changes: 3 additions & 3 deletions pkg/analyzer/lib/src/generated/error_verifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2907,9 +2907,9 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
/// classes such as 'num' or 'String'.
///
// TODO(scheglov): Remove this method, when all inheritance / override
/// is concentrated. We keep it for now only because we need to know when
/// inheritance is completely wrong, so that we don't need to check anything
/// else.
// is concentrated. We keep it for now only because we need to know when
// inheritance is completely wrong, so that we don't need to check anything
// else.
bool _checkForExtendsOrImplementsDisallowedClass(
NamedType namedType, ErrorCode errorCode) {
if (namedType.isSynthetic) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/generated/resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
/// resolution.
///
// TODO(paulberry): make [featureSet] a required parameter (this will be a
/// breaking change).
// breaking change).
ResolverVisitor(
InheritanceManager3 inheritanceManager,
LibraryElementImpl definingLibrary,
Expand Down Expand Up @@ -4210,7 +4210,7 @@ class ResolverVisitorForMigration extends ResolverVisitor {
/// [SimpleIdentifier]s to declarations using scoping rules.
///
// TODO(paulberry): migrate the responsibility for all scope resolution into
/// this visitor.
// this visitor.
class ScopeResolverVisitor extends UnifyingAstVisitor<void> {
static const _nameScopeProperty = 'nameScope';

Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/lint/linter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ class LinterContextUnit {
}

// TODO(scheglov): This class exists only because there are places in the
/// analyzer and analysis server that instantiate [LinterContextUnit]. This
/// should not happen, and should be fixed.
// analyzer and analysis server that instantiate [LinterContextUnit]. This
// should not happen, and should be fixed.
class LinterContextUnit2 implements LinterContextUnit {
final FileState file;

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/services/available_declarations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ class DeclarationsTracker {
}

// TODO(scheglov): Remove after fixing
/// https://github.com/dart-lang/sdk/issues/45233
// https://github.com/dart-lang/sdk/issues/45233
void _addPathOrUri(List<String> pathOrUriList, String path, Uri uri) {
pathOrUriList.add('(uri: $uri, path: $path)');

Expand Down
3 changes: 3 additions & 0 deletions pkg/analyzer/lib/src/summary2/bundle_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ class ConstructorElementLinkedData
element.superConstructor = reader.readElement() as ConstructorElement?;
element.redirectedConstructor = reader.readElement() as ConstructorElement?;
element.constantInitializers = reader._readNodeList();
element.augmentation = reader.readElement() as ConstructorElementImpl?;
element.augmentationTarget =
reader.readElement() as ConstructorElementImpl?;
applyConstantOffsets?.perform();
}
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/analyzer/lib/src/summary2/bundle_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ class BundleWriter {
_resolutionSink.writeElement(element.superConstructor);
_resolutionSink.writeElement(element.redirectedConstructor);
_resolutionSink._writeNodeList(element.constantInitializers);
_resolutionSink.writeElement(element.augmentation);
_resolutionSink.writeElement(element.augmentationTarget);
});
}

Expand Down Expand Up @@ -735,7 +737,7 @@ class ResolutionSink extends _SummaryDataWriter {
}) : _references = references;

// TODO(scheglov): Triage places where we write elements.
/// Some of then cannot be members, e.g. type names.
// Some of then cannot be members, e.g. type names.
void writeElement(Element? element) {
if (element is Member) {
var declaration = element.declaration;
Expand Down
13 changes: 8 additions & 5 deletions pkg/analyzer/lib/src/summary2/element_flags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ class ClassElementFlags {
}

class ConstructorElementFlags {
static const int _isConst = 1 << 0;
static const int _isExternal = 1 << 1;
static const int _isFactory = 1 << 2;
static const int _isSynthetic = 1 << 3;
static const int _isTempAugmentation = 1 << 4;
static const int _isAugmentation = 1 << 0;
static const int _isConst = 1 << 1;
static const int _isExternal = 1 << 2;
static const int _isFactory = 1 << 3;
static const int _isSynthetic = 1 << 4;
static const int _isTempAugmentation = 1 << 5;

static void read(SummaryDataReader reader, ConstructorElementImpl element) {
var byte = reader.readByte();
element.isAugmentation = (byte & _isAugmentation) != 0;
element.isConst = (byte & _isConst) != 0;
element.isExternal = (byte & _isExternal) != 0;
element.isFactory = (byte & _isFactory) != 0;
Expand All @@ -72,6 +74,7 @@ class ConstructorElementFlags {

static void write(BufferedSink sink, ConstructorElementImpl element) {
var result = 0;
result |= element.isAugmentation ? _isAugmentation : 0;
result |= element.isConst ? _isConst : 0;
result |= element.isExternal ? _isExternal : 0;
result |= element.isFactory ? _isFactory : 0;
Expand Down
1 change: 1 addition & 0 deletions pkg/analyzer/lib/src/summary2/library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AugmentedClassDeclarationBuilder
required this.declaration,
}) {
addFields(declaration.fields);
addConstructors(declaration.constructors);
addAccessors(declaration.accessors);
addMethods(declaration.methods);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/summary2/reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class Reference {
}

// TODO(scheglov): Remove it, once when the actual issue is fixed.
/// https://buganizer.corp.google.com/issues/203423390
// https://buganizer.corp.google.com/issues/203423390
static String _rewriteDartUi(String name) {
const srcPrefix = 'dart:ui/src/ui/';
if (name.startsWith(srcPrefix)) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/analyzer/lib/src/wolf/ir/ir.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class BaseIRContainer with IRToStringMixin {
/// interpretation of its body.
///
// TODO(paulberry): when extension types are supported, make this an extension
/// type.
// type.
class FunctionFlags {
static const _asyncBit = 0;
static const _generatorBit = 1;
Expand Down Expand Up @@ -113,7 +113,7 @@ class FunctionFlags {
/// of [BaseIRContainer].
///
// TODO(paulberry): when extension types are supported, make this an extension
/// type.
// type.
class LiteralRef {
final int index;

Expand Down Expand Up @@ -203,7 +203,7 @@ class RawIRWriter with _RawIRWriterMixin {
/// [BaseIRContainer].
///
// TODO(paulberry): when extension types are supported, make this an extension
/// type.
// type.
class TypeRef {
final int index;

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/wolf/ir/validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ base class ValidationEventListener {
/// state is unreachable, and so exact matching of value counts is unnecessary.
///
// TODO(paulberry): when extension types are supported, make this an extension
/// type.
// type.
class ValueCount {
static const indeterminate = ValueCount._(-1);

Expand Down
Loading

0 comments on commit 46e8b18

Please sign in to comment.