From 5eb48071d47594544d909cb069427fc08b763425 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 4 Apr 2015 08:28:48 +0800 Subject: Fixed incorrect resolution order for params in typecheck_params --- src/convert/typecheck_params.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/convert/typecheck_params.cpp b/src/convert/typecheck_params.cpp index c4d231ff..bdc83be0 100644 --- a/src/convert/typecheck_params.cpp +++ b/src/convert/typecheck_params.cpp @@ -66,10 +66,12 @@ public: // === CODE === bool CGenericParamChecker::has_impl_for_param(const ::std::string name, const AST::Path& trait) const { + TRACE_FUNCTION_F("name = " << name << ", trait = " << trait); const AST::TypeParams* tps = nullptr; // Locate params set that contains the passed name for( const auto lt : m_types_stack ) { + DEBUG("lt = " << lt.name); if( lt.name == name ) { if( lt.source_params != nullptr ) { @@ -78,7 +80,7 @@ bool CGenericParamChecker::has_impl_for_param(const ::std::string name, const AS else { DEBUG("Type name '" << name << "' isn't a param"); } - break ; + //break ; } } @@ -88,10 +90,10 @@ bool CGenericParamChecker::has_impl_for_param(const ::std::string name, const AS } // Search bound list for the passed trait - TypeRef param_type(TypeRef::TagArg(), name); for( const auto& bound : tps->bounds() ) { - if( bound.is_trait() && bound.test() == param_type ) + DEBUG("bound = " << bound); + if( bound.is_trait() && bound.test().is_type_param() && bound.test().type_param() == name ) { DEBUG("bound.type() {" << bound.bound() << "} == trait {" << trait << "}"); if( bound.bound() == trait ) @@ -297,6 +299,7 @@ void CGenericParamChecker::end_scope() } void CGenericParamChecker::handle_params(AST::TypeParams& params) { + DEBUG("params = " << params); for( const auto& p : params.ty_params()) m_types_stack.push_back( LocalType(p.name(), ¶ms) ); } -- cgit v1.2.3