refactor: Lower type-refs before type inference

This refactors how we deal with items in hir-def lowering.

- It now lowers all of them through an "ExpressionStore" (kind of a misnomer as this point) as their so called *Signatures.
- We now uniformly lower type AST into TypeRefs before type inference.
- Likewise, this moves macro expansion out of type inference, resulting in a single place where we do non-defmap macro expansion.
- Finally, this PR removes a lot of information from ItemTree, making the DefMap a lot less likely to be recomputed and have it only depend on actual early name resolution related information (not 100% true, we still have ADT fields in there but thats a follow up removal).
This commit is contained in:
Lukas Wirth 2025-01-25 17:20:10 +01:00
parent 588948f267
commit 1fd9520c92
127 changed files with 6733 additions and 7993 deletions

View file

@ -550,7 +550,7 @@ macro_rules! foo {
}
fn main() {
let res = fo$0o!();
fo$0o!()
}
"#,
expect![[r#"
@ -559,6 +559,24 @@ fn main() {
);
}
#[test]
fn macro_expand_item_expansion_in_expression_call() {
check(
r#"
macro_rules! foo {
() => {fn f<T>() {}};
}
fn main() {
let res = fo$0o!();
}
"#,
expect![[r#"
foo!
fn f<T>(){}"#]],
);
}
#[test]
fn macro_expand_derive() {
check(