Hi all, Here's a simple patch. Found while reviewing Megane's patch for improving line number reporting in [ei]r-macro-transformer; this recompiled expand.scm which rubbed those compiler warnings in my face.
I think having these redundant predicate checks in the expander was a temporary measure during the transition from 5.0 to 5.1, but now even if we compile CHICKEN with 5.1 or 5.2 this is not needed at all any more. It might not even have been needed when it was introduced, but I'm not 100% sure. Cheers, Peter
From fe1e9ed7f5eda19837fb8f0955aa2807cc82b95b Mon Sep 17 00:00:00 2001 From: Peter Bex <pe...@more-magic.net> Date: Sat, 10 Apr 2021 15:20:04 +0200 Subject: [PATCH] Minor cleanup Symbols and keywords are disjoint now, so we can remove the needless checks that say (and (symbol? x) (not (keyword? x))), because if something's a symbol, it cannot be a keyword too. This gets rid of some compilation warnings for expand.scm. --- expand.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/expand.scm b/expand.scm index 8da8b2c0..9a3ee7ac 100644 --- a/expand.scm +++ b/expand.scm @@ -763,10 +763,10 @@ (or (##sys#extended-lambda-list? x) (let loop ((x x)) (cond ((null? x)) - ((symbol? x) (not (keyword? x))) + ((symbol? x)) ((pair? x) (let ((s (car x))) - (and (symbol? s) (not (keyword? s)) + (and (symbol? s) (loop (cdr x)) ) ) ) (else #f) ) ) ) ) @@ -849,7 +849,7 @@ (inherit-pair-line-numbers sym (cons (rename (car sym)) (rename (cdr sym))))) ((vector? sym) (list->vector (rename (vector->list sym)))) - ((or (not (symbol? sym)) (keyword? sym)) sym) + ((not (symbol? sym)) sym) ((assq sym renv) => (lambda (a) (dd `(RENAME/RENV: ,sym --> ,(cdr a))) @@ -872,8 +872,8 @@ (do ((i 0 (fx+ i 1)) (f #t (compare (vector-ref s1 i) (vector-ref s2 i)))) ((or (fx>= i len) (not f)) f)))))) - ((and (symbol? s1) (not (keyword? s1)) - (symbol? s2) (not (keyword? s2))) + ((and (symbol? s1) + (symbol? s2)) (let ((ss1 (or (getp s1 '##core#macro-alias) (lookup2 1 s1 dse) s1) ) @@ -912,7 +912,7 @@ sym (cons (mirror-rename (car sym)) (mirror-rename (cdr sym))))) ((vector? sym) (list->vector (mirror-rename (vector->list sym)))) - ((or (not (symbol? sym)) (keyword? sym)) sym) + ((not (symbol? sym)) sym) (else ; Code stolen from strip-syntax (let ((renamed (lookup sym se) ) ) (cond ((assq-reverse sym renv) => -- 2.20.1
signature.asc
Description: PGP signature