Assertation failure in comments with symbol suggestion
Issue description:
Minimal complete verifiable example (MCVE):
comments.p:
/*
Y_Less
koolk
JoeBullet/Google63
g_aSlice/Slice
Misiur
samphunter
tianmeta
*/
static
a,
b;
main.p:
#include "comments.p"
main()
{
__LINE();
}
As far as I have been able to derive. Everything there is required - even the comments and spacing! Just removing one name from that list compiles "correctly" (i.e. gives errors). And I just realised why, the assertion failure is:
errstart <= fline
so I think the problem is related to the relative lengths of the files.
Workspace Information:
- Compiler version: 3.10.9
- Command line arguments provided (or sampctl version):
- Operating System:
This issue has been automatically marked as stale because it has not had recent activity.
Tried to simplify the MCVE as much as possible, got to the following: test.inc:
/* 3 empty lines */
new a, b;// <= line 4
test.pwn:
#include "test.inc"
main(){}
In this example the compiler prints two warning 203: symbol is never used messages, for variables a and b.
Both warnings are displayed at the end of compilation process, when the compiler seeks for unused variables and functions to warn the user about them, so the value in fline is 3 (the number of the last line in test.pwn).
When error() is called for the first time (for variable a):
- the value in
errstartis-1(the number of the starting line for the error/warning message is not defined yet); - expression
errstart<=flineresults in1(-1is less than3), the corresponding assertion doesn't get triggered; -
errstartis assigned value4(the line variableais defined on intest.inc).
Then when error() is called again (this time for variable b):
- the value in
errstartis still4(assigned at the previous function call); - assertion
errstart<=flinegets triggered, as4is greater than3.
I think the fix should involve introducing a new local variable in function error(), which would be used instead of variable errstart, so errstart wouldn't be modified inside error().
This issue has been automatically marked as stale because it has not had recent activity.