From 4656343c6feafc6ea26dd5eb22a30b3afebf5a18 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 2 Sep 2017 11:28:42 +0800 Subject: HIR Impl Specialisation - Check param bounds for overlap --- src/hir/hir.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index a8cffda2..5b43c1c9 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -917,7 +917,21 @@ bool ::HIR::TraitImpl::overlaps_with(const Crate& crate, const ::HIR::TraitImpl& // Determine if `ty` would be bounded (it's an ATY or generic) if( ty.m_data.is_Generic() ) { - TODO(Span(), "Check bound " << ty << " : " << trait << " in source bounds - " << g_src.m_params.fmt_bounds()); + bool found = false; + for(const auto& bound : g_src.m_params.m_bounds) + { + if(const auto* be = bound.opt_TraitBound()) + { + if( be->type != ty ) continue; + if( be->trait != trait ) continue; + found = true; + } + } + if( !found ) + { + DEBUG("No matching bound for " << ty << " : " << trait << " in source bounds - " << g_src.m_params.fmt_bounds()); + return false; + } } else if( TU_TEST1(ty.m_data, Path, .binding.is_Opaque()) ) { TODO(Span(), "Check bound " << ty << " : " << trait << " in source bounds or trait bounds"); -- cgit v1.2.3