From 24ee7b3a8b6fc2a52f6b3485ffe5087d144e4a28 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 24 Sep 2016 17:01:06 +0800 Subject: HIR Typecheck Expr - Fix impl selection bug with an evil hack --- src/hir/type.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/hir/type.cpp') diff --git a/src/hir/type.cpp b/src/hir/type.cpp index 4c7a162f..de60dcb1 100644 --- a/src/hir/type.cpp +++ b/src/hir/type.cpp @@ -524,7 +524,14 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x break; } ) + if( v.m_data.tag() != x.m_data.tag() ) { + // HACK: If the path is Opaque, return a fuzzy match. + // - This works around an impl selection bug. + if( v.m_data.is_Path() && v.m_data.as_Path().binding.is_Opaque() ) { + DEBUG("- Fuzzy match due to opaque"); + return Compare::Fuzzy; + } DEBUG("- Tag mismatch " << v << " and " << x); return Compare::Unequal; } -- cgit v1.2.3