1 // run-pass
2 #![allow(dead_code)]
3 
4 enum T {
5     A(isize),
6     B(f64)
7 }
8 
9 // after fixing #9384 and implementing hygiene for match bindings,
10 // this now fails because the insertion of the 'y' into the match
11 // doesn't cause capture. Making this macro hygienic (as I've done)
12 // could very well make this test case completely pointless....
13 
14 macro_rules! test {
15     ($id1:ident, $id2:ident, $e:expr) => (
16         fn foo(a:T, b:T) -> T {
17             match (a, b) {
18                 (T::A($id1), T::A($id2)) => T::A($e),
19                 (T::B($id1), T::B($id2)) => T::B($e),
20                 _ => panic!()
21             }
22         }
23     )
24 }
25 
26 test!(x,y,x + y);
27 
main()28 pub fn main() {
29     foo(T::A(1), T::A(2));
30 }
31