Skip to content

Commit 64cbfa6

Browse files
author
Dart CI
committed
Version 3.3.0-153.0.dev
Merge a45fc14 into dev
2 parents f1fd145 + a45fc14 commit 64cbfa6

File tree

265 files changed

+6177
-89925
lines changed

Some content is hidden

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

265 files changed

+6177
-89925
lines changed

pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,11 +3215,6 @@ class PromotionModel<Type extends Object> {
32153215
Type declaredType, List<Type>? promotedTypes, Type writtenType) {
32163216
assert(!writeCaptured);
32173217

3218-
if (typeOperations.forcePromotion(
3219-
writtenType, declaredType, this.promotedTypes, promotedTypes)) {
3220-
return _addToPromotedTypes(promotedTypes, writtenType);
3221-
}
3222-
32233218
// Figure out if we have any promotion candidates (types that are a
32243219
// supertype of writtenType and a proper subtype of the currently-promoted
32253220
// type). If at any point we find an exact match, we take it immediately.
@@ -3360,8 +3355,6 @@ class PromotionModel<Type extends Object> {
33603355
TypeOperations<Type> typeOperations = helper.typeOperations;
33613356
List<Type>? newPromotedTypes = joinPromotedTypes(
33623357
first.promotedTypes, second.promotedTypes, typeOperations);
3363-
newPromotedTypes = typeOperations.refinePromotedTypes(
3364-
first.promotedTypes, second.promotedTypes, newPromotedTypes);
33653358
bool newAssigned = first.assigned && second.assigned;
33663359
bool newUnassigned = first.unassigned && second.unassigned;
33673360
bool newWriteCaptured = first.writeCaptured || second.writeCaptured;

pkg/_fe_analyzer_shared/lib/src/type_inference/type_operations.dart

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@ mixin TypeOperations<Type extends Object> {
4646
/// consideration by an instance check.
4747
Type factor(Type from, Type what);
4848

49-
/// Whether the possible promotion from [from] to [to] should be forced, given
50-
/// the current [promotedTypes], and [newPromotedTypes] resulting from
51-
/// possible demotion.
52-
///
53-
/// It is not expected that any implementation would override this except for
54-
/// the migration engine.
55-
bool forcePromotion(Type to, Type from, List<Type>? promotedTypes,
56-
List<Type>? newPromotedTypes) =>
57-
false;
58-
5949
/// Computes the greatest lower bound of [type1] and [type2].
6050
Type glb(Type type1, Type type2);
6151

@@ -119,15 +109,6 @@ mixin TypeOperations<Type extends Object> {
119109
/// `FutureOr<int?>`), so [type] may be returned even if it is nullable.
120110
Type /*!*/ promoteToNonNull(Type type);
121111

122-
/// Performs refinements on the [promotedTypes] chain which resulted in
123-
/// intersecting [chain1] and [chain2].
124-
///
125-
/// It is not expected that any implementation would override this except for
126-
/// the migration engine.
127-
List<Type>? refinePromotedTypes(
128-
List<Type>? chain1, List<Type>? chain2, List<Type>? promotedTypes) =>
129-
promotedTypes;
130-
131112
/// Tries to promote to the first type from the second type, and returns the
132113
/// promoted type if it succeeds, otherwise null.
133114
Type? tryPromoteToType(Type to, Type from);

pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class TypeMemberContributor extends DartCompletionContributor {
7474
// Suggestions provided by StaticMemberContributor.
7575
return;
7676
}
77+
if (elem is ExtensionElement) {
78+
// Suggestions provided by StaticMemberContributor.
79+
return;
80+
}
7781
if (elem is PrefixElement) {
7882
// Suggestions provided by LibraryMemberContributor.
7983
return;

pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,20 @@ class _EnumDescription {
194194
.sort((first, second) => first.indexValue.compareTo(second.indexValue));
195195
for (var field in fieldsToConvert) {
196196
// Compute the declaration of the corresponding enum constant.
197+
var documentationComment = field.element.documentationComment;
197198
if (constantsBuffer.isNotEmpty) {
198-
constantsBuffer.write(',$eol$indent');
199+
constantsBuffer.write(',$eol');
200+
if (documentationComment != null) {
201+
// If the current field has a documentation comment and
202+
// it's not the first field, add an extra new line.
203+
constantsBuffer.write(eol);
204+
}
205+
constantsBuffer.write(indent);
206+
}
207+
if (documentationComment != null) {
208+
constantsBuffer
209+
.write(documentationComment.replaceAll(eol, '$eol$indent'));
210+
constantsBuffer.write('$eol$indent');
199211
}
200212
constantsBuffer.write(field.name);
201213
var invocation = field.instanceCreation;

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,6 @@ CompileTimeErrorCode.LATE_FINAL_LOCAL_ALREADY_ASSIGNED:
10421042
Remove `final`.
10431043
CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE:
10441044
status: noFix
1045-
CompileTimeErrorCode.MACRO_EXECUTION_EXCEPTION:
1046-
status: noFix
10471045
CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE:
10481046
status: needsFix
10491047
notes: |-
@@ -1821,8 +1819,6 @@ FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS:
18211819
status: hasFix
18221820
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH:
18231821
status: hasFix
1824-
HintCode.CAN_BE_NULL_AFTER_NULL_AWARE:
1825-
status: hasFix
18261822
HintCode.DEPRECATED_COLON_FOR_DEFAULT_VALUE:
18271823
status: hasFix
18281824
HintCode.DEPRECATED_MEMBER_USE:
@@ -3691,12 +3687,6 @@ WarningCode.NULLABLE_TYPE_IN_CATCH_CLAUSE:
36913687
WarningCode.NULL_ARGUMENT_TO_NON_NULL_TYPE:
36923688
status: noFix
36933689
since: ~2.15
3694-
WarningCode.NULL_AWARE_BEFORE_OPERATOR:
3695-
status: noFix
3696-
WarningCode.NULL_AWARE_IN_CONDITION:
3697-
status: noFix
3698-
WarningCode.NULL_AWARE_IN_LOGICAL_OPERATOR:
3699-
status: noFix
37003690
WarningCode.NULL_CHECK_ALWAYS_FAILS:
37013691
status: needsFix
37023692
notes: |-

pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,9 +1460,6 @@ class FixProcessor extends BaseProcessor {
14601460
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH: [
14611461
RemoveNameFromDeclarationClause.new,
14621462
],
1463-
HintCode.CAN_BE_NULL_AFTER_NULL_AWARE: [
1464-
ReplaceWithNullAware.inChain,
1465-
],
14661463
HintCode.DEPRECATED_COLON_FOR_DEFAULT_VALUE: [
14671464
ReplaceColonWithEquals.new,
14681465
],

pkg/analysis_server/test/services/completion/dart/declaration/extension_member_test.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,28 @@ suggestions
486486
}
487487
}
488488

489+
Future<void> test_staticMemberAccess_none() async {
490+
allowedIdentifiers = {
491+
'hashCode',
492+
'noSuchMethod',
493+
'runtimeType',
494+
'toString'
495+
};
496+
await computeSuggestions('''
497+
extension E on int {
498+
void a0() {}
499+
}
500+
void f() {
501+
E.^
502+
}
503+
''');
504+
// The purpose of this test is to verify that Type instance members
505+
// are not suggested when accessing static members of an extension.
506+
assertResponse(r'''
507+
suggestions
508+
''');
509+
}
510+
489511
Future<void> test_staticMemberAccess_none_partial() async {
490512
await computeSuggestions('''
491513
extension E on int {

pkg/analysis_server/test/src/services/correction/assist/convert_class_to_enum_test.dart

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,95 @@ class ConvertClassToEnumTest extends AssistProcessorTest {
1919
@override
2020
AssistKind get kind => DartAssistKind.CONVERT_CLASS_TO_ENUM;
2121

22+
Future<void> test_documentationComments_mix() async {
23+
await resolveTestCode('''
24+
class E {
25+
/// AAA
26+
static const E a = E._('a');
27+
static const E b = E._('b');
28+
29+
/// CCC
30+
static const E c = E._('c');
31+
32+
final String name;
33+
34+
const E._(this.name);
35+
}
36+
''');
37+
await assertHasAssistAt('E {', '''
38+
enum E {
39+
/// AAA
40+
a._('a'),
41+
b._('b'),
42+
43+
/// CCC
44+
c._('c');
45+
46+
final String name;
47+
48+
const E._(this.name);
49+
}
50+
''');
51+
}
52+
53+
Future<void> test_documentationComments_multiple() async {
54+
await resolveTestCode('''
55+
class E {
56+
/// AAA
57+
static const E a = E._('a');
58+
59+
/// BBB
60+
/// BBB
61+
static const E b = E._('b');
62+
63+
/// Name.
64+
final String name;
65+
66+
const E._(this.name);
67+
}
68+
''');
69+
await assertHasAssistAt('E {', '''
70+
enum E {
71+
/// AAA
72+
a._('a'),
73+
74+
/// BBB
75+
/// BBB
76+
b._('b');
77+
78+
/// Name.
79+
final String name;
80+
81+
const E._(this.name);
82+
}
83+
''');
84+
}
85+
86+
Future<void> test_documentationComments_single() async {
87+
await resolveTestCode('''
88+
class E {
89+
/// AAA
90+
static const E a = E._('a');
91+
92+
/// Name.
93+
final String name;
94+
95+
const E._(this.name);
96+
}
97+
''');
98+
await assertHasAssistAt('E {', '''
99+
enum E {
100+
/// AAA
101+
a._('a');
102+
103+
/// Name.
104+
final String name;
105+
106+
const E._(this.name);
107+
}
108+
''');
109+
}
110+
22111
Future<void> test_extends_object_privateClass() async {
23112
await resolveTestCode('''
24113
class _E extends Object {

pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analysis_server/src/services/correction/fix.dart';
6-
import 'package:analyzer/src/error/codes.dart';
7-
import 'package:analyzer/src/utilities/legacy.dart';
86
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
97
import 'package:test_reflective_loader/test_reflective_loader.dart';
108

@@ -257,66 +255,6 @@ void f() {
257255
''');
258256
}
259257

260-
Future<void> test_constructor_single_closure_nnbd_from_legacy() async {
261-
newFile('$testPackageLibPath/a.dart', r'''
262-
// @dart = 2.8
263-
import 'package:meta/meta.dart';
264-
265-
typedef int Callback(int a);
266-
267-
class A {
268-
A({@required Callback callback}) {}
269-
}
270-
''');
271-
await resolveTestCode('''
272-
import 'package:test/a.dart';
273-
274-
void f() {
275-
A a = new A();
276-
print(a);
277-
}
278-
''');
279-
await assertHasFix('''
280-
import 'package:test/a.dart';
281-
282-
void f() {
283-
A a = new A(callback: (int a) { });
284-
print(a);
285-
}
286-
''',
287-
errorFilter: (error) =>
288-
error.errorCode == WarningCode.MISSING_REQUIRED_PARAM);
289-
}
290-
291-
Future<void> test_constructor_single_closure_nnbd_into_legacy() async {
292-
noSoundNullSafety = false;
293-
newFile('$testPackageLibPath/a.dart', r'''
294-
typedef int Callback(int? a);
295-
296-
class A {
297-
A({required Callback callback}) {}
298-
}
299-
''');
300-
await resolveTestCode('''
301-
// @dart = 2.8
302-
import 'package:test/a.dart';
303-
304-
void f() {
305-
A a = new A();
306-
print(a);
307-
}
308-
''');
309-
await assertHasFix('''
310-
// @dart = 2.8
311-
import 'package:test/a.dart';
312-
313-
void f() {
314-
A a = new A(callback: (int a) { });
315-
print(a);
316-
}
317-
''');
318-
}
319-
320258
Future<void> test_constructor_single_list() async {
321259
newFile('$testPackageLibPath/a.dart', r'''
322260
class A {

pkg/analysis_server/test/src/services/correction/fix/convert_class_to_enum_test.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,35 @@ class ConvertClassToEnumTest extends FixProcessorLintTest {
7575
@override
7676
String get lintCode => LintNames.use_enums;
7777

78+
Future<void> test_minimal_documentationComments() async {
79+
await resolveTestCode('''
80+
class E {
81+
/// C0.
82+
static const E c0 = E._(0);
83+
84+
/// C1.
85+
static const E c1 = E._(1);
86+
87+
final int value;
88+
89+
const E._(this.value);
90+
}
91+
''');
92+
await assertHasFix('''
93+
enum E {
94+
/// C0.
95+
c0._(0),
96+
97+
/// C1.
98+
c1._(1);
99+
100+
final int value;
101+
102+
const E._(this.value);
103+
}
104+
''');
105+
}
106+
78107
Future<void> test_minimal_intField_privateClass() async {
79108
await resolveTestCode('''
80109
class _E {

0 commit comments

Comments
 (0)