Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not consider an actor … as an async-context #107

Merged
merged 2 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions src/typing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ and infer_exp' env exp : T.typ =
(T.string_of_typ_expand env.cons t1)
)
| ObjE (sort, id, fields) ->
infer_obj env sort.it id fields
let env' = if sort.it = T.Actor then { env with async = false } else env in
infer_obj env' sort.it id fields
| DotE (exp1, {it = Name n;_}) ->
let t1 = infer_exp_promote env exp1 in
(try
Expand Down Expand Up @@ -638,7 +639,8 @@ and check_exp' env t exp =
| OptE exp1, _ when T.is_opt t ->
check_exp env (T.as_opt t) exp1
| ObjE (sort, id, fields), T.Obj (s, tfs) when s = sort.it ->
ignore (check_obj env s tfs id fields exp.at)
let env' = if sort.it = T.Actor then { env with async = false } else env in
ignore (check_obj env' s tfs id fields exp.at)
| ArrayE exps, T.Array t' ->
List.iter (check_exp env (T.as_immut t')) exps
| AsyncE exp1, T.Async t' ->
Expand Down
4 changes: 4 additions & 0 deletions test/fail/ok/await-in-actor.tc.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
await-in-actor.as:3.17-3.34: type error, misplaced await
await-in-actor.as:3.17-3.34: type error, misplaced await
await-in-actor.as:3.17-3.34: type error, misplaced await
await-in-actor.as:3.17-3.34: type error, misplaced await
28 changes: 28 additions & 0 deletions test/run/ok/actor.tc.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
actor.as:14.31-14.49: type error, misplaced await
actor.as:25.31-25.49: type error, misplaced await
actor.as:26.31-26.49: type error, misplaced await
actor.as:37.31-37.49: type error, misplaced await
actor.as:50.31-50.49: type error, misplaced await
actor.as:68.21-68.67: type error, misplaced await
actor.as:69.21-69.67: type error, misplaced await
actor.as:14.31-14.49: type error, misplaced await
actor.as:14.31-14.49: type error, misplaced await
actor.as:14.31-14.49: type error, misplaced await
actor.as:25.31-25.49: type error, misplaced await
actor.as:26.31-26.49: type error, misplaced await
actor.as:25.31-25.49: type error, misplaced await
actor.as:26.31-26.49: type error, misplaced await
actor.as:25.31-25.49: type error, misplaced await
actor.as:26.31-26.49: type error, misplaced await
actor.as:37.31-37.49: type error, misplaced await
actor.as:37.31-37.49: type error, misplaced await
actor.as:37.31-37.49: type error, misplaced await
actor.as:50.31-50.49: type error, misplaced await
actor.as:50.31-50.49: type error, misplaced await
actor.as:50.31-50.49: type error, misplaced await
actor.as:68.21-68.67: type error, misplaced await
actor.as:69.21-69.67: type error, misplaced await
actor.as:68.21-68.67: type error, misplaced await
actor.as:69.21-69.67: type error, misplaced await
actor.as:68.21-68.67: type error, misplaced await
actor.as:69.21-69.67: type error, misplaced await