hir_def: refactor expand_macro_type and cleanups

This commit is contained in:
cynecx 2021-04-17 17:38:38 +02:00
parent 14918a3870
commit 7ed42a3a52
3 changed files with 34 additions and 124 deletions

View file

@ -15,7 +15,7 @@ use hir_def::{
generics::{TypeParamProvenance, WherePredicate, WherePredicateTypeTarget},
path::{GenericArg, Path, PathSegment, PathSegments},
resolver::{HasResolver, Resolver, TypeNs},
type_ref::{expand_type_ref, TraitRef as HirTraitRef, TypeBound, TypeRef},
type_ref::{expand_macro_type, TraitRef as HirTraitRef, TypeBound, TypeRef},
AdtId, AssocContainerId, AssocItemId, ConstId, ConstParamId, EnumId, EnumVariantId, FunctionId,
GenericDefId, HasModule, ImplId, LocalFieldId, Lookup, StaticId, StructId, TraitId,
TypeAliasId, TypeParamId, UnionId, VariantId,
@ -289,8 +289,8 @@ impl<'a> TyLoweringContext<'a> {
}
mt @ TypeRef::Macro(_) => {
if let Some(module_id) = self.resolver.module() {
match expand_type_ref(self.db.upcast(), module_id, mt) {
Some(type_ref) => self.lower_ty(type_ref.as_ref()),
match expand_macro_type(self.db.upcast(), module_id, mt) {
Some(type_ref) => self.lower_ty(&type_ref),
None => TyKind::Error.intern(&Interner),
}
} else {