summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-10-06 21:25:47 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-10-06 21:25:47 +0800
commitcd6d2538b1e59ed0e258547c2480797f650702b7 (patch)
tree3c40c04b0b95350f28adbffc2e6d4070bfbb162d /src
parent773ffcc8bf971cd872eadff6825085b0501fe4a9 (diff)
downloadmrust-cd6d2538b1e59ed0e258547c2480797f650702b7.tar.gz
HIR Typecheck - Return type for empty match statements
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 5d59f880..f5ef9fc6 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -861,6 +861,11 @@ namespace {
this->equate_types_inner_coerce(node.span(), node.m_res_type, arm.m_code);
arm.m_code->visit( *this );
}
+
+ if( node.m_arms.empty() ) {
+ DEBUG("Empty match");
+ this->context.equate_types(node.span(), node.m_res_type, ::HIR::TypeRef::new_diverge());
+ }
}
void visit(::HIR::ExprNode_If& node) override