diff --git a/pkgs/racket-test-core/tests/racket/basic.rktl b/pkgs/racket-test-core/tests/racket/basic.rktl index a10d85df01..1d631b5a00 100644 --- a/pkgs/racket-test-core/tests/racket/basic.rktl +++ b/pkgs/racket-test-core/tests/racket/basic.rktl @@ -293,11 +293,10 @@ (test 'c list-ref '(a b c . d) 2) (arity-test list-ref 2 2) (err/rt-test (list-ref 1 1) exn:application:mismatch?) -(err/rt-test (list-ref '(a b . c) 2) exn:application:mismatch?) +(err/rt-test (list-ref '(a b . c) 2) exn:application:mismatch? #rx"index reaches a non-pair") (err/rt-test (list-ref '(1 2 3) 2.0)) (err/rt-test (list-ref '(1) '(1))) -(err/rt-test (list-ref '(1) 1) exn:application:mismatch?) -(err/rt-test (list-ref '() 0) exn:application:mismatch?) +(err/rt-test (list-ref '(1) 1) exn:application:mismatch? #rx"index too large for list") (err/rt-test (list-ref '() 0) exn:application:mismatch?) (err/rt-test (list-ref '(1) -1)) (err/rt-test (list-ref '(1) 2000000000000) exn:application:mismatch?) @@ -311,8 +310,8 @@ (err/rt-test (list-tail '(1 2 3) 2.0)) (err/rt-test (list-tail '(1) '(1))) (err/rt-test (list-tail '(1) -1)) -(err/rt-test (list-tail '(1) 2) exn:application:mismatch?) -(err/rt-test (list-tail '(1 2 . 3) 3) exn:application:mismatch?) +(err/rt-test (list-tail '(1) 2) exn:application:mismatch? #rx"index too large for list") +(err/rt-test (list-tail '(1 2 . 3) 3) exn:application:mismatch? #rx"index reaches a non-pair") (err/rt-test (car 0) exn:fail:contract? #rx"car: contract violation.*expected: pair[?].*given: 0") (err/rt-test (cdr 0) exn:fail:contract? #rx"cdr: contract violation.*expected: pair[?].*given: 0") diff --git a/racket/src/ChezScheme/mats/patch-compile-0-t-f-f b/racket/src/ChezScheme/mats/patch-compile-0-t-f-f index 4a1b92c34b..36293883c2 100644 --- a/racket/src/ChezScheme/mats/patch-compile-0-t-f-f +++ b/racket/src/ChezScheme/mats/patch-compile-0-t-f-f @@ -171,8 +171,8 @@ 5_2.mo:Expected error in mat c....r-errors: "cddddr: incorrect list structure (a . b)". ! 5_2.mo:Expected error in mat list*: "incorrect argument count in call (list*)". ! 5_2.mo:Expected error in mat cons*: "incorrect argument count in call (cons*)". - 5_2.mo:Expected error in mat list-ref: "list-ref: a is not a proper list". - 5_2.mo:Expected error in mat list-ref: "list-ref: (a b . c) is not a proper list". + 5_2.mo:Expected error in mat list-ref: "list-ref: index 0 reaches a non-pair in a". + 5_2.mo:Expected error in mat list-ref: "list-ref: index 4 reaches a non-pair in (a b . c)". 5_2.mo:Expected error in mat list-ref: "list-ref: index 4 is out of range for list (a b)". --- 693,700 ---- 5_2.mo:Expected error in mat c....r-errors: "cddadr: incorrect list structure (a . b)". @@ -180,8 +180,8 @@ 5_2.mo:Expected error in mat c....r-errors: "cddddr: incorrect list structure (a . b)". ! 5_2.mo:Expected error in mat list*: "incorrect number of arguments -1 to #". ! 5_2.mo:Expected error in mat cons*: "incorrect number of arguments -1 to #". - 5_2.mo:Expected error in mat list-ref: "list-ref: a is not a proper list". - 5_2.mo:Expected error in mat list-ref: "list-ref: (a b . c) is not a proper list". + 5_2.mo:Expected error in mat list-ref: "list-ref: index 0 reaches a non-pair in a". + 5_2.mo:Expected error in mat list-ref: "list-ref: index 4 reaches a non-pair in (a b . c)". 5_2.mo:Expected error in mat list-ref: "list-ref: index 4 is out of range for list (a b)". *************** *** 781,793 **** diff --git a/racket/src/ChezScheme/mats/root-experr-compile-0-f-f-f b/racket/src/ChezScheme/mats/root-experr-compile-0-f-f-f index 16425c86d0..d4258cd9b4 100644 --- a/racket/src/ChezScheme/mats/root-experr-compile-0-f-f-f +++ b/racket/src/ChezScheme/mats/root-experr-compile-0-f-f-f @@ -695,46 +695,46 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: # (lambda (ctc) (format-error-values (string-append "contract violation\n expected: " ctc "\n given: ~s") irritants))] + [(and (or (eq? who 'list-ref) (eq? who 'list-tail)) + (equal? str "index ~s is out of range for list ~s")) + (values (string-append "index too large for list\n" + " index: ~s\n" + " in: ~s") + irritants)] + [(and (or (eq? who 'list-ref) (eq? who 'list-tail)) + (equal? str "index ~s reaches a non-pair in ~s")) + (values (string-append "index reaches a non-pair\n" + " index: ~s\n" + " in: ~s") + irritants)] [(equal? str "~s is not a valid index for ~s") (cond [(exact-nonnegative-integer? (car irritants))