Replace impossible error conditions with debug assertions#169
Open
apasel422 wants to merge 4 commits intoundef1nd:mainfrom
Open
Replace impossible error conditions with debug assertions#169apasel422 wants to merge 4 commits intoundef1nd:mainfrom
apasel422 wants to merge 4 commits intoundef1nd:mainfrom
Conversation
valenting
requested changes
Apr 22, 2025
Collaborator
valenting
left a comment
There was a problem hiding this comment.
As I mentioned in a previous PR, I'm not sure we ought to replace these checks with debug asserts. These don't run in production, and leave space for obscure bugs to creep in.
Collaborator
Author
If these methods were inlined into their lone caller, these error conditions would clearly be impossible. We could do that instead, guaranteeing that this code cannot be reached without the proper precondition. IMO these non-public methods only exist for readability, not because we expect them to gain any other callers in the future. |
627d539 to
5da5108
Compare
These conditions are only possible when the individual bare-item parsing methods are called directly, but that is only possible in tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These conditions are only possible when the individual bare-item parsing
methods are called directly, but that is only possible in tests.