Fix up token_tree_to_syntax_node float split handling

This commit is contained in:
Lukas Wirth 2023-02-07 15:21:37 +01:00
parent 9053bcc65c
commit c6e7917d6e
5 changed files with 76 additions and 12 deletions

View file

@ -111,7 +111,8 @@ impl ItemTree {
Some(node) => node,
None => return Default::default(),
};
if never!(syntax.kind() == SyntaxKind::ERROR) {
if never!(syntax.kind() == SyntaxKind::ERROR, "{:?} from {:?} {}", file_id, syntax, syntax)
{
// FIXME: not 100% sure why these crop up, but return an empty tree to avoid a panic
return Default::default();
}
@ -133,7 +134,7 @@ impl ItemTree {
ctx.lower_macro_stmts(stmts)
},
_ => {
panic!("cannot create item tree from {syntax:?} {syntax}");
panic!("cannot create item tree for file {file_id:?} from {syntax:?} {syntax}");
},
}
};

View file

@ -104,7 +104,7 @@ macro_rules! id {
$($t)*
};
}
id /*+errors*/! {
id! {
#[proc_macros::identity]
impl Foo for WrapBj {
async fn foo(&self) {
@ -113,18 +113,17 @@ id /*+errors*/! {
}
}
"#,
expect![[r##"
expect![[r#"
macro_rules! id {
($($t:tt)*) => {
$($t)*
};
}
/* parse error: expected SEMICOLON */
#[proc_macros::identity] impl Foo for WrapBj {
async fn foo(&self ) {
self .0.id().await ;
}
}
"##]],
"#]],
);
}