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 {
6565 // prepare target ClassDeclaration
6666 ClassElement targetElement = targetType.element;
6767 var targetResult = await sessionHelper.getElementDeclaration (targetElement);
68- if (targetResult.node is ! ClassOrMixinDeclaration ) {
68+ var targetNode = targetResult.node;
69+ if (targetNode is ! ClassDeclaration ) {
6970 return ;
7071 }
71- ClassOrMixinDeclaration targetNode = targetResult.node;
7272
7373 // prepare location
7474 var targetLocation = CorrectionUtils (targetResult.resolvedUnit)
@@ -108,10 +108,10 @@ class CreateConstructor extends CorrectionProducer {
108108 // prepare target ClassDeclaration
109109 var targetElement = constructorElement.enclosingElement;
110110 var targetResult = await sessionHelper.getElementDeclaration (targetElement);
111- if (targetResult.node is ! ClassOrMixinDeclaration ) {
111+ var targetNode = targetResult.node;
112+ if (targetNode is ! ClassDeclaration ) {
112113 return ;
113114 }
114- ClassOrMixinDeclaration targetNode = targetResult.node;
115115
116116 // prepare location
117117 var targetLocation = CorrectionUtils (targetResult.resolvedUnit)
Original file line number Diff line number Diff line change 33// BSD-style license that can be found in the LICENSE file.
44
55import 'package:analysis_server/src/services/correction/fix.dart' ;
6+ import 'package:analyzer/src/error/codes.dart' ;
67import 'package:analyzer_plugin/utilities/fixes/fixes.dart' ;
78import 'package:test_reflective_loader/test_reflective_loader.dart' ;
89
@@ -104,6 +105,19 @@ main() {
104105''' );
105106 }
106107
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+
107121 Future <void > test_named () async {
108122 await resolveTestUnit ('''
109123class A {
You can’t perform that action at this time.
0 commit comments