samth / test-bugs

2 stars 0 forks source link

Macro stepper does not fully expand out uses of certain user macros under Standard Macro hiding #179

Open racket-bug-submit opened 12 years ago

racket-bug-submit commented 12 years ago
Originally submitted by Danny Yoo on: Sun Jan 22 22:08:01 -0500 2012

The following program, when macro expanded using standard Macro hiding, does not fully expand out uses of the user-defined macro:


---
#lang racket
(define-syntax myor
  (syntax-rules ()
    [(_ e) e]
    [(_ e1 . es)
     (let ([r e1]) (if r r (myor . es)))]))
(define (nonzero? r)
  (myor (negative? r)
        (positive? r)))

---

Under Standard macro hiding, this expands out up to:


(module anonymous-module racket
  (#%module-begin
   (define-syntax myor (syntax-rules () [(_ e) e] [(_ e1 . es) (let ([r e1]) (if r r (myor . es)))]))
   (define (nonzero? r) (let ([r (negative? r)]) (if r r (myor (positive? r)))))))

where the second 'myor' still exists there.

There may be a relationship with the syntax tainting mechanisms that syntax-rules enforces. When the module is written using syntax-case rather than syntax-rules, then the macro expands out as expected.

Release:
5.2.0.901
Environment:
Linux i686 / Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko)
 Chrome/12.0.742.124 Safari/534.30
This bug was converted from Gnats bug 12508.

[anon-submit; dyoo at hashcollision dot org]