Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/construct.ml
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,7 @@ let forE pat exp1 exp2 =
)
)
)

let unreachableE =
(* Do we want UnreachableE in the AST *)
loopE unitE
2 changes: 2 additions & 0 deletions src/construct.mli
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ val declare_idE : id -> typ -> exp -> exp
val define_idE : id -> mut -> exp -> exp
val newObjE : obj_sort -> Ir.field list -> typ -> exp

val unreachableE : exp

(* Declarations *)

val letP : pat -> exp -> dec
Expand Down
10 changes: 7 additions & 3 deletions src/desugar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ and exp' at note = function
let args, wrap = to_args cc p in
I.FuncE (name, cc, typ_binds tbs, args, Type.as_seq ty.note, wrap (exp e))
| S.CallE (e1, inst, e2) ->
let cc = Value.call_conv_of_typ e1.Source.note.S.note_typ in
let inst = List.map (fun t -> t.Source.note) inst in
I.CallE (cc, exp e1, inst, exp e2)
let t = e1.Source.note.S.note_typ in
if Type.is_non t
then unreachableE.it
else
let cc = Value.call_conv_of_typ t in
let inst = List.map (fun t -> t.Source.note) inst in
I.CallE (cc, exp e1, inst, exp e2)
| S.BlockE [] -> I.TupE []
| S.BlockE [{it = S.ExpD e; _}] -> (exp e).it
| S.BlockE ds -> I.BlockE (block (Type.is_unit note.S.note_typ) ds)
Expand Down
1 change: 1 addition & 0 deletions src/type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ let rec promote = function

(* Projections *)

let is_non = function Non -> true | _ -> false
let is_prim p = function Prim p' -> p = p' | _ -> false
let is_obj = function Obj _ -> true | _ -> false
let is_variant = function Variant _ -> true | _ -> false
Expand Down
1 change: 1 addition & 0 deletions src/type.mli
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ val prim : string -> prim

(* Projection *)

val is_non : typ -> bool
val is_prim : prim -> typ -> bool
val is_obj : typ -> bool
val is_variant : typ -> bool
Expand Down
66 changes: 0 additions & 66 deletions test/run/ok/call-none.diff-ir.ok

This file was deleted.

66 changes: 0 additions & 66 deletions test/run/ok/call-none.diff-low.ok

This file was deleted.

63 changes: 0 additions & 63 deletions test/run/ok/call-none.run-ir.ok

This file was deleted.

63 changes: 0 additions & 63 deletions test/run/ok/call-none.run-low.ok

This file was deleted.

63 changes: 0 additions & 63 deletions test/run/ok/call-none.wasm.stderr.ok

This file was deleted.