Skip to content

Warn of mutated loop variables #109

@Zash

Description

@Zash

Lua development version has made loop variables read-only in lua/lua@b2f7b3b so having a warning for this would be good so that those cases could be found early.

E.g. code like

for i = 1, 10 do
  i = i - 1
end
for k,v in pairs({ foo = "bar" }) do
  k = "k:"..k
end

Fails with attempt to assign to const variable 'i'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions