-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
where/error doesn't report errors sometimes #254
Comments
I think I get what you're saying, but do you think you could make a standalone example just to make sure I'm getting it right? |
Yes. I was just too lazy and wanted to file the issue before I forgot the problem. I'll circle back to it. |
Standalone example: #lang racket
(require redex/reduction-semantics)
(define-language issue-254
(Id ::= variable-not-otherwise-mentioned)
)
(define-metafunction issue-254
test-function : Id Id -> boolean
[(test-function Id_1 Id)
#t
(where/error Id Id_1)
]
)
(pretty-print (term (test-function Foo Bar))) Running this yields:
but I expect to see "define-metafunction: where/error did not match" |
@shhyou it looks like there is an explicit test case checking for something very close to this situation that disagrees with this issue. Here's the commit and here's the relevant test case. I am currently disagreeing with the existing test case and have put a candidate commit on a branch. There are a bunch of details in the commit because Anyway, what do you think? |
I don't really get the fix, so let me ask this instead. Does the fix distinguish between these three situations?
It looks like the existing code conflated case 2 and 3, which I suppose is wrong. |
I think it does! I think the third case is separated from the second case because it goes through a different code path; a Do you have an idea for a new test case maybe? |
Here is an attempt of case 2. I am not sure if this will take a different path from the test case at line 708--716. (define-metafunction empty-language
[(f integer)
0
(where/error integer 3)
(where #t #t)]
[(f _) 1])
(with-handlers ([exn:fail? exn-message])
(term (f 4))) ;; => #rx"where/error" Here is an attempt of case 3: (define-metafunction empty-language
[(h integer)
0
(where/error integer 3)
(where integer 4)]
[(h _) 1])
(term (h 3)) ;; => should be 1
(with-handlers ([exn:fail? exn-message])
(term (h 4))) ;; => #rx"where/error" |
Thanks! I think the test case probably should be changed. If you think there is more to worry about or I'm missing something, then please let me know! |
I had this function:
and I was, quite confusingly, getting errors like this:
This was true despite the fact that I could clearly see that redex was entering the function, and there seems to be no possible way for the first clause to be rejected (it has
where/error
, after all).It turned out that the problem was that I was using the term
Universe
more than once.The text was updated successfully, but these errors were encountered: