soft-contract icon indicating copy to clipboard operation
soft-contract copied to clipboard

Parse error when specifying contracts on keyword arguments

Open rosekunkel opened this issue 8 years ago • 1 comments

Example

#lang racket

(provide (contract-out [f (-> #:foo any/c any/c)]))

(define (f #:foo x) x)

Expected output

Safe

Actual output

parser: don't know what `make-struct-type` is
  context...:
   temp494
   /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:342:33
   temp349
   /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:342:33
   temp207
   /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:342:33
   /home/will/research/soft-contract/soft-contract/parse/private.rkt:99:8: for-loop
   [repeats 1 more time]
   /home/will/research/soft-contract/soft-contract/parse/private.rkt:84:2: parse-top-level-form
   /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:342:33
   parse-module
   /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:342:33
   parse-files
   /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:346:33
   /home/will/research/soft-contract/soft-contract/parse/main.rkt:11:0: parse-files
   /home/will/research/soft-contract/soft-contract/run.rkt:32:0: havoc-files
   ...

rosekunkel avatar May 03 '17 04:05 rosekunkel

More examples, from #86

Keyword args

#lang racket/base
(define (f #:x x) x)

Error message:

/..../racket/collects/racket/private/kw.rkt:251:10: parser: don't know what this identifier means. It is possibly an unimplemented primitive.
  in: make-struct-type
  context...:

Optional Keyword args

Example program:

#lang racket

(define (f #:x [x #f])
  x)

Error message:

σ@: no address #(struct:-α.wrp #(struct:-𝒾 make-optional-keyword-procedure /Users/ben/code/racket/fork/racket/collects/racket/private/kw.rkt))
  context...:

bennn avatar Jun 05 '17 19:06 bennn