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

Implement lower and upper bound inference in function pointer parameters #50249

Merged
merged 12 commits into from
Jan 28, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static MethodGroupResolution ResolveDelegateOrFunctionPointerMethodGroup
if ((object)delegateInvokeMethodOpt != null)
{
var analyzedArguments = AnalyzedArguments.GetInstance();
GetDelegateArguments(source.Syntax, analyzedArguments, delegateInvokeMethodOpt.Parameters, binder.Compilation);
GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateInvokeMethodOpt.Parameters, binder.Compilation);
var resolution = binder.ResolveMethodGroup(source, analyzedArguments, useSiteDiagnostics: ref useSiteDiagnostics, inferWithDynamic: true,
isMethodGroupConversion: true, returnRefKind: delegateInvokeMethodOpt.RefKind, returnType: delegateInvokeMethodOpt.ReturnType,
isFunctionPointerResolution: isFunctionPointer, callingConventionInfo: callingConventionInfo);
Expand Down Expand Up @@ -229,7 +229,7 @@ public Conversion MethodGroupConversion(SyntaxNode syntax, MethodGroup methodGro

Debug.Assert((object)delegateInvokeMethod != null && !delegateInvokeMethod.HasUseSiteError,
"This method should only be called for valid delegate types");
GetDelegateArguments(syntax, analyzedArguments, delegateInvokeMethod.Parameters, Compilation);
GetDelegateOrFunctionPointerArguments(syntax, analyzedArguments, delegateInvokeMethod.Parameters, Compilation);
_binder.OverloadResolution.MethodInvocationOverloadResolution(
methods: methodGroup.Methods,
typeArguments: methodGroup.TypeArguments,
Expand All @@ -247,7 +247,7 @@ public Conversion MethodGroupConversion(SyntaxNode syntax, MethodGroup methodGro
return conversion;
}

public static void GetDelegateArguments(SyntaxNode syntax, AnalyzedArguments analyzedArguments, ImmutableArray<ParameterSymbol> delegateParameters, CSharpCompilation compilation)
public static void GetDelegateOrFunctionPointerArguments(SyntaxNode syntax, AnalyzedArguments analyzedArguments, ImmutableArray<ParameterSymbol> delegateParameters, CSharpCompilation compilation)
{
foreach (var p in delegateParameters)
{
Expand Down
Loading