Skip to content

Commit

Permalink
Version 3.7.0-321.0.dev
Browse files Browse the repository at this point in the history
Merge bdf8c21 into dev
  • Loading branch information
Dart CI committed Jan 11, 2025
2 parents f585c17 + bdf8c21 commit 2229972
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 176 deletions.
13 changes: 6 additions & 7 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
}

@override
ClassElement? getClass(String className) {
ClassElementImpl? getClass(String className) {
for (var class_ in classes) {
if (class_.name == className) {
return class_;
Expand Down Expand Up @@ -3679,8 +3679,7 @@ abstract class ExecutableElementImpl extends _ExistingElementImpl
}

@override
List<FormalParameterFragment> get formalParameters =>
parameters.cast<FormalParameterFragment>();
List<ParameterElementImpl> get formalParameters => parameters;

@override
bool get hasImplicitReturnType {
Expand Down Expand Up @@ -5901,11 +5900,11 @@ abstract class InterfaceElementImpl extends InstanceElementImpl

/// The non-nullable instance of this element, without alias.
/// Should be used only when the element has no type parameters.
InterfaceType? _nonNullableInstance;
InterfaceTypeImpl? _nonNullableInstance;

/// The nullable instance of this element, without alias.
/// Should be used only when the element has no type parameters.
InterfaceType? _nullableInstance;
InterfaceTypeImpl? _nullableInstance;

List<ConstructorElementImpl> _constructors = _Sentinel.constructorElement;

Expand Down Expand Up @@ -6078,7 +6077,7 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
}

@override
InterfaceType instantiate({
InterfaceTypeImpl instantiate({
required List<DartType> typeArguments,
required NullabilitySuffix nullabilitySuffix,
}) {
Expand Down Expand Up @@ -7091,7 +7090,7 @@ class LibraryElementImpl extends ElementImpl
}

@override
ClassElement? getClass(String name) {
ClassElementImpl? getClass(String name) {
for (var unitElement in units) {
var element = unitElement.getClass(name);
if (element != null) {
Expand Down
11 changes: 0 additions & 11 deletions pkg/analyzer/lib/src/dart/element/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,6 @@ extension LibraryExtension2 on LibraryElement2? {
this?.featureSet.isEnabled(Feature.wildcard_variables) ?? false;
}

extension ListOfParameterElementExtension on List<ParameterElement> {
/// Returns `this` as `List<ParameterElementImpl>`, converting if it isn't
/// one already.
List<ParameterElementImpl> toImpl() {
return switch (this) {
List<ParameterElementImpl> already => already,
_ => [for (var p in this) p.toImpl()],
};
}
}

extension ParameterElementExtension on ParameterElement {
/// Return [ParameterElement] with the specified properties replaced.
ParameterElementImpl copyWith({
Expand Down
12 changes: 10 additions & 2 deletions pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,11 @@ class InheritanceManager3 {
result.name2 = fragmentName;
result.typeParameters = resultType.typeFormals.cast();
result.returnType = resultType.returnType;
result.parameters = resultType.parameters.toImpl();
// `resultType` is guaranteed to have been produced by
// `TypeSystemImpl.topMerge`; when that function merges function types, it
// always produces a `FunctionType` whose parameter list is a
// `List<ParameterElementImpl>`.
result.parameters = resultType.parameters as List<ParameterElementImpl>;
result.element = MethodElementImpl2(
Reference.root(), // TODO(scheglov): wrong
firstMethod.name,
Expand All @@ -1160,7 +1164,11 @@ class InheritanceManager3 {
result.isGetter = firstAccessor.isGetter;
result.isSetter = firstAccessor.isSetter;
result.returnType = resultType.returnType;
result.parameters = resultType.parameters.toImpl();
// `resultType` is guaranteed to have been produced by
// `TypeSystemImpl.topMerge`; when that function merges function types, it
// always produces a `FunctionType` whose parameter list is a
// `List<ParameterElementImpl>`.
result.parameters = resultType.parameters as List<ParameterElementImpl>;

var field = FieldElementImpl(variableName, -1);
field.enclosingElement3 = targetClass;
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/element/top_merge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class TopMergeHelper {
throw _TopMergeStateError(T, S, 'Different number of formal parameters');
}

var R_parameters = <ParameterElement>[];
var R_parameters = <ParameterElementImpl>[];
for (var i = 0; i < T_parameters.length; i++) {
var T_parameter = T_parameters[i];
var S_parameter = S_parameters[i];
Expand Down
Loading

0 comments on commit 2229972

Please sign in to comment.