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

Code before:
                // When both results are WrongArity, prefer the generic type over the non-generic one
                // if the user supplied type arguments
                if (PreferGenericOverNonGeneric(this.SingleSymbolOrDefault, result.Symbol))
                {
                    this.SetFrom(result);
                }
                else if (!PreferGenericOverNonGeneric(result.Symbol, this.SingleSymbolOrDefault))
                {
                    // Neither is preferred, add both symbols
                    if ((object)result.Symbol != null)
                    {
                        _symbolList.Add(result.Symbol);
                    }
                }
                // else: existing result is preferred (generic over non-generic), keep it
            }
            else if ((object)result.Symbol != null)
            {
                // Same goodness. Include all symbols
                _symbolList.Add(result.Symbol);
            }

            static bool PreferGenericOverNonGeneric(Symbol currentSymbol, Symbol newSymbol)
            {
                return currentSymbol is NamedTypeSymbol { Arity: 0 } && newSymbol is NamedTypeSymbol { Arity: > 0 };
            }
        }

        // global pool
        //TODO: consider if global pool is ok.
        private static readonly ObjectPool<LookupResult> s_poolInstance = CreatePool();

        // if someone needs to create a pool
        internal static ObjectPool<LookupResult> CreatePool()
        {
            ObjectPool<LookupResult> pool = null;
            pool = new ObjectPool<LookupResult>(() => new LookupResult(pool), 128); // we rarely need more than 10
            return pool;
        }

        internal static LookupResult GetInstance()
        {
            var instance = s_poolInstance.Allocate();
            Debug.Assert(instance.IsClear);
            return instance;
        }

        internal void Free()
        {
            this.Clear();
            if (_pool != null)

Review comment (suggestion):
```suggestion
            static bool PreferGenericOverNonGeneric(Symbol currentSymbol, Symbol newSymbol)
                => currentSymbol is NamedTypeSymbol { Arity: 0 } && newSymbol is NamedTypeSymbol { Arity: > 0 };
``` #Closed

Code after:
                return;
            }

            if (Kind == LookupResultKind.WrongArity && result.Kind == LookupResultKind.WrongArity)
            {
                if (isNonGenericVersusGeneric(result.Symbol, this.SingleSymbolOrDefault))
                {
                    // Current result is generic, and incoming is not.  We just want stick with what we currently have
                    // as the better symbol to be referring to when generics are provided, but arity is wrong.
                    return;
                }

                if (isNonGenericVersusGeneric(this.SingleSymbolOrDefault, result.Symbol))
                {
                    // Current result is non generic, but incoming is generic.  It's strictly the better symbol to be
                    // referring to when generics are provided, but arity is wrong.
                    this.SetFrom(result);
                    return;
                }

                // Neither is preferred, fall through and include all symbols.
            }

            // Same goodness. Include all symbols
            _symbolList.AddIfNotNull(result.Symbol);

            static bool isNonGenericVersusGeneric(Symbol firstSymbol, Symbol secondSymbol)
                => firstSymbol.GetArity() == 0 && secondSymbol.GetArity() > 0;
        }

        // global pool
        //TODO: consider if global pool is ok.
        private static readonly ObjectPool<LookupResult> s_poolInstance = CreatePool();

        // if someone needs to create a pool
        internal static ObjectPool<LookupResult> CreatePool()
        {
            ObjectPool<LookupResult> pool = null;
            pool = new ObjectPool<LookupResult>(() => new LookupResult(pool), 128); // we rarely need more than 10
            return pool;
        }

        internal static LookupResult GetInstance()
        {
            var instance = s_poolInstance.Allocate();
            Debug.Assert(instance.IsClear);
            return instance;
        }

        internal void Free()
        {