aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorCharles Lew <[email protected]>2020-09-16 13:57:14 +0100
committerCharles Lew <[email protected]>2020-09-16 13:57:14 +0100
commit389d9a6c2d297d838b4cfa754565b6bea5f8c757 (patch)
treeac8ace43e9dd1167fb343092685f710a7c57a1a5 /crates/hir_ty
parentb302f69b7c5b1b966ec3f8637761ecb867e3bcca (diff)
Lower extern type alias as foreign opaque type.
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/lower.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index cd574e983..39252bc5e 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -1101,9 +1101,13 @@ 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 let inner = if db.type_alias_data(t).is_extern {
1106 Ty::simple(TypeCtor::ForeignType(t))
1107 } else {
1108 let type_ref = &db.type_alias_data(t).type_ref;
1109 Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error))
1110 };
1107 Binders::new(substs.len(), inner) 1111 Binders::new(substs.len(), inner)
1108} 1112}
1109 1113