Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No warning for unused enum struct fields and methods #769

Open
dysphie opened this issue Feb 14, 2022 · 2 comments
Open

No warning for unused enum struct fields and methods #769

dysphie opened this issue Feb 14, 2022 · 2 comments

Comments

@dysphie
Copy link

dysphie commented Feb 14, 2022

Code

enum struct Thing
{
	bool a;
	bool b;

	void DoThing() 
	{
		
	}
}

public void OnPluginStart()
{
	Thing t;
	t.a = true;
}

produces no warning for unused symbols b and DoThing.
Tested in spcomp 1.11.0.6846

@dvander
Copy link
Member

dvander commented Feb 14, 2022

I don't see us adding this warning. We don't check for unused types, and we don't check for unused properties/nethods of types.

@dysphie
Copy link
Author

dysphie commented Feb 14, 2022

Fair enough. My reasoning was that the compiler already checks for unused global vars and methodmap functions, and ES are used by developers in a similar fashion. I can't think of a scenario where one would want to declare ES properties/methods and never use them. Whenever I do this, it's by mistake. Even though they're just arrays under the hood, their declaration is more explicit and they can't be sanely passed via natives, so if the properties/methods aren't used locally, they're just dead code/memory. (unless I'm missing a use case where this isn't true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants