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)
688var values = fac?.Related(rel.Relation.Operator(), rel.ConstantValue); 802DagState uniquifyState(FrozenArrayBuilder<StateForCase> cases, ImmutableDictionary<BoundDagTemp, IValueSet> remainingValues) 815var newRemainingValues = ImmutableDictionary.CreateBuilder<BoundDagTemp, IValueSet>(); 820if (existingState.RemainingValues.TryGetValue(dagTemp, out var existingValuesForTemp)) 822var newExistingValuesForTemp = existingValuesForTemp.Union(valuesForTemp); 828!existingState.RemainingValues.All(kv => newRemainingValues.TryGetValue(kv.Key, out IValueSet? values) && kv.Value.Equals(values))) 861ImmutableDictionary<BoundDagTemp, IValueSet>.Empty); 904case BoundDagAssignmentEvaluation e when state.RemainingValues.TryGetValue(e.Input, out IValueSet? currentValues): 909if (state.RemainingValues.TryGetValue(e.Target, out IValueSet? targetValues)) 1047IValueSet? whenTrueValues, 1048IValueSet? whenFalseValues, 1062out ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues, 1064out ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues, 1076whenTrueValues.TryGetValue(test.Input, out IValueSet? whenTrueValuesOpt); 1077whenFalseValues.TryGetValue(test.Input, out IValueSet? whenFalseValuesOpt); 1099ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues, 1100ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues, 1104ImmutableDictionary<BoundDagTemp, IValueSet> values, 1123ImmutableDictionary<BoundDagTemp, IValueSet> whenTrueValues, 1124ImmutableDictionary<BoundDagTemp, IValueSet> whenFalseValues, 1136IValueSet fromTestPassing = valueFac.Related(relation.Operator(), value); 1137IValueSet fromTestFailing = fromTestPassing.Complement(); 1138if (values.TryGetValue(input, out IValueSet? tempValuesBeforeTest)) 1218IValueSet? whenTrueValues, 1219IValueSet? whenFalseValues, 1828public ImmutableDictionary<BoundDagTemp, IValueSet> RemainingValues { get; private set; } = null!; 1857public static DagState GetInstance(FrozenArrayBuilder<StateForCase> cases, ImmutableDictionary<BoundDagTemp, IValueSet> remainingValues) 1901internal void UpdateRemainingValues(ImmutableDictionary<BoundDagTemp, IValueSet> newRemainingValues) 2045IValueSet? whenTrueValues, 2046IValueSet? whenFalseValues, 2069IValueSet? whenTrueValues, 2070IValueSet? whenFalseValues, 2090IValueSet? whenTrueValues, 2091IValueSet? whenFalseValues, 2114IValueSet? whenTrueValues, 2115IValueSet? whenFalseValues, 2230var lengthValues = fac.Related(relation, constant); 2281IValueSet? whenTrueValues, 2282IValueSet? whenFalseValues, 2308IValueSet? whenTrueValues, 2309IValueSet? 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();