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
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let real-dvm =
let dev = builtins.fetchGit {
url = "ssh://git@github.com/dfinity-lab/dev";
ref = "master";
rev = "2837f4eaca887143bd08bc9341a7209f6dec42bc";
rev = "da62da1c64586b5248e62d35713fb773e238996e";
}; in
(import dev {}).dvm
else null
Expand Down
9 changes: 5 additions & 4 deletions src/typing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ and check_typ' env typ : T.typ =
let ts1 = List.map (check_typ env') typs1 in
let ts2 = List.map (check_typ env') typs2 in
let c = match typs2 with [{it = AsyncT _; _}] -> T.Promises | _ -> T.Returns in
if sort.it = T.Sharable then begin
if sort.it = T.Sharable then
if not env.pre then
begin
let t1 = T.seq ts1 in
if not (T.sub t1 T.Shared) then
error env typ1.at "shared function has non-shared parameter type\n %s"
Expand All @@ -183,10 +185,9 @@ and check_typ' env typ : T.typ =
T.Opt (check_typ env typ)
| AsyncT typ ->
let t = check_typ env typ in
let t' = T.promote t in
if t' <> T.Pre && not (T.sub t' T.Shared) then
if not env.pre && not (T.sub t T.Shared) then
error env typ.at "async type has non-shared parameter type\n %s"
(T.string_of_typ_expand t');
(T.string_of_typ_expand t);
T.Async t
| ObjT (sort, fields) ->
check_ids env (List.map (fun (field : typ_field) -> field.it.id) fields);
Expand Down
2 changes: 1 addition & 1 deletion test/fail/ok/asyncret1.tc.ok
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
asyncret1.as:1.42-1.43: type error, shared function has non-async result type
C
C/1
2 changes: 0 additions & 2 deletions test/run/ok/issue120.tc.ok

This file was deleted.