racket / rackunit

Other
18 stars 34 forks source link

typed/rackunit: with-check-info broken #160

Open danielrothfus opened 2 years ago

danielrothfus commented 2 years ago

Given the following program on Racket v8.6 [cs]:

#lang typed/racket

(require rackunit)

(for-each
   (lambda (elt)
     (with-check-info
      (('current-element elt))
      (check-pred odd? elt)))
   (list 1 3 5 7 8))

The following error is generated at compile time:

; test.rkt:7:5: Type Checker: missing type for identifier;
;  consider using `require/typed' to import it
;   identifier: with-check-info*
;   from module: check-info.rkt
;   in: (with-check-info (((quote current-element) elt)) (check-pred odd? elt))
...

and other similar errors for make-check-info and provide/contract-id-syntax->location (which I've only seen references to on https://github.com/racket/typed-racket/issues/989).

I've poked around for a fix but haven't found a solution yet. If you can point me in the right direction, I can try to make a patch.

sorawee commented 7 months ago

It makes sense that rackunit won't work, but I do expect typed/rackunit to work, and it doesn't.

It's weird since typed/rackunit is supposed to export the type for with-check-info*:

https://github.com/racket/rackunit/blob/master/rackunit-typed/rackunit/main.rkt#L156