Skip to content

Commit 5313e4f

Browse files
committed
Initial TypeCast Rules
This gives us full explicit control for all casting. Just like other rules. More test cases are needed to close out type-casts by the the end of the traits milestone. Fixes #592
1 parent 6822e1b commit 5313e4f

File tree

8 files changed

+1450
-0
lines changed

8 files changed

+1450
-0
lines changed

gcc/rust/typecheck/rust-hir-type-check-expr.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,16 @@ class TypeCheckExpr : public TypeCheckBase
11471147
}
11481148
}
11491149

1150+
void visit (HIR::TypeCastExpr &expr) override
1151+
{
1152+
TyTy::BaseType *expr_to_convert
1153+
= TypeCheckExpr::Resolve (expr.get_casted_expr ().get (), false);
1154+
TyTy::BaseType *tyty_to_convert_to
1155+
= TypeCheckType::Resolve (expr.get_type_to_convert_to ().get ());
1156+
1157+
infered = expr_to_convert->cast (tyty_to_convert_to);
1158+
}
1159+
11501160
private:
11511161
TypeCheckExpr (bool inside_loop)
11521162
: TypeCheckBase (), infered (nullptr), infered_array_elems (nullptr),

0 commit comments

Comments
 (0)