private IEnumerable <ProgramState> TrySetObjectConstraint(ObjectConstraint constraint,
                                                                  SymbolicValueConstraints oldConstraints, ProgramState programState)
        {
            if (oldConstraints.HasConstraint <BoolConstraint>())
            {
                if (constraint == ObjectConstraint.Null)
                {
                    return(Enumerable.Empty <ProgramState>());
                }

                return(new[] { programState });
            }

            var oldObjectConstraint = oldConstraints.GetConstraintOrDefault <ObjectConstraint>();

            if (oldObjectConstraint != null)
            {
                if (oldObjectConstraint != constraint)
                {
                    return(Enumerable.Empty <ProgramState>());
                }

                return(new[] { programState.SetConstraint(this, constraint) });
            }

            throw new NotSupportedException($"Neither {nameof(BoolConstraint)}, nor {nameof(ObjectConstraint)}");
        }
        private IEnumerable <ProgramState> TrySetBoolConstraint(BoolConstraint constraint,
                                                                SymbolicValueConstraints oldConstraints, ProgramState programState)
        {
            if (oldConstraints.HasConstraint(ObjectConstraint.Null))
            {
                // It was null, and now it should be true or false
                return(Enumerable.Empty <ProgramState>());
            }

            var oldBoolConstraint = oldConstraints.GetConstraintOrDefault <BoolConstraint>();

            if (oldBoolConstraint != null &&
                oldBoolConstraint != constraint)
            {
                return(Enumerable.Empty <ProgramState>());
            }

            // Either same bool constraint, or previously not null, and now a bool constraint
            return(new[] { programState.SetConstraint(this, constraint) });
        }