Repository: dotnet/roslyn
File: src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs (C#)

Code before:
            }

            int parm = badArg.Result.ParameterFromArgument(arg);
            SourceLocation sourceLocation = new SourceLocation(argument.Syntax);

            // Early out: if the bad argument is an __arglist parameter then simply report that:

            var parameters = method.GetParametersIncludingExtensionParameter(skipExtensionIfStatic: false);
            if (method.GetIsVararg() && parm == parameters.Length)
            {
                // NOTE: No SymbolDistinguisher required, since one of the arguments is "__arglist".

                // CS1503: Argument {0}: cannot convert from '{1}' to '{2}'
                diagnostics.Add(
                    ErrorCode.ERR_BadArgType,
                    sourceLocation,
                    symbols,
                    arg + 1,
                    argument.Display,
                    "__arglist");
                return;
            }

            ParameterSymbol parameter = parameters[parm];
            bool isLastParameter = parameters.Length == parm + 1; // This is used to later decide if we need to try to unwrap a params collection
            
            // If this is a params parameter and the argument would be convertible to the element type when expanded,
            // don't report an error for this argument. The real issue is elsewhere (e.g., another argument).
            if (isLastParameter && parameter.IsParams && argument.HasExpressionType())
            {
                // Get the element type of the params parameter
                var parameterType = parameter.Type;
                if (parameterType is ArrayTypeSymbol arrayType)
                {
                    var paramsElementType = arrayType.ElementType;
                    CompoundUseSiteInfo<AssemblySymbol> useSiteInfo = binder.GetNewCompoundUseSiteInfo(diagnostics);
                    var conversion = binder.Conversions.ClassifyConversionFromExpression(argument, paramsElementType, isChecked: false, ref useSiteInfo);
                    
                    // If the argument can convert to the params element type, then the error is not really about this argument.
                    // It's about another argument that prevents the method from being applicable.
                    if (conversion.IsImplicit)
                    {
                        return;
                    }
                }
            }
            
            RefKind refArg = arguments.RefKind(arg);
            RefKind refParameter = parameter.RefKind;

            if (arguments.IsExtensionMethodReceiverArgument(arg))

Review comment (suggestion):
@copilot try another approach.  INstead of trying to suppress reporting someething here, change it so that this argument is not in MemberAnalysisResult.BadArgumentsOpt in the first place.  This means that during binding we should not consider this arg in error because we should  have felt it matched the expanded parmeter array type. 

Code after:
            }

            int parm = badArg.Result.ParameterFromArgument(arg);
            SourceLocation sourceLocation = new SourceLocation(argument.Syntax);

            // Early out: if the bad argument is an __arglist parameter then simply report that:

            var parameters = method.GetParametersIncludingExtensionParameter(skipExtensionIfStatic: false);
            if (method.GetIsVararg() && parm == parameters.Length)
            {
                // NOTE: No SymbolDistinguisher required, since one of the arguments is "__arglist".

                // CS1503: Argument {0}: cannot convert from '{1}' to '{2}'
                diagnostics.Add(
                    ErrorCode.ERR_BadArgType,
                    sourceLocation,
                    symbols,
                    arg + 1,
                    argument.Display,
                    "__arglist");
                return;
            }

            ParameterSymbol parameter = parameters[parm];
            bool isLastParameter = parameters.Length == parm + 1; // This is used to later decide if we need to try to unwrap a params collection
            RefKind refArg = arguments.RefKind(arg);
            RefKind refParameter = parameter.RefKind;

            if (arguments.IsExtensionMethodReceiverArgument(arg))
            {
                Debug.Assert(refArg == RefKind.None);
                if (refParameter == RefKind.Ref || refParameter == RefKind.In)
                {
                    // For ref and ref-readonly extension methods, we omit the "ref" modifier on receiver arguments.
                    // Setting the correct RefKind for finding the correct diagnostics message.
                    // For other ref kinds, keeping it as it is to find mismatch errors. 
                    refArg = refParameter;
                }
            }

            // If the expression is untyped because it is a lambda, anonymous method, method group or null
            // then we never want to report the error "you need a ref on that thing". Rather, we want to
            // say that you can't convert "null" to "ref int".
            if (!argument.HasExpressionType() &&
                argument.Kind != BoundKind.OutDeconstructVarPendingInference &&
                argument.Kind != BoundKind.OutVariablePendingInference &&
                argument.Kind != BoundKind.DiscardExpression)
            {
                TypeSymbol parameterType = unwrapIfParamsCollection(badArg, parameter, isLastParameter) is TypeSymbol t ? t : parameter.Type;

                // If the problem is that a lambda isn't convertible to the given type, also report why.