/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/CSharp/Portable/Utilities/IConstantValueSetFactory.cs
57 строк
2 KB
AlekseyTs
Pattern matching: Implement value set for a union of types
07 дек 2025, 00:51
07 дек 2025, 00:51
3b33619
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; namespace Microsoft.CodeAnalysis.CSharp { /// <summary> /// A value set factory, which can be used to create a value set instance. A given instance of <see cref="IConstantValueSetFactory"/> /// supports only one type for the value sets it can produce. /// </summary> internal interface IConstantValueSetFactory { /// <summary> /// Returns a value set that includes any values that satisfy the given relation when compared to the given value. /// </summary> IConstantValueSet Related(BinaryOperatorKind relation, ConstantValue value); /// <summary> /// Returns true iff the values are related according to the given relation. /// </summary> bool Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right); /// <summary> /// Produce a random value set with the given expected size for testing. /// </summary> IConstantValueSet Random(int expectedSize, Random random); /// <summary> /// Produce a random value for testing. /// </summary> ConstantValue RandomValue(Random random); /// <summary> /// The set containing all values of the type. /// </summary> IConstantValueSet AllValues { get; } /// <summary> /// The empty set of values. /// </summary> IConstantValueSet NoValues { get; } } /// <summary> /// A value set factory, which can be used to create a value set instance. Like <see cref="ValueSetFactory"/> but strongly /// typed to <typeparamref name="T"/>. /// </summary> internal interface IConstantValueSetFactory<T> : IConstantValueSetFactory { /// <summary> /// Returns a value set that includes any values that satisfy the given relation when compared to the given value. /// </summary> IConstantValueSet<T> Related(BinaryOperatorKind relation, T value); } }