@@ -101,11 +101,11 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) =
101
101
if not (is_integer (fundamental_ty actual)) then
102
102
type_error " integer" actual
103
103
in
104
- let demand_bool_or_char_or_integer (actual :Ast.ty ) : unit =
104
+ let demand_bool_or_char_or_integer_or_native (actual :Ast.ty ) : unit =
105
105
match fundamental_ty actual with
106
- Ast. TY_bool | Ast. TY_char -> ()
106
+ Ast. TY_bool | Ast. TY_char | Ast. TY_native _ -> ()
107
107
| ty when is_integer ty -> ()
108
- | _ -> type_error " bool, char, or integer " actual
108
+ | _ -> type_error " bool, char, integer or native " actual
109
109
in
110
110
let demand_number (actual :Ast.ty ) : unit =
111
111
match fundamental_ty actual with
@@ -634,9 +634,11 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) =
634
634
ty
635
635
| Ast. EXPR_unary (Ast. UNOP_cast dst_ty_id , atom ) ->
636
636
(* TODO: probably we want to handle more cases here *)
637
- demand_bool_or_char_or_integer (check_atom atom);
638
- let dst_ty = dst_ty_id.Common. node in
639
- demand_bool_or_char_or_integer dst_ty;
637
+ demand_bool_or_char_or_integer_or_native (check_atom atom);
638
+ let dst_ty =
639
+ Hashtbl. find cx.Semant. ctxt_all_cast_types dst_ty_id.Common. id
640
+ in
641
+ demand_bool_or_char_or_integer_or_native dst_ty;
640
642
dst_ty
641
643
in
642
644
0 commit comments