Skip to content

z3 boolean isn't number-comparable #283

Open
@pschanely

Description

@pschanely
          [from `test_assume_has_status_reason`:](https://github.com/HypothesisWorks/hypothesis/actions/runs/10046646626/job/27766587120?pr=4034#step:6:3400)
Traceback (most recent call last):
  File ".../crosshair/libimpl/builtinslib.py", line 900, in __abs__
    return self._unary_op(lambda v: z3.If(v < 0, -v, v))
  File ".../crosshair/libimpl/builtinslib.py", line 319, in _unary_op
    return self.__class__(op(self.var), self.python_type)
  File ".../crosshair/libimpl/builtinslib.py", line 900, in <lambda>
    return self._unary_op(lambda v: z3.If(v < 0, -v, v))
TypeError: '<' not supported between instances of 'BoolRef' and 'int'

whereas in Python issubclass(bool, int) and so you can indeed compare them.

Originally posted by @Zac-HD in HypothesisWorks/hypothesis#4034 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions