diff options
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index cd574e983..708e2af0f 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -1101,10 +1101,14 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> { | |||
1101 | let resolver = t.resolver(db.upcast()); | 1101 | let resolver = t.resolver(db.upcast()); |
1102 | let ctx = | 1102 | let ctx = |
1103 | TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable); | 1103 | TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable); |
1104 | let type_ref = &db.type_alias_data(t).type_ref; | ||
1105 | let substs = Substs::bound_vars(&generics, DebruijnIndex::INNERMOST); | 1104 | let substs = Substs::bound_vars(&generics, DebruijnIndex::INNERMOST); |
1106 | let inner = Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error)); | 1105 | if db.type_alias_data(t).is_extern { |
1107 | Binders::new(substs.len(), inner) | 1106 | Binders::new(substs.len(), Ty::apply(TypeCtor::ForeignType(t), substs)) |
1107 | } else { | ||
1108 | let type_ref = &db.type_alias_data(t).type_ref; | ||
1109 | let inner = Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error)); | ||
1110 | Binders::new(substs.len(), inner) | ||
1111 | } | ||
1108 | } | 1112 | } |
1109 | 1113 | ||
1110 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 1114 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |