diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-10-06 21:25:47 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-10-06 21:25:47 +0800 |
commit | cd6d2538b1e59ed0e258547c2480797f650702b7 (patch) | |
tree | 3c40c04b0b95350f28adbffc2e6d4070bfbb162d /src | |
parent | 773ffcc8bf971cd872eadff6825085b0501fe4a9 (diff) | |
download | mrust-cd6d2538b1e59ed0e258547c2480797f650702b7.tar.gz |
HIR Typecheck - Return type for empty match statements
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 5 |
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 |