summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2014-06-24 16:34:03 -0700
committerJohn Clements <clements@racket-lang.org>2014-06-25 14:16:12 -0700
commitbc837fdadf185a7aa593008e13364fde2b8c7fc9 (patch)
treebc71c149fce5b533c268f732f33637f6ae74917d /src/libsyntax/ext
parent19e1d834ffad4c5023a44f894d570054913e31e8 (diff)
downloadrust-bc837fdadf185a7aa593008e13364fde2b8c7fc9.tar.gz
rust-bc837fdadf185a7aa593008e13364fde2b8c7fc9.zip
add unit test for match var hygiene
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/expand.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index bf68538d656..c2e13a53b1e 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1254,6 +1254,18 @@ mod test {
             0)
     }
 
+    // FIXME #9384, match variable hygiene. Should expand into
+    // fn z() {match 8 {x_1 => {match 9 {x_2 | x_2 => x_2 + x_1}}}}
+    #[test] fn issue_9384(){
+        run_renaming_test(
+            &("macro_rules! bad_macro (($ex:expr) => ({match 9 {x | x => x + $ex}}))
+              fn z() {match 8 {x => bad_macro!(_x)}}",
+              // NB: the third "binding" is the repeat of the second one.
+              vec!(vec!(1),vec!(0),vec!(0)),
+              true),
+            0)
+    }
+
     // create a really evil test case where a $x appears inside a binding of $x
     // but *shouldnt* bind because it was inserted by a different macro....
     // can't write this test case until we have macro-generating macros.