Skip to content

Commit 0831f31

Browse files
author
Jonas Schievink
committed
Fix tests
1 parent 9bd1145 commit 0831f31

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

crates/hir-def/src/macro_expansion_tests/mbe.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ struct#10 MyTraitMap2#32 {#13
4848

4949
#[test]
5050
fn token_mapping_floats() {
51+
// Regression test for https://github.com/rust-lang/rust-analyzer/issues/12216
52+
// (and related issues)
5153
check(
5254
r#"
5355
// +tokenids
@@ -87,9 +89,9 @@ macro_rules! f {#0
8789
// }
8890
fn#19 main#20(#21)#21 {#22
8991
1#23;#24
90-
1#26.0;
91-
let x#31 =#22 1;
92-
}
92+
1.0#25;#26
93+
let#27 x#28 =#29 1#30;#31
94+
}#22
9395
9496
9597
"##]],

crates/hir-def/src/macro_expansion_tests/proc_macros.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ macro_rules! id {
104104
$($t)*
105105
};
106106
}
107-
id! {
107+
id /*+errors*/! {
108108
#[proc_macros::identity]
109109
impl Foo for WrapBj {
110110
async fn foo(&self) {
@@ -119,6 +119,7 @@ macro_rules! id {
119119
$($t)*
120120
};
121121
}
122+
/* parse error: expected SEMICOLON */
122123
#[proc_macros::identity] impl Foo for WrapBj {
123124
async fn foo(&self ) {
124125
self .0.id().await ;

crates/ide-completion/src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ impl<'a> CompletionContext<'a> {
10621062
let receiver_is_ambiguous_float_literal = match &receiver {
10631063
Some(ast::Expr::Literal(l)) => matches! {
10641064
l.kind(),
1065-
ast::LiteralKind::FloatNumber { .. } if l.syntax().last_token().map_or(false, |it| it.kind() == T![.])
1065+
ast::LiteralKind::FloatNumber { .. } if l.syntax().last_token().map_or(false, |it| it.text().ends_with('.'))
10661066
},
10671067
_ => false,
10681068
};

0 commit comments

Comments
 (0)