From 8862fe6ff25c209ec4c027f0c253005ec3a9e3e0 Mon Sep 17 00:00:00 2001 From: Wildbook Date: Wed, 5 Oct 2022 17:45:32 +0200 Subject: [PATCH] Fix assertion failure in type inference (#13352) --- crates/hir/src/lib.rs | 4 ++++ crates/ide/src/highlight_related.rs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index e08dd8dadeb..f5324208c9a 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2807,6 +2807,10 @@ fn from_def(db: &dyn HirDatabase, def: impl HasResolver + Into) -> Type let subst = TyBuilder::subst_for_def(db, id, None).fill_with_unknown().build(); Some(subst) } + ItemContainerId::ImplId(id) => { + let subst = TyBuilder::subst_for_def(db, id, None).fill_with_unknown().build(); + Some(subst) + } _ => None, }, _ => None, diff --git a/crates/ide/src/highlight_related.rs b/crates/ide/src/highlight_related.rs index 1bdd626f1e8..540a115832d 100644 --- a/crates/ide/src/highlight_related.rs +++ b/crates/ide/src/highlight_related.rs @@ -1373,6 +1373,22 @@ fn main() { ().func$0(); //^^^^ } +"#, + ); + } + + #[test] + fn test_assoc_type_highlighting() { + check( + r#" +trait Trait { + type Output; + // ^^^^^^ +} +impl Trait for () { + type Output$0 = (); + // ^^^^^^ +} "#, ); }