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

Code before:
            var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken);

            if (conflictAnnotation.IsInvocationExpression)
            {
                if (tokenOrNode.IsNode)
                {
                    var invocationReferencedSymbols = SymbolsForEnclosingInvocationExpressionWorker((SyntaxNode)tokenOrNode!, newDocumentSemanticModel, _cancellationToken);
                    if (!invocationReferencedSymbols.IsDefault)
                        newReferencedSymbols = invocationReferencedSymbols;
                }
            }

            // 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 GetSymbolsTouchingPosition
            if (newReferencedSymbols.Length >= 2)
            {
                var aliasSymbol = newReferencedSymbols.FirstOrDefault(s => s.Kind == SymbolKind.Alias);
                var nonAliasSymbols = newReferencedSymbols.WhereAsArray(a => a.Kind != SymbolKind.Alias);

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

            return newReferencedSymbols;
        }

        private async Task<ISymbol> GetRenamedSymbolInCurrentSolutionAsync(MutableConflictResolution conflictResolution)
        {
            try
            {
                // get the renamed symbol in complexified new solution
                var start = _documentOfRenameSymbolHasBeenRenamed
                    ? conflictResolution.GetAdjustedTokenStartingPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration)
                    : _renameSymbolDeclarationLocation.SourceSpan.Start;

                var document = await conflictResolution.CurrentSolution.GetRequiredDocumentAsync(
                    _documentIdOfRenameSymbolDeclaration, includeSourceGenerated: true, _cancellationToken).ConfigureAwait(false);
                var newSymbol = await SymbolFinder.FindSymbolAtPositionAsync(document, start, cancellationToken: _cancellationToken).ConfigureAwait(false);

Review comment (suggestion):
@copilot 

```suggestion
                if (aliasSymbol != null &&
                    nonAliasSymbols is [ITypeSymbol targetType] &&
                    RenameUtilities.IsUnrenamableAliasTarget(targetType))
```

Code after:
            var newReferencedSymbols = RenameUtilities.GetSymbolsTouchingPosition(tokenOrNode.Span.Start, newDocumentSemanticModel, newDocument.Project.Solution.Services, _cancellationToken);

            if (conflictAnnotation.IsInvocationExpression)
            {
                if (tokenOrNode.IsNode)
                {
                    var invocationReferencedSymbols = SymbolsForEnclosingInvocationExpressionWorker((SyntaxNode)tokenOrNode!, newDocumentSemanticModel, _cancellationToken);
                    if (!invocationReferencedSymbols.IsDefault)
                        newReferencedSymbols = invocationReferencedSymbols;
                }
            }

            // 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 GetSymbolsTouchingPosition
            if (newReferencedSymbols.Length >= 2)
            {
                newReferencedSymbols = RenameUtilities.FilterAliasSymbols(newReferencedSymbols);
            }

            return newReferencedSymbols;
        }

        private async Task<ISymbol> GetRenamedSymbolInCurrentSolutionAsync(MutableConflictResolution conflictResolution)
        {
            try
            {
                // get the renamed symbol in complexified new solution
                var start = _documentOfRenameSymbolHasBeenRenamed
                    ? conflictResolution.GetAdjustedTokenStartingPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration)
                    : _renameSymbolDeclarationLocation.SourceSpan.Start;

                var document = await conflictResolution.CurrentSolution.GetRequiredDocumentAsync(
                    _documentIdOfRenameSymbolDeclaration, includeSourceGenerated: true, _cancellationToken).ConfigureAwait(false);
                var newSymbol = await SymbolFinder.FindSymbolAtPositionAsync(document, start, cancellationToken: _cancellationToken).ConfigureAwait(false);
                return newSymbol;
            }
            catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, ErrorSeverity.Critical))
            {
                throw ExceptionUtilities.Unreachable();
            }
        }

        /// <summary>
        /// The method determines the set of documents that need to be processed for Rename and also determines
        /// the possible set of names that need to be checked for conflicts.
        /// The list will contains Strings like Bar -> BarAttribute ; Property Bar -> Bar , get_Bar, set_Bar
        /// </summary>
        private async Task<(ImmutableHashSet<DocumentId> documentIds, ImmutableArray<string> possibleNameConflicts)> FindDocumentsAndPossibleNameConflictsAsync()
        {
            try