Skip to content

Commit 328adc5

Browse files
committed
---
yaml --- r: 524 b: refs/heads/master c: 9277f55 h: refs/heads/master v: v3
1 parent ffda1b5 commit 328adc5

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a4b8c74f9f6e41f40b30cf4ef49ea42a2cee9b4f
2+
refs/heads/master: 9277f551d34d4891cf440316d5d10e1457310b0d

trunk/src/boot/me/semant.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,8 @@ let type_is_unsigned_2s_complement t =
10121012
| Ast.TY_mach TY_u64
10131013
| Ast.TY_char
10141014
| Ast.TY_uint
1015-
| Ast.TY_bool -> true
1015+
| Ast.TY_bool
1016+
| Ast.TY_native _ -> true
10161017
| _ -> false
10171018
;;
10181019

trunk/src/boot/me/type.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) =
101101
if not (is_integer (fundamental_ty actual)) then
102102
type_error "integer" actual
103103
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 =
105105
match fundamental_ty actual with
106-
Ast.TY_bool | Ast.TY_char -> ()
106+
Ast.TY_bool | Ast.TY_char | Ast.TY_native _ -> ()
107107
| ty when is_integer ty -> ()
108-
| _ -> type_error "bool, char, or integer" actual
108+
| _ -> type_error "bool, char, integer or native" actual
109109
in
110110
let demand_number (actual:Ast.ty) : unit =
111111
match fundamental_ty actual with
@@ -634,9 +634,11 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) =
634634
ty
635635
| Ast.EXPR_unary (Ast.UNOP_cast dst_ty_id, atom) ->
636636
(* 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;
640642
dst_ty
641643
in
642644

0 commit comments

Comments
 (0)