Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2eab25e

Browse files
author
Dart CI
committed
Version 2.11.0-183.0.dev
Merge commit 'd63d5d93a59b370bf5f5c277109110cb67a96b75' into 'dev'
2 parents 9c89ce3 + d63d5d9 commit 2eab25e

File tree

61 files changed

+193
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+193
-244
lines changed

pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/type_parameter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class C<T extends num?> {
1212
void promoteNullable(T? t) {
1313
T? s;
1414
if (t is int) {
15-
s = /*T & int*/ t;
15+
s = /*analyzer.T? & int*/ /*cfe.T & int*/ t;
1616
}
1717
}
1818

@@ -50,7 +50,7 @@ class E<T> {
5050
class F<S, T extends S> {
5151
void nonNull(T t) {
5252
if (t != null) {
53-
/*T & S*/ t;
53+
/*analyzer.T & S & Object*/ /*cfe.T & S*/ t;
5454
}
5555
}
5656
}

pkg/analyzer/lib/src/dart/element/display_string_builder.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ class ElementDisplayStringBuilder {
190190
void writeTypeParameterType(TypeParameterTypeImpl type) {
191191
_write(type.element.displayName);
192192
_writeNullability(type.nullabilitySuffix);
193+
194+
if (type.promotedBound != null) {
195+
_write(' & ');
196+
_writeType(type.promotedBound);
197+
}
193198
}
194199

195200
void writeUnknownInferredType() {

pkg/analyzer/test/id_tests/type_promotion_test.dart

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,7 @@ class _TypePromotionDataInterpreter implements DataInterpreter<DartType> {
7171

7272
@override
7373
String getText(DartType actualData, [String indentation]) {
74-
if (actualData is TypeParameterTypeImpl) {
75-
var element = actualData.element;
76-
var promotedBound = actualData.promotedBound;
77-
if (promotedBound != null) {
78-
return '${element.name} & ${_typeToString(promotedBound)}';
79-
}
80-
}
81-
return _typeToString(actualData);
74+
return actualData.getDisplayString(withNullability: true);
8275
}
8376

8477
@override
@@ -93,8 +86,4 @@ class _TypePromotionDataInterpreter implements DataInterpreter<DartType> {
9386

9487
@override
9588
bool isEmpty(DartType actualData) => actualData == null;
96-
97-
String _typeToString(DartType type) {
98-
return type.getDisplayString(withNullability: true);
99-
}
10089
}

pkg/analyzer/test/src/dart/element/nullable_test.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,11 @@ class PromoteToNonNullTest extends _NullableBase {
647647
test_typeParameter_bound_dynamic() {
648648
var element = typeParameter('T', bound: dynamicNone);
649649

650-
var result = typeSystem.promoteToNonNull(
650+
_checkTypeParameter(
651651
typeParameterTypeNone(element),
652-
) as TypeParameterTypeImpl;
653-
expect(result.element, same(element));
654-
expect(result.promotedBound, isNull);
655-
expect(result.nullabilitySuffix, NullabilitySuffix.none);
652+
element: element,
653+
promotedBound: null,
654+
);
656655
}
657656

658657
test_typeParameter_bound_none() {

0 commit comments

Comments
 (0)