scribble icon indicating copy to clipboard operation
scribble copied to clipboard

Unhelpful behavior of malformed defform

Open iitalics opened this issue 7 years ago • 0 comments

Code:

@defform[(m) #:contracts ([x any/c] [y any/c bad])]

Result:

issue.scrbl:3:27: x: unbound identifier
  in: x

When the #:contracts clause is even slightly malformed, it treats the entire expression as part of "pre-flow". This creates very unhelpful error messages. The likely fix is to stop backtracking when the keyword is matched.


As an amusing aside, the following almost-well-formed invocation:

@defform[(m) #:contracts ([const any/c] [thunk procedure? = void])]

Gives the following error:

application: procedure does not accept keyword arguments
  procedure: list
  arguments...:
   #:contracts any/c
Context:
 /home/milo/.racket/7.0.0.1/pkgs/scribble-lib/scribble/private/manual-form.rkt:325:0 *defforms

iitalics avatar Jun 18 '18 22:06 iitalics