Skip to content

Commit a92b585

Browse files
FMorschelCommit Queue
authored andcommitted
[DAS] Fixes missing "Add import" case
Fixes: #61128 Change-Id: I889be4860d2ce1bb2321531620988dd2ffc9b6f0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442720 Auto-Submit: Felipe Morschel <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent dbf80ad commit a92b585

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS:
11251125
CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_NON_INTERFACE:
11261126
status: hasFix
11271127
CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS:
1128-
status: noFix
1128+
status: hasFix
11291129
CompileTimeErrorCode.MIXINS_SUPER_CLASS:
11301130
status: needsFix
11311131
notes: |-

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,10 @@ final _builtInNonLintMultiGenerators = {
13611361
DataDriven.new,
13621362
ImportLibrary.forType,
13631363
],
1364+
CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS: [
1365+
CreateClass.new,
1366+
ImportLibrary.forType,
1367+
],
13641368
CompileTimeErrorCode.NEW_WITH_NON_TYPE: [
13651369
CreateClass.new,
13661370
ImportLibrary.forType,

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,22 @@ void f() {
304304
await assertNoFix();
305305
}
306306

307+
Future<void> test_classContainingWith() async {
308+
await resolveTestCode('''
309+
class B extends A with M {}
310+
311+
mixin M {}
312+
''');
313+
await assertHasFix('''
314+
class B extends A with M {}
315+
316+
class A {
317+
}
318+
319+
mixin M {}
320+
''');
321+
}
322+
307323
Future<void> test_extends() async {
308324
await resolveTestCode('''
309325
class MyClass extends BaseClass {}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,24 @@ void f() {
313313
await assertNoFix();
314314
}
315315

316+
Future<void> test_classContainingWith() async {
317+
newFile('$testPackageLibPath/lib.dart', '''
318+
class A {}
319+
''');
320+
await resolveTestCode('''
321+
class B extends A with M {}
322+
323+
mixin M {}
324+
''');
325+
await assertHasFix('''
326+
import 'package:test/lib.dart';
327+
328+
class B extends A with M {}
329+
330+
mixin M {}
331+
''');
332+
}
333+
316334
Future<void> test_extension_name() async {
317335
createAnalysisOptionsFile(lints: [LintNames.comment_references]);
318336
newFile('$testPackageLibPath/lib.dart', '''

0 commit comments

Comments
 (0)