Macro code variables shadow the retryable function parameters #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working on this function:
When I ran into issues with my
start
variable not being the type I expected.Thankfully I am familiar with the macro code, and there are 3 variables defined by the
#block
is inserted into the macro:So what happens is that
start
from the macro is overriding mystart
parameter.My solution was simple - to prefix these 3 variables with
__
so the chances you'll ever have a function parameter called__start
would be very low. If you want to be extra safe you might want to prefix even further, because if you do have the macro shadowing your function parameter - the compilation error is superrr weird and most folks wouldn't understand why it's happening, so if we can avoid it even further it's better.