Check that at least one require spec is provided.

Closes PR 10617.
 Merge to v5.0.
This commit is contained in:
Sam Tobin-Hochstadt 2010-05-24 18:45:16 -07:00
parent a9250ec4f0
commit 27e971dce2
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,16 @@
#;
(exn-pred "at least one")
#lang typed/racket
(require/typed (make-main (([Listof Node] [Listof Edge] -> Graph)
(State Number Number MouseEvent -> State)
(State KeyEvent -> State)
(State -> Scene)
(Any -> Boolean)
(State -> Boolean)
(Stop -> Graph)
(Any -> Edge)
(Edge -> Graph)
->
(Boolean -> Graph))))

View File

@ -79,7 +79,9 @@ This file defines two sorts of primitives. All of them are provided into any mod
#:fail-unless (eq? 'opaque (syntax-e #'opaque)) #f
#:with opt #'(#:name-exists)))
(syntax-parse stx
[(_ lib (~or sc:simple-clause strc:struct-clause oc:opaque-clause) ...)
[(_ lib:expr (~or sc:simple-clause strc:struct-clause oc:opaque-clause) ...)
(unless (< 0 (length (syntax->list #'(sc ... strc ... oc ...))))
(raise-syntax-error #f "at least one specification is required" stx))
#'(begin
(require/opaque-type oc.ty oc.pred lib . oc.opt) ...
(require/typed sc.nm sc.ty lib) ...