Skip to content

Instantly share code, notes, and snippets.

@greghendershott
Created March 12, 2014 18:15
Show Gist options
  • Save greghendershott/9512916 to your computer and use it in GitHub Desktop.
Save greghendershott/9512916 to your computer and use it in GitHub Desktop.
Additional example for PR 14389
Here's what I think is a variation of the same bug.
It uses `for:` (my original report involved using `for/flvector`).
---
#lang typed/racket/base
(module m typed/racket/base
(: f (Nonnegative-Real -> Float))
(define (f n)
(+ (real->double-flonum n) 10))
(provide f))
(require 'm)
(module+ test
(require typed/rackunit)
(for: ([k : Nonnegative-Real (list 32 70)])
(check-= (f k) k 0.0001)))
; Type Checker: untyped identifier apply-contract imported from module
<private/base.rkt>
; in: ((require typed/rackunit) (for: ((k : Nonnegative-Real (list
32 70))) (check-= (f k) k 0.0001)))
; Type Checker: untyped identifier generated-contract2 imported from
module <(submod . m)>
; in: ((require typed/rackunit) (for: ((k : Nonnegative-Real (list
32 70))) (check-= (f k) k 0.0001)))
; Type Checker: untyped identifier f imported from module <(submod . m)>
; in: ((require typed/rackunit) (for: ((k : Nonnegative-Real (list
32 70))) (check-= (f k) k 0.0001)))
; Type Checker: untyped identifier blame1 imported from module <(submod . m)>
; in: ((require typed/rackunit) (for: ((k : Nonnegative-Real (list
32 70))) (check-= (f k) k 0.0001)))
; Type Checker: Summary: 4 errors encountered
---
What's bizarre is that there are no errors if the definition of `f` is
directly in the same module. Likewise no error if the test is in the
same module (instead of in a `test` submodule).
I keep hitting this error with (module+ test) forms, to the point
where I've had to temporarily comment out nearly half my tests in one
project. (Although I could work around this by moving them to
dedicated test files, (a) there are dozens and (b) I _really_ prefer
the "inline" (module+ test) forms right below the things they test.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment