File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
lib/src/services/correction/dart
test/src/services/correction/fix Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,10 @@ class CreateConstructor extends CorrectionProducer {
65
65
// prepare target ClassDeclaration
66
66
ClassElement targetElement = targetType.element;
67
67
var targetResult = await sessionHelper.getElementDeclaration (targetElement);
68
- if (targetResult.node is ! ClassOrMixinDeclaration ) {
68
+ var targetNode = targetResult.node;
69
+ if (targetNode is ! ClassDeclaration ) {
69
70
return ;
70
71
}
71
- ClassOrMixinDeclaration targetNode = targetResult.node;
72
72
73
73
// prepare location
74
74
var targetLocation = CorrectionUtils (targetResult.resolvedUnit)
@@ -108,10 +108,10 @@ class CreateConstructor extends CorrectionProducer {
108
108
// prepare target ClassDeclaration
109
109
var targetElement = constructorElement.enclosingElement;
110
110
var targetResult = await sessionHelper.getElementDeclaration (targetElement);
111
- if (targetResult.node is ! ClassOrMixinDeclaration ) {
111
+ var targetNode = targetResult.node;
112
+ if (targetNode is ! ClassDeclaration ) {
112
113
return ;
113
114
}
114
- ClassOrMixinDeclaration targetNode = targetResult.node;
115
115
116
116
// prepare location
117
117
var targetLocation = CorrectionUtils (targetResult.resolvedUnit)
Original file line number Diff line number Diff line change 3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
5
import 'package:analysis_server/src/services/correction/fix.dart' ;
6
+ import 'package:analyzer/src/error/codes.dart' ;
6
7
import 'package:analyzer_plugin/utilities/fixes/fixes.dart' ;
7
8
import 'package:test_reflective_loader/test_reflective_loader.dart' ;
8
9
@@ -104,6 +105,19 @@ main() {
104
105
''' );
105
106
}
106
107
108
+ Future <void > test_mixin () async {
109
+ verifyNoTestUnitErrors = false ;
110
+ await resolveTestUnit ('''
111
+ mixin M {}
112
+ void f() {
113
+ new M(3);
114
+ }
115
+ ''' );
116
+ await assertNoFix (
117
+ errorFilter: (error) =>
118
+ error.errorCode != CompileTimeErrorCode .MIXIN_INSTANTIATE );
119
+ }
120
+
107
121
Future <void > test_named () async {
108
122
await resolveTestUnit ('''
109
123
class A {
You can’t perform that action at this time.
0 commit comments