Skip to content

Commit 71d9b97

Browse files
bdeketmflatt
authored andcommitted
Make sure that span is not false before checking length
1 parent ce75508 commit 71d9b97

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

scribble-lib/scribble/racket.rkt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@
280280
[(and (number? sc)
281281
(inexact? sc))
282282
(define s (iformat "~s" sc))
283-
(if (= (string-length s)
284-
(- (syntax-span c) 2))
283+
(if (let ([span (syntax-span c)])
284+
(and span (= (string-length s)
285+
(- span 2))))
285286
;; There's no way to know whether the source used #i,
286287
;; but it should be ok to include it:
287288
(string-append "#i" s)

scribble-test/tests/scribble/docs/manual-ex.rkt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@
3131
(define val:list '(1 2 3 4))
3232
(define val:vector #(1 2 3 4))
3333
(define val:param (make-parameter 'foo))
34+
(define val:flonum 1.25)

scribble-test/tests/scribble/docs/manual.scrbl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ A function, again, not a link target, documented to return @racket[10] using a d
8080
@defthing[#:link-target? #f val:kw any/c #:auto-value]{Test auto-value keyword reading.}
8181
@defthing[#:link-target? #f val:list any/c #:auto-value]{Test auto-value list reading.}
8282
@defthing[#:link-target? #f val:vector any/c #:auto-value]{Test auto-value vector reading.}
83+
@defthing[#:link-target? #f val:flonum any/c #:auto-value]{Test auto-value flonum reading.}
8384

8485
@defstruct[pt ([x real?] [y real?])]{A structure type with extra name.}
8586

scribble-test/tests/scribble/docs/manual.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ val:vector : any/c = #(1 2 3 4)
186186

187187
Test auto-value vector reading.
188188

189+
val:flonum : any/c = 1.25
190+
191+
Test auto-value flonum reading.
192+
189193
(struct pt (x y)
190194
    #:extra-constructor-name make-pt)
191195
  x : real?

0 commit comments

Comments
 (0)