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