This commit is contained in:
Tyrrrz
2024-05-20 22:42:04 +03:00
parent a5a4ad05a0
commit 30bc1d3330
51 changed files with 236 additions and 275 deletions

View File

@@ -30,11 +30,10 @@ internal static class RoslynExtensions
}
public static ITypeSymbol? TryGetEnumerableUnderlyingType(this ITypeSymbol type) =>
type.AllInterfaces
.FirstOrDefault(
i =>
i.ConstructedFrom.SpecialType
== SpecialType.System_Collections_Generic_IEnumerable_T
type
.AllInterfaces.FirstOrDefault(i =>
i.ConstructedFrom.SpecialType
== SpecialType.System_Collections_Generic_IEnumerable_T
)
?.TypeArguments[0];
@@ -44,8 +43,7 @@ internal static class RoslynExtensions
property
// Can't rely on the RequiredMemberAttribute because it's generated by the compiler, not added by the user,
// so we have to check for the presence of the `required` modifier in the syntax tree instead.
.DeclaringSyntaxReferences
.Select(r => r.GetSyntax())
.DeclaringSyntaxReferences.Select(r => r.GetSyntax())
.OfType<PropertyDeclarationSyntax>()
.SelectMany(p => p.Modifiers)
.Any(m => m.IsKind((SyntaxKind)8447));