From 1fea5f8e3f019532321d9fc30f51533e37f4e473 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 27 Jan 2021 14:47:58 -0700 Subject: [PATCH] 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. --- pkgs/racket-test-core/tests/racket/srcloc.rktl | 5 +++++ racket/src/cs/rumble/error.ss | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/racket-test-core/tests/racket/srcloc.rktl b/pkgs/racket-test-core/tests/racket/srcloc.rktl index a79f6618df..d4289e4673 100644 --- a/pkgs/racket-test-core/tests/racket/srcloc.rktl +++ b/pkgs/racket-test-core/tests/racket/srcloc.rktl @@ -336,6 +336,11 @@ (test #t regexp-match? #rx"listof srcloc[?]" (go (a "msg" (current-continuation-marks) 'oops) #: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)) (report-errs) diff --git a/racket/src/cs/rumble/error.ss b/racket/src/cs/rumble/error.ss index 5a952bf1e7..8879691b06 100644 --- a/racket/src/cs/rumble/error.ss +++ b/racket/src/cs/rumble/error.ss @@ -701,9 +701,10 @@ (and (exn? v) (not (exn:fail:user? v)))) (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) - null)] + '())] [l (if (zero? n) '() (traces->context