From 73ea9b76f3bd42aff75d2890b0e282ac1fbaa44b Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 7 Jan 2024 10:11:14 +0800 Subject: [PATCH] HIR Typecheck - Fix `match_test_generics_fuzz` on const generics --- src/hir/path.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hir/path.cpp b/src/hir/path.cpp index 4745c362..ce336196 100644 --- a/src/hir/path.cpp +++ b/src/hir/path.cpp @@ -303,17 +303,19 @@ ::HIR::Compare HIR::PathParams::match_test_generics_fuzz(const Span& sp, const P } for( unsigned int i = 0; i < x.m_values.size(); i ++ ) { - if( const auto* ge = this->m_values[i].opt_Generic() ) { - rv &= match.match_val(*ge, x.m_values[i]); + const auto& val_t = resolve_placeholder.get_val(sp, this->m_values[i]); + const auto& val_x = resolve_placeholder.get_val(sp, x.m_values[i]); + if( const auto* ge = val_t.opt_Generic() ) { + rv &= match.match_val(*ge, val_x); if(rv == Compare::Unequal) return Compare::Unequal; } else { // TODO: Look up the the ivars? - if( this->m_values[i].is_Infer() ) { + if( val_t.is_Infer() || val_x.is_Infer() ) { return Compare::Fuzzy; } - if( this->m_values[i] != x.m_values[i] ) { + if( val_t != val_x ) { return Compare::Unequal; } }