-
Notifications
You must be signed in to change notification settings - Fork 158
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
Matchers do not warn on improper use #160
Comments
I did search first, but then... #149 |
Yeah, so far we've not been able to figure out a way to enforce the |
Worth filing something against Clang? It might be an edge case in the AST. |
Probably, it's basically accessing the block but doing nothing - something that should raise a warning if it's not inside an if statement. |
This is a real head scratcher! I distilled the problem down to a very simple example for the future humans who will know how to fix this: https://gist.github.com/adamkaplan/3c69fda47bf02790a860#file-expexpectawarningdemo-m |
This is really interesting. I think this does indeed demonstrate a limitation in Clang. I think it's being tripped up by the // Emits warning: "Property access result unused - getters should not be used for side effects"
_EXP_expect(nil, 0, "", ^id{ return nil; }).to.beNil; |
Yup, definitely related to the macro expansion. I filed a a bug against Clang last week but forgot to link it: |
Oh, awesome! Thanks for filing the bug! 👍 |
Hi there, seems it's done intentionally. Though it works as expected when the |
@AlexDenisov The intention per the comments is a few degrees off from observed behavior. The unused result does not originate within macro body expansion, but rather a function called on the result of the expansion. In this case the function |
Clang seems quite confused by the chained properties DSL. Today I found that some of my matchers were missing trailing parens, effectively returning but not executing the matcher. The specific case was
.beNil
vs.beNil()
. The former compiles without any warning and appears to "pass", while in fact doing nothing at all.This shouldn't happen. It might be a Clang bug since Clang changes it's mind based on the precedence.
I tried enabling some additional Clang flags to no avail. Ideally Expecta shouldn't go quietly into the night with all of your tests running as no-ops...
The text was updated successfully, but these errors were encountered: