From 5297a996eae29e81fe71fbf04101b1242273b378 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Sat, 25 Jul 2026 16:44:24 +0000
Subject: [PATCH 29/30] hir_typeck: bind path ivars against non-generic impls
 in value paths

ExprNode_PathValue's UfcsInherent arm only equated the path type with
the impl type when the impl block was generic; a non-generic impl
(`impl Range<i32> { const ZERO...: Self; }`) named via `Range::ZERO...`
left the elided param as an unbound ivar -> "Failed to infer type _ in
<Range<_>>::ZERO...". With a single applicable candidate committing to
its self type is exactly rustc's probe behaviour. Seen with fend-core
1.5.8 (blocks fend).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GNXc7PddzJE4X1swqbe3Xn
---
 src/hir_typeck/expr_cs__enum.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/hir_typeck/expr_cs__enum.cpp b/src/hir_typeck/expr_cs__enum.cpp
index 474a984b..4d5dc75d 100644
--- a/src/hir_typeck/expr_cs__enum.cpp
+++ b/src/hir_typeck/expr_cs__enum.cpp
@@ -1956,6 +1956,13 @@ namespace typecheck
                         this->context.equate_types(node.span(), t, e.type);
                     }
                 }
+                else
+                {
+                    // Non-generic impl block: the path's type must equal the impl type exactly.
+                    // Binds any ivars in the path, e.g. `<Range<_>>::ZERO` with only `impl Range<i32>`
+                    // providing the constant (the single applicable candidate, so committing is sound).
+                    this->context.equate_types(node.span(), impl_ptr->m_type, e.type);
+                }
 
 
                 if( fcn_ptr )
-- 
2.43.0

