-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a number of accessibility resolution issues in the source generator. #87136
Fix a number of accessibility resolution issues in the source generator. #87136
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsUpdates the source generator to use the built-in Roslyn
|
@@ -589,179 +591,41 @@ private TypeGenerationSpec ParseTypeGenerationSpec(TypeToGenerate typeToGenerate | |||
{ | |||
classType = ClassType.Enum; | |||
} | |||
else if (type.GetCompatibleGenericBaseType(_knownSymbols.IAsyncEnumerableOfTType) is INamedTypeSymbol iasyncEnumerableType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deleted code has been extracted into the TryResolveCollectionType
method .
@@ -426,8 +426,10 @@ public record AppRecord(int Id) | |||
CheckCompilationDiagnosticsErrors(result.Diagnostics); | |||
CheckCompilationDiagnosticsErrors(result.NewCompilation.GetDiagnostics()); | |||
|
|||
Assert.Equal(4, result.AllGeneratedTypes.Count()); | |||
Assert.Equal(3, result.AllGeneratedTypes.Count()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generated type number changed because we no longer include the compiler-generated EqualityContract
property.
cc @Sergio0694 it would be interesting to see how this impacts your application size. |
@eiriktsarpalis will share binary size deltas in the Store and in the NAOT sample with the new package from this PR! 👍 |
@eiriktsarpalis size diffs for the Microsoft Store below:
Deltas:
Pretty nice win overall, and it seems this PR saved another ~35 KB per arch. Not groundbreaking, but hey, it's free 😄 |
Updates the source generator to use the built-in Roslyn
IsSymbolAccessibleWithin
method when resolving accessibility for symbols. This addresses the following issues: