diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-20 11:45:19 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-20 11:45:19 +0800 |
commit | 09db207173ba768176ead9ff8dad1b9f744ab035 (patch) | |
tree | b6b1baf30fc7b0fdfd2e36f310f6454a2c125dd1 /src | |
parent | 70e274b016a0a285ed62e03193ffa27d3d94b1be (diff) | |
download | mrust-09db207173ba768176ead9ff8dad1b9f744ab035.tar.gz |
HIR Typecheck Expr - Print (some of) the rules when there's leftovers
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 0db9c744..091184a5 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -5507,7 +5507,37 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR: if( context.has_rules() ) { - //context.dump(); + for(const auto& coercion : context.link_coerce) + { + const auto& sp = (**coercion.right_node_ptr).span(); + const auto& src_ty = (**coercion.right_node_ptr).m_res_type; + WARNING(sp, W0000, "Spare Rule - " << context.m_ivars.fmt_type(coercion.left_ty) << " := " << context.m_ivars.fmt_type(src_ty) ); + } + for(const auto& rule : context.link_assoc) + { + const auto& sp = rule.span; + if( rule.name == "" || rule.left_ty == ::HIR::TypeRef() ) + { + WARNING(sp, W0000, "Spare Rule - " << context.m_ivars.fmt_type(rule.impl_ty) << " : " << rule.trait << rule.params ); + } + else + { + WARNING(sp, W0000, "Spare Rule - " << context.m_ivars.fmt_type(rule.left_ty) + << " = < " << context.m_ivars.fmt_type(rule.impl_ty) << " as " << rule.trait << rule.params << " >::" << rule.name ); + } + } + // TODO: Print revisit rules and advanced revisit rules. + for(const auto& node : context.to_visit) + { + const auto& sp = node->span(); + if( const auto* np = dynamic_cast<::HIR::ExprNode_CallMethod*>(node) ) + { + WARNING(sp, W0000, "Spare Rule - {" << context.m_ivars.fmt_type(np->m_value->m_res_type) << "}." << np->m_method); + } + else + { + } + } BUG(root_ptr->span(), "Spare rules left after typecheck stabilised"); } |