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

Pattern matching of tuples and Any #2028

Closed
Praetonus opened this issue Jul 10, 2017 · 2 comments
Closed

Pattern matching of tuples and Any #2028

Praetonus opened this issue Jul 10, 2017 · 2 comments
Assignees

Comments

@Praetonus
Copy link
Member

Initially reported on the mailing list by @sgebbie.

actor Main
  new create(env: Env) =>
    let x: (Any val | (None, None)) = None
    match x
    | (let n1: None, let n2: None) => None
    end

This code used to compile under the 0.14 version but doesn't compile anymore. This comes from #1937, which made tuples be subtypes of empty interfaces like Any. The above type, (Any val | (None, None)) is now folded into Any val, and then fails to match with the tuple type because it doesn't have the right cardinality. The pattern matching code should be updated to allow empty interfaces to match with tuples of any cardinality.

@Theodus
Copy link
Contributor

Theodus commented Oct 13, 2017

A possible solution to this may come from ponylang/rfcs#105

@jemc
Copy link
Member

jemc commented Oct 13, 2017

@Theodus - I don't think this is the same issue as the one addressed by that RFRFC.

@Praetonus Praetonus self-assigned this Feb 2, 2018
Praetonus pushed a commit to Praetonus/ponyc that referenced this issue Feb 3, 2018
SeanTAllen pushed a commit that referenced this issue Feb 7, 2018
dipinhora pushed a commit to dipinhora/ponyc that referenced this issue Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants