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

Bug with non-sequential list matching #10

Open
DavePearce opened this issue Jun 18, 2015 · 1 comment
Open

Bug with non-sequential list matching #10

DavePearce opened this issue Jun 18, 2015 · 1 comment

Comments

@DavePearce
Copy link
Member

Issue by DavePearce
Thursday Sep 06, 2012 at 18:43 GMT
Originally opened as Whiley/WhileyCompiler#124


There is a bug related to non-sequential list matching which the following excerpt from the types examples illustrates:

term Tuple[Type...]

rewrite Tuple{And{Type... xs}, Type... rest}:
    => let ys = { Tuple(x ++ rest) | x in xs }
       in And(ys)

The problem is that the non-sequential match will automatically consider the type of rest as being a set --- when in fact, it should really be a list. However, it's not completely clear how to model this example correctly (since i'm just concatenating the field onto the beginning of the list rest which is clearly wrong).

@DavePearce
Copy link
Member Author

Comment by DavePearce
Thursday Sep 06, 2012 at 19:13 GMT


A syntax like this would be quite an interesting solution:

rewrite Tuple[Type... front, And{Type... xs}, Type... back]:
    => let ys = { Tuple(front ++ x ++ back) | x in xs }
       in And(ys)

In this case, we have actually dropped the set-based non-sequential match for a list-based one. Interesting, huh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant