diff options
-rw-r--r-- | src/hir_typeck/helpers.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index 9f72483b..f74ef4f0 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -2806,10 +2806,16 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp, const auto& real_trait_path = real_trait.m_path; DEBUG("- bound mono " << real_type << " : " << real_trait); bool found_fuzzy_match = false; - if( real_type.m_data.is_Path() && real_type.m_data.as_Path().binding.is_Unbound() ) { + // If the type is an unbound UFCS path, assume fuzzy + if( TU_TEST1(real_type.m_data, Path, .binding.is_Unbound()) ) { DEBUG("- Bounded type is unbound UFCS, assuming fuzzy match"); found_fuzzy_match = true; } + // If the type is an ivar, but not a literal, assume fuzzy + if( TU_TEST1(real_type.m_data, Infer, .is_lit() == false) ) { + DEBUG("- Bounded type is an ivar, assuming fuzzy match"); + found_fuzzy_match = true; + } // TODO: Pass the `match_test_generics` callback? Or another one that handles the impl placeholders. auto rv = this->find_trait_impls(sp, real_trait_path.m_path, real_trait_path.m_params, real_type, [&](auto impl, auto impl_cmp) { DEBUG("[ftic_check_params] impl_cmp = " << impl_cmp << ", impl = " << impl); |