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

warning if variable is set but its value is never read afterwards #800

Closed
hishamhm opened this issue Sep 8, 2024 · 0 comments
Closed

warning if variable is set but its value is never read afterwards #800

hishamhm opened this issue Sep 8, 2024 · 0 comments
Labels
feature request New feature or request

Comments

@hishamhm
Copy link
Member

hishamhm commented Sep 8, 2024

Luacheck has two warnings of this kind:

  • variable x is never accessed — if a variable is set but it is never read in its scope
  • value assigned to variable x is unused — if a variable is set but its value is re-set before it is read

The latter may need more flow checking, but the former should be more easily doable, similar to how we deal with our "unused variable" warnings.

@hishamhm hishamhm added the feature request New feature or request label Sep 8, 2024
euclidianAce added a commit to euclidianAce/tl that referenced this issue Dec 7, 2024
This splits `Variable.used` into `Variable.has_been_read_from` and
`Variable.has_been_written_to`. This allows us to catch bad code of the
form

	do
		local foo = bar()
		foo = baz()
	end

Half closes teal-language#800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant