Skip to content

Commit

Permalink
[element model] migrate string_types
Browse files Browse the repository at this point in the history
Change-Id: I31def5c451778f07733eaccd2110741e18638467
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403501
Commit-Queue: Phil Quitslund <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
Auto-Submit: Phil Quitslund <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
  • Loading branch information
pq authored and Commit Queue committed Jan 7, 2025
1 parent 9b8841a commit b35bb73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion pkg/analyzer/analyzer_use_new_elements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ test/src/dart/element/name_union_test.dart
test/src/dart/element/normalize_type_test.dart
test/src/dart/element/nullable_test.dart
test/src/dart/element/runtime_type_equality_test.dart
test/src/dart/element/string_types.dart
test/src/dart/element/subtype_test.dart
test/src/dart/element/top_merge_test.dart
test/src/dart/element/type_algebra_test.dart
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/test/generated/elements_types_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ mixin ElementsTypesMixin {
return fragment;
}

ParameterElement namedParameter({
ParameterElementImpl namedParameter({
required String name,
required DartType type,
bool isCovariant = false,
Expand Down
16 changes: 8 additions & 8 deletions pkg/analyzer/test/src/dart/element/string_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/element2.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/type_visitor.dart';
import 'package:test/test.dart';
Expand Down Expand Up @@ -470,21 +470,21 @@ class _TypeParameterCollector extends TypeVisitor<void> {
/// We don't need to print bounds for these type parameters, because
/// they are already included into the function type itself, and cannot
/// be promoted.
final Set<TypeParameterElement> functionTypeParameters = {};
final Set<TypeParameterElement2> functionTypeParameters = {};

@override
void visitDynamicType(DynamicType type) {}

@override
void visitFunctionType(FunctionType type) {
functionTypeParameters.addAll(type.typeFormals);
for (var typeParameter in type.typeFormals) {
functionTypeParameters.addAll(type.typeParameters);
for (var typeParameter in type.typeParameters) {
var bound = typeParameter.bound;
if (bound != null) {
bound.accept(this);
}
}
for (var parameter in type.parameters) {
for (var parameter in type.formalParameters) {
parameter.type.accept(this);
}
type.returnType.accept(this);
Expand Down Expand Up @@ -516,8 +516,8 @@ class _TypeParameterCollector extends TypeVisitor<void> {

@override
void visitTypeParameterType(TypeParameterType type) {
if (!functionTypeParameters.contains(type.element)) {
var bound = type.element.bound;
if (!functionTypeParameters.contains(type.element3)) {
var bound = type.element3.bound;

if (bound == null) {
return;
Expand All @@ -526,7 +526,7 @@ class _TypeParameterCollector extends TypeVisitor<void> {
var str = '';

var boundStr = bound.getDisplayString();
str += '${type.element.name} extends $boundStr';
str += '${type.element3.name3} extends $boundStr';

typeParameters.add(str);
}
Expand Down

0 comments on commit b35bb73

Please sign in to comment.