Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproviding an identifier imported with require/typed does not enforce negative obligations with contracts #762

Open
lexi-lambda opened this issue Aug 22, 2018 · 4 comments

Comments

@lexi-lambda
Copy link
Member

This program produces a surprising result:

#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.

@samth
Copy link
Sponsor Member

samth commented Aug 22, 2018

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.

@mfelleisen
Copy link

mfelleisen commented Aug 23, 2018 via email

@samth
Copy link
Sponsor Member

samth commented Aug 23, 2018

It's not a design decision, it's a bug. I'm just pointing out where the bug is in the code.

@mfelleisen
Copy link

mfelleisen commented Aug 23, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants