-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
More consistently report problems with non-linear patterns. #2231
base: master
Are you sure you want to change the base?
Conversation
Also document limitation, and suggest a fix. Closes racket#1386 Closes racket#2152
I like these documentation changes. The code changes seem to have broken a test, however. |
Yes, the code changes are a bit too aggressive. I have to figure out how to make it less so, but it's not totally obvious. |
@AlexKnauth this is relevant to #4304 |
While working on #4304 I found that just erroring when nonlinear patterns are detected via the For example, I would like (match '(1 2 3 4)
[(list a ... a) a]) to be an error, but the renaming of |
@@ -175,16 +177,21 @@ | |||
(and (bound-identifier=? v v*) (or id (list v v*))))) | |||
=> | |||
(lambda (id) | |||
(if (identifier? id) | |||
(if (and (identifier? id) (not (inside-GSeq?))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (not (inside-GSeq?))
check also doesn't allow nonlinear patterns inside the "tail" of GSeq
patterns, such as in (list a _ ... a)
and (cons a (list pre ... a post ...))
.
That seems too restrictive to me. In my opinion it should be restricted based on the pattern itself being under ellipses, not based on it being in the tail after something else that's under ellipses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This PR is too aggressive as I said at the time, but I didn't settle on a better fix.
Also document limitation, and suggest a fix.
Closes #1386 Closes #2152