summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hir_conv/constant_evaluation.cpp5
-rw-r--r--src/hir_expand/const_eval_full.cpp8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/hir_conv/constant_evaluation.cpp b/src/hir_conv/constant_evaluation.cpp
index 99e2629a..7318f2cf 100644
--- a/src/hir_conv/constant_evaluation.cpp
+++ b/src/hir_conv/constant_evaluation.cpp
@@ -328,8 +328,11 @@ namespace {
}
void visit(::HIR::ExprNode_BinOp& node) override {
TRACE_FUNCTION_F("_BinOp");
+
node.m_left->visit(*this);
auto left = mv$(m_rv);
+ auto ret_type = mv$(m_rv_type);
+
node.m_right->visit(*this);
auto right = mv$(m_rv);
@@ -425,7 +428,7 @@ namespace {
break;
}
- m_rv_type = m_exp_type.clone();
+ m_rv_type = mv$(ret_type);
}
void visit(::HIR::ExprNode_UniOp& node) override {
TRACE_FUNCTION_FR("_UniOp", m_rv);
diff --git a/src/hir_expand/const_eval_full.cpp b/src/hir_expand/const_eval_full.cpp
index 6e493aea..d2fa3a76 100644
--- a/src/hir_expand/const_eval_full.cpp
+++ b/src/hir_expand/const_eval_full.cpp
@@ -569,6 +569,14 @@ namespace {
else {
BUG(sp, "Invalid cast of " << inval.tag_str() << " to " << e.type);
}
+ ),
+ (Borrow,
+ TU_IFLET( ::HIR::Literal, inval, BorrowOf, i,
+ val = mv$(inval);
+ )
+ else {
+ BUG(sp, "Invalid cast of " << inval.tag_str() << " to " << e.type);
+ }
)
)
),