Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
be8cb5d0
Commit
be8cb5d0
authored
2 years ago
by
Tarn Burton
Browse files
Options
Downloads
Patches
Plain Diff
Avoid inserting NIL into simple LOOP from FORMAT
parent
4be1d90c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/code/format.lisp
+2
-1
2 additions, 1 deletion
src/code/format.lisp
tests/printer.lisp
+13
-0
13 additions, 0 deletions
tests/printer.lisp
with
15 additions
and
1 deletion
src/code/format.lisp
+
2
−
1
View file @
be8cb5d0
...
...
@@ -399,7 +399,8 @@
(
form
new-directives
)
(
expand-directive
(
car
remaining-directives
)
(
cdr
remaining-directives
))
(
push
form
results
)
(
when
form
(
push
form
results
))
(
setf
remaining-directives
new-directives
)))
(
reverse
results
)))
...
...
This diff is collapsed.
Click to expand it.
tests/printer.lisp
+
13
−
0
View file @
be8cb5d0
...
...
@@ -113,3 +113,16 @@
(
define-test
sub-output-integer.1
(
assert-prints
"-536870912"
(
princ
most-negative-fixnum
)))
;;; Simple LOOP requires only compound forms. Hence NIL is not
;;; permitted. Some FORMAT directives (like newline) return NIL
;;; as the form when they have nothing to add to the body.
;;; Normally this is fine since BLOCK accepts NIL as a form. On
;;; the other hand, when the newline directive is inside of an
;;; iteration directive this will produce something like
;;; (LOOP (fu) nil (bar)) which is not acceptable. To verify
;;; that this is not happening we make sure we are not getting
;;; (BLOCK NIL NIL) since this is easier to test for.
(
define-test
format-no-nil-form.1
(
assert-equal
'
(
block
nil
)
(
third
(
second
(
macroexpand-1
'
(
formatter
"~
"
))))))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment