diff --git a/collects/redex/private/reduction-semantics.ss b/collects/redex/private/reduction-semantics.ss index e0ebe4ef6e..182ac20a02 100644 --- a/collects/redex/private/reduction-semantics.ss +++ b/collects/redex/private/reduction-semantics.ss @@ -485,6 +485,20 @@ [withs (make-module-identifier-mapping)]) (for-each (λ (shortcut) (syntax-case shortcut () + [((rhs-arrow rhs-from rhs-to) + (lhs-arrow a b)) + (not (identifier? #'a)) + (raise-syntax-error + orig-name + "malformed shortcut, expected identifier" + shortcut #'a)] + [((rhs-arrow rhs-from rhs-to) + (lhs-arrow a b)) + (not (identifier? #'b)) + (raise-syntax-error + orig-name + "malformed shortcut, expected identifier" + shortcut #'b)] [((rhs-arrow rhs-from rhs-to) (lhs-arrow lhs-from lhs-to)) (begin diff --git a/collects/redex/tests/tl-test.ss b/collects/redex/tests/tl-test.ss index 71da27c8a9..bceba8e321 100644 --- a/collects/redex/tests/tl-test.ss +++ b/collects/redex/tests/tl-test.ss @@ -1090,6 +1090,22 @@ [(~> a b) (==> a b)]) #rx"~> relation is not defined") + (test-syn-err (reduction-relation + grammar + (==> 1 2) + with + [(--> a b) + (==> a (+ 3 b))]) + #rx"expected identifier") + + (test-syn-err (reduction-relation + grammar + (==> 1 2) + with + [(--> a b) + (==> (+ 3 a) b)]) + #rx"expected identifier") + (test-syn-err (define-language bad-lang1 (e name)) #rx"name") (test-syn-err (define-language bad-lang2 (name x)) #rx"name") (test-syn-err (define-language bad-lang3 (x_y x)) #rx"cannot have _")