summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hir_typeck/expr_check.cpp6
-rw-r--r--src/hir_typeck/expr_cs.cpp18
2 files changed, 21 insertions, 3 deletions
diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp
index 086c20b9..7b6b3705 100644
--- a/src/hir_typeck/expr_check.cpp
+++ b/src/hir_typeck/expr_check.cpp
@@ -394,7 +394,7 @@ namespace {
}
check_types_equal(node.span(), node.m_res_type, node.m_arg_types.back());
- // Don't bother checking the trait, if the cache is populated it was found
+ // Don't bother checking for a FnOnce impl, if the cache is populated it was found
node.m_value->visit( *this );
for( auto& val : node.m_args ) {
@@ -404,9 +404,11 @@ namespace {
void visit(::HIR::ExprNode_CallMethod& node) override
{
ASSERT_BUG(node.span(), node.m_cache.m_arg_types.size() > 0, "CallMethod cache not populated");
+ ASSERT_BUG(node.span(), node.m_cache.m_arg_types.size() == 1 + node.m_args.size() + 1, "CallMethod cache mis-sized");
+ check_types_equal(node.m_cache.m_arg_types[0], node.m_value);
for(unsigned int i = 0; i < node.m_args.size(); i ++)
{
- check_types_equal(node.span(), node.m_cache.m_arg_types[i], node.m_args[i]->m_res_type);
+ check_types_equal(node.m_cache.m_arg_types[1+i], node.m_args[i]);
}
check_types_equal(node.span(), node.m_res_type, node.m_cache.m_arg_types.back());
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 8d2afe33..58a637e2 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -1914,6 +1914,22 @@ namespace {
::HIR::ExprVisitorDef::visit(node);
}
+ void visit(::HIR::ExprNode_CallPath& node) override {
+ for(auto& ty : node.m_cache.m_arg_types)
+ this->check_type_resolved_top(node.span(), ty);
+ ::HIR::ExprVisitorDef::visit(node);
+ }
+ void visit(::HIR::ExprNode_CallMethod& node) override {
+ for(auto& ty : node.m_cache.m_arg_types)
+ this->check_type_resolved_top(node.span(), ty);
+ ::HIR::ExprVisitorDef::visit(node);
+ }
+ void visit(::HIR::ExprNode_CallValue& node) override {
+ for(auto& ty : node.m_arg_types)
+ this->check_type_resolved_top(node.span(), ty);
+ ::HIR::ExprVisitorDef::visit(node);
+ }
+
private:
void check_type_resolved_top(const Span& sp, ::HIR::TypeRef& ty) const {
check_type_resolved(sp, ty, ty);
@@ -3519,7 +3535,7 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR:
context.dump();
ExprVisitor_Apply visitor { context.m_ivars };
- root_ptr->visit( visitor );
+ visitor.visit_node_ptr( root_ptr );
}
expr = ::HIR::ExprPtr( mv$(root_ptr) );
}