Skip to content

Commit

Permalink
demonstrate that actor methods cannot be imported explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Jan 28, 2022
1 parent ca01c14 commit af6941a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/run-drun/explicit-actor-import.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//MOC-FLAG --actor-idl actor-import
//MOC-FLAG --actor-alias self lg264-qjkae

// this imports our own IDL, stored in actor-import

// currently hard-codes the ic-ref self id
// once we have actor aliases we can let run.sh set an alias.

import imported1 "ic:lg264-qjkae";
import { go = imported1_go } "ic:lg264-qjkae";
import { go = imported2_go } "canister:self";

actor a {
public func go() : async (actor {}) = async imported1;
public func go2() : async (actor {}) = async await (imported1_go());
public func go3() : async (actor {}) = async await (imported2_go());
};
//CALL ingress go "DIDL\x00\x00"
//CALL ingress go2 "DIDL\x00\x00"
//CALL ingress go3 "DIDL\x00\x00"


//SKIP run
//SKIP run-ir
//SKIP run-low

// Skip running on drun for now; hard to pass a `--actor-alias` that works for
// both drun and ic-ref-run
//SKIP comp

4 changes: 4 additions & 0 deletions test/run-drun/ok/explicit-actor-import.tc.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
explicit-actor-import.mo:10.8-10.29: type error [M0114], object pattern cannot consume actor type
actor {go : shared () -> async actor {}}
explicit-actor-import.mo:11.8-11.29: type error [M0114], object pattern cannot consume actor type
actor {go : shared () -> async actor {}}
1 change: 1 addition & 0 deletions test/run-drun/ok/explicit-actor-import.tc.ret.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return code 1

0 comments on commit af6941a

Please sign in to comment.