Skip to content

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

@ghallak

Description

@ghallak
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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions