diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-03-22 23:57:38 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-03-22 23:57:38 -0700 |
commit | 502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89 (patch) | |
tree | 2dabede4707e240329405b6f008da043766dc657 | |
parent | df0ade89277738dea89abfaa226e91a30025bf60 (diff) | |
download | txr-502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89.tar.gz txr-502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89.tar.bz2 txr-502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89.zip |
lib: address remaining unused variable warnings.
* stdlib/arith-each.tl (sys-arith-each): Remove :form param.
* stdlib/awk.tl (awk-state :fini): Suppress unused warning
in dohash form by using an uninterned symbol for this
variable. This is a useful technique worth documenting.
(awk-expander): Remove unused varaible in a predicate
pattern.
(awk-code-move-check): Lose the unused awc and aws-sym.
(awk-mac-let): Don't pass the unused parameters to
awk-code-move-check.
* stdlib/conv.tl (conv-expand): Remove unused gensym.
* stdlib/debugger.tl (fcall-frame loc,
fcall-frame print-trace, expand-frame print-trace):
Mark unused parameters ignored.
* stdlib/defset.tl (defset-expander-simple): Remove
unused parameter.
(defset): Drop argument from defset-expander-simple
call, and also fix unused warning in tree-case form.
* stdlib/doc-lookup.tl (detached-run): Remove unused
variable from a pattern matching predicate.
It's not in the rightmost position so we have to
revers the comparison. I will enhance the pattern
matcher to support @nil in a predicate.
(toplevel): Ignore a parameter of the not-implemented
version of the open-url function.
* stdlib/doloop.tl (expand-dooloop): Replace unused
variable in a tree binding pattern with the t
symbol.
* stdlib/each-prod.tl (expand-each-prod*): Remove
unused let variable.
* stdlib/except.tl (expand-handle): Put else variable
in tree bind pattern to use.
* stdlib/getopts.tl (opt-desc (basic-type-p, cumul-type-p)):
Replace unused catch-all variable in tree bind pattern
with t symbol.
(opt-processor parse-opts): Remove unused args argument.
The object holds the args, prepared at construction time.
(getopts, option-base getopts): Don't pass args to parse-opts.
(define-option-struct): Replace unused treee pattern
variable with t.
* stdlib/ifa.tl (if-to-cond): Put catch-all else variable
to use.
* stdlib/keyparams.tl (param-expander): Mark unused parameter
ignored. Replace unused variables in tree-case with t.
* stdlib/match.tl (compile-struct-match, compile-predicate-match,
compile-require-match, compile-as-match, compile-with-match,
compile-or-match, compile-and-match, compile-not-match,
compile-hash-match, compile-scan-match, compile-exprs-match):
Address unused variables in mac-param-bind and tree-bind
patterns.
(match-case): Likewise, and also remove unused let variables.
(while-match-case, while-true-match-case): Remove unused
:env parameter.
(expand-lambda-match): Remove unused let variable.
(defun-match): Remove unused variable in tree-bind.
(define-param-expander): Mark menv parameter ignored.
Unused variables in tree-bind.
(defmatch): Replace lambda variable with a gensym.
(loosen, pat-len): Remove unused parameter.
(sme, end): Fix calls to loosen and pat-len.
(non-triv-pat-p): Mark parameter ignored in the
temporary version of this function.
(expand-quasi-match): Address unused variables in patterns,
and remove unused gensyms.
* stdlib/op.tl (op-rec-p): Unused variable in tree-case.
(op-alpha-rename): Remove f parameter.
(op-ignerr): Mark catch handler parameter ignored.
(op-expand): Remove argument from calls to op-alpha-rename.
* stdlib/path.test (if-windows, if-native-windows): The
compiler complains here about the unused variable
due to constant folding. We use the use function
to indicate that the variable is not ignored, but used.
* stdlib/pic.tl (expand-pic-num): Remove unused let variable.
(pic): Remove unused :env parameter.
* stdlib/place.tl (macroexpand-1-place): Ignore unused
env parameter.
(pset): Ignore some tree-bind variables. Not replacing
them with t because their names help code readability.
Lots of tricky code in place.tl.
(shift): Replace unused variable with t in tree-case.
(vecref, chr-str, ref, sub): Deal with unused expander
parameters.
(gethash): Deal with unused place parameter.
(dwim): Remove unused env parameter, and deal with
unused place parameters.
(get-fun-getter-setter): Unused variables in tree-bind.
(read-once, define-modify-macro): Remove unused gensyms.
(placelet-1): Mark ignored a parameter of an update
expander lambda.
* stdlib/pmac.tl (macroexpand-params): Fix unused
catch-all in tree-case.
* stdlib/struct.tl (prune-missing-inits): Mark
tree-bind unused variable ignored.
(defstruct): Unused tree-case variable.
(qref): Unused tree-case catch-all variables.
(rslot): Unused parameter removed.
(:delegate): Unused tree-case variables.
* stdlib/tagbody.tl (tagbody): Drop unused :env param.
Mark ignored the threaded-2 let variable, which cannot
be removed because its init-form performs a needed
side effect.
* stdlib/trace.tl (trace-leave): Remove unused param.
(trace): Don't pass argument to unused param of trace-leave.
(untrace): Use gensym in dohash to suppress unused
variable warning.
* stdlib/type.tl (typecase-expander): Unused variable
in tree-case.
* stdlib/with-resources.tl (with-resources): Likewise.
* stdlib/yield.tl (hlet-expand): Remove two unused locals.
* tests/012/lambda.tl: Fix test cases that break the
tests due to unused variable warnings.
* tests/016/arith.tl: Add test case for each-prod*.
At first I thought a bug was found in it but it turned
out that the init-forms variable that was removed
was really superfluous.
-rw-r--r-- | stdlib/arith-each.tl | 2 | ||||
-rw-r--r-- | stdlib/awk.tl | 19 | ||||
-rw-r--r-- | stdlib/conv.tl | 2 | ||||
-rw-r--r-- | stdlib/debugger.tl | 5 | ||||
-rw-r--r-- | stdlib/defset.tl | 8 | ||||
-rw-r--r-- | stdlib/doc-lookup.tl | 6 | ||||
-rw-r--r-- | stdlib/doloop.tl | 2 | ||||
-rw-r--r-- | stdlib/each-prod.tl | 3 | ||||
-rw-r--r-- | stdlib/except.tl | 2 | ||||
-rw-r--r-- | stdlib/getopts.tl | 12 | ||||
-rw-r--r-- | stdlib/ifa.tl | 2 | ||||
-rw-r--r-- | stdlib/keyparams.tl | 5 | ||||
-rw-r--r-- | stdlib/match.tl | 97 | ||||
-rw-r--r-- | stdlib/op.tl | 22 | ||||
-rw-r--r-- | stdlib/path-test.tl | 2 | ||||
-rw-r--r-- | stdlib/pic.tl | 3 | ||||
-rw-r--r-- | stdlib/place.tl | 40 | ||||
-rw-r--r-- | stdlib/pmac.tl | 3 | ||||
-rw-r--r-- | stdlib/struct.tl | 13 | ||||
-rw-r--r-- | stdlib/tagbody.tl | 3 | ||||
-rw-r--r-- | stdlib/trace.tl | 8 | ||||
-rw-r--r-- | stdlib/type.tl | 2 | ||||
-rw-r--r-- | stdlib/with-resources.tl | 2 | ||||
-rw-r--r-- | stdlib/yield.tl | 2 | ||||
-rw-r--r-- | tests/012/lambda.tl | 12 | ||||
-rw-r--r-- | tests/016/arith.tl | 4 |
26 files changed, 152 insertions, 129 deletions
diff --git a/stdlib/arith-each.tl b/stdlib/arith-each.tl index d28362e2..3b1ab87b 100644 --- a/stdlib/arith-each.tl +++ b/stdlib/arith-each.tl @@ -31,7 +31,7 @@ (whenlet ((bad (find-if [notf consp] vars))) (compile-error form "~s isn't a var-initform pair" bad))) -(defmacro sys:arith-each (:form f fn iv short-circ vars . body) +(defmacro sys:arith-each (fn iv short-circ vars . body) (let* ((gens (mapcar (ret (gensym)) vars)) (syms [mapcar car vars]) (accum (gensym))) diff --git a/stdlib/awk.tl b/stdlib/awk.tl index 0e8ad81f..54d2909c 100644 --- a/stdlib/awk.tl +++ b/stdlib/awk.tl @@ -44,7 +44,7 @@ par-mode par-mode-fs par-mode-prev-fs (streams (hash :equal-based)) (:fini (self) - (dohash (k v self.streams) + (dohash (#:k v self.streams) (close-stream v))) (:postinit (self) (set self.inputs (or self.inputs (zap *args*) (list *stdin*))) @@ -331,7 +331,7 @@ (collect-each ((fn actions)) (match-case fn (@(bindable @sym) (list sym)) - ((@(bindable @sym) @(bindable @fun)) + ((@(bindable @sym) @(bindable)) (if (eq sym '-) (awk-error "type given for unnamed field")) fn) @@ -356,8 +356,7 @@ awc.cond-actions (nreverse awc.cond-actions)) awc)) -(defun sys:awk-code-move-check (awc aws-sym mainform subform - suspicious-vars kind) +(defun sys:awk-code-move-check (mainform subform suspicious-vars kind) (when suspicious-vars (compile-warning mainform "~!form ~s\n\ is moved out of the apparent scope\n\ @@ -413,20 +412,16 @@ (expand-with-free-refs from-expr e ,awc.outer-env) (expand-with-free-refs to-expr e ,awc.outer-env) (list (cadr form) (caddr form))) - (sys:awk-code-move-check ,awc ',aws-sym - form from-expr-orig + (sys:awk-code-move-check form from-expr-orig (diff fe-ev fe-fv) 'variables) - (sys:awk-code-move-check ,awc ',aws-sym - form from-expr-orig + (sys:awk-code-move-check form from-expr-orig (diff fe-ef fe-ff) 'functions) - (sys:awk-code-move-check ,awc ',aws-sym - form to-expr-orig + (sys:awk-code-move-check form to-expr-orig (diff te-ev te-fv) 'variables) - (sys:awk-code-move-check ,awc ',aws-sym - form to-expr-orig + (sys:awk-code-move-check form to-expr-orig (diff te-ef te-ff) 'functions) (push rng-temp (qref ,awc rng-expr-temps)) diff --git a/stdlib/conv.tl b/stdlib/conv.tl index 5f0aa680..b6795d6f 100644 --- a/stdlib/conv.tl +++ b/stdlib/conv.tl @@ -76,7 +76,7 @@ (op where (op eq :))) (let ((nl (length lead)) (nt (length trail))) - (with-gensyms (i nm lfl mfl tfl) + (with-gensyms (nm lfl mfl tfl) (sys:conv-let ^(let* ((,nm (- (length ,list-sym) ,(+ nl nt))) (,lfl (list ,*lead)) diff --git a/stdlib/debugger.tl b/stdlib/debugger.tl index 72279848..85954da0 100644 --- a/stdlib/debugger.tl +++ b/stdlib/debugger.tl @@ -45,9 +45,11 @@ (defun debugger-help () (mapdo (ap pprinl `@{@1 15} @3`) %dbg-commands%)) -(defmeth fcall-frame loc (fr)) +(defmeth fcall-frame loc (fr) + (ignore fr)) (defmeth fcall-frame print-trace (fr pr-fr nx-fr prefix) + (ignore pr-fr) (let* ((fun fr.fun) (args fr.args) (name (if (functionp fun) @@ -80,6 +82,7 @@ ^(,sym))))))) (defmeth expand-frame print-trace (fr pr-fr nx-fr prefix) + (ignore pr-fr nx-fr) (let* ((form fr.form) (loc (source-loc-str form))) (put-string `@prefix X:@(if loc `(@loc):`)`) diff --git a/stdlib/defset.tl b/stdlib/defset.tl index f08b62a5..2745a9b6 100644 --- a/stdlib/defset.tl +++ b/stdlib/defset.tl @@ -45,7 +45,8 @@ (syms (mac-env-flatten (symbol-value env)))) (list (cadr explam) syms))) -(defun defset-expander-simple (macform get-fun set-fun) +(defun defset-expander-simple (get-fun set-fun) + (ignore set-fun) (with-gensyms (getter setter params) ^(defplace (,get-fun . ,params) body (,getter ,setter @@ -106,10 +107,11 @@ (defmacro usr:defset (:env e :form mf . args) (tree-case args ((name (. params) newval setform) + (ignore name params newval setform) (defset-expander e mf . args)) ((get-fun set-fun) - (defset-expander-simple mf get-fun set-fun)) - (x (compile-error mf "invalid syntax")))) + (defset-expander-simple get-fun set-fun)) + (t (compile-error mf "invalid syntax")))) (defset sub-list (list : (from 0) (to t)) items ^(progn (set ,list (replace-list ,list ,items ,from ,to)) ,items)) diff --git a/stdlib/doc-lookup.tl b/stdlib/doc-lookup.tl index 231d3b62..78597405 100644 --- a/stdlib/doc-lookup.tl +++ b/stdlib/doc-lookup.tl @@ -24,7 +24,7 @@ (exit* (let ((*stdout* *stdnull*)) (run program args))) (exit* 0))) - (@(< @res 0) (error "fork failed")))) + (@(> 0) (error "fork failed")))) (caseql os-symbol ((:linux :macos :openbsd :solaris :solaris10 :android) @@ -53,7 +53,9 @@ (if (> (int-cptr hinst) 32) t (error `~s: failed to open ~s` 'open-url url)))))) - (t (defun open-url (url) (error "~s: not implemented" 'open-url)))) + (t (defun open-url (url) + (ignore url) + (error "~s: not implemented" 'open-url)))) (defun usr:doc (: sym) (iflet ((str (typecase sym diff --git a/stdlib/doloop.tl b/stdlib/doloop.tl index 3b0c7892..c9eac310 100644 --- a/stdlib/doloop.tl +++ b/stdlib/doloop.tl @@ -27,7 +27,7 @@ (defun sys:expand-doloop (f vars cexp body) (let ((xvars (mapcar (tc - (((:whole w v i s . r)) + (((:whole w t t t . r)) (if r (compile-error f "excess elements in ~s" w) w)) (((:whole w v i . r)) (if r diff --git a/stdlib/each-prod.tl b/stdlib/each-prod.tl index a084ff5d..be514920 100644 --- a/stdlib/each-prod.tl +++ b/stdlib/each-prod.tl @@ -57,8 +57,7 @@ (append-each-prod* 'append-each-prod) (sum-each-prod* 'sum-each-prod) (mul-each-prod* 'mul-each-prod))) - (syms [mapcar car vars]) - (inits [mapcar cadr vars])) + (syms [mapcar car vars])) ^(let* ,vars (,each-prod-op ,(zip syms syms) ,*body)))) diff --git a/stdlib/except.tl b/stdlib/except.tl index 08402dd6..7e1f8ac8 100644 --- a/stdlib/except.tl +++ b/stdlib/except.tl @@ -72,7 +72,7 @@ (<= 161 sys:compat))) ^(,exc-sym)) ,exc-args))) - (else (sys:handle-bad-syntax hc)))))) + (else (sys:handle-bad-syntax else)))))) ^(handler-bind (lambda (,exc-sym . ,exc-args) (cond ,*(mapcar (aret ^((exception-subtype-p ,exc-sym ',@1) ,@2)) diff --git a/stdlib/getopts.tl b/stdlib/getopts.tl index fee9b7f5..74c770bc 100644 --- a/stdlib/getopts.tl +++ b/stdlib/getopts.tl @@ -79,7 +79,7 @@ ((indicator btype) (and (eq indicator 'list) (neq btype :bool) me.(basic-type-p btype))) - (x nil))) + (t nil))) (defmeth opt-desc cumul-type-p (me type) (tree-case type @@ -87,7 +87,7 @@ (neq btype :bool) (or me.(basic-type-p btype) me.(list-type-p btype)))) - (x nil))) + (t nil))) (defmeth opt-desc check (me) (unless (or me.(basic-type-p me.type) @@ -232,7 +232,7 @@ opts.(add-opt (new (sys:opt-parsed o arg od)))) (sys:opt-err "unrecognized option: -~a" o)))) -(defmeth sys:opt-processor parse-opts (me args) +(defmeth sys:opt-processor parse-opts (me) (let ((opts me.opts)) (whilet ((arg (pop opts.out-args))) (cond @@ -273,7 +273,7 @@ (defun getopts (opt-desc-list args) (let* ((opts (new opts in-args args out-args args)) (opr (new sys:opt-processor od-list opt-desc-list opts opts))) - opr.(parse-opts args))) + opr.(parse-opts))) (defun opthelp (opt-desc-list : (*stdout* *stdout*)) (let ((sorted [nsort (copy-list (remove-if (op null @1.helptext) @@ -428,7 +428,7 @@ (:method getopts (me args) (set me.in-args args me.out-args args) (let ((opr (new sys:opt-processor od-list me.opt-desc-list opts me))) - opr.(parse-opts args))) + opr.(parse-opts))) (:method opthelp (me : (stream *stdout*)) (opthelp me.opt-desc-list stream)) (:method opthelp-conventions (me : (stream *stdout*)) @@ -437,7 +437,7 @@ (opthelp-types me.opt-desc-list stream))) (defmacro define-option-struct (name super-spec . opts) - (let* ((slots (mapcar (tb ((short long . rest)) + (let* ((slots (mapcar (tb ((short long . t)) (or long short)) opts)) (supers (if (and super-spec (atom super-spec)) diff --git a/stdlib/ifa.tl b/stdlib/ifa.tl index 6eeff5d9..e2c35f14 100644 --- a/stdlib/ifa.tl +++ b/stdlib/ifa.tl @@ -74,7 +74,7 @@ (((test . forms) . rest) ^(,if-oper ,test (progn ,*forms) (,cond-oper ,*rest))) (() ()) - (else (compile-error f "bad syntax: ~s" pairs)))) + (else (compile-error f "bad syntax: ~s" else)))) (defmacro conda (:form f . pairs) (sys:if-to-cond f 'ifa 'conda pairs)) diff --git a/stdlib/keyparams.tl b/stdlib/keyparams.tl index 601ad45b..d50656ec 100644 --- a/stdlib/keyparams.tl +++ b/stdlib/keyparams.tl @@ -43,6 +43,7 @@ ,*(if sym-p ^((set ,sym-p t))))))))))) (define-param-expander :key (param body menv form) + (ignore menv) (let* ((excluding-rest (butlastn 0 param)) (key-start (memq '-- excluding-rest)) (rest-param (or (nthlast 0 param) (gensym))) @@ -52,7 +53,7 @@ (eff-param (append before-key rest-param))) (each ((key-spec key-params)) (tree-case key-spec - ((sym init var-p . junk) + ((t t var-p . junk) (when (consp junk) (compile-error form "superfluous forms in ~s" key-spec)) (when junk @@ -60,7 +61,7 @@ (unless (bindable var-p) (compile-error form "~s isn't a bindable symbol" var-p)) :) - ((sym init . more) + ((t t . more) (unless (listp more) (compile-error form "invalid dotted form ~s" key-spec)) :) diff --git a/stdlib/match.tl b/stdlib/match.tl index b0b09437..3adbba27 100644 --- a/stdlib/match.tl +++ b/stdlib/match.tl @@ -137,7 +137,7 @@ "internal error: bad guard ~s" g))))) (defun compile-struct-match (struct-pat obj-var var-list) - (mac-param-bind *match-form* (op required-type . pairs) struct-pat + (mac-param-bind *match-form* (t required-type . pairs) struct-pat (let* ((loose-p (not (bindable required-type))) (slot-pairs (plist-to-alist pairs)) (required-slots [mapcar car slot-pairs]) @@ -274,7 +274,7 @@ (let ((head (car exp))) (if (and (consp head) (eq (car head) 'sys:var)) (tree-case exp - (((sv rvar) (op . args)) + (((t rvar) (op . args)) (let* ((avar (condlet (((vm (member-if [andf consp (op eq (car @1) 'sys:var)] @@ -305,7 +305,8 @@ guard-chain (append avar-match.guard-chain (list guard) rvar-match.guard-chain))))) - (els (compile-error *match-form* "invalid predicate syntax: ~s" exp))) + (else (compile-error *match-form* + "invalid predicate syntax: ~s" else))) (compile-predicate-match (list '@nil exp) obj-var var-list)))) (defun compile-cons-structure (cons-pat obj-var var-list) @@ -336,14 +337,14 @@ cdr-match.guard-chain)))))) (defun compile-require-match (exp obj-var var-list) - (mac-param-bind *match-form* (op match . conditions) exp + (mac-param-bind *match-form* (t match . conditions) exp (let ((match (compile-match match obj-var var-list))) match.(add-guards-post (new match-guard guard-expr ^(and ,*conditions))) match))) (defun compile-as-match (exp obj-var var-list) - (mac-param-bind *match-form* (op sym pat) exp + (mac-param-bind *match-form* (t sym pat) exp (let ((var-match (compile-new-var-match sym obj-var var-list)) (pat-match (compile-match pat obj-var var-list))) (new compiled-match @@ -354,7 +355,7 @@ (defun compile-with-match (exp obj-var var-list) (tree-case exp - ((op main-pat side-pat-var side-expr) + ((t main-pat side-pat-var side-expr) (let* ((side-var (gensym)) (side-pat (if (or (null side-pat-var) (bindable side-pat-var)) ^(sys:var ,side-pat-var) @@ -372,7 +373,7 @@ side-match.guard-chain)))) ((op side-pat-var side-expr) (compile-with-match ^(,op @nil ,side-pat-var ,side-expr) obj-var var-list)) - (x (compile-error *match-form* "bad syntax: ~s" exp)))) + (else (compile-error *match-form* "bad syntax: ~s" else)))) (defun compile-loop-match (exp obj-var var-list) (mac-param-bind *match-form* (op match) exp @@ -434,7 +435,7 @@ guard-chain (list guard0 guard1))))) (defun compile-or-match (par-pat obj-var var-list) - (mac-param-bind *match-form* (op . pats) par-pat + (mac-param-bind *match-form* (t . pats) par-pat (let* ((var-lists (mapcar (ret (copy var-list)) pats)) (par-matches (mapcar (op compile-match @1 obj-var @2) pats var-lists)) @@ -449,7 +450,7 @@ guard-chain (list dj-guard))))) (defun compile-and-match (and-pat obj-var var-list) - (mac-param-bind *match-form* (op . pats) and-pat + (mac-param-bind *match-form* (t . pats) and-pat (let* ((par-matches (mapcar (lop compile-match obj-var var-list) pats))) (new compiled-match pattern and-pat @@ -457,7 +458,7 @@ guard-chain (mappend .guard-chain par-matches))))) (defun compile-not-match (pattern obj-var var-list) - (mac-param-bind *match-form* (op pattern) pattern + (mac-param-bind *match-form* (t pattern) pattern (let* ((pm (compile-match pattern obj-var var-list)) (guard (new match-guard guard-expr ^(not (let ,pm.(get-vars) @@ -468,7 +469,7 @@ guard-chain (list guard))))) (defun compile-hash-match (hash-expr obj-var var-list) - (mac-param-bind *match-form* (op . pairs) hash-expr + (mac-param-bind *match-form* (t . pairs) hash-expr (let* ((hash-alist-var (gensym "hash-alist-")) (hash-alt-val ^',(gensym "alt")) (need-alist-p nil) @@ -546,7 +547,7 @@ guard-chain (cons guard (mappend .guard-chain hash-matches)))))) (defun compile-scan-match (scan-syntax obj-var var-list) - (mac-param-bind *match-form* (op pattern) scan-syntax + (mac-param-bind *match-form* (t pattern) scan-syntax (with-gensyms (iter found-p cont-p success-p) (let* ((cm (compile-match pattern iter var-list)) (loop ^(for ((,iter ,obj-var) (,cont-p t) ,found-p) @@ -568,9 +569,9 @@ (defun compile-exprs-match (exprs-syntax uexprs var-list) (let ((upats (cdr exprs-syntax)) (utemps (mapcar (ret (gensym)) uexprs))) - (tree-bind (pats temps exprs) (multi-sort (list upats utemps uexprs) - [list less] - [list non-triv-pat-p]) + (tree-bind (pats temps t) (multi-sort (list upats utemps uexprs) + [list less] + [list non-triv-pat-p]) (let* ((matches (mapcar (op compile-match @1 @2 var-list) pats temps))) (new compiled-match @@ -671,17 +672,15 @@ (defmacro match-case (:form *match-form* :env e obj . clauses) (unless [all clauses [andf proper-listp [chain len plusp]]] (compile-error *match-form* "bad clause syntax")) - (let* ((matched-p-temp (gensym "matched-p-")) - (result-temp (gensym "result-")) + (let* ((result-temp (gensym "result-")) (objvar (gensym "obj-")) (var-list (get-var-list e)) (clause-matches [mapcar (op compile-match (car @1) objvar (copy var-list)) clauses]) - (nclauses (len clauses)) (clause-code (collect-each ((cl clauses) (cm clause-matches)) - (mac-param-bind *match-form* (match . forms) cl + (mac-param-bind *match-form* (t . forms) cl ^(let (,*cm.(get-vars)) ,cm.(wrap-guards ^(set ,result-temp (progn ,*forms)) @@ -697,7 +696,7 @@ ,*clauses ((var ,else) (match-error 'match-ecase ,else))))) -(defmacro while-match-case (:form *match-form* :env e obj . clauses) +(defmacro while-match-case (:form *match-form* obj . clauses) (unless [all clauses [andf proper-listp [chain len plusp]]] (compile-error *match-form* "bad clause syntax")) ^(for () @@ -705,7 +704,7 @@ ,*(mapcar (ret ^(,(car @1) ,*(cdr @1) t)) clauses))) ())) -(defmacro while-true-match-case (:form *match-form* :env e obj . clauses) +(defmacro while-true-match-case (:form *match-form* obj . clauses) (unless [all clauses [andf proper-listp [chain len plusp]]] (compile-error *match-form* "bad clause syntax")) ^(for () @@ -766,7 +765,6 @@ (present-vec (vec-list (append (repeat '(t) min-args) present-p-temps))) (result-temp (gensym "result")) - (nclauses (len parsed-clauses)) (ex-clauses (collect-each ((pc parsed-clauses)) (let* ((vp pc.variadic-pattern) (exp ^(when-exprs-match @@ -802,10 +800,11 @@ (expand-lambda-match clauses)) (defmacro defun-match (:form *match-form* name . clauses) - (tree-bind (lambda args . body) (expand-lambda-match clauses) + (tree-bind (t args . body) (expand-lambda-match clauses) ^(defun ,name ,args . ,body))) (define-param-expander :match (params clauses menv form) + (ignore menv) (let ((*match-form* form)) (unless (proper-list-p params) (compile-error form @@ -815,7 +814,7 @@ (compile-error form "~s is incompatible with optional parameters" :match)) - (tree-bind (lambda lparams . body) (expand-lambda-match clauses) + (tree-bind (t lparams . body) (expand-lambda-match clauses) (let ((dashdash (member '-- params))) (cons (append (ldiff params dashdash) (butlastn 0 lparams) @@ -824,11 +823,11 @@ body))))) (defmacro defmatch (name destructuring-args . body) - (with-gensyms (name-dummy args) + (with-gensyms (name-dummy args vars-env) ^(progn (sethash *match-macro* ',name - (lambda (,args vars-env) - (mac-env-param-bind *match-form* vars-env + (lambda (,args ,vars-env) + (mac-env-param-bind *match-form* ,vars-env (,name-dummy ,*destructuring-args) ,args ,*body))) ',name))) @@ -856,12 +855,12 @@ ((and (null sym) nil-ok) sym) (t (compile-error f "~s: bindable symbol expected, not ~s" op sym)))) -(defun loosen (f pat) +(defun loosen (pat) (if (proper-list-p pat) (append pat '@nil) pat)) -(defun pat-len (f pat) +(defun pat-len (pat) (if (consp pat) (let ((var-op-pos (pos-if (op meq 'sys:var 'sys:expr 'sys:quasi) (butlastn 0 pat)))) @@ -869,12 +868,12 @@ 0)) (defmatch sme (:form f sta mid end : (mvar (gensym)) eobj) - (let* ((psta (loosen f (check f 'sme sta))) - (pmid (loosen f (check f 'sme mid))) + (let* ((psta (loosen (check f 'sme sta))) + (pmid (loosen (check f 'sme mid))) (pend (check-end f 'sme end)) - (lsta (pat-len f psta)) - (lmid (pat-len f pmid)) - (lend (pat-len f pend)) + (lsta (pat-len psta)) + (lmid (pat-len pmid)) + (lend (pat-len pend)) (obj (gensym))) ^@(as ,(check-sym f 'sme obj) @(and ,psta @@ -885,13 +884,15 @@ (defmatch end (:form f end : evar) (let* ((pend (check-end f 'end end)) - (lend (pat-len f pend)) + (lend (pat-len pend)) (obj (gensym))) ^@(as ,(check-sym f 'end obj) @(with @(as ,(check-sym f 'end evar t) ,pend) (nthlast ,lend ,obj))))) -(defun non-triv-pat-p (syntax) t) +(defun non-triv-pat-p (syntax) + (ignore syntax) + t) (defun non-triv-pat-p (syntax) (match-case syntax @@ -944,12 +945,12 @@ ^@(require @nil (equal ,sym (sub-str ,str ,pos ,npos))) (quasi-match vlist rest vars str npos)))) ;; `@var` (existing binding) - (((@(eq 'sys:var) @(bound-p vlist vars @sym) . @nil)) + (((@(eq 'sys:var) @(bound-p vlist vars) . @nil)) (list ^@(require @nil (eql (len ,str) (match-str ,str (sys:quasi ,(car args)) ,pos))))) ;; `@var@...` (existing binding) - ((@(as avar (@(eq 'sys:var) @(bound-p vlist vars @sym) . @nil)) + ((@(as avar (@(eq 'sys:var) @(bound-p vlist vars) . @nil)) . @rest) (with-gensyms (txt len npos) (list* ^@(with ,txt (sys:quasi ,avar)) @@ -999,13 +1000,13 @@ (quasi-match vlist rest (cons sym vars) str npos)))) ;; `@{var}txt` (new binding) (((@(eq 'sys:var) @sym) @(stringp @txt)) - (with-gensyms (len end) + (with-gensyms (end) (list ^@(require @(with ,end (search-str ,str ,txt ,pos)) ,end (eql (+ ,end ,(len txt)) (len ,str))) ^@(with ,sym (sub-str ,str ,pos ,end))))) ;; `@{var}txt...` (new binding) (((@(eq 'sys:var) @sym) @(stringp @txt) . @rest) - (with-gensyms (len end npos) + (with-gensyms (end npos) (list* ^@(require @(with ,end (search-str ,str ,txt ,pos)) ,end) ^@(with ,npos (+ ,end ,(len txt))) @@ -1013,7 +1014,8 @@ (quasi-match vlist rest (cons sym vars) str npos)))) ;; `@var0@var1` (unbound followed by bound) (((@(eq 'sys:var) @sym) - @(as bvar (@(eq 'sys:var) @(bound-p vlist vars @bsym) . @mods))) + @(as bvar (@(eq 'sys:var) @(bound-p vlist vars) . @mods))) + (ignore mods) (with-gensyms (txt end) (list ^@(with ,txt (sys:quasi ,bvar)) ^@(require @(with ,end (search-str ,str ,txt ,pos)) @@ -1021,8 +1023,9 @@ ^@(with ,sym (sub-str ,str ,pos ,end))))) ;; `@var0@var1...` (unbound followed by bound) (((@(eq 'sys:var) @sym) - @(as bvar (@(eq 'sys:var) @(bound-p vlist vars @bsym) . @mods)) + @(as bvar (@(eq 'sys:var) @(bound-p vlist vars) . @mods)) . @rest) + (ignore mods) (with-gensyms (txt end npos) (list* ^@(with ,txt (sys:quasi ,bvar)) ^@(require @(with ,end (search-str ,str ,txt ,pos)) @@ -1031,22 +1034,22 @@ ^@(with ,sym (sub-str ,str ,pos ,end)) (quasi-match vlist rest (cons sym vars) str npos)))) ;; `@{var whatever}@...`(new binding, unsupported modifiers) - (((@(eq 'sys:var) @sym @mods . @nil) . @rest) + (((@(eq 'sys:var) @sym @mods . @nil) . @nil) (compile-error *match-form* "variable ~s: unsupported modifiers ~s" sym mods)) ;; `@var0@var1` (unbound followed by unbound) (((@(eq 'sys:var) @sym0) - (@(eq 'sys:var) @sym1 . @mods) - . @rest) + (@(eq 'sys:var) @sym1 . @nil) + . @nil) (compile-error *match-form* "consecutive unbound variables ~s and ~s" sym0 sym1)) - ((@bad . @rest) (compile-error *match-form* + ((@bad . @nil) (compile-error *match-form* "unsupported syntax ~s" ^(sys:quasi ,bad))) - (@else (compile-error *match-form* "bad quasiliteral syntax"))))) + (@nil (compile-error *match-form* "bad quasiliteral syntax"))))) (with-gensyms (str pos) ^@(and @(require (sys:var ,str) diff --git a/stdlib/op.tl b/stdlib/op.tl index 855b155f..31d0dc37 100644 --- a/stdlib/op.tl +++ b/stdlib/op.tl @@ -59,7 +59,7 @@ (defun sys:op-rec-p (exp) (or (tree-case exp - ((x (y . r)) (and (eq x 'sys:expr) (eq y 'usr:rec)))) + ((x (y . t)) (and (eq x 'sys:expr) (eq y 'usr:rec)))) (equal exp '(sys:var usr:rec)))) (defun sys:op-ensure-rec (ctx : recvar) @@ -72,7 +72,7 @@ (sys:setq more nil))) (sys:setq ctx (slot ctx 'up)))) -(defun sys:op-alpha-rename (f e op-args do-nested-metas) +(defun sys:op-alpha-rename (e op-args do-nested-metas) (let* ((ctx sys:*op-ctx*) (code ^(macrolet ((sys:expr (:form f arg) (let* ((ctx ,ctx) @@ -105,7 +105,7 @@ (eval-only (defmacro op-ignerr (x) - ^(sys:catch (error) ,x () (error (. args))))) + ^(sys:catch (error) ,x () (error (. args) (ignore args))))) (defun sys:op-expand (f e args) (unless args @@ -118,9 +118,9 @@ (syntax-0 (if (eq sym 'do) args ^[,*args])) (syntax-1 (if (or (null syntax-0) (neq sym 'do) compat) ;; Not do, or empty do syntax, or compat mode. - (sys:op-alpha-rename f e syntax-0 nil) + (sys:op-alpha-rename e syntax-0 nil) ;; Try to expand args as-is, catching errors. - (let ((syn (op-ignerr (sys:op-alpha-rename f e + (let ((syn (op-ignerr (sys:op-alpha-rename e syntax-0 nil)))) (if syn @@ -130,15 +130,15 @@ syn ;; No metas: add do-gen at the end and expand ;; again, without catching errors. - (sys:op-alpha-rename f e + (sys:op-alpha-rename e (append syntax-0 (list do-gen)) nil)) ;; Args didn't expand, so let's try it with ;; do-gen added. (let ((syn (sys:op-alpha-rename - f e (append syntax-0 - (list do-gen)) + e (append syntax-0 + (list do-gen)) nil))) ;; It didn't blow up with the do-gen. However, if ;; there are metas, we must not be adding this @@ -147,19 +147,19 @@ ;; Thus we just expand it again without the do-gen, ;; without op-ignerr, to let the error propagate. (when (or (slot ctx 'gens) (slot ctx 'nested)) - (sys:op-alpha-rename f e syntax-0 nil) + (sys:op-alpha-rename e syntax-0 nil) ;; Just in case: we don't expect to reach this: ['compile-error f "internal error"]) ;; There were no metas. Let's return the ;; form augmented with do-gen. syn))))) - (syntax-2 (sys:op-alpha-rename f e syntax-1 t)) + (syntax-2 (sys:op-alpha-rename e syntax-1 t)) (metas (slot ctx 'gens)) (rec (slot ctx 'rec)) (recvar (slot ctx 'recvar)) (rest-sym (sys:ensure-op-arg ctx 0)) (lambda-interior (let ((fargs (tree-case syntax-2 - ((a b . fa) fa)))) + ((t t . fa) fa)))) (cond ((and (eq sym 'lop) fargs) (let ((fargs-l1 (mapcar (lambda (farg) diff --git a/stdlib/path-test.tl b/stdlib/path-test.tl index e0970504..491f63af 100644 --- a/stdlib/path-test.tl +++ b/stdlib/path-test.tl @@ -166,11 +166,13 @@ (eval-only (defmacro if-windows (then : else) + (use then) (if (eql 2 (sizeof wchar)) then else)) (defmacro if-native-windows (then : else) + (use then) (if-windows ^(if (find #\\ path-sep-chars) ,then ,else) else))) diff --git a/stdlib/pic.tl b/stdlib/pic.tl index c25b6942..c428f2a6 100644 --- a/stdlib/pic.tl +++ b/stdlib/pic.tl @@ -34,7 +34,6 @@ (exc (pos #\! fmt)) (dot (or exc (pos #\. fmt))) (fmt (if (and exc (eq #\! [fmt -1])) [fmt 0..-1] fmt)) - (int (if dot [fmt 0..dot] fmt)) (fra (if dot [fmt (succ dot)..:] ""))) (let ((code (if (or minus plus (not zero)) ^(fmt ,`~@(len fmt),@(if plus "+")@(if zero "0")@(len fra)f` @@ -154,7 +153,7 @@ ([m^$ #/\|+/ fmt] (expand-pic-align "^" fmt val)) (t (compile-error f "unrecognized format string ~s" fmt)))) -(defmacro pic (:form f :env e bigfmt . args) +(defmacro pic (:form f bigfmt . args) (let* ((regex #/[+\-]?(0,?)?#+(,#+)*([.!]#+(,#+)*|!)?| \ \((0,?)?#+(,#+)*([.!]#+(,#+)*|!)?\)| \ <+| \ diff --git a/stdlib/place.tl b/stdlib/place.tl index dd79a4b3..13b9bb18 100644 --- a/stdlib/place.tl +++ b/stdlib/place.tl @@ -79,7 +79,8 @@ (return-from macroexpand-place place)) (sys:setq unex-place place)))) -(defun macroexpand-1-place (unex-place : env-unused) +(defun macroexpand-1-place (unex-place : env) + (ignore env) (let ((pm-expander (if (consp unex-place) (sys:get-place-macro (car unex-place))))) (if pm-expander @@ -215,13 +216,15 @@ (list a b (gensym) (gensym) (gensym))) (tuples 2 place-value-pairs))) (ls (reduce-left (tb ((lets stores) (place value temp getter setter)) - (list ^((,temp ,value) ,*lets) - ^((,setter ,temp) ,*stores))) + (ignore place getter) + (list ^((,temp ,value) ,*lets) + ^((,setter ,temp) ,*stores))) pvtgs '(nil nil))) (lets (first ls)) (stores (second ls)) (body-form ^(rlet (,*lets) ,*stores))) (reduce-left (tb (accum-form (place value temp getter setter)) + (ignore place value temp) (call-update-expander getter setter place env accum-form)) pvtgs body-form)))))) @@ -307,7 +310,7 @@ (defmacro shift (:form f :env env . places) (tree-case places (() (compile-error f "need at least two arguments")) - ((place) (compile-error f "need at least two arguments")) + ((t) (compile-error f "need at least two arguments")) ((place newvalue) (with-update-expander (getter setter) place env ^(prog1 (,getter) (,setter ,newvalue)))) @@ -530,6 +533,7 @@ (defplace (vecref vector index :whole args) body (getter setter (with-gensyms (vec-sym ind-sym) + (ignore args) ^(alet ((,vec-sym ,vector) (,ind-sym ,index)) (macrolet ((,getter () ^(vecref ,',vec-sym ,',ind-sym)) @@ -537,9 +541,11 @@ ,body)))) (ssetter ^(macrolet ((,ssetter (val) ^(refset ,*',args ,val))) + ,(ignore vector index) ,body)) (deleter (with-gensyms (vec-sym ind-sym) + (ignore args) ^(alet ((,vec-sym ,vector) (,ind-sym ,index)) (macrolet ((,deleter () @@ -551,6 +557,7 @@ (defplace (chr-str string index :whole args) body (getter setter (with-gensyms (str-sym ind-sym) + (ignore args) ^(alet ((,str-sym ,string) (,ind-sym ,index)) (macrolet ((,getter () ^(chr-str ,',str-sym ,',ind-sym)) @@ -558,9 +565,11 @@ ,body)))) (ssetter ^(macrolet ((,ssetter (val) ^(chr-str-set ,*',args ,val))) + ,(ignore string index) ,body)) (deleter (with-gensyms (str-sym ind-sym) + (ignore args) ^(alet ((,str-sym ,string) (,ind-sym ,index)) (macrolet ((,deleter () @@ -572,6 +581,7 @@ (defplace (ref seq index :whole args) body (getter setter (with-gensyms (seq-sym ind-sym) + (ignore args) ^(alet ((,seq-sym ,seq) (,ind-sym ,index)) (macrolet ((,getter () ^(ref ,',seq-sym ,',ind-sym)) @@ -579,9 +589,11 @@ ,body)))) (ssetter ^(macrolet ((,ssetter (val) ^(refset ,*',args ,val))) + ,(ignore seq index) ,body)) (deleter (with-gensyms (seq-sym ind-sym) + (ignore args) ^(alet ((,seq-sym ,seq) (,ind-sym ,index)) (macrolet ((,deleter () @@ -590,7 +602,7 @@ ,',ind-sym (succ ,',ind-sym))))) ,body))))) -(defplace (sub seq :whole args : (from 0) (to t)) body +(defplace (sub seq : (from 0) (to t)) body (getter setter (with-gensyms (seq-sym from-sym to-sym v-sym) (with-update-expander (seq-getter seq-setter) seq sys:*pl-env* @@ -632,6 +644,7 @@ (defplace (gethash hash key : (default nil have-default-p)) body (getter setter (with-gensyms (entry-sym) + (ignore have-default-p) ^(let ((,entry-sym (inhash ,hash ,key ,default))) (macrolet ((,getter () ^(cdr ,',entry-sym)) (,setter (val) ^(sys:rplacd ,',entry-sym ,val))) @@ -662,9 +675,9 @@ ^(set-hash-userdata ,',hash ,val))) ,body))) -(defplace (dwim obj-place :env env . args) body +(defplace (dwim obj-place . args) body (getter setter - (with-gensyms (ogetter-sym osetter-sym obj-sym newval-sym) + (with-gensyms (obj-sym newval-sym) (let ((arg-syms (mapcar (ret (gensym)) args))) (if (place-form-p obj-place sys:*pl-env*) (with-update-expander (ogetter-sym osetter-sym) @@ -691,7 +704,7 @@ ,',newval-sym))) ,body)))))) (ssetter - (with-gensyms (osetter-sym ogetter-sym obj-sym newval-sym) + (with-gensyms (obj-sym newval-sym) (let ((arg-syms (mapcar (ret (gensym)) args))) (if (place-form-p obj-place sys:*pl-env*) (with-update-expander (ogetter-sym osetter-sym) @@ -719,7 +732,7 @@ ,body))))) (deleter - (with-gensyms (osetter-sym ogetter-sym obj-sym oldval-sym) + (with-gensyms (obj-sym oldval-sym) (let ((arg-syms (mapcar (ret (gensym)) args))) (if (place-form-p obj-place sys:*pl-env*) (with-update-expander (ogetter-sym osetter-sym) @@ -805,13 +818,13 @@ (cons (op cdr) (op sys:rplacd cell))) :)) - ((op . rest) + ((op . t) (if (eq op 'lambda) (compile-error f "cannot assign to lambda") (compile-error f "invalid function syntax ~s" sym))) (else (let ((cell (or (gethash sys:top-fb sym) - (sethash sys:top-fb sym (cons sym nil))))) + (sethash sys:top-fb sym (cons else nil))))) (cons (op cdr) (op sys:rplacd cell)))))) @@ -875,7 +888,7 @@ (defplace (read-once place) body (getter setter - (with-gensyms (cache-var pgetter psetter) + (with-gensyms (cache-var) (with-update-expander (pgetter psetter) place sys:*pl-env* ^(slet ((,cache-var (,pgetter))) (macrolet ((,getter () ',cache-var) @@ -885,7 +898,7 @@ (defmacro define-modify-macro (name lambda-list function) (let ((cleaned-lambda-list (mapcar [iffi consp car] (remql : lambda-list)))) - (with-gensyms (place-sym args-sym) + (with-gensyms (place-sym) ^(defmacro ,name (:env env ,place-sym ,*lambda-list) (with-update-expander (getter setter) ,place-sym env ^(,setter (,',function (,getter) ,,*cleaned-lambda-list))))))) @@ -908,6 +921,7 @@ ;; uses of sym as a place will fail due to get-foo not being a place. (sethash *place-update-expander* tmp-place (lambda (tmp-getter tmp-setter tmp-place tmp-body) + (ignore tmp-place) ^(macrolet ((,tmp-getter () ^(,',pl-getter)) (,tmp-setter (val) ^(,',pl-setter ,val))) ,tmp-body))) diff --git a/stdlib/pmac.tl b/stdlib/pmac.tl index db684bd4..caa4f4e2 100644 --- a/stdlib/pmac.tl +++ b/stdlib/pmac.tl @@ -38,5 +38,4 @@ (tree-case prototype-form ((name params . body) (cons name (sys:expand-param-macro params body env prototype-form))) - (else (error "~s: invalid prototype-form argument ~s" - %fun% prototype-form)))) + (else (error "~s: invalid prototype-form argument ~s" %fun% else)))) diff --git a/stdlib/struct.tl b/stdlib/struct.tl index 48e7055d..726b7fce 100644 --- a/stdlib/struct.tl +++ b/stdlib/struct.tl @@ -35,6 +35,7 @@ (defun sys:prune-missing-inits (slot-init-forms) (remove-if (tb ((kind name : (init-form nil init-form-present))) + (ignore name init-form) (and (member kind '(:static :instance :function)) (not init-form-present))) slot-init-forms)) @@ -61,7 +62,7 @@ (additional-supers nil)) (labels ((expand-slot (form slot) (tree-case slot - ((op . args) + ((op . t) (iflet ((expander [*struct-clause-expander* op])) (append-each ((exslot [expander slot form])) [expand-slot form exslot]) @@ -249,7 +250,7 @@ ^(slet ((,s ,b)) (if ,s (qref ,s ,*refs)))) :)) - (x (tree-case refs + (t (tree-case refs (() ()) (((pref sym) . more) (if (eq pref t) @@ -291,7 +292,7 @@ ((sym . more) (sys:check-slot form sym) ^(qref (slot ,obj ',sym) ,*more)) - (obj (throwf 'eval-error "~s: bad syntax: ~s" 'qref refs)))))) + (else (throwf 'eval-error "~s: bad syntax: ~s" 'qref else)))))) (defmacro uref (. args) (cond @@ -393,7 +394,7 @@ (slotset struct sym val) (call (umethod meth-sym) struct))) -(defmacro usr:rslot (struct sym meth-sym) +(defmacro usr:rslot (struct sym t) ^(slot ,struct ,sym)) (define-place-macro usr:rslot (struct sym meth-sym) @@ -465,8 +466,8 @@ (cons : (collect-each ((o pp.opt)) (tree-case o ((sym) ^(,sym :)) - ((sym init) o) - ((sym init sym-p) + ((t t) o) + ((t t t) (compile-error form "~s: three-element optional \ \ parameter ~s not supported" diff --git a/stdlib/tagbody.tl b/stdlib/tagbody.tl index 23c0827b..dabfa045 100644 --- a/stdlib/tagbody.tl +++ b/stdlib/tagbody.tl @@ -25,7 +25,7 @@ ;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ;; POSSIBILITY OF SUCH DAMAGE. -(defmacro tagbody (:env env . forms) +(defmacro tagbody (. forms) (when forms (let* ((tb-id (gensym "tb-id-")) (next-var (gensym "next-")) @@ -43,6 +43,7 @@ (threaded-1 (mapcar (op member-if true) (conses forms))) (threaded-2 [apply nconc forms]) ;; important side effect (codes [mapcar car threaded-1])) + (ignore threaded-2) (unless (eql (length (uniq lbls)) (length lbls)) (throwf 'eval-error "~s: duplicate labels occur" 'tagbody)) (let* ((basic-code ^(let ((,tb-id (gensym "tb-dyn-id-")) diff --git a/stdlib/trace.tl b/stdlib/trace.tl index 50b2e0f0..4d63992b 100644 --- a/stdlib/trace.tl +++ b/stdlib/trace.tl @@ -36,7 +36,7 @@ (defun sys:trace-enter (name args) [sys:trfm *trace-output* "~*a(~s ~s\n" [sys:tr* sys:*trace-level* 2] "" name args]) -(defun sys:trace-leave (name val) +(defun sys:trace-leave (val) [sys:trfm *trace-output* "~*a ~s)\n" [sys:tr* sys:*trace-level* 2] "" val]) (defun sys:trace-canonicalize-name (name) @@ -77,11 +77,11 @@ (progn (sys:trace-enter lex-n args) (let ((val (apply prev args))) - (sys:trace-leave lex-n val) + (sys:trace-leave val) (set abandoned nil) val)) (if abandoned - (sys:trace-leave lex-n :abandoned))))))) + (sys:trace-leave :abandoned))))))) (set (symbol-function n) hook [sys:*trace-hash* n] prev))))))) @@ -99,7 +99,7 @@ (each ((n-orig names) (n [mapcar sys:trace-canonicalize-name names])) (disable n-orig n)) - (dohash (n v sys:*trace-hash*) + (dohash (n #:v sys:*trace-hash*) (disable n n))))) (defun sys:trace-redefine-check (orig-name) diff --git a/stdlib/type.tl b/stdlib/type.tl index 36188b2a..e166493b 100644 --- a/stdlib/type.tl +++ b/stdlib/type.tl @@ -38,7 +38,7 @@ (t :))) (else (compile-error form "~s: bad clause syntax: ~s" - 'typecase cl)))))) + 'typecase else)))))) ^(let ((,val ,obj)) (cond ,*cond-pairs ,*(if (eq (car form) 'etypecase) diff --git a/stdlib/with-resources.tl b/stdlib/with-resources.tl index 052b2b18..e7d83378 100644 --- a/stdlib/with-resources.tl +++ b/stdlib/with-resources.tl @@ -46,7 +46,7 @@ (with-resources ,rest ,*body))) (nil ^(progn ,*body)) - (other (compile-error f "bad syntax")))) + (t (compile-error f "bad syntax")))) (defmacro with-objects (var-init-forms . body) (let ((gens (mapcar (ret (gensym)) var-init-forms))) diff --git a/stdlib/yield.tl b/stdlib/yield.tl index 379fa2f0..b91e184e 100644 --- a/stdlib/yield.tl +++ b/stdlib/yield.tl @@ -95,8 +95,6 @@ (nvars (len vis)) (syms [mapcar car vis]) (inits [mapcar cadr vis]) - (letop (if (eq op 'hlet*) 'let* 'let)) - (gens (mapcar (ret (gensym)) vis)) (vec (gensym)) (macs (mapcar (ret ^(,@1 (vecref ,vec ,@2))) syms (range 0))) diff --git a/tests/012/lambda.tl b/tests/012/lambda.tl index d298f59a..47b03e4b 100644 --- a/tests/012/lambda.tl +++ b/tests/012/lambda.tl @@ -19,7 +19,7 @@ [(lambda ())] nil [(lambda (a) a)] :error [(lambda (a) a) 1] 1 - [(lambda (a b) a) 1] :error + [(lambda (a b) (list a b)) 1] :error [(lambda (a b) (list a b)) 1 2] (1 2) [(lambda (a b c) (list a b c)) 1 2] :error [(lambda (a b c) (list a b c)) 1 2 3] (1 2 3)) @@ -32,11 +32,11 @@ [(lambda (: (a 1 a-p)) (list a a-p)) 2] (2 t)) (mltest - [(lambda (x : a) a)] :error - [(lambda (x : (a 1)) a)] :error - [(lambda (x : (a 1)) a) 2] 1 - [(lambda (x : (a 1 a-p)) (list a a-p))] :error - [(lambda (x : (a 1 a-p)) (list a a-p)) 2] (1 nil)) + [(lambda (x : a) (list x a))] :error + [(lambda (x : (a 1)) (list x a))] :error + [(lambda (x : (a 1)) (list x a)) 2] (2 1) + [(lambda (x : (a 1 a-p)) (list x a a-p))] :error + [(lambda (x : (a 1 a-p)) (list x a a-p)) 2] (2 1 nil)) (mltest [(lambda (x : a) (list x a)) 0] (0 nil) diff --git a/tests/016/arith.tl b/tests/016/arith.tl index 8f401463..86b5d9bb 100644 --- a/tests/016/arith.tl +++ b/tests/016/arith.tl @@ -401,3 +401,7 @@ (gcd-grind '(2 3 5 7 11 13 17 19 23)) (gcd-grind '(2 3 5 4294967291 4294967311 4294967357 4294967371)) + +(test + (build (each-prod* ((i '(b c)) (j (cons 'a i))) (add (list i j)))) + ((b a) (b b) (b c) (c a) (c b) (c c))) |