diff options
author | John Hodge <tpg@mutabah.net> | 2015-04-04 08:28:48 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-04-04 08:28:48 +0800 |
commit | 5eb48071d47594544d909cb069427fc08b763425 (patch) | |
tree | b3308c2d6dc5a6bda8ca2883c01a30f23eea87be /src | |
parent | b532739cc38f6754770b7a3f8a285df6aa5cd532 (diff) | |
download | mrust-5eb48071d47594544d909cb069427fc08b763425.tar.gz |
Fixed incorrect resolution order for params in typecheck_params
Diffstat (limited to 'src')
-rw-r--r-- | src/convert/typecheck_params.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
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) ); } |