Skip to content

Commit

Permalink
Version 3.8.0-20.0.dev
Browse files Browse the repository at this point in the history
Merge 9b7bb9d into dev
  • Loading branch information
Dart CI committed Jan 22, 2025
2 parents c390aae + 9b7bb9d commit eb3f266
Show file tree
Hide file tree
Showing 78 changed files with 687 additions and 569 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ vars = {
"markdown_rev": "19aaded4300d24bedcbf52ade792b203ddf030b0",
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
# dart-native-interop-team@ is rolling breaking changes manually while the assets features are in experimental.
"native_rev": "d1d9aa5e62d239580b8bf17e36db6d47c308fc89", # disable tools/rev_sdk_deps.dart
"native_rev": "3ed5d3d07246cd792693584c2c42216739a634b7", # disable tools/rev_sdk_deps.dart
"protobuf_rev": "b7dd58cdbd879beee4c3fbf8ee80fce8e97bad26",
"pub_rev": "710265bae23ad5860f33287fba10b5c369f19a93", # disable tools/rev_sdk_deps.dart
"shelf_rev": "bf799519cda2898a7c5af06dcfdd5fe6443afd79",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum ConstraintGenerationSource {
/// `GenericInferrer.constrainGenericFunctionInContext` method.
genericFunctionInContext(description: 'GENERIC FUNCTION IN CONTEXT'),

/// The source of the constraint is the the context of the invocation whose
/// The source of the constraint is the context of the invocation whose
/// type is being inferred, being matched against the return type in function
/// or method being invoked.
returnType(description: 'RETURN TYPE');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2568,7 +2568,7 @@ abstract class TypeAnalyzerErrors<

/// Called for variable that is assigned more than once.
///
/// Returns an error object that is passed on the the caller.
/// Returns an error object that is passed on to the caller.
Error duplicateAssignmentPatternVariable({
required Variable variable,
required Pattern original,
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ abstract class CommonServerContextManagerCallbacks
// If the removed file doesn't have an overlay, we need to clear any
// previous results.
if (!resourceProvider.hasOverlay(file)) {
// Clear the cached errors in the the notification manager so we don't
// Clear the cached errors in the notification manager so we don't
// re-send stale results if a plugin sends an update and we merge it with
// previous results.
analysisServer.notificationManager.errors.clearResultsForFile(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PercentileCalculator {
/// Return a map that can be encoded as JSON that represents the state of this
/// calculator.
Map<String, Object> toJson() {
// It's important the the encoded form of the list of percentile values be
// It's important that the encoded form of the list of percentile values be
// less than 100 characters long.
return {
'count': _valueCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:analyzer/dart/element/element2.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:meta/meta.dart';
Expand Down Expand Up @@ -67,7 +68,7 @@ abstract class CreateFieldOrGetter extends ResolvedCorrectionProducer {
}

var matchedType = objectPattern.type.typeOrThrow;
if (matchedType is! InterfaceType) {
if (matchedType is! InterfaceTypeImpl) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server_plugin/edit/dart/correction_producer.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
Expand Down Expand Up @@ -41,7 +41,7 @@ class MoveTypeArgumentsToClass extends ResolvedCorrectionProducer {
}

var type = namedType.typeOrThrow;
if (type is InterfaceType) {
if (type is InterfaceTypeImpl) {
var element = type.element3;
if (element.typeParameters2.length == typeArguments.arguments.length) {
await builder.addDartFileEdit(file, (builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ CompileTimeErrorCode.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE:
CompileTimeErrorCode.INCONSISTENT_PATTERN_VARIABLE_LOGICAL_OR:
status: noFix
notes: |-
We cannot figure out the the user's intent here, and so cannot generate a
We cannot figure out the user's intent here, and so cannot generate a
fix that would be right.
CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD:
status: needsFix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ class PubspecFixGenerator {
? prevEntry.value.span.end.offset
: (currentEntry.key as YamlNode).span.start.offset;
// If nextEntry is null, this is the last entry in the
// dev_dependencies section, and also dev_dependencies is the the
// last section in the pubspec file. So delete till the end of the
// dev_dependencies section, and also dev_dependencies is the last
// section in the pubspec file. So delete till the end of the
// section.
var endOffset =
nextEntry == null
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/tool/lsp_spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Direction: Client -> Server
Params: `{ uri: Uri }`
Returns: `{ content: string | undefined }`

Returns the content of the the virtual document with `uri`. This is intended for generated files (such as those generated by macros) and is not supported for 'file' URIs.
Returns the content of the virtual document with `uri`. This is intended for generated files (such as those generated by macros) and is not supported for 'file' URIs.

### dart/textDocumentContentDidChange Notification

Expand Down
11 changes: 7 additions & 4 deletions pkg/analyzer/lib/src/dart/ast/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9022,7 +9022,7 @@ final class GenericFunctionTypeImpl extends TypeAnnotationImpl
final Token? question;

@override
DartType? type;
TypeImpl? type;

/// The element associated with the function type, or `null` if the AST
/// structure hasn't been resolved.
Expand Down Expand Up @@ -12546,7 +12546,7 @@ final class NamedTypeImpl extends TypeAnnotationImpl implements NamedType {
final Token? question;

@override
DartType? type;
TypeImpl? type;

/// Initializes a newly created type name.
///
Expand Down Expand Up @@ -14860,7 +14860,7 @@ final class RecordTypeAnnotationImpl extends TypeAnnotationImpl
final Token? question;

@override
DartType? type;
TypeImpl? type;

RecordTypeAnnotationImpl({
required this.leftParenthesis,
Expand Down Expand Up @@ -17834,7 +17834,10 @@ sealed class TypeAnnotation implements AstNode {
DartType? get type;
}

sealed class TypeAnnotationImpl extends AstNodeImpl implements TypeAnnotation {}
sealed class TypeAnnotationImpl extends AstNodeImpl implements TypeAnnotation {
@override
TypeImpl? get type;
}

/// A list of type arguments.
///
Expand Down
11 changes: 10 additions & 1 deletion pkg/analyzer/lib/src/dart/ast/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,16 @@ extension TypeAnnotationExtension on TypeAnnotation {
/// This accessor should be used on expressions that are expected to
/// be already resolved. Every such expression must have the type set,
/// at least `dynamic`.
DartType get typeOrThrow {
TypeImpl get typeOrThrow => (this as TypeAnnotationImpl).typeOrThrow;
}

extension TypeAnnotationImplExtension on TypeAnnotationImpl {
/// Return the static type of this type annotation.
///
/// This accessor should be used on expressions that are expected to
/// be already resolved. Every such expression must have the type set,
/// at least `dynamic`.
TypeImpl get typeOrThrow {
var type = this.type;
if (type == null) {
throw StateError('No type: $this');
Expand Down
30 changes: 16 additions & 14 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7844,9 +7844,9 @@ class LocalVariableElementImpl2 extends PromotableElementImpl2
Metadata get metadata2 => wrappedElement.metadata2;

@override
DartType get type => _wrappedElement.type;
TypeImpl get type => _wrappedElement.type;

set type(DartType type) => _wrappedElement.type = type;
set type(TypeImpl type) => _wrappedElement.type = type;

LocalVariableElementImpl get wrappedElement {
return _wrappedElement;
Expand Down Expand Up @@ -9310,7 +9310,9 @@ class ParameterElementImpl extends VariableElementImpl
nameOffset: -1,
parameterKind: parameterKind,
);
element.type = type;
// TODO(paulberry): remove this cast by changing the type of the `type`
// parameter.
element.type = type as TypeImpl;
element.isSynthetic = true;
return element;
}
Expand Down Expand Up @@ -10357,7 +10359,7 @@ abstract class PropertyInducingElementImpl
}

@override
set type(DartType type) {
set type(TypeImpl type) {
super.type = type;
// Reset cached types of synthetic getters and setters.
// TODO(scheglov): Consider not caching these types.
Expand Down Expand Up @@ -10859,7 +10861,7 @@ class TypeAliasElementImpl extends _ExistingElementImpl
ElementLinkedData? linkedData;

ElementImpl? _aliasedElement;
DartType? _aliasedType;
TypeImpl? _aliasedType;

@override
late TypeAliasElementImpl2 element;
Expand All @@ -10878,13 +10880,15 @@ class TypeAliasElementImpl extends _ExistingElementImpl
}

@override
DartType get aliasedType {
TypeImpl get aliasedType {
linkedData?.read(this);
return _aliasedType!;
}

set aliasedType(DartType rawType) {
_aliasedType = rawType;
// TODO(paulberry): eliminate this cast by changing the type of the
// `rawType` parameter.
_aliasedType = rawType as TypeImpl;
}

/// The aliased type, might be `null` if not yet linked.
Expand All @@ -10910,7 +10914,7 @@ class TypeAliasElementImpl extends _ExistingElementImpl
/// the constructor-tearoffs specification.
bool get isProperRename {
var aliasedType_ = aliasedType;
if (aliasedType_ is! InterfaceType) {
if (aliasedType_ is! InterfaceTypeImpl) {
return false;
}
var aliasedClass = aliasedType_.element;
Expand Down Expand Up @@ -11157,7 +11161,7 @@ class TypeAliasElementImpl2 extends TypeDefiningElementImpl2
}

@override
DartType instantiate(
TypeImpl instantiate(
{required List<DartType> typeArguments,
required NullabilitySuffix nullabilitySuffix}) =>
firstFragment.instantiate(
Expand Down Expand Up @@ -11347,7 +11351,7 @@ class TypeParameterElementImpl extends ElementImpl
}

@override
TypeParameterType instantiate({
TypeParameterTypeImpl instantiate({
required NullabilitySuffix nullabilitySuffix,
}) {
return TypeParameterTypeImpl(
Expand Down Expand Up @@ -11628,10 +11632,8 @@ abstract class VariableElementImpl extends ElementImpl
@override
TypeImpl get type => _type!;

set type(DartType type) {
// TODO(paulberry): eliminate this cast by changing the setter parameter
// type to `TypeImpl`.
_type = type as TypeImpl;
set type(TypeImpl type) {
_type = type;
}

@override
Expand Down
8 changes: 5 additions & 3 deletions pkg/analyzer/lib/src/dart/element/replacement_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ReplacementVisitor
required FunctionTypeBuilder type,
required List<TypeParameterElement>? newTypeParameters,
required List<ParameterElement>? newParameters,
required DartType? newReturnType,
required TypeImpl? newReturnType,
required NullabilitySuffix? newNullability,
}) {
if (newNullability == null &&
Expand Down Expand Up @@ -311,13 +311,15 @@ class ReplacementVisitor
}
}

DartType? visitType(DartType? type) {
TypeImpl? visitType(DartType? type) {
if (type == null) return null;
var result = type.accept(this);
if (substitution != null) {
result = substitution.substituteType(result ?? type);
}
return result;
// TODO(paulberry): eliminate this cast by changing `ReplacementVisitor`
// to implement `TypeVisitor<TypeImpl?>`.
return result as TypeImpl?;
}

var newReturnType = visitType(node.returnType);
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/element/type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ abstract class TypeImpl implements DartType {
const TypeImpl({this.alias});

@override
DartType get extensionTypeErasure {
TypeImpl get extensionTypeErasure {
return const ExtensionTypeErasure().perform(this);
}

Expand Down
6 changes: 4 additions & 2 deletions pkg/analyzer/lib/src/dart/element/type_algebra.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class FreshTypeParameters {

FreshTypeParameters(this.freshTypeParameters, this.substitution);

FunctionType applyToFunctionType(FunctionType type) {
FunctionTypeImpl applyToFunctionType(FunctionType type) {
return FunctionTypeImpl(
typeFormals: freshTypeParameters.map((e) => e.firstFragment).toList(),
parameters: type.parameters.map((parameter) {
Expand Down Expand Up @@ -554,7 +554,9 @@ abstract class _TypeSubstitutor

inner.invertVariance();

var returnType = type.returnType.accept(inner);
// TODO(paulberry): eliminate this cast by changing `_TypeSubstitutor` to
// implement `TypeVisitor<TypeImpl>`.
var returnType = type.returnType.accept(inner) as TypeImpl;

if (useCounter == before) return type;

Expand Down
14 changes: 8 additions & 6 deletions pkg/analyzer/lib/src/dart/element/type_system.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ import 'package:meta/meta.dart';
class ExtensionTypeErasure extends ReplacementVisitor {
const ExtensionTypeErasure();

DartType perform(DartType type) {
return type.accept(this) ?? type;
TypeImpl perform(TypeImpl type) {
// TODO(paulberry): eliminate this cast by changing `ReplacementVisitor` so
// that it implements `TypeVisitor<TypeImpl?>`.
return (type.accept(this) ?? type) as TypeImpl;
}

@override
Expand Down Expand Up @@ -700,8 +702,8 @@ class TypeSystemImpl implements TypeSystem {
}

@override
InterfaceType instantiateInterfaceToBounds({
required InterfaceElement element,
InterfaceTypeImpl instantiateInterfaceToBounds({
required covariant InterfaceElementImpl element,
required NullabilitySuffix nullabilitySuffix,
}) {
var typeParameters = element.typeParameters;
Expand Down Expand Up @@ -746,8 +748,8 @@ class TypeSystemImpl implements TypeSystem {
}

@override
DartType instantiateTypeAliasToBounds({
required TypeAliasElement element,
TypeImpl instantiateTypeAliasToBounds({
required covariant TypeAliasElementImpl element,
required NullabilitySuffix nullabilitySuffix,
}) {
var typeParameters = element.typeParameters;
Expand Down
6 changes: 5 additions & 1 deletion pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_constraint_gatherer.dart';
import 'package:analyzer/src/dart/element/type_schema.dart';
import 'package:analyzer/src/dart/resolver/invocation_inference_helper.dart';
Expand Down Expand Up @@ -139,7 +140,10 @@ class AnnotationResolver {
contextType: UnknownInferredType.instance,
whyNotPromotedArguments: whyNotPromotedArguments,
constructorName: constructorName)
.resolveInvocation(rawType: constructorRawType);
.resolveInvocation(
// TODO(paulberry): eliminate this cast by changing the type of
// `ConstructorElementToInfer.asType`.
rawType: constructorRawType as FunctionTypeImpl);
}

void _extensionGetter(
Expand Down
Loading

0 comments on commit eb3f266

Please sign in to comment.