Some more minor cleanups

This commit is contained in:
Lukas Wirth 2023-12-02 16:50:21 +01:00
parent 5edf7bddc6
commit 02a3a9438a
7 changed files with 65 additions and 21 deletions

View file

@ -2,7 +2,6 @@ mod block;
use base_db::{fixture::WithFixture, SourceDatabase};
use expect_test::{expect, Expect};
use hir_expand::db::ExpandDatabase;
use crate::{test_db::TestDB, ModuleDefId};
@ -255,7 +254,6 @@ impl SsrError {
}
"##,
);
println!("{}", db.dump_syntax_contexts());
assert_eq!(db.body_with_source_map(def.into()).1.diagnostics(), &[]);
expect![[r#"
@ -288,3 +286,49 @@ impl SsrError {
}"#]]
.assert_eq(&body.pretty_print(&db, def))
}
#[test]
fn regression_10300() {
let (db, body, def) = lower(
r#"
//- minicore: concat, panic
mod private {
pub use core::concat;
}
macro_rules! m {
() => {
panic!(concat!($crate::private::concat!("cc")));
};
}
fn f() {
m!();
}
"#,
);
let (_, source_map) = db.body_with_source_map(def.into());
assert_eq!(source_map.diagnostics(), &[]);
for (_, def_map) in body.blocks(&db) {
assert_eq!(def_map.diagnostics(), &[]);
}
expect![[r#"
fn f() {
$crate::panicking::panic_fmt(
builtin#lang(Arguments::new_v1_formatted)(
&[
"\"cc\"",
],
&[],
&[],
unsafe {
builtin#lang(UnsafeArg::new)()
},
),
);
}"#]]
.assert_eq(&body.pretty_print(&db, def))
}