diff options
author | Vitek Karas <10670590+vitek-karas@users.noreply.github.com> | 2022-10-25 20:42:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 20:42:21 +0300 |
commit | c0bd2080670407e7681c26aadb4745d0b7c03e7c (patch) | |
tree | 25582fa374f84bc5a694f95d443d63d56c2dcfc0 /src | |
parent | d8ca185cf241d60182183ebe9740e36a23ac5b97 (diff) |
Change analyzer versions such that the repo can be built with .NET 7 RC2 SDK (#3077)
Change analyzer versions such that the repo can be built with .NET 7 RC2 SDK.
- Took the versions from dotnet/runtime.
- Remove CheckAttributeInstantiation method since is no longer necessary
- Remove global attributes since they are no longer necessary
- Workaround the fact that compiler injects System.Runtime.CompilerServices.RefSafetyRulesAttribute into every assembly to describe the language version
Co-authored-by: tlakollo <tlakaelel_axayakatl@outlook.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs b/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs index 893dbeeca..2922c51ca 100644 --- a/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs +++ b/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs @@ -47,19 +47,11 @@ namespace ILLink.RoslynAnalyzer if (methodSymbol.IsStaticConstructor () && methodSymbol.HasAttribute (RequiresAttributeName)) ReportRequiresOnStaticCtorDiagnostic (symbolAnalysisContext, methodSymbol); CheckMatchingAttributesInOverrides (symbolAnalysisContext, methodSymbol); - CheckAttributeInstantiation (symbolAnalysisContext, methodSymbol); - foreach (var typeParameter in methodSymbol.TypeParameters) - CheckAttributeInstantiation (symbolAnalysisContext, typeParameter); - }, SymbolKind.Method); context.RegisterSymbolAction (symbolAnalysisContext => { var typeSymbol = (INamedTypeSymbol) symbolAnalysisContext.Symbol; CheckMatchingAttributesInInterfaces (symbolAnalysisContext, typeSymbol); - CheckAttributeInstantiation (symbolAnalysisContext, typeSymbol); - foreach (var typeParameter in typeSymbol.TypeParameters) - CheckAttributeInstantiation (symbolAnalysisContext, typeParameter); - }, SymbolKind.NamedType); @@ -68,8 +60,6 @@ namespace ILLink.RoslynAnalyzer if (AnalyzerDiagnosticTargets.HasFlag (DiagnosticTargets.Property)) { CheckMatchingAttributesInOverrides (symbolAnalysisContext, propertySymbol); } - - CheckAttributeInstantiation (symbolAnalysisContext, propertySymbol); }, SymbolKind.Property); context.RegisterSymbolAction (symbolAnalysisContext => { @@ -77,15 +67,8 @@ namespace ILLink.RoslynAnalyzer if (AnalyzerDiagnosticTargets.HasFlag (DiagnosticTargets.Event)) { CheckMatchingAttributesInOverrides (symbolAnalysisContext, eventSymbol); } - - CheckAttributeInstantiation (symbolAnalysisContext, eventSymbol); }, SymbolKind.Event); - context.RegisterSymbolAction (symbolAnalysisContext => { - var fieldSymbol = (IFieldSymbol) symbolAnalysisContext.Symbol; - CheckAttributeInstantiation (symbolAnalysisContext, fieldSymbol); - }, SymbolKind.Field); - context.RegisterOperationAction (operationContext => { var methodInvocation = (IInvocationOperation) operationContext.Operation; CheckCalledMember (operationContext, methodInvocation.TargetMethod, incompatibleMembers); @@ -205,21 +188,6 @@ namespace ILLink.RoslynAnalyzer foreach (var extraSymbolAction in ExtraSymbolActions) context.RegisterSymbolAction (extraSymbolAction.Action, extraSymbolAction.SymbolKind); - void CheckAttributeInstantiation ( - SymbolAnalysisContext symbolAnalysisContext, - ISymbol symbol) - { - if (symbol.IsInRequiresScope (RequiresAttributeName)) - return; - - foreach (var attr in symbol.GetAttributes ()) { - if (attr.AttributeConstructor?.DoesMemberRequire (RequiresAttributeName, out var requiresAttribute) == true) { - symbolAnalysisContext.ReportDiagnostic (Diagnostic.Create (RequiresDiagnosticRule, - symbol.Locations[0], attr.AttributeConstructor.GetDisplayName (), GetMessageFromAttribute (requiresAttribute), GetUrlFromAttribute (requiresAttribute))); - } - } - } - void CheckCalledMember ( OperationAnalysisContext operationContext, ISymbol member, |