You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#lang racket
(module a racket
(provide f)
(define (f x) (- x 100)))
(module b typed/racket
(require/typed
(submod".." a)
[f (-> Number Number)])
(provide f))
(require'b)
(f #f)
I would expect it to signal a contract violation and blame the outer module, using the contract from the interface for f established by module b. However, it does not. Instead, it simply invokes f with #f, and - raises an error.
It seems like identifiers imported with require/typed are not properly protected with additional contracts if they are reprovided. I don’t think this can cause any actual unsoundness in typed code, but it’s certainly surprising.
The text was updated successfully, but these errors were encountered:
I think this is because Typed Racket only protects provided identifiers that are defined in "this module", and that check is missing identifiers imported with require/typed.
This program produces a surprising result:
I would expect it to signal a contract violation and blame the outer module, using the contract from the interface for
f
established by moduleb
. However, it does not. Instead, it simply invokesf
with#f
, and-
raises an error.It seems like identifiers imported with
require/typed
are not properly protected with additional contracts if they are reprovided. I don’t think this can cause any actual unsoundness in typed code, but it’s certainly surprising.The text was updated successfully, but these errors were encountered: