@@ -17,7 +17,7 @@ public class AttributeAnalyzer : DiagnosticAnalyzer
1717 public override ImmutableArray < DiagnosticDescriptor > SupportedDiagnostics { get ; } = ImmutableArray . Create (
1818 ASP001ParameterName . Descriptor ,
1919 ASP002MissingParameter . Descriptor ,
20- ASP003ParameterType . Descriptor ,
20+ ASP003ParameterSymbolType . Descriptor ,
2121 ASP005ParameterSyntax . Descriptor ,
2222 ASP006ParameterRegex . Descriptor ) ;
2323
@@ -77,12 +77,12 @@ context.ContainingSymbol is IMethodSymbol method &&
7777
7878 foreach ( var pair in pairs )
7979 {
80- if ( HasWrongType ( pair , out var typeName ) &&
80+ if ( HasWrongType ( pair , out var typeName , out _ ) &&
8181 methodDeclaration . TryFindParameter ( pair . Symbol ? . Name , out parameterSyntax ) )
8282 {
8383 context . ReportDiagnostic (
8484 Diagnostic . Create (
85- ASP003ParameterType . Descriptor ,
85+ ASP003ParameterSymbolType . Descriptor ,
8686 parameterSyntax . Type . GetLocation ( ) ,
8787 ImmutableDictionary < string , string > . Empty . Add (
8888 nameof ( TypeSyntax ) ,
@@ -182,7 +182,7 @@ private static PooledList<ParameterPair> GetPairs(UrlTemplate template, IMethodS
182182 return list ;
183183 }
184184
185- private static bool HasWrongType ( ParameterPair pair , out string correctType )
185+ private static bool HasWrongType ( ParameterPair pair , out string correctType , out string correctConstraint )
186186 {
187187 if ( pair . Route ? . Constraints is ImmutableArray < RouteConstraint > constraints &&
188188 pair . Symbol is IParameterSymbol parameter )
@@ -193,6 +193,7 @@ private static bool HasWrongType(ParameterPair pair, out string correctType)
193193 if ( TryGetType ( constraint . Span , out var type ) )
194194 {
195195 correctType = parameter . Type == type ? null : type . Alias ?? type . FullName ;
196+ correctConstraint = null ;
196197 return correctType != null ;
197198 }
198199 }
@@ -203,10 +204,12 @@ parameter.Type is INamedTypeSymbol namedType &&
203204 namedType . TypeArguments . TrySingle ( out var typeArg ) )
204205 {
205206 correctType = typeArg . ToString ( ) ;
207+ correctConstraint = null ;
206208 return true ;
207209 }
208210 }
209211
212+ correctConstraint = null ;
210213 correctType = null ;
211214 return false ;
212215
0 commit comments