Modified module/ice-9/psyntax.scm diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 728ab12..c3aa6d8 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -1778,7 +1778,19 @@ r* w* mod))))) (syntax-case clauses () - (() (values '() #f)) + (() ; zero clauses + (values + '() + (build-lambda-case s '() '() 'rest #f '() + (list (build-lexical-var s 'rest)) + (build-application s + (make-toplevel-ref s 'throw) + (list + (build-data + s 'wrong-number-of-args) + (build-data + s "Wrong number of arguments"))) + #f))) (((args e1 e2 ...) (args* e1* e2* ...) ...) (call-with-values (lambda () (get-formals #'args)) (lambda (req opt rest kw) @@ -2092,12 +2104,12 @@ (global-extend 'core 'case-lambda (lambda (e r w s mod) (syntax-case e () - ((_ (args e1 e2 ...) (args* e1* e2* ...) ...) + ((_ (args e1 e2 ...) ...) (call-with-values (lambda () (expand-lambda-case e r w s mod lambda-formals - #'((args e1 e2 ...) (args* e1* e2* ...) ...))) + #'((args e1 e2 ...) ...))) (lambda (meta lcase) (build-case-lambda s meta lcase)))) (_ (syntax-violation 'case-lambda "bad case-lambda" e))))) @@ -2105,12 +2117,12 @@ (global-extend 'core 'case-lambda* (lambda (e r w s mod) (syntax-case e () - ((_ (args e1 e2 ...) (args* e1* e2* ...) ...) + ((_ (args e1 e2 ...) ...) (call-with-values (lambda () (expand-lambda-case e r w s mod lambda*-formals - #'((args e1 e2 ...) (args* e1* e2* ...) ...))) + #'((args e1 e2 ...) ...))) (lambda (meta lcase) (build-case-lambda s meta lcase)))) (_ (syntax-violation 'case-lambda "bad case-lambda*" e))))) Modified test-suite/tests/compiler.test diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test index ee688c0..bb2be06 100644 --- a/test-suite/tests/compiler.test +++ b/test-suite/tests/compiler.test @@ -1,5 +1,5 @@ ;;;; compiler.test --- tests for the compiler -*- scheme -*- -;;;; Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;;;; Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -163,4 +163,11 @@ (display (list x y)) (list x y)))) (display (t 'x))))) - "(x y)(x y)"))) + "(x y)(x y)")) + + (pass-if-exception "zero clauses" + exception:wrong-num-args + ;; See . + (compile '(let ((p (case-lambda))) + (and (procedure? p) (p))) + #:to 'value)))