mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Move test to hir_ty
This commit is contained in:
parent
6d6606895c
commit
9ff50d7e83
2 changed files with 31 additions and 30 deletions
|
@ -453,3 +453,34 @@ pub mod str {
|
||||||
// should be Option<char>, but currently not because of Chalk ambiguity problem
|
// should be Option<char>, but currently not because of Chalk ambiguity problem
|
||||||
assert_eq!("(Option<{unknown}>, Option<{unknown}>)", super::type_at_pos(&db, pos));
|
assert_eq!("(Option<{unknown}>, Option<{unknown}>)", super::type_at_pos(&db, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn issue_3642_bad_macro_stackover() {
|
||||||
|
let (db, pos) = TestDB::with_position(
|
||||||
|
r#"
|
||||||
|
//- /main.rs
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! match_ast {
|
||||||
|
(match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
|
||||||
|
|
||||||
|
(match ($node:expr) {
|
||||||
|
$( ast::$ast:ident($it:ident) => $res:expr, )*
|
||||||
|
_ => $catch_all:expr $(,)?
|
||||||
|
}) => {{
|
||||||
|
$( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
|
||||||
|
{ $catch_all }
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let anchor<|> = match_ast! {
|
||||||
|
match parent {
|
||||||
|
as => {},
|
||||||
|
_ => return None
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!("()", super::type_at_pos(&db, pos));
|
||||||
|
}
|
||||||
|
|
|
@ -715,34 +715,4 @@ fn main() {
|
||||||
check_struct_shorthand_initialization,
|
check_struct_shorthand_initialization,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_bad_macro_stackover() {
|
|
||||||
check_no_diagnostic(
|
|
||||||
r#"
|
|
||||||
//- /main.rs
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! match_ast {
|
|
||||||
(match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
|
|
||||||
|
|
||||||
(match ($node:expr) {
|
|
||||||
$( ast::$ast:ident($it:ident) => $res:expr, )*
|
|
||||||
_ => $catch_all:expr $(,)?
|
|
||||||
}) => {{
|
|
||||||
$( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
|
|
||||||
{ $catch_all }
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let anchor = match_ast! {
|
|
||||||
match parent {
|
|
||||||
as => {},
|
|
||||||
_ => return None
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue