diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-22 14:13:22 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-22 14:13:22 +0800 |
commit | 25f2e4f1cbdced1372440afb05a2b7f418d1239e (patch) | |
tree | 45251e6a00593a858f1053468878f87b785378d6 | |
parent | f4384b3b1cf517662cba9e5fc6b34e73b502f4c3 (diff) | |
download | mrust-25f2e4f1cbdced1372440afb05a2b7f418d1239e.tar.gz |
HIT Typecheck - Fix apply to apply variables
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 2fce29b0..b0ff5b9d 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2035,6 +2035,20 @@ namespace { ivars(context.m_ivars) { } + void visit_node_ptr(::HIR::ExprPtr& node_ptr) + { + auto& node = *node_ptr; + const char* node_ty = typeid(node).name(); + + TRACE_FUNCTION_FR(&node << " " << &node << " " << node_ty << " : " << node.m_res_type, node_ty); + this->check_type_resolved_top(node.span(), node.m_res_type); + DEBUG(node_ty << " : = " << node.m_res_type); + + node_ptr->visit(*this); + + for( auto& ty : node_ptr.m_bindings ) + this->check_type_resolved_top(node.span(), ty); + } void visit_node_ptr(::HIR::ExprNodeP& node_ptr) override { auto& node = *node_ptr; const char* node_ty = typeid(node).name(); @@ -3999,15 +4013,6 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR: BUG(root_ptr->span(), "Spare rules left after typecheck stabilised"); } - // - Validate typeck - { - DEBUG("==== VALIDATE ==== (" << count << " rounds)"); - context.dump(); - - ExprVisitor_Apply visitor { context }; - visitor.visit_node_ptr( root_ptr ); - } - // - Recreate the pointer expr = ::HIR::ExprPtr( mv$(root_ptr) ); // > Steal the binding types @@ -4015,5 +4020,14 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR: for(auto& binding : context.m_bindings) { expr.m_bindings.push_back( mv$(binding.ty) ); } + + // - Validate typeck + { + DEBUG("==== VALIDATE ==== (" << count << " rounds)"); + context.dump(); + + ExprVisitor_Apply visitor { context }; + visitor.visit_node_ptr( expr ); + } } |