5 types derived from Tests
Microsoft.CodeAnalysis.CSharp (5)
Binder\DecisionDagBuilder.cs (5)
2087public sealed class True : Tests 2108public sealed class False : Tests 2131public sealed class One : Tests 2276public sealed class Not : Tests 2321public abstract class SequenceTests : Tests
179 references to Tests
Microsoft.CodeAnalysis.CSharp (179)
Binder\DecisionDagBuilder.cs (171)
191Tests tests = MakeAndSimplifyTestsAndBindings(input, pattern, out ImmutableArray<BoundPatternBinding> bindings); 195private Tests MakeAndSimplifyTestsAndBindings( 201Tests tests = MakeTestsAndBindings(input, pattern, bindingsBuilder); 207private static Tests SimplifyTestsAndBindings( 208Tests tests, 224var result = scanAndSimplify(tests); 228Tests scanAndSimplify(Tests tests) 232case Tests.SequenceTests seq: 235var newSequence = ArrayBuilder<Tests>.GetInstance(length); 242case Tests.True _: 243case Tests.False _: 245case Tests.One(BoundDagEvaluation e): 254return Tests.True.Instance; 256case Tests.One(BoundDagTest d): 260case Tests.Not n: 261return Tests.Not.Create(scanAndSimplify(n.Negated)); 268private Tests MakeTestsAndBindings( 281private Tests MakeTestsAndBindings( 297return Tests.True.Instance; 318private Tests MakeTestsAndBindingsForITuplePattern( 332var tests = ArrayBuilder<Tests>.GetInstance(4 + patternLength * 2); 334tests.Add(new Tests.One(new BoundDagTypeTest(syntax, iTupleType, input))); 336tests.Add(new Tests.One(valueAsITupleEvaluation)); 341tests.Add(new Tests.One(lengthEvaluation)); 343tests.Add(new Tests.One(new BoundDagValueTest(syntax, ConstantValue.Create(patternLength), lengthTemp))); 349tests.Add(new Tests.One(indexEvaluation)); 354return Tests.AndSequence.Create(tests); 391private Tests MakeTestsAndBindingsForDeclarationPattern( 398var tests = ArrayBuilder<Tests>.GetInstance(1); 416return Tests.AndSequence.Create(tests); 419private Tests MakeTestsForTypePattern( 425var tests = ArrayBuilder<Tests>.GetInstance(4); 427return Tests.AndSequence.Create(tests); 434ArrayBuilder<Tests> tests) 441tests.Add(new Tests.One(new BoundDagNonNullTest(syntax, isExplicitTest, input))); 453ArrayBuilder<Tests> tests) 471tests.Add(new Tests.One(new BoundDagTypeTest(syntax, type, input))); 476tests.Add(new Tests.One(evaluation)); 482private Tests MakeTestsForConstantPattern( 490return new Tests.One(new BoundDagExplicitNullTest(constant.Syntax, input)); 495return new Tests.One(new BoundDagValueTest(constant.Syntax, constant.ConstantValue, input)); 499var tests = ArrayBuilder<Tests>.GetInstance(2); 506tests.Add(Tests.False.Instance); 510tests.Add(new Tests.One(new BoundDagValueTest(constant.Syntax, constant.ConstantValue, input))); 512return Tests.AndSequence.Create(tests); 516private Tests MakeTestsAndBindingsForRecursivePattern( 524var tests = ArrayBuilder<Tests>.GetInstance(5); 534tests.Add(new Tests.One(evaluation)); 564tests.Add(new Tests.One(evaluation)); 574tests.Add(new Tests.One(new BoundDagTypeTest(recursive.Syntax, ErrorType(), input, hasErrors: true))); 588tests.Add(new Tests.One(new BoundDagTypeTest(recursive.Syntax, ErrorType(), input, hasErrors: true))); 603return Tests.AndSequence.Create(tests); 630tests.Add(new Tests.One(evaluation)); 636private Tests MakeTestsAndBindingsForNegatedPattern(BoundDagTemp input, BoundNegatedPattern neg, ArrayBuilder<BoundPatternBinding> bindings) 638var tests = MakeTestsAndBindings(input, neg.Negated, bindings); 639return Tests.Not.Create(tests); 642private Tests MakeTestsAndBindingsForBinaryPattern( 660Tests result = MakeTestsAndBindings(input, currentNode.Left, out output, bindings); 671static Tests makeTestsAndBindingsForBinaryPattern(DecisionDagBuilder @this, Tests leftTests, BoundDagTemp leftOutput, BoundDagTemp input, BoundBinaryPattern bin, out BoundDagTemp output, ArrayBuilder<BoundPatternBinding> bindings) 673var builder = ArrayBuilder<Tests>.GetInstance(2); 678var result = Tests.OrSequence.Create(builder); 686builder = ArrayBuilder<Tests>.GetInstance(2); 689return Tests.AndSequence.Create(builder); 698return Tests.AndSequence.Create(builder); 703private Tests MakeTestsAndBindingsForRelationalPattern( 711var tests = ArrayBuilder<Tests>.GetInstance(2); 717tests.Add(Tests.False.Instance); 721tests.Add(new Tests.One(new BoundDagRelationalTest(rel.Syntax, rel.Relation, rel.ConstantValue, output, rel.HasErrors))); 724return Tests.AndSequence.Create(tests); 1012RoslynDebug.Assert(!(first.RemainingTests is Tests.False)); 1079stateForCase.RemainingTests.Filter(this, test, state, whenTrueValues, whenFalseValues, out Tests whenTrueTests, out Tests whenFalseTests, ref foundExplicitNullTest); 1212if (remainingTests is Tests.False) 1414out Tests relationCondition, 1415out Tests relationEffect) 1417relationCondition = Tests.True.Instance; 1418relationEffect = Tests.True.Instance; 1440ArrayBuilder<Tests>? conditions = null; 1454relationCondition = Tests.AndSequence.Create(conditions); 1458relationEffect = new Tests.One(new BoundDagAssignmentEvaluation(syntax, target: other.Input, input: test.Input)); 1502(conditions ??= ArrayBuilder<Tests>.GetInstance()).Add(new Tests.One(new BoundDagValueTest(syntax, ConstantValue.Create(lengthValue), s1LengthTemp))); 1989public readonly Tests RemainingTests; 1996Tests RemainingTests, 2012public bool IsFullyMatched => RemainingTests is Tests.True && (WhenClause is null || WhenClause.ConstantValueOpt == ConstantValue.True); 2017public bool PatternIsSatisfied => RemainingTests is Tests.True; 2023public bool IsImpossible => RemainingTests is Tests.False; 2043public StateForCase WithRemainingTests(Tests newRemainingTests) 2050/// <inheritdoc cref="Tests.RewriteNestedLengthTests"/> 2073out Tests whenTrue, 2074out Tests whenFalse, 2077public virtual Tests RemoveEvaluation(BoundDagEvaluation e) => this; 2081public virtual Tests RewriteNestedLengthTests() => this; 2097out Tests whenTrue, 2098out Tests whenFalse, 2118out Tests whenTrue, 2119out Tests whenFalse, 2142out Tests whenTrue, 2143out Tests whenFalse, 2150relationCondition: out Tests relationCondition, 2151relationEffect: out Tests relationEffect)) 2199static Tests rewrite(bool decisionImpliesTrueOther, bool decisionPermitsTrueOther, Tests relationCondition, Tests relationEffect, Tests other) 2209public override Tests RemoveEvaluation(BoundDagEvaluation e) => e.Equals(Test) ? Tests.True.Instance : (Tests)this; 2213public override Tests RewriteNestedLengthTests() 2252static Tests? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset) 2279public readonly Tests Negated; 2280private Not(Tests negated) => Negated = negated; 2281public static Tests Create(Tests negated) => negated switch 2283Tests.True _ => Tests.False.Instance, 2284Tests.False _ => Tests.True.Instance, 2285Tests.Not n => n.Negated, // double negative 2286Tests.AndSequence a => new Not(a), 2287Tests.OrSequence a => Tests.AndSequence.Create(NegateSequenceElements(a.RemainingTests)), // use demorgan to prefer and sequences 2288Tests.One o => new Not(o), 2291private static ArrayBuilder<Tests> NegateSequenceElements(ImmutableArray<Tests> seq) 2293var builder = ArrayBuilder<Tests>.GetInstance(seq.Length); 2294foreach (var t in seq) 2299public override Tests RemoveEvaluation(BoundDagEvaluation e) => Create(Negated.RemoveEvaluation(e)); 2300public override Tests RewriteNestedLengthTests() => Create(Negated.RewriteNestedLengthTests()); 2309out Tests whenTrue, 2310out Tests whenFalse, 2313Negated.Filter(builder, test, state, whenTrueValues, whenFalseValues, out var whenTestTrue, out var whenTestFalse, ref foundExplicitNullTest); 2323public readonly ImmutableArray<Tests> RemainingTests; 2324protected SequenceTests(ImmutableArray<Tests> remainingTests) 2329public abstract Tests Update(ArrayBuilder<Tests> remainingTests); 2336out Tests whenTrue, 2337out Tests whenFalse, 2340var trueBuilder = ArrayBuilder<Tests>.GetInstance(RemainingTests.Length); 2341var falseBuilder = ArrayBuilder<Tests>.GetInstance(RemainingTests.Length); 2342foreach (var other in RemainingTests) 2344other.Filter(builder, test, state, whenTrueValues, whenFalseValues, out Tests oneTrue, out Tests oneFalse, ref foundExplicitNullTest); 2352public sealed override Tests RemoveEvaluation(BoundDagEvaluation e) 2354var builder = ArrayBuilder<Tests>.GetInstance(RemainingTests.Length); 2355foreach (var test in RemainingTests) 2360public sealed override Tests RewriteNestedLengthTests() 2362var builder = ArrayBuilder<Tests>.GetInstance(RemainingTests.Length); 2363foreach (var test in RemainingTests) 2385private AndSequence(ImmutableArray<Tests> remainingTests) : base(remainingTests) { } 2386public override Tests Update(ArrayBuilder<Tests> remainingTests) => Create(remainingTests); 2387public static Tests Create(Tests t1, Tests t2) 2392var builder = ArrayBuilder<Tests>.GetInstance(2); 2397public static Tests Create(ArrayBuilder<Tests> remainingTests) 2464private OrSequence(ImmutableArray<Tests> remainingTests) : base(remainingTests) { } 2466public override Tests Update(ArrayBuilder<Tests> remainingTests) => Create(remainingTests); 2467public static Tests Create(Tests t1, Tests t2) 2472var builder = ArrayBuilder<Tests>.GetInstance(2); 2477public static Tests Create(ArrayBuilder<Tests> remainingTests)
Binder\DecisionDagBuilder_ListPatterns.cs (8)
13private Tests MakeTestsAndBindingsForListPattern(BoundDagTemp input, BoundListPattern list, out BoundDagTemp output, ArrayBuilder<BoundPatternBinding> bindings) 23var tests = ArrayBuilder<Tests>.GetInstance(4 + subpatterns.Length * 2); 28tests.Add(new Tests.One(new BoundDagTypeTest(list.Syntax, ErrorType(), input, hasErrors: true))); 42tests.Add(new Tests.One(lengthEvaluation)); 44tests.Add(new Tests.One(list.HasSlice 66tests.Add(new Tests.One(sliceEvaluation)); 81tests.Add(new Tests.One(indexEvaluation)); 92return Tests.AndSequence.Create(tests);