diff options
author | John Hodge <tpg@mutabah.net> | 2016-06-12 23:49:25 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-06-12 23:49:25 +0800 |
commit | 874eb4767f6350156fff6c50851d0cf9b4e6a625 (patch) | |
tree | b5f4fbcb4aabc40c4516085a25067a50a0db188c /src | |
parent | c48b9ea73a89a08d2326478fa99e0a2598dae2d0 (diff) | |
download | mrust-874eb4767f6350156fff6c50851d0cf9b4e6a625.tar.gz |
HIR Typecheck - Don't assume 'prim <<= prim' is has both equal
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr.cpp | 8 | ||||
-rw-r--r-- | src/hir_typeck/expr_context.cpp | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/hir_typeck/expr.cpp b/src/hir_typeck/expr.cpp index 2388e353..03276a9d 100644 --- a/src/hir_typeck/expr.cpp +++ b/src/hir_typeck/expr.cpp @@ -641,7 +641,11 @@ namespace typeck { // - The only option is for them both to be the same type (because primitives can't have multiple overloads) // TODO: Check that this operation is valid to peform. (e.g. not doing f32_val <<= f32_val) // TODO: Aren't the bitwise shift operators valid with any integer type count? - this->context.apply_equality(node.span(), node.m_slot->m_res_type, node.m_value->m_res_type); + if( node.m_op == ::HIR::ExprNode_Assign::Op::Shr || node.m_op == ::HIR::ExprNode_Assign::Op::Shl ) { + } + else { + this->context.apply_equality(node.span(), node.m_slot->m_res_type, node.m_value->m_res_type); + } } else { const char *lang_item = nullptr; @@ -1415,8 +1419,6 @@ namespace typeck { }, [&](const auto& impl) { DEBUG("- impl" << impl.m_params.fmt_args() << " " << impl.m_type); - for(const auto& v : impl.m_methods) - DEBUG(" > " << v.first); auto it = impl.m_methods.find(e.item); if( it == impl.m_methods.end() ) return false; diff --git a/src/hir_typeck/expr_context.cpp b/src/hir_typeck/expr_context.cpp index a425aa56..4699b0b3 100644 --- a/src/hir_typeck/expr_context.cpp +++ b/src/hir_typeck/expr_context.cpp @@ -1968,7 +1968,6 @@ bool typeck::TypecheckContext::find_method(const Span& sp, const ::HIR::TypeRef& { if( trait_ref.first == nullptr ) break; - DEBUG("Search for impl of ?" << *trait_ref.first); // TODO: Search supertraits too auto it = trait_ref.second->m_values.find(method_name); |