Skip to content
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

Avoid synthesizing incorrect allows ref struct delegate type parameters #74914

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

jjonescz
Copy link
Member

Fixes #74823.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 27, 2024
@jjonescz jjonescz marked this pull request as ready for review August 27, 2024 17:16
@jjonescz jjonescz requested a review from a team as a code owner August 27, 2024 17:16
@@ -70,17 +70,20 @@ static SynthesizedDelegateInvokeMethod createInvokeMethod(AnonymousDelegateTempl
}
}

private static ImmutableArray<TypeParameterSymbol> CreateTypeParameters(AnonymousDelegateTemplateSymbol containingType, int parameterCount, bool returnsVoid)
private static ImmutableArray<TypeParameterSymbol> CreateTypeParameters(AnonymousDelegateTemplateSymbol containingType, int parameterCount, bool returnsVoid, bool hasParamsArray)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was trying to think of any other cases where this could be a problem but couldn't come up with anything. Was thinking through situations like

var del = int (ref int i) => 0;

That is fine though. There aren't restrictions to having ref to type parameters that allows ref struct.

@jjonescz jjonescz merged commit dd14428 into dotnet:main Aug 28, 2024
24 checks passed
@jjonescz jjonescz deleted the 74823-RefStruct-AnonymousDelegate branch August 28, 2024 10:33
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Feature - RefStructInterfaces untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Anonymous-Params-delegate is generated incorrectly with AllowRefStructFlag
3 participants