replace calls to `If` and `After` constructors with `cond` and `after` helper functions, to retain type information
haydnv opened this issue · comments
Examples:
# old
y = tc.Int(tc.If(x >= 0, x, tc.error.BadRequest(...)))
# new
y = tc.cond(x >= 0, x, tc.error.BadRequest(...)))
assert type(x) is type(y)
``
```python
# old
y = type(z)(form=tc.After(x, z))
# new
y = tc.after(x, z)
assert type(y) is type(z)
The cond
function should return an instance of the non-error type, if one branch is an error, otherwise an instance of the greatest common subclass of when
and then
.