summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-05-05 10:39:25 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-05-05 10:39:25 +0800
commita67c91329da4e2840ee4089e5c7854f68bb8afda (patch)
treefc597d729b54033da1ffd2571baae2efc1fa6629
parente475d337864918773d3e7784c645976e8acee663 (diff)
downloadmrust-a67c91329da4e2840ee4089e5c7854f68bb8afda.tar.gz
Typecheck Expressions - (Disabled) inclusion of a coercion point on match values
-rw-r--r--src/hir_typeck/expr_cs.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index f971cca7..a8fa2870 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -812,8 +812,8 @@ namespace {
{
TRACE_FUNCTION_F(&node << " match ...");
+#if 1
const auto& val_type = node.m_value->m_res_type;
-
{
auto _ = this->push_inner_coerce_scoped(true);
this->context.add_ivars(node.m_value->m_res_type);
@@ -821,6 +821,15 @@ namespace {
// TODO: If a coercion point (and ivar for the value) is placed here, it will allow `match &string { "..." ... }`
node.m_value->visit( *this );
}
+#else
+ auto val_type = this->context.m_ivars.new_ivar_tr();
+ {
+ auto _ = this->push_inner_coerce_scoped(true);
+ this->context.add_ivars(node.m_value->m_res_type);
+ node.m_value->visit( *this );
+ this->context.equate_types_coerce( node.span(), val_type, node.m_value );
+ }
+#endif
for(auto& arm : node.m_arms)
{