Closed eladb closed 1 year ago
I am looking into this.
@Chriscbr the culprit is indeed the code added to the FieldReferenceVisitor
here.
In for loops, the iteration variable (p
in the example above) is only defined within the symbol environment of the loop block and not the parent environment. This is why the lookup fails.
I'll leave it to you to pick up from here.
Ick. I wish there was a way to arbitrarily find a symbol's parent environment / or just find the VariableInfo given a particular symbol.
In any case I've found a way to fix it for now since we can stop analyzing the expression as soon as we know it's a local/bound variable.
Congrats! :rocket: This was released in Wing 0.15.2.
Ick. I wish there was a way to arbitrarily find a symbol's parent environment / or just find the VariableInfo given a particular symbol.
You're right, that's what we need here. Added a fix as part of #2158.
I tried this:
This happened:
I expected this:
To work
Is there a workaround?
Not that I am aware of
Component
Compiler
Wing Version
No response
Wing Console Version
No response
Node.js Version
No response
Platform(s)
No response
Anything else?
I suspect this is related to #2211
Community Notes