From a67c91329da4e2840ee4089e5c7854f68bb8afda Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 5 May 2019 10:39:25 +0800 Subject: Typecheck Expressions - (Disabled) inclusion of a coercion point on match values --- src/hir_typeck/expr_cs.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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) { -- cgit v1.2.3