aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
authorcynecx <[email protected]>2021-04-10 16:49:12 +0100
committercynecx <[email protected]>2021-04-17 15:24:56 +0100
commitcf3b4f1e208247c9d171273dabff9c6b3c98a240 (patch)
tree0cae2703b98ba8640ce6693abe32fb51fe27fdda /crates/hir_ty/src/lower.rs
parentfb2d284f28f70426e39e1b92d95bdbb217a48109 (diff)
hir_ty: Expand macros at type position
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index a035686bc..95ca5bdb0 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -15,7 +15,7 @@ use hir_def::{
15 generics::{TypeParamProvenance, WherePredicate, WherePredicateTypeTarget}, 15 generics::{TypeParamProvenance, WherePredicate, WherePredicateTypeTarget},
16 path::{GenericArg, Path, PathSegment, PathSegments}, 16 path::{GenericArg, Path, PathSegment, PathSegments},
17 resolver::{HasResolver, Resolver, TypeNs}, 17 resolver::{HasResolver, Resolver, TypeNs},
18 type_ref::{TraitRef as HirTraitRef, TypeBound, TypeRef}, 18 type_ref::{expand_type_ref, TraitRef as HirTraitRef, TypeBound, TypeRef},
19 AdtId, AssocContainerId, AssocItemId, ConstId, ConstParamId, EnumId, EnumVariantId, FunctionId, 19 AdtId, AssocContainerId, AssocItemId, ConstId, ConstParamId, EnumId, EnumVariantId, FunctionId,
20 GenericDefId, HasModule, ImplId, LocalFieldId, Lookup, StaticId, StructId, TraitId, 20 GenericDefId, HasModule, ImplId, LocalFieldId, Lookup, StaticId, StructId, TraitId,
21 TypeAliasId, TypeParamId, UnionId, VariantId, 21 TypeAliasId, TypeParamId, UnionId, VariantId,
@@ -287,6 +287,16 @@ impl<'a> TyLoweringContext<'a> {
287 } 287 }
288 } 288 }
289 } 289 }
290 mt @ TypeRef::Macro(_) => {
291 if let Some(module_id) = self.resolver.module() {
292 match expand_type_ref(self.db.upcast(), module_id, mt) {
293 Some(type_ref) => self.lower_ty(type_ref.as_ref()),
294 None => TyKind::Error.intern(&Interner),
295 }
296 } else {
297 TyKind::Error.intern(&Interner)
298 }
299 }
290 TypeRef::Error => TyKind::Error.intern(&Interner), 300 TypeRef::Error => TyKind::Error.intern(&Interner),
291 }; 301 };
292 (ty, res) 302 (ty, res)