refuse a match in a case label

case and case/fallthrough walked their label as a statement, so a match
there was taken and wrote `case switch:'.
This commit is contained in:
2026-10-19 15:32:47 +03:00
parent 913af0b463
commit a0b323980f
2 changed files with 12 additions and 2 deletions

View File

@@ -591,7 +591,10 @@
((for while if switch)
(with-scope env (lambda () (walk-control form env))))
((case case/fallthrough default)
((case case/fallthrough)
(walk-control form env))
((default)
(parameterize ((operand-position? #f))
(walk-parts form env)))
@@ -899,7 +902,7 @@
;;; Whether the Ith of a control form's SLOTS is read as a value: an
;;; `if''s tests but not its trailing else, a `for''s header, the
;;; scrutinee of a `while' or a `switch'
;;; scrutinee of a `while' or a `switch', a `case''s label
(define (test-slot? head i slots)
(case head
((if) (and (even? i) (< (+ i 1) slots)))