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

Inability to pattern match a datatype from a remote contract #471

Open
ghallak opened this issue Jul 17, 2023 · 1 comment
Open

Inability to pattern match a datatype from a remote contract #471

ghallak opened this issue Jul 17, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ghallak
Copy link
Contributor

ghallak commented Jul 17, 2023

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

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

The above code fails with the following error message:

type_error:7:7: Invalid call to contract entrypoint `Cx.Zero`. (It must be called as `c.Zero` for some `c : Cx`.)
type_error:8:7: Invalid call to contract entrypoint `Cx.One`. (It must be called as `c.One` for some `c : Cx`.)

This issue is realted to the commit 5adeb6c that banned using contracts as namespaces.

@ghallak ghallak added the bug Something isn't working label Jul 17, 2023
@ghallak ghallak self-assigned this Jul 17, 2023
@marc0olo
Copy link
Contributor

marc0olo commented Aug 27, 2023

I am now also using a namespace as "workaround" as suggested by @radrow and @hanssv.

I think this is the core issue I ran into which I didn't dig into too deep. because of this issue I used a "solution" which was obviously a bug that has recently been fixed with #469.

IMO this issue should be prioritized if there is nothing more "urgent" on the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants