diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-08 12:44:19 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-08 12:44:19 +0800 |
commit | 018875fc56bfaac6a9164cc1e26113313ba8b65d (patch) | |
tree | 8bf62f5c0a6b34f5e8e15685006cff4e6b23da9a | |
parent | a901b985312f70e55834445038c3158af16102b9 (diff) | |
download | mrust-018875fc56bfaac6a9164cc1e26113313ba8b65d.tar.gz |
HIR Typecheck - Add an unconditional coercion point to fix a librustdoc fail
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 44a6c80c..e796b3b1 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -795,12 +795,17 @@ namespace { } this->context.add_ivars( node.m_true->m_res_type ); - this->equate_types_inner_coerce(node.span(), node.m_res_type, node.m_true); + if( node.m_false ) { + this->context.equate_types_coerce(node.span(), node.m_res_type, node.m_true); + } + else { + this->context.equate_types(node.span(), node.m_res_type, ::HIR::TypeRef::new_unit()); + } node.m_true->visit( *this ); if( node.m_false ) { this->context.add_ivars( node.m_false->m_res_type ); - this->equate_types_inner_coerce(node.span(), node.m_res_type, node.m_false); + this->context.equate_types_coerce(node.span(), node.m_res_type, node.m_false); node.m_false->visit( *this ); } else { |