K2 scripting: fix containing decl for last script expression

Generally the wrapping anonymous initializer can be used as a
"containing declaration" for some elements, but since the initialiser
for the last script expression could be dropped (the expression could
be converted to the result property), this may lead to the surprises,
e.g. as described in KT-65984
This fix marks the last initialiser as local, preventing it from being
referenced as "containing declaration".

#KT-65984
This commit is contained in:
Ilya Chernikov
2024-02-19 15:24:08 +01:00
committed by Space Team
parent 0c5b700523
commit 9ea775cbed
13 changed files with 481 additions and 7 deletions
@@ -0,0 +1,3 @@
// FIR_IDENTICAL
@Suppress("UNCHECKED_CAST")
java.io.File(".").list() as? Array<String>