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

(Typed Racket) -𝒾: contract violation blaming <pkgs>/soft-contract/parse/private.rkt #90

Open
bennn opened this issue Jun 5, 2017 · 3 comments

Comments

@bennn
Copy link

bennn commented Jun 5, 2017

soft-contract blames itself when it tries to verify a program that depends on a typed racket program.

Example program

"b.rkt"

#lang typed/racket/base

(: f (-> Integer Integer))
(define (f x)
  (+ x 2))

(provide f)

"a.rkt"

#lang racket

(require "b.rkt")

(define (g x)
  (f (f x)))

(provide (contract-out (g (-> integer? integer?))))

Error Message

-𝒾: contract violation
  expected: (or/c String Symbol)
  given: '(#<path:/Users/ben/code/racket/my-pkgs/require-typed-scv/test/gtp/lnm/bug/b.rkt> #%contract-defs)
  in: the 2nd argument of
      (-> Symbol (or/c String Symbol) any)
  contract from: 
      <pkgs>/soft-contract/ast/definition.rkt
  blaming: <pkgs>/soft-contract/parse/private.rkt
   (assuming the contract is correct)
  at: <pkgs>/soft-contract/ast/definition.rkt:58.8
  context...:
@philnguyen
Copy link
Owner

I fixed the error, which came from the parser. But there are still problems from requiring a typed/racket module.

@philnguyen
Copy link
Owner

@bennn did you have a rudimentary way to convert types to contracts? Worst case I can try using that to convert everything to contracted untyped modules first...

@bennn
Copy link
Author

bennn commented Jun 17, 2017

Yes, very rudimentary.
https://github.com/bennn/require-typed-scv/blob/master/private/parse-type.rkt#L17

Just parses surface syntax.
It would be better to parse expanded TR syntax ... and I think that is the best we could do without changing TR's type->contract function to have a text backend.

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

2 participants