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

Code before:
        // has only one annotation pertaining to the current session or try to extract only the current session annotation
        var originalAliasAnnotation = token.GetAnnotations(AliasAnnotation.Kind).Single();
        var originalAliasName = AliasAnnotation.GetAliasName(originalAliasAnnotation);

        if (originalAliasName == aliasSymbol.Name)
        {
            token = token.WithoutAnnotations(originalAliasAnnotation);
            var replacementAliasAnnotation = AliasAnnotation.Create(replacementText);
            token = token.WithAdditionalAnnotations(replacementAliasAnnotation);
        }

        return token;
    }

    /// <summary>
    /// Determines if a type symbol is an unrenamable target for an alias.
    /// Such types include arrays, tuples, pointers, function pointers, and dynamic, which cannot be renamed
    /// themselves but can be aliased with the "using alias = type" feature.
    /// </summary>
    internal static bool IsUnrenamableAliasTarget(ITypeSymbol typeSymbol)
    {
        return typeSymbol.TypeKind == TypeKind.Array ||
               typeSymbol.IsTupleType ||
               typeSymbol.TypeKind == TypeKind.Pointer ||
               typeSymbol.TypeKind == TypeKind.FunctionPointer ||
               typeSymbol.TypeKind == TypeKind.Dynamic;
    }

    /// <summary>
    /// Filters symbols to determine which should be used for renaming when both an alias and its target are present.
    /// For aliases to unrenamable types (like tuples, arrays, pointers, etc.), keeps the alias symbol.
    /// Otherwise, keeps the non-alias symbols (original behavior).
    /// </summary>
    internal static ImmutableArray<ISymbol> FilterAliasSymbols(ImmutableArray<ISymbol> symbols)
    {
        if (symbols.Length <= 1)
            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];
        }


Review comment (suggestion):
```suggestion
        return typeSymbol.IsTupleType ||
            typeSymbol.TypeKind is TypeKind.Array or TypeKind.Pointer or TypeKind.FunctionPointer or TypeKind.Dynamic;
```

Code after:
        // has only one annotation pertaining to the current session or try to extract only the current session annotation
        var originalAliasAnnotation = token.GetAnnotations(AliasAnnotation.Kind).Single();
        var originalAliasName = AliasAnnotation.GetAliasName(originalAliasAnnotation);

        if (originalAliasName == aliasSymbol.Name)
        {
            token = token.WithoutAnnotations(originalAliasAnnotation);
            var replacementAliasAnnotation = AliasAnnotation.Create(replacementText);
            token = token.WithAdditionalAnnotations(replacementAliasAnnotation);
        }

        return token;
    }

    /// <summary>
    /// Determines if a type symbol is an unrenamable target for an alias.
    /// Such types include arrays, tuples, pointers, function pointers, and dynamic, which cannot be renamed
    /// themselves but can be aliased with the "using alias = type" feature.
    /// </summary>
    internal static bool IsUnrenamableAliasTarget(ITypeSymbol typeSymbol)
    {
        return typeSymbol.IsTupleType ||
            typeSymbol.TypeKind is TypeKind.Array or TypeKind.Pointer or TypeKind.FunctionPointer or TypeKind.Dynamic;
    }

    /// <summary>
    /// Filters symbols to determine which should be used for renaming when both an alias and its target are present.
    /// For aliases to unrenamable types (like tuples, arrays, pointers, etc.), keeps the alias symbol.
    /// Otherwise, keeps the non-alias symbols (original behavior).
    /// </summary>
    internal static ImmutableArray<ISymbol> FilterAliasSymbols(ImmutableArray<ISymbol> symbols)
    {
        if (symbols.Length <= 1)
            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;
    }