Count indexing as variable usage #2906
Replies: 5 comments
-
It's not using the variable though. |
Beta Was this translation helpful? Give feedback.
-
It's may be ambiguous whether array access is being used meaningfully or not, but I think it's worth assuming that it is. I think it should be apparently how this could be used meaningfully. function setup(Input:table) { // Warning: Unused variable: Input
Input[1] = 123
}
Table = table()
setup(Table)
print(Table[1, number]) Also, with wirelinks: let WL = Lamp:wirelink() // Labeled unused
WL["On", number] = 1 |
Beta Was this translation helpful? Give feedback.
-
In those cases where the table is provided by something out of scope, could allow this behavior |
Beta Was this translation helpful? Give feedback.
-
Then again this is kind of just complicating things since we'll have to make another exception for wirelinks I guess.. I'd be fine with reverting the behavior for now. I mean that's how it initially was til it was suggested to be changed to the opposite. Maybe in the future I'd bring it back fully featured as I planned here but in the analyzer where the complexity would be isolated. |
Beta Was this translation helpful? Give feedback.
-
Not a bug though so converting to discussion. |
Beta Was this translation helpful? Give feedback.
-
Description:
Using array access on a variable does not mark the variable as used, therefore making it warn as unused.
To Reproduce:
Expected behavior:
The variable should be marked as used.
Beta Was this translation helpful? Give feedback.
All reactions