This snippet:
qux = "outer"
foo {
when (true) {
local qux = "inner"
}
prop = qux
}
Produces:
qux = "outer"
foo {
prop = "inner"
}
This is because generator object bodies are visible to the enclosing object.
Sometimes, names resolve either to a generator property, and sometimes, they resolve to an outer property. At parse time, we can't tell what these should resolve to. For example:
qux = "outer"
foo {
when (true) {
qux = "inner"
}
prop = qux // resolves to inner qux
}
bar {
when (false) {
qux = "inner"
}
prop = qux // resolves to outer qux
}
It would be better if names declared inside of generator bodies are not visible from an enclosing object body.
Most code would still work if it resolved to implicit this.
We need to fix this before we can do #1580
This snippet:
Produces:
This is because generator object bodies are visible to the enclosing object.
Sometimes, names resolve either to a generator property, and sometimes, they resolve to an outer property. At parse time, we can't tell what these should resolve to. For example:
It would be better if names declared inside of generator bodies are not visible from an enclosing object body.
Most code would still work if it resolved to implicit
this.We need to fix this before we can do #1580