LordGolias/sqf

Linter ignores different return types from ammoOnPylon

Closed this issue · 4 comments

When using the 1.70 command ammoOnPylon, it can return boolean or a number. The linter will display an error if the command is used in an if statement.

🤔 A very interesting case, I'm half inclined to say it should error in this case because unless you're expecting the command to fail every time it shouldn't be used in an if statement (could just be replaced with false if you did expect it to fail every time).

@SilentSpike there is a type check before the if statement so it would always be correct.

I believe this is because the command is considered to return type Number and not Anything as would be usual for a command with multiple return types (see only scalar is listed here).

Fix would be to add to the dict of wrong return types (I'm presuming the linter considers Anything a valid type to have in an if statement).

I believe this is because the command is considered to return type Number and not Anything as would be usual for a command with multiple return types

This. We do not have a type representing multiple types (like Number or Boolean), so the simplest option would be to use Anything.