1 interface inheriting from IValueSet
Microsoft.CodeAnalysis.CSharp (1)
Utilities\IValueSet.cs (1)
65internal interface IValueSet<T> : IValueSet
2 implementations of IValueSet
Microsoft.CodeAnalysis.CSharp (2)
Utilities\ValueSetFactory.NintValueSet.cs (1)
15private sealed class NintValueSet : IValueSet<int>, IValueSet
Utilities\ValueSetFactory.NuintValueSet.cs (1)
15private sealed class NuintValueSet : IValueSet<uint>, IValueSet
162 references to IValueSet
Microsoft.CodeAnalysis.CSharp (154)
Binder\DecisionDagBuilder.cs (41)
714var values = fac?.Related(rel.Relation.Operator(), rel.ConstantValue); 828DagState uniquifyState(FrozenArrayBuilder<StateForCase> cases, ImmutableDictionary<BoundDagTemp, IValueSet> remainingValues) 841var newRemainingValues = ImmutableDictionary.CreateBuilder<BoundDagTemp, IValueSet>(); 846if (existingState.RemainingValues.TryGetValue(dagTemp, out var existingValuesForTemp)) 848var newExistingValuesForTemp = existingValuesForTemp.Union(valuesForTemp); 854!existingState.RemainingValues.All(kv => newRemainingValues.TryGetValue(kv.Key, out IValueSet? values) && kv.Value.Equals(values))) 887ImmutableDictionary<BoundDagTemp, IValueSet>.Empty); 930case BoundDagAssignmentEvaluation e when state.RemainingValues.TryGetValue(e.Input, out IValueSet? currentValues): 935if (state.RemainingValues.TryGetValue(e.Target, out IValueSet? targetValues)) 1073IValueSet? whenTrueValues, 1074IValueSet? whenFalseValues, 1088out ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues, 1090out ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues, 1102whenTrueValues.TryGetValue(test.Input, out IValueSet? whenTrueValuesOpt); 1103whenFalseValues.TryGetValue(test.Input, out IValueSet? whenFalseValuesOpt); 1125ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues, 1126ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues, 1130ImmutableDictionary<BoundDagTemp, IValueSet> values, 1149ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues, 1150ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues, 1162IValueSet fromTestPassing = valueFac.Related(relation.Operator(), value); 1163IValueSet fromTestFailing = fromTestPassing.Complement(); 1164if (values.TryGetValue(input, out IValueSet? tempValuesBeforeTest)) 1244IValueSet? whenTrueValues, 1245IValueSet? whenFalseValues, 1854public ImmutableDictionary<BoundDagTemp, IValueSet> RemainingValues { get; private set; } = null!; 1883public static DagState GetInstance(FrozenArrayBuilder<StateForCase> cases, ImmutableDictionary<BoundDagTemp, IValueSet> remainingValues) 1927internal void UpdateRemainingValues(ImmutableDictionary<BoundDagTemp, IValueSet> newRemainingValues) 2071IValueSet? whenTrueValues, 2072IValueSet? whenFalseValues, 2095IValueSet? whenTrueValues, 2096IValueSet? whenFalseValues, 2116IValueSet? whenTrueValues, 2117IValueSet? whenFalseValues, 2140IValueSet? whenTrueValues, 2141IValueSet? whenFalseValues, 2256var lengthValues = fac.Related(relation, constant); 2307IValueSet? whenTrueValues, 2308IValueSet? whenFalseValues, 2334IValueSet? whenTrueValues, 2335IValueSet? whenFalseValues,
Binder\PatternExplainer.cs (5)
510IValueSet remainingValues = computeRemainingValues(fac, constraints); 596IValueSet computeRemainingValues(IValueSetFactory fac, ImmutableArray<(BoundDagTest test, bool sense)> constraints) 598var remainingValues = fac.AllValues; 616var filtered = fac.Related(relation, value); 641private static string SampleValueString(IValueSet remainingValues, TypeSymbol type, bool requireExactType, ref bool unnamedEnumValue)
Utilities\IValueSet.cs (6)
21IValueSet Intersect(IValueSet other); 26IValueSet Union(IValueSet other); 31IValueSet Complement(); 63/// An interface representing a set of values of a specific type. Like <see cref="IValueSet"/> but strongly typed to <typeparamref name="T"/>.
Utilities\IValueSetFactory.cs (4)
18IValueSet Related(BinaryOperatorKind relation, ConstantValue value); 28IValueSet Random(int expectedSize, Random random); 38IValueSet AllValues { get; } 43IValueSet NoValues { get; }
Utilities\ValueSetFactory.BoolValueSet.cs (11)
39bool IValueSet.IsEmpty => !_hasFalse && !_hasTrue; 41ConstantValue IValueSet.Sample => ConstantValue.Create(_hasTrue ? true : _hasFalse ? false : throw new ArgumentException()); 56bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.BooleanValue); 71bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, value.BooleanValue); 75IValueSet IValueSet.Complement() => this.Complement(); 85public IValueSet Intersect(IValueSet other) => this.Intersect((IValueSet<bool>)other); 95IValueSet IValueSet.Union(IValueSet other) => this.Union((IValueSet<bool>)other);
Utilities\ValueSetFactory.BoolValueSetFactory.cs (4)
24IValueSet IValueSetFactory.AllValues => BoolValueSet.AllValues; 26IValueSet IValueSetFactory.NoValues => BoolValueSet.None; 42IValueSet IValueSetFactory.Random(int expectedSize, Random random) => random.Next(4) switch 53IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value)
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (4)
17IValueSet IValueSetFactory.AllValues => NumericValueSet<decimal>.AllValues(DecimalTC.Instance); 19IValueSet IValueSetFactory.NoValues => NumericValueSet<decimal>.NoValues(DecimalTC.Instance); 23IValueSet IValueSetFactory.Random(int expectedSize, Random random) => _underlying.Random(expectedSize, random); 27IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) =>
Utilities\ValueSetFactory.EnumeratedValueSet.cs (11)
48ConstantValue IValueSet.Sample 88bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 111bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value)); 115IValueSet IValueSet.Complement() => this.Complement(); 138IValueSet IValueSet.Intersect(IValueSet other) => Intersect((IValueSet<T>)other); 161IValueSet IValueSet.Union(IValueSet other) => Union((IValueSet<T>)other);
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (4)
21IValueSet IValueSetFactory.AllValues => EnumeratedValueSet<T>.AllValues(_tc); 23IValueSet IValueSetFactory.NoValues => EnumeratedValueSet<T>.NoValues(_tc); 38IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 47public IValueSet Random(int expectedSize, Random random)
Utilities\ValueSetFactory.FloatingValueSet.cs (11)
51ConstantValue IValueSet.Sample 111IValueSet IValueSet.Intersect(IValueSet other) => this.Intersect((IValueSet<TFloating>)other); 126IValueSet IValueSet.Union(IValueSet other) => this.Union((IValueSet<TFloating>)other); 136IValueSet IValueSet.Complement() => this.Complement(); 138bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => 148bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (4)
20IValueSet IValueSetFactory.AllValues => FloatingValueSet<TFloating>.AllValues(_tc); 22IValueSet IValueSetFactory.NoValues => FloatingValueSet<TFloating>.NoValues(_tc); 27IValueSet IValueSetFactory.Random(int expectedSize, Random random) => 35IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) =>
Utilities\ValueSetFactory.NintValueSet.cs (11)
48ConstantValue? IValueSet.Sample 74bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.Int32Value); 85bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.Int32Value); 96IValueSet IValueSet.Complement() => this.Complement(); 108IValueSet IValueSet.Intersect(IValueSet other) => this.Intersect((NintValueSet)other); 120IValueSet IValueSet.Union(IValueSet other) => this.Union((NintValueSet)other);
Utilities\ValueSetFactory.NintValueSetFactory.cs (4)
19IValueSet IValueSetFactory.AllValues => NintValueSet.AllValues; 21IValueSet IValueSetFactory.NoValues => NintValueSet.NoValues; 32IValueSet IValueSetFactory.Random(int expectedSize, Random random) 43IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value)
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (4)
21public IValueSet AllValues => NumericValueSet<int>.AllValues(IntTC.NonNegativeInstance); 23public IValueSet NoValues => NumericValueSet<int>.NoValues(IntTC.NonNegativeInstance); 53IValueSet IValueSetFactory.Random(int expectedSize, Random random) => s_underlying.Random(expectedSize, random); 57IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) =>
Utilities\ValueSetFactory.NuintValueSet.cs (11)
39ConstantValue? IValueSet.Sample 63bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.UInt32Value); 72bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.UInt32Value); 82IValueSet IValueSet.Complement() => this.Complement(); 93IValueSet IValueSet.Intersect(IValueSet other) => this.Intersect((NuintValueSet)other); 104IValueSet IValueSet.Union(IValueSet other) => this.Union((NuintValueSet)other);
Utilities\ValueSetFactory.NuintValueSetFactory.cs (4)
19IValueSet IValueSetFactory.AllValues => NuintValueSet.AllValues; 21IValueSet IValueSetFactory.NoValues => NuintValueSet.NoValues; 31IValueSet IValueSetFactory.Random(int expectedSize, Random random) 41IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value)
Utilities\ValueSetFactory.NumericValueSet.cs (11)
56ConstantValue IValueSet.Sample 107bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 129bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value)); 160IValueSet IValueSet.Complement() => this.Complement(); 237IValueSet IValueSet.Intersect(IValueSet other) => this.Intersect((IValueSet<T>)other); 288IValueSet IValueSet.Union(IValueSet other) => this.Union((IValueSet<T>)other);
Utilities\ValueSetFactory.NumericValueSetFactory.cs (4)
23IValueSet IValueSetFactory.AllValues => NumericValueSet<T>.AllValues(_tc); 25IValueSet IValueSetFactory.NoValues => NumericValueSet<T>.NoValues(_tc); 52IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 55public IValueSet Random(int expectedSize, Random random) =>
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (8)
Utilities\ValueSetTests.cs (8)
434var s3 = b.Complement().Intersect(s2.Complement()); 436var s4 = b.Union(s2).Complement(); 603var s1 = fac.Random(10, Random); 604var s2 = fac.Random(10, Random); 605var u1 = s1.Union(s2); 606var u2 = s1.Complement().Intersect(s2.Complement()).Complement(); 608var i1 = s1.Intersect(s2); 609var i2 = s1.Complement().Union(s2.Complement()).Complement();