Make `defproc' throw an error if two arguments have the same name.

Related to the already fixed PR 12114 and PR 12133, which motivated the
error, and a few additional typos of the same kind.

(Note that it uses the symbols, but that's how they'll render anyway.)
This commit is contained in:
Eli Barzilay 2011-09-16 10:27:10 -04:00
parent f02d19553c
commit 16cd1ad78d
6 changed files with 21 additions and 19 deletions

View File

@ -336,21 +336,21 @@ Equivalent to @racket[(namespace-require `(for-syntax ,req))].}
Raises @racket[exn:fail], because the operations are not supported.}
@defproc*[([(hash-table? [v any/c])
@defproc*[([(hash-table? [v any/c])
hash-table?]
[(hash-table? [v any/c] [flag (one-of/c 'weak 'equal 'eqv)])
hash-table?]
[(hash-table? [v any/c]
[(hash-table? [v any/c]
[flag (one-of/c 'weak 'equal 'eqv)]
[flag (one-of/c 'weak 'equal 'eqv)])
[flag2 (one-of/c 'weak 'equal 'eqv)])
hash-table?])]{
Returns @racket[#t] if @racket[v] like a hash table created by
@racket[make-hash-table] or @racket[make-immutable-hash-table] with
the given @racket[flag]s (or more), @racket[#f] otherwise. Each
provided @racket[flag] must be distinct and @racket['equal] cannot be
used with @racket['eqv], otherwise the @racket[exn:fail:contract]
exception is raised.}
Returns @racket[#t] if @racket[v] is a hash table created by
@racket[make-hash-table] or @racket[make-immutable-hash-table] with the
given @racket[flag]s (or more), @racket[#f] otherwise. If @racket[flag2]
is provided, it must be distinct from @racket[flag] and @racket['equal]
cannot be used with @racket['eqv], otherwise the
@racket[exn:fail:contract] exception is raised.}
@defproc*[([(make-hash-table)
@ -358,7 +358,7 @@ exception is raised.}
[(make-hash-table [flag (one-of/c 'weak 'equal 'eqv)])
hash-table?]
[(make-hash-table [flag (one-of/c 'weak 'equal 'eqv)]
[flag (one-of/c 'weak 'equal 'eqv)])
[flag2 (one-of/c 'weak 'equal 'eqv)])
hash-table?])]{
Creates and returns a new hash table. If provided, each @racket[flag]
@ -381,7 +381,7 @@ must one of the following:
]
By default, key comparisons use @racket[eq?] (i.e., the hash table is
created with @racket[make-hasheq]). If the second @racket[flag] is
created with @racket[make-hasheq]). If @racket[flag2] is
redundant or @racket['equal] is provided with @racket['eqv], the
@racket[exn:fail:contract] exception is raised.}

View File

@ -1809,7 +1809,7 @@ exploring reduction sequences.
[#:x-spacing x-spacing number? 15]
[#:y-spacing y-spacing number? 15]
[#:layout layout (-> (listof term-node?) void) void]
[#:edge-labels? edge-label-font boolean? #t]
[#:edge-labels? edge-labels? boolean? #t]
[#:edge-label-font edge-label-font (or/c #f (is-a?/c font%)) #f]
[#:graph-pasteboard-mixin graph-pasteboard-mixin (make-mixin-contract graph-pasteboard<%>) values])
void?]{
@ -1926,7 +1926,7 @@ inserted into the editor by this library have a
[#:layout layout (-> (listof term-node?) void) void]
[#:x-spacing x-spacing number? 15]
[#:y-spacing y-spacing number? 15]
[#:edge-labels? edge-label-font boolean? #t]
[#:edge-labels? edge-labels? boolean? #t]
[#:edge-label-font edge-label-font (or/c #f (is-a?/c font%)) #f]
[#:graph-pasteboard-mixin graph-pasteboard-mixin (make-mixin-contract graph-pasteboard<%>) values]
[#:post-process post-process (-> (is-a?/c graph-pasteboard<%>) any/c)])

View File

@ -238,6 +238,10 @@
(if (symbol? (car p)) (car p) (loop (car p)))))
(define (do-one stx-id prototype args arg-contracts arg-vals result-contract
first?)
(let ([names (remq* '(... ...+) (map arg-id args))])
(unless (= (length names) (length (remove-duplicates names eq?)))
(error 'defproc "duplicate argument names in prototype for ~s: ~s"
(syntax->datum stx-id) names)))
(define tagged
(cond
[(eq? mode 'new)

View File

@ -467,7 +467,7 @@ making @filepath{.plt} archives.}
@litchar{[.]plt$}.}
@defproc[(mztar (path path-string?)
[#:as-path path path-string? path]
[#:as-path as-path path-string? path]
(output output-port?)
(filter (path-string? . -> . boolean?))
(file-mode (symbols 'file 'file-replace))) void?]{
@ -478,4 +478,3 @@ making @filepath{.plt} archives.}
path should be different from the original path. The
@racket[file-mode] argument specifies the default mode for packing a file,
either @racket['file] or @racket['file-replace].}

View File

@ -207,7 +207,7 @@ formats to the current one.}
[alt-path path-string?] [alt-anchor string?]) redirect-target-element?]
@defproc[(make-link-element [style any/c] [content list?] [tag tag?]) link-element?]
@defproc[(make-index-element [style any/c] [content list?] [tag tag?]
[tag tag?] [plain-seq (and/c pair? (listof string?))]
[plain-seq (and/c pair? (listof string?))]
[entry-seq list?] [desc any/c]) index-element?]
)]{

View File

@ -1237,16 +1237,15 @@ more expensive than with the other shapes.
3 1))]
}
@defproc*[([(freeze [image image?]) image?]
[(freeze [width (and/c real? (not/c negative?))]
[width (and/c real? (not/c negative?))]
[height (and/c real? (not/c negative?))]
[image image?]) image?]
[(freeze [x real?]
[y real?]
[width (and/c real? (not/c negative?))]
[width (and/c real? (not/c negative?))]
[height (and/c real? (not/c negative?))]
[image image?]) image?])]{
Freezing an image internally builds a bitmap, crops the image, draws the cropped image
into the bitmap and then