Fix tests

This commit is contained in:
Jonas Schievink 2022-05-13 15:27:17 +02:00
parent 9bd11459ba
commit 0831f3123b
3 changed files with 8 additions and 5 deletions

View File

@ -48,6 +48,8 @@ struct#10 MyTraitMap2#32 {#13
#[test]
fn token_mapping_floats() {
// Regression test for https://github.com/rust-lang/rust-analyzer/issues/12216
// (and related issues)
check(
r#"
// +tokenids
@ -87,9 +89,9 @@ macro_rules! f {#0
// }
fn#19 main#20(#21)#21 {#22
1#23;#24
1#26.0;
let x#31 =#22 1;
}
1.0#25;#26
let#27 x#28 =#29 1#30;#31
}#22
"##]],

View File

@ -104,7 +104,7 @@ macro_rules! id {
$($t)*
};
}
id! {
id /*+errors*/! {
#[proc_macros::identity]
impl Foo for WrapBj {
async fn foo(&self) {
@ -119,6 +119,7 @@ macro_rules! id {
$($t)*
};
}
/* parse error: expected SEMICOLON */
#[proc_macros::identity] impl Foo for WrapBj {
async fn foo(&self ) {
self .0.id().await ;

View File

@ -1062,7 +1062,7 @@ impl<'a> CompletionContext<'a> {
let receiver_is_ambiguous_float_literal = match &receiver {
Some(ast::Expr::Literal(l)) => matches! {
l.kind(),
ast::LiteralKind::FloatNumber { .. } if l.syntax().last_token().map_or(false, |it| it.kind() == T![.])
ast::LiteralKind::FloatNumber { .. } if l.syntax().last_token().map_or(false, |it| it.text().ends_with('.'))
},
_ => false,
};