From 183153147d29e08a01e2930bbccf894917bc2a14 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Nov 2017 12:53:54 +0800 Subject: Typecheck Expressions - Incremental change to auto trait handling --- src/hir_typeck/helpers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index f74ef4f0..1a9382b6 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -2621,6 +2621,10 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp, BUG(sp, "UfcsUnknown in typeck - " << type); ), (UfcsKnown, + // If unbound, use Fuzzy + if(e.binding.is_Unbound()) + return ::HIR::Compare::Fuzzy; + // Otherwise, it's opaque. Check the bounds on the trait. TODO(sp, "Check trait bounds for bound on " << type); ), (UfcsInherent, @@ -2629,6 +2633,9 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp, ) return res; ) + else TU_IFLET( ::HIR::TypeRef::Data, type.m_data, Generic, e, + TODO(sp, "Check trait bounds on " << type); + ) else TU_IFLET( ::HIR::TypeRef::Data, type.m_data, Tuple, e, ::HIR::Compare res = ::HIR::Compare::Equal; for(const auto& sty : e) -- cgit v1.2.3