From 75f06ce1fb63898d45b301a796f83fa2e91f9871 Mon Sep 17 00:00:00 2001 From: Ali Bektas Date: Sat, 15 Jul 2023 18:32:21 +0200 Subject: [PATCH 1/2] Handle TyAlias in projected_ty --- crates/hir-ty/src/mir.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs index dc846fc394..b598e5ebcf 100644 --- a/crates/hir-ty/src/mir.rs +++ b/crates/hir-ty/src/mir.rs @@ -151,6 +151,7 @@ impl ProjectionElem { TyKind::Adt(_, subst) => { db.field_types(f.parent)[f.local_id].clone().substitute(Interner, subst) } + TyKind::Alias(al) => al.clone().intern(Interner), _ => { never!("Only adt has field"); return TyKind::Error.intern(Interner); @@ -167,6 +168,7 @@ impl ProjectionElem { TyKind::Error.intern(Interner) }), TyKind::Closure(id, subst) => closure_field(*id, subst, *f), + TyKind::Alias(al) => al.clone().intern(Interner), _ => { never!("Only tuple or closure has tuple or closure field"); return TyKind::Error.intern(Interner); From f8f19c42886aa58c5ac9e463ca060242e7e6ae24 Mon Sep 17 00:00:00 2001 From: Ali Bektas Date: Sat, 15 Jul 2023 19:04:59 +0200 Subject: [PATCH 2/2] Change names to sth more presentable --- crates/hir-ty/src/mir.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs index b598e5ebcf..df53d239ca 100644 --- a/crates/hir-ty/src/mir.rs +++ b/crates/hir-ty/src/mir.rs @@ -151,7 +151,7 @@ impl ProjectionElem { TyKind::Adt(_, subst) => { db.field_types(f.parent)[f.local_id].clone().substitute(Interner, subst) } - TyKind::Alias(al) => al.clone().intern(Interner), + TyKind::Alias(inner) => inner.clone().intern(Interner), _ => { never!("Only adt has field"); return TyKind::Error.intern(Interner); @@ -168,7 +168,7 @@ impl ProjectionElem { TyKind::Error.intern(Interner) }), TyKind::Closure(id, subst) => closure_field(*id, subst, *f), - TyKind::Alias(al) => al.clone().intern(Interner), + TyKind::Alias(inner) => inner.clone().intern(Interner), _ => { never!("Only tuple or closure has tuple or closure field"); return TyKind::Error.intern(Interner);