Downmap the token in attribute inputs when expanding speculatively

This commit is contained in:
Lukas Wirth 2021-09-14 00:04:04 +02:00
parent 2b907652ee
commit aa1b36dc6d
4 changed files with 154 additions and 21 deletions

View file

@ -73,3 +73,73 @@ fn main() {
"#]],
)
}
#[test]
fn complete_dot_in_attr_input() {
check(
r#"
//- proc_macros: input_replace
pub struct Foo;
impl Foo {
fn foo(&self) {}
}
#[proc_macros::input_replace(
fn suprise() {
Foo.$0
}
)]
fn main() {}
"#,
expect![[r#"
me foo() fn(&self)
sn ref &expr
sn refm &mut expr
sn match match expr {}
sn box Box::new(expr)
sn ok Ok(expr)
sn err Err(expr)
sn some Some(expr)
sn dbg dbg!(expr)
sn dbgr dbg!(&expr)
sn call function(expr)
sn let let
sn letm let mut
"#]],
)
}
#[test]
fn complete_dot_in_attr_input2() {
check(
r#"
//- proc_macros: input_replace
pub struct Foo;
impl Foo {
fn foo(&self) {}
}
#[proc_macros::input_replace(
fn suprise() {
Foo.f$0
}
)]
fn main() {}
"#,
expect![[r#"
me foo() fn(&self)
sn ref &expr
sn refm &mut expr
sn match match expr {}
sn box Box::new(expr)
sn ok Ok(expr)
sn err Err(expr)
sn some Some(expr)
sn dbg dbg!(expr)
sn dbgr dbg!(&expr)
sn call function(expr)
sn let let
sn letm let mut
"#]],
)
}