From 3ee9d5c193e5177e695ae237ab2c28c225619ff2 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 5 Oct 2016 19:07:38 +0800 Subject: HIR Typecheck Validate - Allow no-op casts --- src/hir_typeck/expr_check.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp index 2f962f71..4f4235cd 100644 --- a/src/hir_typeck/expr_check.cpp +++ b/src/hir_typeck/expr_check.cpp @@ -243,6 +243,12 @@ namespace { const auto& src_ty = node.m_value->m_res_type; const auto& dst_ty = node.m_res_type; + + if( dst_ty == src_ty ) { + // Would be nice to delete it, but this is a readonly pass + return ; + } + // Check castability TU_MATCH_DEF(::HIR::TypeRef::Data, (dst_ty.m_data), (de), ( -- cgit v1.2.3