Skip to content

Commit f3fa836

Browse files
committed
added test for method arg hygiene
1 parent 8bb34a3 commit f3fa836

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,19 @@ mod test {
13901390
// but *shouldn't* bind because it was inserted by a different macro....
13911391
// can't write this test case until we have macro-generating macros.
13921392

1393+
// method arg hygiene
1394+
// method expands to fn get_x(&self_0, x_1:int) {self_0 + self_2 + x_3 + x_1}
1395+
#[test] fn method_arg_hygiene(){
1396+
run_renaming_test(
1397+
&("macro_rules! inject_x (()=>(x))
1398+
macro_rules! inject_self (()=>(self))
1399+
struct A;
1400+
impl A{fn get_x(&self, x: int) {self + inject_self!() + inject_x!() + x;} }",
1401+
vec!(vec!(0),vec!(3)),
1402+
true),
1403+
0)
1404+
}
1405+
13931406
// item fn hygiene
13941407
// expands to fn q(x_1:int){fn g(x_2:int){x_2 + x_1};}
13951408
#[test] fn issue_9383(){

0 commit comments

Comments
 (0)