summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hir/type.cpp6
-rw-r--r--src/hir_typeck/expr_cs.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/hir/type.cpp b/src/hir/type.cpp
index 76154008..6f465c44 100644
--- a/src/hir/type.cpp
+++ b/src/hir/type.cpp
@@ -932,6 +932,12 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
// - See `(Generic,` below
if( left.m_data.tag() != right.m_data.tag() ) {
+ if( left.m_data.is_Path() && left.m_data.as_Path().binding.is_Unbound() ) {
+ return Compare::Fuzzy;
+ }
+ if( right.m_data.is_Path() && right.m_data.as_Path().binding.is_Unbound() ) {
+ return Compare::Fuzzy;
+ }
return Compare::Unequal;
}
TU_MATCH(::HIR::TypeRef::Data, (left.m_data, right.m_data), (le, re),
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index accb1636..b0d8f0b5 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4533,11 +4533,13 @@ namespace {
auto out_ty_o = impl.get_type(v.name.c_str());
if( out_ty_o == ::HIR::TypeRef() )
{
+ //BUG(sp, "Getting associated type '" << v.name << "' which isn't in " << v.trait << " (" << ty << ")");
out_ty_o = ::HIR::TypeRef( ::HIR::Path(::HIR::Path( v.impl_ty.clone(), ::HIR::GenericPath(v.trait, v.params.clone()), v.name, ::HIR::PathParams() )) );
}
out_ty_o = context.m_resolve.expand_associated_types(sp, mv$(out_ty_o));
- //BUG(sp, "Getting associated type '" << v.name << "' which isn't in " << v.trait << " (" << ty << ")");
-
+
+ // TODO: if this is an unbound UfcsUnknown, treat as a fuzzy match.
+ // - Shouldn't compare_with_placeholders do that?
const auto& out_ty = out_ty_o;
// - If we're looking for an associated type, allow it to eliminate impossible impls