cs: don't display via prop:exn:srclocs when context length is 0

It's not clear that supressing source locations with the context
length is set to 0 is the right choie, but it's consistent with BC.
This commit is contained in:
Matthew Flatt 2021-01-27 14:47:58 -07:00
parent 0ff8d18be5
commit 1fea5f8e3f
2 changed files with 8 additions and 2 deletions

View File

@ -336,6 +336,11 @@
(test #t regexp-match? #rx"listof srcloc[?]" (go (a "msg" (current-continuation-marks) (test #t regexp-match? #rx"listof srcloc[?]" (go (a "msg" (current-continuation-marks)
'oops) 'oops)
#:catch? #t)) #:catch? #t))
(parameterize ([error-print-context-length 0])
(test #f regexp-match? #rx"here" (go (a "msg" (current-continuation-marks)
(list (srcloc "here" 1 2 3 4)
(srcloc "there" 10 20 30 40))))))
(void)) (void))
(report-errs) (report-errs)

View File

@ -701,9 +701,10 @@
(and (exn? v) (and (exn? v)
(not (exn:fail:user? v)))) (not (exn:fail:user? v))))
(let* ([n (|#%app| error-print-context-length)] (let* ([n (|#%app| error-print-context-length)]
[locs (if (exn:srclocs? v) [locs (if (and (exn:srclocs? v)
(not (zero? n)))
((exn:srclocs-accessor* v) v) ((exn:srclocs-accessor* v) v)
null)] '())]
[l (if (zero? n) [l (if (zero? n)
'() '()
(traces->context (traces->context