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

Code before:
            bool syntaxIsOk = CheckSyntaxForNameofArgument(argument, out string name, boundArgument.HasAnyErrors ? BindingDiagnosticBag.Discarded : diagnostics);
            if (boundArgument is BoundMethodGroup methodGroup)
            {
                if (!boundArgument.HasAnyErrors && syntaxIsOk)
                {
                    if (!methodGroup.TypeArgumentsOpt.IsDefaultOrEmpty)
                    {
                        // method group with type parameters not allowed
                        diagnostics.Add(ErrorCode.ERR_NameofMethodGroupWithTypeParameters, argument.Location);
                    }
                    else
                    {
                        EnsureNameofExpressionSymbols(methodGroup, diagnostics);
                    }
                }

                bool useType = !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureInstanceMemberInNameof);
                boundArgument = methodGroup.Update(
                    methodGroup.TypeArgumentsOpt,
                    methodGroup.Name,
                    methodGroup.Methods,
                    methodGroup.LookupSymbolOpt,
                    methodGroup.LookupError,
                    methodGroup.Flags,
                    methodGroup.FunctionType,
                    receiverOpt: ReplaceTypeOrValueReceiver(methodGroup.ReceiverOpt, useType: useType, BindingDiagnosticBag.Discarded), //only change
                    methodGroup.ResultKind);
            }
            else if (boundArgument is BoundPropertyAccess propertyAccess)
            {
                if (propertyAccess.PropertySymbol.IsExtensionBlockMember())
                {
                    diagnostics.Add(ErrorCode.ERR_NameofExtensionMember, boundArgument.Syntax);
                }
            }
            else if (boundArgument is BoundNamespaceExpression nsExpr)
            {
                diagnostics.AddAssembliesUsedByNamespaceReference(nsExpr.NamespaceSymbol);
            }
            else if (boundArgument is BoundIndexerAccess indexerAccess)
            {
                // nameof(x[y]) where the argument is an indexer is an error. Ref analysis requires
                // the indexer to be recognized as get, set, or both. We don't know which was
                // intended for nameof() but since this is already an error, assume it's get.
                Debug.Assert(!syntaxIsOk);
                Debug.Assert(indexerAccess.AccessorKind == AccessorKind.Unknown);
                if (indexerAccess.AccessorKind == AccessorKind.Unknown)
                {
                    boundArgument = CheckValue(boundArgument, BindValueKind.RValue, diagnostics);
                }
            }

Review comment (suggestion):
>useType [](http://example.com/codeflow?start=94&length=7)

Can we always pass `true` here? #Closed

Code after:
            bool syntaxIsOk = CheckSyntaxForNameofArgument(argument, out string name, boundArgument.HasAnyErrors ? BindingDiagnosticBag.Discarded : diagnostics);
            if (boundArgument is BoundMethodGroup methodGroup)
            {
                if (!boundArgument.HasAnyErrors && syntaxIsOk)
                {
                    if (!methodGroup.TypeArgumentsOpt.IsDefaultOrEmpty)
                    {
                        // method group with type parameters not allowed
                        diagnostics.Add(ErrorCode.ERR_NameofMethodGroupWithTypeParameters, argument.Location);
                    }
                    else
                    {
                        EnsureNameofExpressionSymbols(methodGroup, diagnostics);
                    }
                }

                boundArgument = methodGroup.Update(
                    methodGroup.TypeArgumentsOpt,
                    methodGroup.Name,
                    methodGroup.Methods,
                    methodGroup.LookupSymbolOpt,
                    methodGroup.LookupError,
                    methodGroup.Flags,
                    methodGroup.FunctionType,
                    receiverOpt: ReplaceTypeOrValueReceiver(methodGroup.ReceiverOpt, useType: true, boundArgument.HasAnyErrors ? BindingDiagnosticBag.Discarded : diagnostics), //only change
                    methodGroup.ResultKind);
            }
            else if (boundArgument is BoundPropertyAccess propertyAccess)
            {
                if (propertyAccess.PropertySymbol.IsExtensionBlockMember())
                {
                    diagnostics.Add(ErrorCode.ERR_NameofExtensionMember, boundArgument.Syntax);
                }
            }
            else if (boundArgument is BoundNamespaceExpression nsExpr)
            {
                diagnostics.AddAssembliesUsedByNamespaceReference(nsExpr.NamespaceSymbol);
            }
            else if (boundArgument is BoundIndexerAccess indexerAccess)
            {
                // nameof(x[y]) where the argument is an indexer is an error. Ref analysis requires
                // the indexer to be recognized as get, set, or both. We don't know which was
                // intended for nameof() but since this is already an error, assume it's get.
                Debug.Assert(!syntaxIsOk);
                Debug.Assert(indexerAccess.AccessorKind == AccessorKind.Unknown);
                if (indexerAccess.AccessorKind == AccessorKind.Unknown)
                {
                    boundArgument = CheckValue(boundArgument, BindValueKind.RValue, diagnostics);
                }
            }