public IEnumerable <ItemValueVariantBase> this[[NotNull] AnalysisContext context,
                                                       [CanBeNull] ValueInterval interval]
        {
            get
            {
                if (interval != null)
                {
                    interval &= IndexRange;
                }
                else
                {
                    interval = IndexRange;
                }

                foreach (var i in interval.Iterate(IntegerLiteral.One))
                {
                    yield return(this[context, i]);
                }
            }
            set
            {
                if (interval != null)
                {
                    interval &= IndexRange;
                }
                else
                {
                    interval = IndexRange;
                }

                var indexes = interval.Iterate(IntegerLiteral.One);
                var values  = value;

                var indexesArray = indexes.ToArray();
                var valuesArray  = values.ToArray();

                if (indexesArray.Length != valuesArray.Length)
                {
                    Log.Warning("Mismatch: {Indexes} = {Values}", indexesArray, valuesArray);
                }

                indexes = indexesArray;
                values  = valuesArray;

                foreach (var(i, item) in indexes.Zip(values))
                {
                    this[context, i] = item;
                }
            }
        }
        public ArrayVariant([NotNull] Variable value, [NotNull] AnalysisContext context) : base(value, context)
        {
            Value      = new DataValueArray(Array.Empty <LogicExpressionBase>());
            IndexRange = ValueInterval.Empty;

            if (!(value.TypeRef is ArrayTypeRef arrayTypeRef))
            {
                Log.Error("ArrayVariant expects ArrayTypeRef, not {Type}", value.TypeRef);
                return;
            }

            if (!(arrayTypeRef.Length is OrderedLiteralBase length))
            {
                Log.Information("ArrayVariant expects OrderedLiteralBase as length, not {Type}",
                                arrayTypeRef.Length);
                return;
            }

            IndexRange = new ValueInterval(IntegerLiteral.Zero, length, toInclusive: false);
            foreach (var i in IndexRange.Iterate(IntegerLiteral.One))
            {
                var itemVariant = new ArrayItemVariant(value,
                                                       InnerTypeRef,
                                                       ValueInterval.Single(i),
                                                       context);
                this[context, i] = itemVariant;
            }
        }