// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Linq;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingMicrosoft.CodeAnalysis.Editing;
usingMicrosoft.CodeAnalysis.LanguageServices;
usingRoslyn.Utilities;
namespaceMicrosoft.CodeAnalysis.Shared.Extensions
{
internalstaticclassSyntaxEditorExtensions
{
/// <summary>
/// Helper function for fix-all fixes where individual fixes may affect the viability
/// of another. For example, consider the following code:
///
/// if ((double)x == (double)y)
///
/// In this code either cast can be removed, but at least one cast must remain. Even
/// though an analyzer marks both, a fixer must not remove both. One way to accomplish
/// this would be to have the fixer do a semantic check after each application. However
/// This is extremely expensive, especially for hte common cases where one fix does
/// not affect each other.
///
/// To address that, this helper groups fixes at certain boundary points. i.e. at
/// statement boundaries. If there is only one fix within the boundary, it does not
/// do any semantic verification. However, if there are multiple fixes in a boundary
/// it will call into <paramref name="canReplace"/> to validate if the subsequent fix