WurstScript icon indicating copy to clipboard operation
WurstScript copied to clipboard

"The assignment to local variable _ is never read" - incorrect

Open Cokemonkey11 opened this issue 7 years ago • 1 comments

Describe the bug When a for-to loop's body mutates its iteration index, the exit condition doesn't correctly trigger "variable read".

  • Example:
		for i = 0 to stackPointer
			Invulnerable wrapper = invulns[stackPointer]
			wrapper.durationLeft -= FIDELITY

			if wrapper.durationLeft <= 0.
				wrapper.which.removeAbility(ID_INVULNERABLE)
				destroy wrapper
				invulns[i] = invulns[stackPointer]
				stackPointer--
				i--

Error says: The assignment to local variable i is never read.

Cokemonkey11 avatar Jun 17 '18 11:06 Cokemonkey11

Hmm, the for loop variable was not meant to be mutated manually. Will probably replace this with a different warning ;)

peq avatar Jun 19 '18 21:06 peq