-
Notifications
You must be signed in to change notification settings - Fork 4k
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 allow ref like types for synthesized TypeParameterSymbols in Ad-Hoc Delegates #74714
Conversation
Do we have a bug for this? |
See #74823 |
@@ -32,6 +32,40 @@ internal static void VerifyDiagnostics(string source, params DiagnosticDescripti | |||
[CompilerTrait(CompilerFeature.LocalFunctions)] | |||
public class LocalFunctionTests : LocalFunctionsTestBase | |||
{ | |||
[Fact] | |||
public void TestAdHocDelegateWithParams_NotAllowRefLikeTest() |
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.
It feels like this should be in a different file than LocalFunctionTests
, for example RefStructInterfacesTests
seems better.
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.
I didn't know where to define it - that would be a better place or something like "allowRefStructTests.cs"
|
||
namespace Microsoft.CodeAnalysis.CSharp.Symbols | ||
{ | ||
internal sealed class AllowsRefLikeTypeSymbolVisitor : SymbolVisitor |
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.
Are there any other cases than just params T[]
that need to be handled specially?
- If yes, we should have tests for these cases.
- If no, we don't need a visitor, we could simply check just that one case.
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.
Not as far as I know
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.
Feel free to simplify the check
Currently synthesized TypeParameterSymbols for array params return AllowsRefLikeType=true, which is not true.
An array can not contain ref-structs.
fixes: #74823