-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Comment contradicts code (in all run-times)? #2172
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
Comments
Indeed that looks weird. @sharwell note that we create
but // since EMPTY_RETURN_STATE can only appear in the last position, we
// don't need to verify that size==1
return returnStates[0]==EMPTY_RETURN_STATE; That seems like a glaring problem but we've not seen any weird bugs have we? |
Actually, now I see something else in public boolean hasEmptyPath() {
// since EMPTY_RETURN_STATE can only appear in the last position, we check last one
return getReturnState(size() - 1) == EMPTY_RETURN_STATE;
} |
The implementations of
So this is just a bug to update the comment in code? |
Actually, it looks like a bug. Test for ArrayPredictionContext.isEmpty expects EMPTY_RETURN_STATE in position 0 but mergeRoot() is putting it at position 1 |
The result of mergeRoot is not empty. Updated my previous comment too. |
Doesn't it create an array context with |
|
interesting. ok, so is the "fix" just changing this comment?
to
|
I believe that is correct. |
ok, cool. thanks! |
Uh oh!
There was an error while loading. Please reload this page.
In this function of PredictionContext.
The comments // $ + x = [$,x]
and more explicitly // x + $ = [$,x] ($ is always first if present)
Seem to contradict the implementation. This was done 6 years ago by @parrt.
Should the order in the comments not be [x,$], ($ is always second if present)?
The text was updated successfully, but these errors were encountered: