From af6941a96aeb7ca78c11bf506d050803f75313a8 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 28 Jan 2022 22:41:15 +0100 Subject: [PATCH] demonstrate that actor methods cannot be imported explicitly --- test/run-drun/explicit-actor-import.mo | 30 +++++++++++++++++++ test/run-drun/ok/explicit-actor-import.tc.ok | 4 +++ .../ok/explicit-actor-import.tc.ret.ok | 1 + 3 files changed, 35 insertions(+) create mode 100644 test/run-drun/explicit-actor-import.mo create mode 100644 test/run-drun/ok/explicit-actor-import.tc.ok create mode 100644 test/run-drun/ok/explicit-actor-import.tc.ret.ok diff --git a/test/run-drun/explicit-actor-import.mo b/test/run-drun/explicit-actor-import.mo new file mode 100644 index 00000000000..e9b36316b29 --- /dev/null +++ b/test/run-drun/explicit-actor-import.mo @@ -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 + diff --git a/test/run-drun/ok/explicit-actor-import.tc.ok b/test/run-drun/ok/explicit-actor-import.tc.ok new file mode 100644 index 00000000000..979a9876b22 --- /dev/null +++ b/test/run-drun/ok/explicit-actor-import.tc.ok @@ -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 {}} diff --git a/test/run-drun/ok/explicit-actor-import.tc.ret.ok b/test/run-drun/ok/explicit-actor-import.tc.ret.ok new file mode 100644 index 00000000000..69becfa16f9 --- /dev/null +++ b/test/run-drun/ok/explicit-actor-import.tc.ret.ok @@ -0,0 +1 @@ +Return code 1