allow datatype usage from other contracts, not just namespaces #472

Closed
opened 2023-07-17 20:27:53 +09:00 by zxq9 · 1 comment
zxq9 commented 2023-07-17 20:27:53 +09:00 (Migrated from gitlab.com)

Created by: thepiwo

contract C2 =
  datatype dt = Zero | One(int)

main contract C =
  entrypoint foo(d : Cx.dt) =
    switch (d)
      Cx.Zero => 0
      Cx.One(_) => 1

doesn't work as expected, whereas

namespace Cx =
 datatype dt = Zero | One(int)

contract interface C2 =
 entrypoint x: (Cx.dt) => int

contract C =
 entrypoint foo(d : Cx.dt) =
   switch (d)
     Cx.Zero => 0
     Cx.One(_) => 1

does

*Created by: thepiwo* ``` contract C2 = datatype dt = Zero | One(int) main contract C = entrypoint foo(d : Cx.dt) = switch (d) Cx.Zero => 0 Cx.One(_) => 1 ``` doesn't work as expected, whereas ``` namespace Cx = datatype dt = Zero | One(int) contract interface C2 = entrypoint x: (Cx.dt) => int contract C = entrypoint foo(d : Cx.dt) = switch (d) Cx.Zero => 0 Cx.One(_) => 1 ``` does
zxq9 commented 2023-07-17 20:28:14 +09:00 (Migrated from gitlab.com)

Created by: thepiwo

closing as duplicate of https://gitlab.com/gajumaristas/aesophia/-/issues/471

*Created by: thepiwo* closing as duplicate of https://gitlab.com/gajumaristas/aesophia/-/issues/471
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#472