racket / rackunit

Other
18 stars 34 forks source link

rackunit-typed: fix exn:test type declaration #147

Closed bennn closed 3 years ago

bennn commented 3 years ago

Change the annotation because exn:test is really an exn:fail (and not a direct sub-struct of exn).

The old annotation had a funny consequence for the type of test-begin. It has a predicate that checks for exn:fail structs that are not exn:fail:test structs. Here's the old code:

          (with-handlers ([(λ (e)
                             (and (exn:fail? e)
                                  (not (exn:test? e))))

The funny consequence is that (exn:test? e) has type False because the typechecker thinks that exn:fail is distinct. And so, the whole old predicate boils down to exn:fail?.

With the new annotation, the predicate has an asymmetric occurrence type. That's why I had to add an ann there.