summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/helpers.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index 1cf2e320..8c69c38d 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -2670,7 +2670,15 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp,
}
else {
DEBUG("[ftic_check_params] Param " << idx << " " << *impl_params[idx] << " == " << ty);
- return impl_params[idx]->compare_with_placeholders(sp, ty, this->m_ivars.callback_resolve_infer());
+ auto rv = impl_params[idx]->compare_with_placeholders(sp, ty, this->m_ivars.callback_resolve_infer());
+ // If the existing is an ivar, replace with this.
+ // - TODO: Store the least fuzzy option, or store all fuzzy options?
+ if( rv == ::HIR::Compare::Fuzzy && impl_params[idx]->m_data.is_Infer() )
+ {
+ DEBUG("[ftic_check_params] Param " << idx << " fuzzy, use " << ty);
+ impl_params[idx] = &ty;
+ }
+ return rv;
}
};