diff --git a/default.nix b/default.nix index 11e2639f231..f451d5016ad 100644 --- a/default.nix +++ b/default.nix @@ -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 diff --git a/src/typing.ml b/src/typing.ml index e0aeeda523f..e99f24cec5b 100644 --- a/src/typing.ml +++ b/src/typing.ml @@ -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" @@ -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); diff --git a/test/fail/ok/asyncret1.tc.ok b/test/fail/ok/asyncret1.tc.ok index 8dfc6b7f512..80b0257d1cf 100644 --- a/test/fail/ok/asyncret1.tc.ok +++ b/test/fail/ok/asyncret1.tc.ok @@ -1,2 +1,2 @@ asyncret1.as:1.42-1.43: type error, shared function has non-async result type - C + C/1 diff --git a/test/run/ok/issue120.tc.ok b/test/run/ok/issue120.tc.ok deleted file mode 100644 index 47786ea3e31..00000000000 --- a/test/run/ok/issue120.tc.ok +++ /dev/null @@ -1,2 +0,0 @@ -issue120.as:2.8-2.11: type error, shared function has non-shared parameter type - Bar