Skip to content

Commit

Permalink
Version 3.8.0-28.0.dev
Browse files Browse the repository at this point in the history
Merge 496749a into dev
  • Loading branch information
Dart CI committed Jan 23, 2025
2 parents 13f4846 + 496749a commit a70aef4
Show file tree
Hide file tree
Showing 176 changed files with 725 additions and 452 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": "fe6ba55d16fe2354d90c73e7a8e7a021b77a884a", # disable tools/rev_sdk_deps.dart
"native_rev": "c817a5e41220de370cbea6e6445e63cdc7087544", # 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 @@ -17,6 +17,7 @@ import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/extensions.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/dart/resolver/applicable_extensions.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
Expand Down Expand Up @@ -491,9 +492,10 @@ class DeclarationHelper {
targetLibrary: libraryElement,
// Ignore nullability, consistent with non-extension members.
targetType:
type.isDartCoreNull
? type
: library.typeSystem.promoteToNonNull(type),
(type.isDartCoreNull
? type
: library.typeSystem.promoteToNonNull(type))
as TypeImpl,
strictCasts: false,
);
var importData = ImportData(
Expand Down Expand Up @@ -749,9 +751,10 @@ class DeclarationHelper {
targetLibrary: libraryElement,
// Ignore nullability, consistent with non-extension members.
targetType:
type.isDartCoreNull
? type
: libraryElement.typeSystem.promoteToNonNull(type),
(type.isDartCoreNull
? type
: libraryElement.typeSystem.promoteToNonNull(type))
as TypeImpl,
strictCasts: false,
);
for (var instantiatedExtension in applicableExtensions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analysis_server_plugin/edit/dart/correction_producer.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/applicable_extensions.dart';
import 'package:analyzer/src/utilities/extensions/ast.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
Expand Down Expand Up @@ -283,7 +284,7 @@ abstract class _CreateExtensionMember extends ResolvedCorrectionProducer {
var element = existingExtension.declaredFragment!.element;
var instantiated = [element].applicableTo(
targetLibrary: libraryElement2,
targetType: targetType,
targetType: targetType as TypeImpl,
strictCasts: true,
);
if (instantiated.isNotEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/applicable_extensions.dart';
import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/src/utilities/library.dart';
Expand Down Expand Up @@ -88,7 +89,10 @@ class ImportLibrary extends MultiCorrectionProducer {
foundImport = true;
var instantiatedExtensions = importedLibrary.exportedExtensions
.havingMemberWithBaseName(memberName)
.applicableTo(targetLibrary: libraryElement2, targetType: targetType);
.applicableTo(
targetLibrary: libraryElement2,
targetType: targetType as TypeImpl,
);
for (var instantiatedExtension in instantiatedExtensions) {
// If the import has a combinator that needs to be updated, then offer
// to update it.
Expand Down Expand Up @@ -755,7 +759,10 @@ class _ImportLibraryContainingExtension extends ResolvedCorrectionProducer {
Future<void> compute(ChangeBuilder builder) async {
var instantiatedExtensions = library.exportedExtensions
.havingMemberWithBaseName(memberName)
.applicableTo(targetLibrary: libraryElement2, targetType: targetType);
.applicableTo(
targetLibrary: libraryElement2,
targetType: targetType as TypeImpl,
);
if (instantiatedExtensions.isNotEmpty) {
await builder.addDartFileEdit(file, (builder) {
_uriText = builder.importLibrary(library.uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element2.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/applicable_extensions.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
Expand Down Expand Up @@ -113,7 +114,7 @@ class _UseDifferentDivisionOperator extends ResolvedCorrectionProducer {
.havingMemberWithBaseName(name)
.applicableTo(
targetLibrary: libraryElement2,
targetType: leftType!,
targetType: leftType! as TypeImpl,
)
.isNotEmpty;
}).isEmpty;
Expand Down
3 changes: 2 additions & 1 deletion pkg/analyzer/lib/src/dart/ast/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6657,7 +6657,8 @@ final class ExtensionOverrideImpl extends ExpressionImpl

@experimental
@override
ExtensionElement2 get element2 => (element as ExtensionFragment).element;
ExtensionElementImpl2 get element2 =>
(element as ExtensionElementImpl).element;

@override
Token get endToken => _argumentList.endToken;
Expand Down
47 changes: 33 additions & 14 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ class ConstructorElementImpl extends ExecutableElementImpl
}

@override
FunctionType get type {
FunctionTypeImpl get type {
// TODO(scheglov): Remove "element" in the breaking changes branch.
return _type ??= FunctionTypeImpl(
typeFormals: typeParameters,
Expand Down Expand Up @@ -3732,7 +3732,7 @@ abstract class ExecutableElementImpl extends _ExistingElementImpl
TypeImpl? _returnType;

/// The type of function defined by this executable element.
FunctionType? _type;
FunctionTypeImpl? _type;

@override
ElementLinkedData? linkedData;
Expand Down Expand Up @@ -3887,7 +3887,7 @@ abstract class ExecutableElementImpl extends _ExistingElementImpl
}

@override
FunctionType get type {
FunctionTypeImpl get type {
if (_type != null) return _type!;

return _type = FunctionTypeImpl(
Expand All @@ -3898,7 +3898,7 @@ abstract class ExecutableElementImpl extends _ExistingElementImpl
);
}

set type(FunctionType type) {
set type(FunctionTypeImpl type) {
_type = type;
}

Expand Down Expand Up @@ -4084,7 +4084,7 @@ class ExtensionElementImpl2 extends InstanceElementImpl2
final ExtensionElementImpl firstFragment;

@override
DartType extendedType = InvalidTypeImpl.instance;
TypeImpl extendedType = InvalidTypeImpl.instance;

ExtensionElementImpl2(this.reference, this.firstFragment) {
reference.element2 = this;
Expand Down Expand Up @@ -4663,6 +4663,9 @@ class FormalParameterElementImpl extends PromotableElementImpl2
/// [FormalParameterElement].
mixin FormalParameterElementMixin
implements FormalParameterElement, SharedNamedFunctionParameter {
@override
TypeImpl get type;

@override
void appendToWithoutDelimiters2(StringBuffer buffer) {
buffer.write(
Expand Down Expand Up @@ -5116,7 +5119,7 @@ mixin FragmentedFunctionTypedElementMixin<E extends ExecutableFragment>
// TODO(augmentations): This is wrong. The function type needs to be a merge
// of the function types of all of the fragments, but I don't know how to
// perform that merge.
FunctionType get type {
FunctionTypeImpl get type {
if (firstFragment is ExecutableElementImpl) {
return (firstFragment as ExecutableElementImpl).type;
} else if (firstFragment is FunctionTypedElementImpl) {
Expand Down Expand Up @@ -5246,6 +5249,9 @@ class FunctionElementImpl extends ExecutableElementImpl
abstract class FunctionTypedElementImpl
implements _ExistingElementImpl, FunctionTypedElement {
set returnType(DartType returnType);

@override
FunctionTypeImpl get type;
}

abstract class FunctionTypedElementImpl2 extends TypeParameterizedElementImpl2
Expand Down Expand Up @@ -5277,7 +5283,7 @@ class GenericFunctionTypeElementImpl extends _ExistingElementImpl
bool isNullable = false;

/// The type defined by this element.
FunctionType? _type;
FunctionTypeImpl? _type;

late final GenericFunctionTypeElementImpl2 _element2 =
GenericFunctionTypeElementImpl2(this);
Expand Down Expand Up @@ -5361,7 +5367,7 @@ class GenericFunctionTypeElementImpl extends _ExistingElementImpl
}

@override
FunctionType get type {
FunctionTypeImpl get type {
if (_type != null) return _type!;

return _type = FunctionTypeImpl(
Expand All @@ -5375,7 +5381,7 @@ class GenericFunctionTypeElementImpl extends _ExistingElementImpl

/// Set the function type defined by this function type element to the given
/// [type].
set type(FunctionType type) {
set type(FunctionTypeImpl type) {
_type = type;
}

Expand Down Expand Up @@ -8262,10 +8268,15 @@ final class MetadataImpl implements Metadata {
}
}

abstract class MethodElement2OrMember implements MethodElement2 {
@override
FunctionTypeImpl get type;
}

/// A concrete implementation of a [MethodElement].
class MethodElementImpl extends ExecutableElementImpl
with AugmentableElement<MethodElementImpl>
implements MethodElement, MethodFragment {
implements MethodElementOrMember, MethodFragment {
@override
late MethodElementImpl2 element;

Expand Down Expand Up @@ -8365,7 +8376,7 @@ class MethodElementImpl2 extends ExecutableElementImpl2
FragmentedAnnotatableElementMixin<MethodFragment>,
FragmentedElementMixin<MethodFragment>,
_HasSinceSdkVersionMixin
implements MethodElement2 {
implements MethodElement2OrMember {
@override
final Reference reference;

Expand Down Expand Up @@ -8422,6 +8433,11 @@ class MethodElementImpl2 extends ExecutableElementImpl2
}
}

abstract class MethodElementOrMember implements MethodElement {
@override
FunctionTypeImpl get type;
}

/// A [ClassElementImpl] representing a mixin declaration.
class MixinElementImpl extends ClassOrMixinElementImpl
with AugmentableElement<MixinElementImpl>
Expand Down Expand Up @@ -9535,6 +9551,9 @@ mixin ParameterElementMixin implements ParameterElement {
// Overridden to remove the 'deprecated' annotation.
ParameterKind get parameterKind;

@override
TypeImpl get type;

@override
void appendToWithoutDelimiters(
StringBuffer buffer, {
Expand Down Expand Up @@ -10141,7 +10160,7 @@ class PropertyAccessorElementImpl_ImplicitGetter
Version? get sinceSdkVersion => variable2.sinceSdkVersion;

@override
FunctionType get type {
FunctionTypeImpl get type {
return _type ??= FunctionTypeImpl(
typeFormals: const <TypeParameterElement>[],
parameters: const <ParameterElement>[],
Expand Down Expand Up @@ -10207,7 +10226,7 @@ class PropertyAccessorElementImpl_ImplicitSetter
Version? get sinceSdkVersion => variable2.sinceSdkVersion;

@override
FunctionType get type {
FunctionTypeImpl get type {
return _type ??= FunctionTypeImpl(
typeFormals: const <TypeParameterElement>[],
parameters: parameters,
Expand Down Expand Up @@ -11116,7 +11135,7 @@ class TypeAliasElementImpl2 extends TypeDefiningElementImpl2
}

@override
DartType get aliasedType => firstFragment.aliasedType;
TypeImpl get aliasedType => firstFragment.aliasedType;

@override
TypeAliasElementImpl2 get baseElement => this;
Expand Down
Loading

0 comments on commit a70aef4

Please sign in to comment.