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
1 change: 1 addition & 0 deletions src/desugar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ and exp' at note = function
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)
| S.BlockE ([{it = S.ExpD e; _}], _) -> exp' e.at e.note e.it
| S.BlockE (ds, ot) -> I.BlockE (decs ds, !ot)
| S.NotE e -> I.IfE (exp e, falseE, trueE)
| S.AndE (e1, e2) -> I.IfE (exp e1, exp e2, falseE)
Expand Down
2 changes: 1 addition & 1 deletion src/type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ let rec rel_typ env rel eq t1 t2 =
s1 = s2 &&
rel_fields env rel eq tfs1 tfs2
| Obj (s, _), Shared when rel != eq ->
s != Object Local
s <> Object Local
| Array t1', Array t2' ->
rel_typ env rel eq t1' t2'
| Array t1', Obj _ when rel != eq ->
Expand Down
4 changes: 4 additions & 0 deletions test/fail/ok/issue103.tc.ok
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
issue103.as:3.29-3.40: type error, shared function has non-shared parameter type
() -> Nat
issue103.as:10.29-10.46: type error, shared function has non-shared parameter type
{foo : () -> Nat}
issue103.as:17.29-17.40: type error, async type has non-shared parameter type
() -> Nat
issue103.as:24.29-24.48: type error, async type has non-shared parameter type
{foo : () -> Nat}
4 changes: 2 additions & 2 deletions test/run-dfinity/chatpp.as
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* a simple data structure: mutable, singly linked list */
type List<T> = ?{head: T; var tail: List<T>};

type subscription = {
type subscription = shared {
post : shared Text -> async (); /* revokable by Server */
cancel : shared () -> ();
};
Expand Down Expand Up @@ -51,7 +51,7 @@ actor Server = {
nextId += 1;
let cs = new { head = c; var tail = clients};
clients := ?cs;
return (new {
return (shared {
post = (shared func (message:Text) : async ()
{ if (not (c.revoked))
await broadcast(c.id, message);
Expand Down
6 changes: 3 additions & 3 deletions test/run-dfinity/data-params.as
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let a = actor {
printInt(c);
print("\n");
};
increcord(a : { x : Nat; y : Nat }) : () {
increcord(a : shared { x : Nat; y : Nat }) : () {
c += a.x;
c += a.y;
printInt(c);
Expand Down Expand Up @@ -60,8 +60,8 @@ a.incnested(7,(8,9));
a.incarray([10,11,12,13]);
a.incopt(null);
a.incopt(?14);
a.increcord(new {x = 15; y = 16});
a.increcord(new {x = 17; y = 18; z = 19});
a.increcord(shared {x = 15; y = 16});
a.increcord(shared {x = 17; y = 18; z = 19});
a.printCounter();
a.printLabeled("Foo: ");
// a.readCounter(func (n : Nat) = { printInt n; print("\n") });
2 changes: 1 addition & 1 deletion test/run-dfinity/ok/counter-class.wasm.stderr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ non-closed actor: (ActorE
$lambda
(VarP $0)
()
(CallE ( 1 -> 0) (VarE $0) (BlockE (ExpD (VarE c)) Int))
(CallE ( 1 -> 0) (VarE $0) (VarE c))
)
(Int -> ()) -> ()
)
Expand Down
25 changes: 0 additions & 25 deletions test/run/for.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ async {
assert(i == 11);
};

{
var i = 0;
for (j in await async (range(0, 10))) {
printInt(j);
assert(j == i);
i += 1;
};
assert(i == 11);
};

{
var i = 0;
i := 0;
Expand All @@ -31,19 +21,4 @@ async {
assert(i == 11);
};

{
var i = 0;
for (j in await async (range(0, 10))) {
printInt(j);
assert(j == i);
await (async (i += 1));
};
assert(i == 11);
};

};





2 changes: 1 addition & 1 deletion test/run/ok/for.run-ir.ok
Original file line number Diff line number Diff line change
@@ -1 +1 @@
012345678910012345678910012345678910012345678910
012345678910012345678910
2 changes: 1 addition & 1 deletion test/run/ok/for.run-low.ok
Original file line number Diff line number Diff line change
@@ -1 +1 @@
012345678910012345678910012345678910012345678910
012345678910012345678910
2 changes: 1 addition & 1 deletion test/run/ok/for.run.ok
Original file line number Diff line number Diff line change
@@ -1 +1 @@
012345678910012345678910012345678910012345678910
012345678910012345678910