5 types derived from Tests
Microsoft.CodeAnalysis.CSharp (5)
Binder\DecisionDagBuilder.cs (5)
1933
public sealed class True :
Tests
1954
public sealed class False :
Tests
1977
public sealed class One :
Tests
2122
public sealed class Not :
Tests
2167
public abstract class SequenceTests :
Tests
179 references to Tests
Microsoft.CodeAnalysis.CSharp (179)
Binder\DecisionDagBuilder.cs (171)
188
Tests
tests = MakeAndSimplifyTestsAndBindings(input, pattern, out ImmutableArray<BoundPatternBinding> bindings);
192
private
Tests
MakeAndSimplifyTestsAndBindings(
198
Tests
tests = MakeTestsAndBindings(input, pattern, bindingsBuilder);
204
private static
Tests
SimplifyTestsAndBindings(
205
Tests
tests,
221
var
result = scanAndSimplify(tests);
225
Tests
scanAndSimplify(
Tests
tests)
229
case
Tests
.SequenceTests seq:
232
var newSequence = ArrayBuilder<
Tests
>.GetInstance(length);
239
case
Tests
.True _:
240
case
Tests
.False _:
242
case
Tests
.One(BoundDagEvaluation e):
251
return
Tests
.True.Instance;
253
case
Tests
.One(BoundDagTest d):
257
case
Tests
.Not n:
258
return
Tests
.Not.Create(scanAndSimplify(n.Negated));
265
private
Tests
MakeTestsAndBindings(
278
private
Tests
MakeTestsAndBindings(
294
return
Tests
.True.Instance;
315
private
Tests
MakeTestsAndBindingsForITuplePattern(
329
var tests = ArrayBuilder<
Tests
>.GetInstance(4 + patternLength * 2);
331
tests.Add(new
Tests
.One(new BoundDagTypeTest(syntax, iTupleType, input)));
333
tests.Add(new
Tests
.One(valueAsITupleEvaluation));
338
tests.Add(new
Tests
.One(lengthEvaluation));
340
tests.Add(new
Tests
.One(new BoundDagValueTest(syntax, ConstantValue.Create(patternLength), lengthTemp)));
346
tests.Add(new
Tests
.One(indexEvaluation));
351
return
Tests
.AndSequence.Create(tests);
388
private
Tests
MakeTestsAndBindingsForDeclarationPattern(
395
var tests = ArrayBuilder<
Tests
>.GetInstance(1);
413
return
Tests
.AndSequence.Create(tests);
416
private
Tests
MakeTestsForTypePattern(
422
var tests = ArrayBuilder<
Tests
>.GetInstance(4);
424
return
Tests
.AndSequence.Create(tests);
431
ArrayBuilder<
Tests
> tests)
438
tests.Add(new
Tests
.One(new BoundDagNonNullTest(syntax, isExplicitTest, input)));
450
ArrayBuilder<
Tests
> tests)
468
tests.Add(new
Tests
.One(new BoundDagTypeTest(syntax, type, input)));
473
tests.Add(new
Tests
.One(evaluation));
479
private
Tests
MakeTestsForConstantPattern(
487
return new
Tests
.One(new BoundDagExplicitNullTest(constant.Syntax, input));
492
return new
Tests
.One(new BoundDagValueTest(constant.Syntax, constant.ConstantValue, input));
496
var tests = ArrayBuilder<
Tests
>.GetInstance(2);
503
tests.Add(
Tests
.False.Instance);
507
tests.Add(new
Tests
.One(new BoundDagValueTest(constant.Syntax, constant.ConstantValue, input)));
509
return
Tests
.AndSequence.Create(tests);
513
private
Tests
MakeTestsAndBindingsForRecursivePattern(
521
var tests = ArrayBuilder<
Tests
>.GetInstance(5);
531
tests.Add(new
Tests
.One(evaluation));
561
tests.Add(new
Tests
.One(evaluation));
571
tests.Add(new
Tests
.One(new BoundDagTypeTest(recursive.Syntax, ErrorType(), input, hasErrors: true)));
585
tests.Add(new
Tests
.One(new BoundDagTypeTest(recursive.Syntax, ErrorType(), input, hasErrors: true)));
600
return
Tests
.AndSequence.Create(tests);
627
tests.Add(new
Tests
.One(evaluation));
633
private
Tests
MakeTestsAndBindingsForNegatedPattern(BoundDagTemp input, BoundNegatedPattern neg, ArrayBuilder<BoundPatternBinding> bindings)
635
var
tests = MakeTestsAndBindings(input, neg.Negated, bindings);
636
return
Tests
.Not.Create(tests);
639
private
Tests
MakeTestsAndBindingsForBinaryPattern(
645
var builder = ArrayBuilder<
Tests
>.GetInstance(2);
650
var
result =
Tests
.OrSequence.Create(builder);
658
builder = ArrayBuilder<
Tests
>.GetInstance(2);
661
return
Tests
.AndSequence.Create(builder);
670
return
Tests
.AndSequence.Create(builder);
674
private
Tests
MakeTestsAndBindingsForRelationalPattern(
681
var tests = ArrayBuilder<
Tests
>.GetInstance(2);
687
tests.Add(
Tests
.False.Instance);
691
tests.Add(new
Tests
.One(new BoundDagRelationalTest(rel.Syntax, rel.Relation, rel.ConstantValue, output, rel.HasErrors)));
694
return
Tests
.AndSequence.Create(tests);
963
RoslynDebug.Assert(!(first.RemainingTests is
Tests
.False));
1030
stateForCase.RemainingTests.Filter(this, test, state, whenTrueValues, whenFalseValues, out
Tests
whenTrueTests, out
Tests
whenFalseTests, ref foundExplicitNullTest);
1162
var
remainingTests = stateForCase.RemainingTests.RemoveEvaluation(e);
1163
if (remainingTests is
Tests
.False)
1365
out
Tests
relationCondition,
1366
out
Tests
relationEffect)
1368
relationCondition =
Tests
.True.Instance;
1369
relationEffect =
Tests
.True.Instance;
1391
ArrayBuilder<
Tests
>? conditions = null;
1405
relationCondition =
Tests
.AndSequence.Create(conditions);
1409
relationEffect = new
Tests
.One(new BoundDagAssignmentEvaluation(syntax, target: other.Input, input: test.Input));
1453
(conditions ??= ArrayBuilder<
Tests
>.GetInstance()).Add(new
Tests
.One(new BoundDagValueTest(syntax, ConstantValue.Create(lengthValue), s1LengthTemp)));
1833
public readonly
Tests
RemainingTests;
1840
Tests
RemainingTests,
1856
public bool IsFullyMatched => RemainingTests is
Tests
.True && (WhenClause is null || WhenClause.ConstantValueOpt == ConstantValue.True);
1861
public bool PatternIsSatisfied => RemainingTests is
Tests
.True;
1867
public bool IsImpossible => RemainingTests is
Tests
.False;
1889
public StateForCase WithRemainingTests(
Tests
newRemainingTests)
1896
/// <inheritdoc cref="
Tests
.RewriteNestedLengthTests"/>
1919
out
Tests
whenTrue,
1920
out
Tests
whenFalse,
1923
public virtual
Tests
RemoveEvaluation(BoundDagEvaluation e) => this;
1927
public virtual
Tests
RewriteNestedLengthTests() => this;
1943
out
Tests
whenTrue,
1944
out
Tests
whenFalse,
1964
out
Tests
whenTrue,
1965
out
Tests
whenFalse,
1988
out
Tests
whenTrue,
1989
out
Tests
whenFalse,
1996
relationCondition: out
Tests
relationCondition,
1997
relationEffect: out
Tests
relationEffect))
2045
static
Tests
rewrite(bool decisionImpliesTrueOther, bool decisionPermitsTrueOther,
Tests
relationCondition,
Tests
relationEffect,
Tests
other)
2055
public override
Tests
RemoveEvaluation(BoundDagEvaluation e) => e.Equals(Test) ?
Tests
.True.Instance : (
Tests
)this;
2059
public override
Tests
RewriteNestedLengthTests()
2098
static
Tests
? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset)
2125
public readonly
Tests
Negated;
2126
private Not(
Tests
negated) => Negated = negated;
2127
public static
Tests
Create(
Tests
negated) => negated switch
2129
Tests
.True _ =>
Tests
.False.Instance,
2130
Tests
.False _ =>
Tests
.True.Instance,
2131
Tests
.Not n => n.Negated, // double negative
2132
Tests
.AndSequence a => new Not(a),
2133
Tests
.OrSequence a =>
Tests
.AndSequence.Create(NegateSequenceElements(a.RemainingTests)), // use demorgan to prefer and sequences
2134
Tests
.One o => new Not(o),
2137
private static ArrayBuilder<
Tests
> NegateSequenceElements(ImmutableArray<
Tests
> seq)
2139
var builder = ArrayBuilder<
Tests
>.GetInstance(seq.Length);
2140
foreach (
var
t in seq)
2145
public override
Tests
RemoveEvaluation(BoundDagEvaluation e) => Create(Negated.RemoveEvaluation(e));
2146
public override
Tests
RewriteNestedLengthTests() => Create(Negated.RewriteNestedLengthTests());
2155
out
Tests
whenTrue,
2156
out
Tests
whenFalse,
2159
Negated.Filter(builder, test, state, whenTrueValues, whenFalseValues, out
var
whenTestTrue, out
var
whenTestFalse, ref foundExplicitNullTest);
2169
public readonly ImmutableArray<
Tests
> RemainingTests;
2170
protected SequenceTests(ImmutableArray<
Tests
> remainingTests)
2175
public abstract
Tests
Update(ArrayBuilder<
Tests
> remainingTests);
2182
out
Tests
whenTrue,
2183
out
Tests
whenFalse,
2186
var trueBuilder = ArrayBuilder<
Tests
>.GetInstance(RemainingTests.Length);
2187
var falseBuilder = ArrayBuilder<
Tests
>.GetInstance(RemainingTests.Length);
2188
foreach (
var
other in RemainingTests)
2190
other.Filter(builder, test, state, whenTrueValues, whenFalseValues, out
Tests
oneTrue, out
Tests
oneFalse, ref foundExplicitNullTest);
2198
public sealed override
Tests
RemoveEvaluation(BoundDagEvaluation e)
2200
var builder = ArrayBuilder<
Tests
>.GetInstance(RemainingTests.Length);
2201
foreach (
var
test in RemainingTests)
2206
public sealed override
Tests
RewriteNestedLengthTests()
2208
var builder = ArrayBuilder<
Tests
>.GetInstance(RemainingTests.Length);
2209
foreach (
var
test in RemainingTests)
2231
private AndSequence(ImmutableArray<
Tests
> remainingTests) : base(remainingTests) { }
2232
public override
Tests
Update(ArrayBuilder<
Tests
> remainingTests) => Create(remainingTests);
2233
public static
Tests
Create(
Tests
t1,
Tests
t2)
2238
var builder = ArrayBuilder<
Tests
>.GetInstance(2);
2243
public static
Tests
Create(ArrayBuilder<
Tests
> remainingTests)
2263
var
result = remainingTests.Count switch
2310
private OrSequence(ImmutableArray<
Tests
> remainingTests) : base(remainingTests) { }
2312
public override
Tests
Update(ArrayBuilder<
Tests
> remainingTests) => Create(remainingTests);
2313
public static
Tests
Create(
Tests
t1,
Tests
t2)
2318
var builder = ArrayBuilder<
Tests
>.GetInstance(2);
2323
public static
Tests
Create(ArrayBuilder<
Tests
> remainingTests)
2343
var
result = remainingTests.Count switch
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);