-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,16 +11,6 @@ namespace Xunit.Analyzers; | |
|
||
static class CodeAnalysisExtensions | ||
{ | ||
#if ROSLYN_4_4_OR_GREATER | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static IOperation.OperationList Children(this IOperation operation) => | ||
operation.ChildOperations; | ||
This comment has been minimized.
Sorry, something went wrong.
sharwell
Contributor
|
||
#else | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static IEnumerable<IOperation> Children(this IOperation operation) => | ||
operation.Children; | ||
#endif | ||
|
||
public static INamedTypeSymbol? FindNamedType( | ||
this IAssemblySymbol assembly, | ||
Func<INamedTypeSymbol, bool> selector) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
#if ROSLYN_3_11 | ||
#pragma warning disable RS1024 // Incorrectly triggered by Roslyn 3.11 | ||
This comment has been minimized.
Sorry, something went wrong.
sharwell
Contributor
|
||
#endif | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
@@ -224,7 +222,7 @@ static bool TaskIsKnownToBeCompleted( | |
|
||
bool validateSafeTasks(IOperation op) | ||
{ | ||
foreach (var childOperation in op.Children()) | ||
foreach (var childOperation in op.Children) | ||
{ | ||
// Stop looking once we've found the operation that is ours, since any | ||
// code after that operation isn't something we should consider | ||
|
@@ -243,7 +241,7 @@ bool validateSafeTasks(IOperation op) | |
if (unfoundSymbols.Count == 0) | ||
return true; | ||
|
||
if (childOperation.Children().Any(c => validateSafeTasks(c))) | ||
if (childOperation.Children.Any(c => validateSafeTasks(c))) | ||
return true; | ||
} | ||
|
||
|
@@ -270,9 +268,9 @@ static void ValidateTaskFromWhenAny( | |
{ | ||
if (!unfoundSymbols.Contains(operation.Symbol)) | ||
return; | ||
if (operation.Children().FirstOrDefault() is not IVariableInitializerOperation variableInitializerOperation) | ||
if (operation.Children.FirstOrDefault() is not IVariableInitializerOperation variableInitializerOperation) | ||
return; | ||
if (variableInitializerOperation.Value.Children().FirstOrDefault() is not IInvocationOperation variableInitializerInvocationOperation) | ||
if (variableInitializerOperation.Value.Children.FirstOrDefault() is not IInvocationOperation variableInitializerInvocationOperation) | ||
return; | ||
if (!FindSymbol(variableInitializerInvocationOperation.TargetMethod, variableInitializerInvocationOperation, taskType, whenAny, xunitContext, out var _)) | ||
return; | ||
|
There was a bug in the test library for a long time which could impact this behavior. I believe the "3.11" behavior you have here is the correct behavior (using
WithIsSuppressed(true)
), and new versions of the test library should make this work across additional versions.