Fix float-split hack not setting up spans correctly

This commit is contained in:
Lukas Wirth 2023-11-19 18:42:25 +01:00
parent 8423893d1c
commit 394d11b0fa
15 changed files with 197 additions and 58 deletions

View file

@ -7,7 +7,7 @@ use base_db::{
AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast,
};
use hir_def::{db::DefDatabase, ModuleId};
use hir_expand::{db::ExpandDatabase, hygiene::SyntaxContextData};
use hir_expand::db::ExpandDatabase;
use nohash_hasher::IntMap;
use rustc_hash::FxHashSet;
use syntax::TextRange;
@ -30,7 +30,7 @@ pub(crate) struct TestDB {
impl Default for TestDB {
fn default() -> Self {
let mut this = Self { storage: Default::default(), events: Default::default() };
this.intern_syntax_context(SyntaxContextData::root());
this.setup_syntax_context_root();
this.set_expand_proc_attr_macros_with_durability(true, Durability::HIGH);
this
}

View file

@ -63,10 +63,10 @@ fn infer_macros_expanded() {
}
"#,
expect![[r#"
!0..17 '{Foo(v...,2,])}': Foo
!0..21 '{Foo(v...2),])}': Foo
!1..4 'Foo': Foo({unknown}) -> Foo
!1..16 'Foo(vec![1,2,])': Foo
!5..15 'vec![1,2,]': {unknown}
!1..20 'Foo(ve...(2),])': Foo
!5..19 'vec![(1),(2),]': {unknown}
155..181 '{ ...,2); }': ()
165..166 'x': Foo
"#]],
@ -96,10 +96,10 @@ fn infer_legacy_textual_scoped_macros_expanded() {
}
"#,
expect![[r#"
!0..17 '{Foo(v...,2,])}': Foo
!0..21 '{Foo(v...2),])}': Foo
!1..4 'Foo': Foo({unknown}) -> Foo
!1..16 'Foo(vec![1,2,])': Foo
!5..15 'vec![1,2,]': {unknown}
!1..20 'Foo(ve...(2),])': Foo
!5..19 'vec![(1),(2),]': {unknown}
194..250 '{ ...,2); }': ()
204..205 'x': Foo
227..228 'y': {unknown}