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

fix #754 #852

Merged
merged 4 commits into from
Jun 22, 2020
Merged

fix #754 #852

merged 4 commits into from
Jun 22, 2020

Conversation

jamescheney
Copy link
Contributor

This PR attempts to fix #754 by adding cases that recognize regular expression matching tests in the let-insertion and flattening stages of shredding. Previously these were handled generically and failing because these stages didn't provide any cases to handle variants (which is how regular expressions are represented at runtime in the IR).

This makes simple tests using regexes inside nested queries, like the one in #754 work, but does not make regular expression handling on the database any more complete/safe than it already was.

I've added debug messages to the two new cases in case we should be doing something more with the regex expressions, so that if we run into problems there will be a debugging message that gives more of a clue what the problem is.

@jamescheney jamescheney requested a review from SimonJF June 22, 2020 09:20
Copy link
Member

@SimonJF SimonJF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a simple fix, so looks good to me. My only ask would be a test just to make sure it works within a non-top-level query.

@jamescheney
Copy link
Contributor Author

I added a test for this in jrules.links, is that sufficient?

@SimonJF
Copy link
Member

SimonJF commented Jun 22, 2020

I was more thinking of something like

sig marketers : () -> [(name:String, clients:[Int])]
fun marketers () {
  for (m <-- marketers_names)
    [(name=m.name, clients = for (x <-- mc) where (x.m == m.name && x.name =~ /a/) [x.c])]
}

just to make sure it works within nested queries, if possible. I'm sure it'll be the same and still work, but it's worth checking.

@jamescheney
Copy link
Contributor Author

OK,done. Will merge when CI passes.

@SimonJF SimonJF merged commit e013c1d into master Jun 22, 2020
@jamescheney jamescheney deleted the issue754 branch June 22, 2020 12:15
jamescheney added a commit that referenced this pull request Jun 22, 2020
* fix 754 by passing regular expressions through let insertion and flattening stages

* whitespace

* whitespace

* add genuinely nested query test
frank-emrich pushed a commit to frank-emrich/links that referenced this pull request Sep 16, 2020
* fix 754 by passing regular expressions through let insertion and flattening stages

* whitespace

* whitespace

* add genuinely nested query test
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

Successfully merging this pull request may close these issues.

Regexes in nested queries do not work
2 participants