diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-10 16:38:40 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-10 16:38:40 +0800 |
commit | efba09df1f3f513acc8db4b8f0c7bae80483af6d (patch) | |
tree | 14295f0954635facd01d5ef8febd64d781bee684 | |
parent | c1348ccd50cd7877cf72af1db65c8671c9b70c91 (diff) | |
download | mrust-efba09df1f3f513acc8db4b8f0c7bae80483af6d.tar.gz |
HIR Typecheck - Applied inferred literal suffixes
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 10d3f9fe..91febcc4 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2960,6 +2960,25 @@ namespace { ::HIR::ExprVisitorDef::visit(node); } + + void visit(::HIR::ExprNode_Literal& node) override { + TU_MATCH(::HIR::ExprNode_Literal::Data, (node.m_data), (e), + (Integer, + ASSERT_BUG(node.span(), node.m_res_type.m_data.is_Primitive(), "Float Literal didn't return primitive"); + e.m_type = node.m_res_type.m_data.as_Primitive(); + ), + (Float, + ASSERT_BUG(node.span(), node.m_res_type.m_data.is_Primitive(), "Float Literal didn't return primitive"); + e.m_type = node.m_res_type.m_data.as_Primitive(); + ), + (Boolean, + ), + (ByteString, + ), + (String, + ) + ) + } private: void check_type_resolved_top(const Span& sp, ::HIR::TypeRef& ty) const { check_type_resolved(sp, ty, ty); |