Skip to content

debug info for tagmismatch warnings#265

Merged
Southclaws merged 2 commits intopawn-lang:masterfrom
YashasSamaga:enhancement-tagmm-info
Jan 28, 2018
Merged

debug info for tagmismatch warnings#265
Southclaws merged 2 commits intopawn-lang:masterfrom
YashasSamaga:enhancement-tagmm-info

Conversation

@YashasSamaga
Copy link
Member

@YashasSamaga YashasSamaga commented Jan 18, 2018

This commit adds useful information to the "tag mismatch" warning.

Basic tests:

#pragma warning disable 203
#pragma warning disable 204
#pragma warning disable 219

enum PInfo_t {
	Money,
	Score
}

TAG_H:func1(TAG_G:arg1 = 5,
			 {TAG_I_1, TAG_I_2, _, TAG_I_3}:arg2 = 5,
			    {TAG_J_1}:arg3 = TAG_J_2:5,
			        {_}:arg4 = TAG_K_1:5,
			 	 		{TAG_L_1, TAG_L_2, TAG_L_3}:arg5[] = {1, TAG_L_4:2, TAG_L_5:3})
{
	return 5;
}

func2(arg) { }

main() {
	new TAG_A:var1 = 5;
	new TAG_B:arr1[] = {TAG_B_1:5, TAG_B_2:2};
	new TAG_C:str1[] = "abcdefg";
	new TAG_D:str2[2][] = {"abc", "efg"};
	new TAG_E:arr2[2][] = {{1}, {2}};
	const TAG_F:var2 = TAG_F_1:6;

	func1();
	func1(TAG_G_1:66, AA:6);

	new Money = 5;
	func2(Money);
	func1(TAG_G_1:66);
}
test.pwn(10) : warning 213: tag mismatch: expected tag "TAG_G", but found none ("_")
test.pwn(11) : warning 213: tag mismatch: expected tag "TAG_I_1", but found none ("_")
test.pwn(12) : warning 213: tag mismatch: expected tag "TAG_J_1", but found "TAG_J_2"
test.pwn(13) : warning 213: tag mismatch: expected tag none ("_"), but found "TAG_K_1"
test.pwn(14) : warning 213: tag mismatch: expected tag "TAG_L_1", but found none ("_")
test.pwn(14) : warning 213: tag mismatch: expected tag "TAG_L_1", but found "TAG_L_4"
test.pwn(14) : warning 213: tag mismatch: expected tag "TAG_L_1", but found "TAG_L_5"
test.pwn(16) : warning 213: tag mismatch: expected tag "TAG_H", but found none ("_")
test.pwn(22) : warning 213: tag mismatch: expected tag "TAG_A", but found none ("_")
test.pwn(23) : warning 213: tag mismatch: expected tag "TAG_B", but found "TAG_B_1"
test.pwn(23) : warning 213: tag mismatch: expected tag "TAG_B", but found "TAG_B_2"
test.pwn(24) : warning 213: tag mismatch: expected tag "TAG_C", but found none ("_")
test.pwn(25) : warning 213: tag mismatch: expected tag "TAG_D", but found none ("_")
test.pwn(25) : warning 213: tag mismatch: expected tag "TAG_D", but found none ("_")
test.pwn(26) : warning 213: tag mismatch: expected tag "TAG_E", but found none ("_")
test.pwn(26) : warning 213: tag mismatch: expected tag "TAG_E", but found none ("_")
test.pwn(27) : warning 213: tag mismatch: expected tag "TAG_F", but found "TAG_F_1"
test.pwn(30) : warning 213: tag mismatch: expected tag "TAG_G", but found "TAG_G_1"
test.pwn(30) : warning 213: tag mismatch: expected tags "TAG_I_1", "TAG_I_2", "TAG_I_3", or none ("_"); but found "AA"
test.pwn(33) : warning 213: tag mismatch: expected tag none ("_"), but found "PInfo_t"
test.pwn(34) : warning 213: tag mismatch: expected tag "TAG_G", but found "TAG_G_1"

This commit adds useful information to the "tag mismatch" warning.
@Y-Less
Copy link
Member

Y-Less commented Jan 18, 2018

Should but found "_" be but found none? It isn't always obvious that no tag is _:. Or maybe but found none ("_").

@YashasSamaga
Copy link
Member Author

YashasSamaga commented Jan 18, 2018

What if the user had explicitly mentioned the tag to be _:? Found none wouldn't make sense in this context.

none ("_") is sort of fine though.

@YashasSamaga YashasSamaga force-pushed the enhancement-tagmm-info branch 2 times, most recently from 925df7e to 345b415 Compare January 25, 2018 17:35
@Southclaws Southclaws merged commit e02cb51 into pawn-lang:master Jan 28, 2018
@YashasSamaga YashasSamaga deleted the enhancement-tagmm-info branch October 11, 2020 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants