fix: swap Too many/Too few messages and correct expected/have in callback arg errors (#42)#1564
Open
KorsarOfficial wants to merge 1 commit intoVKCOM:masterfrom
Open
Conversation
…callback arg errors (VKCOM#42) The two error messages for callback argument count mismatches in check-func-calls-and-vararg.cpp had their labels swapped and their printf arguments in the wrong order: - The condition `call_n_params >= get_min_argn()` is false when there are TOO FEW arguments, but the message said "Too many arguments for callback". - The condition `get_params().size() >= call_n_params` is false when there are TOO MANY arguments, but the message said "Too few arguments for callback". - In both cases the "expected" and "have" values were transposed. Fix: swap the two message strings and swap the fmt_format arguments to match the corrected messages and mirror the non-callback pattern on lines 271-274.
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.
Problem
The two error messages for callback argument count mismatches in
check-func-calls-and-vararg.cpphad their labels swapped and theexpected/haveformat arguments transposed.Formal Analysis
Define argument validation predicates:
Bug — two compound errors:
n < min(too few)n > max(too many)Truth table (min=2, max=4):
Fix
Swap message strings and reorder
fmt_formatarguments to match the non-callback pattern on lines 271-274 (known correct reference).Verification: After fix, callback error structure is isomorphic to the non-callback pattern:
∎
Technical Report
Full report with mathematical formalization (PDF)
Closes #42