Repository: dotnet/roslyn
File: src/Workspaces/Core/Portable/Rename/RenameUtilities.cs (C#)

Code before:
            ? [semanticInfo.DeclaredSymbol]
            : semanticInfo.GetSymbols(includeType: false);

        // if there are more than one symbol, then remove the alias symbols.
        // When using (not declaring) an alias, the alias symbol and the target symbol are returned
        // by GetSymbols
        if (symbols.Length > 1)
        {
            var aliasSymbol = symbols.FirstOrDefault(s => s.Kind == SymbolKind.Alias);
            var nonAliasSymbols = symbols.WhereAsArray(s => s.Kind != SymbolKind.Alias);
            
            // For aliases to types that cannot be renamed (like tuples, arrays, pointers, function pointers),
            // we should rename the alias itself, not the target type.
            if (aliasSymbol != null && 
                nonAliasSymbols.Length == 1 && 
                nonAliasSymbols[0] is ITypeSymbol targetType &&
                IsUnrenamableAliasTarget(targetType))
            {
                // Keep the alias symbol for renaming
                symbols = [aliasSymbol];
            }
            else
            {
                // Original behavior: use the non-alias symbols
                symbols = nonAliasSymbols;
            }
        }

        if (symbols.Length == 0)
        {
            var info = semanticModel.GetSymbolInfo(bindableToken, cancellationToken);
            if (info.CandidateReason == CandidateReason.MemberGroup)
            {
                return info.CandidateSymbols;
            }
        }

        return symbols;
    }

    private static bool IsSymbolDefinedInsideMethod(ISymbol symbol)
    {
        return
            symbol.Kind is SymbolKind.Local or
            SymbolKind.Label or
            SymbolKind.RangeVariable or
            SymbolKind.Parameter;
    }

    internal static IEnumerable<Document> GetDocumentsAffectedByRename(ISymbol symbol, Solution solution, IEnumerable<RenameLocation> renameLocations)
    {

Review comment (refactor):
@copilot this logic looks identical to what was added in `ConflictResolver.Session.cs`.  Please extract a helper you use from both.

Code after:
            return symbols;

        var aliasSymbol = symbols.FirstOrDefault(s => s.Kind == SymbolKind.Alias);
        var nonAliasSymbols = symbols.WhereAsArray(s => s.Kind != SymbolKind.Alias);

        // For aliases to types that cannot be renamed (like tuples, arrays, pointers, function pointers),
        // we should rename the alias itself, not the target type.
        if (aliasSymbol != null &&
            nonAliasSymbols is [ITypeSymbol targetType] &&
            IsUnrenamableAliasTarget(targetType))
        {
            // Keep the alias symbol for renaming
            return [aliasSymbol];
        }

        // Original behavior: use the non-alias symbols
        return nonAliasSymbols;
    }

    internal static ImmutableArray<ISymbol> GetSymbolsTouchingPosition(
        int position, SemanticModel semanticModel, SolutionServices services, CancellationToken cancellationToken)
    {
        var bindableToken = semanticModel.SyntaxTree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true);
        var semanticInfo = semanticModel.GetSemanticInfo(bindableToken, services, cancellationToken);
        var symbols = semanticInfo.DeclaredSymbol != null
            ? [semanticInfo.DeclaredSymbol]
            : semanticInfo.GetSymbols(includeType: false);

        // if there are more than one symbol, then remove the alias symbols.
        // When using (not declaring) an alias, the alias symbol and the target symbol are returned
        // by GetSymbols
        if (symbols.Length > 1)
        {
            symbols = FilterAliasSymbols(symbols);
        }

        if (symbols.Length == 0)
        {
            var info = semanticModel.GetSymbolInfo(bindableToken, cancellationToken);
            if (info.CandidateReason == CandidateReason.MemberGroup)
            {
                return info.CandidateSymbols;
            }
        }

        return symbols;
    }

    private static bool IsSymbolDefinedInsideMethod(ISymbol symbol)
    {
        return