This repository was archived by the owner on Nov 20, 2024. It is now read-only.
File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ class NonConstantIdentifierNames extends LintRule {
56
56
registry.addCatchClause (this , visitor);
57
57
registry.addConstructorDeclaration (this , visitor);
58
58
registry.addDeclaredVariablePattern (this , visitor);
59
+ registry.addExtensionTypeDeclaration (this , visitor);
59
60
registry.addForEachPartsWithDeclaration (this , visitor);
60
61
registry.addFormalParameterList (this , visitor);
61
62
registry.addFunctionDeclaration (this , visitor);
@@ -105,6 +106,11 @@ class _Visitor extends SimpleAstVisitor<void> {
105
106
checkIdentifier (node.name);
106
107
}
107
108
109
+ @override
110
+ void visitExtensionTypeDeclaration (ExtensionTypeDeclaration node) {
111
+ checkIdentifier (node.representation.constructorName? .name);
112
+ }
113
+
108
114
@override
109
115
void visitForEachPartsWithDeclaration (ForEachPartsWithDeclaration node) {
110
116
checkIdentifier (node.loopVariable.name);
Original file line number Diff line number Diff line change @@ -16,9 +16,20 @@ main() {
16
16
17
17
@reflectiveTest
18
18
class NonConstantIdentifierNamesPatternsTest extends LintRuleTest {
19
+ @override
20
+ List <String > get experiments => ['inline-class' ];
21
+
19
22
@override
20
23
String get lintRule => 'non_constant_identifier_names' ;
21
24
25
+ test_extensionType_representationConstructorName () async {
26
+ await assertDiagnostics (r'''
27
+ extension type e.Efg(int i) {}
28
+ ''' , [
29
+ lint (17 , 3 ),
30
+ ]);
31
+ }
32
+
22
33
test_patternForStatement () async {
23
34
await assertDiagnostics (r'''
24
35
void f() {
You can’t perform that action at this time.
0 commit comments