File tree Expand file tree Collapse file tree
StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,11 +159,28 @@ private static void HandleMemberDeclaration(SyntaxNodeAnalysisContext context)
159159 }
160160 }
161161
162- // "class Test {}" has assigne System.Object as its base type.
163- if ( memberSyntax is ConstructorDeclarationSyntax && declaredSymbol is IMethodSymbol methodSymbol && methodSymbol . ContainingType != null
164- && methodSymbol . ContainingType . BaseType ? . SpecialType != SpecialType . System_Object )
162+ if ( memberSyntax is ConstructorDeclarationSyntax constructorDeclarationSyntax )
165163 {
166- return ;
164+ // ConstructorInitializerSyntax initializer = constructorDeclarationSyntax.Initializer;
165+ ISymbol symbol = context . SemanticModel . GetDeclaredSymbol ( constructorDeclarationSyntax , context . CancellationToken ) ;
166+
167+ if ( symbol is IMethodSymbol constructorMethodSymbol && constructorMethodSymbol . ContainingType is INamedTypeSymbol enclosingNamedTypeSymbol )
168+ {
169+ INamedTypeSymbol baseType = enclosingNamedTypeSymbol . BaseType ;
170+
171+ if ( baseType . SpecialType != SpecialType . System_Object )
172+ {
173+ foreach ( IMethodSymbol baseConstructorMethod in baseType . Constructors )
174+ {
175+ // TODO: SymbolEqualityComparer?
176+ if ( constructorMethodSymbol . Parameters . SequenceEqual ( baseConstructorMethod . Parameters ) )
177+ {
178+ // Matching constructor was found.
179+ return ;
180+ }
181+ }
182+ }
183+ }
167184 }
168185
169186 if ( documentation . Content . GetFirstXmlElement ( XmlCommentHelper . IncludeXmlTag ) is XmlEmptyElementSyntax includeElement )
You can’t perform that action at this time.
0 commit comments