Closures in scripts have outer expression
#KT-22029 Fixed Target versions 1.2.30
This commit is contained in:
@@ -133,7 +133,10 @@ public class CodegenBinding {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return classDescriptor.isInner() || !(classDescriptor.getContainingDeclaration() instanceof ClassDescriptor);
|
DeclarationDescriptor containingDeclaration = classDescriptor.getContainingDeclaration();
|
||||||
|
return classDescriptor.isInner()
|
||||||
|
|| containingDeclaration instanceof ScriptDescriptor
|
||||||
|
|| !(containingDeclaration instanceof ClassDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
data class Pair(val first: Int, val second: Int)
|
||||||
|
|
||||||
|
inline fun <T> run(fn: () -> T) = fn()
|
||||||
|
|
||||||
|
val fstSec = 42
|
||||||
|
|
||||||
|
val (fst, snd) = run { Pair(fstSec, fstSec) }
|
||||||
|
|
||||||
|
// expected: fst: 42
|
||||||
@@ -73,6 +73,12 @@ public class ScriptCodegenTestGenerated extends AbstractScriptCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt22029.kts")
|
||||||
|
public void testKt22029() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/kt22029.kts");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("localDelegatedProperty.kts")
|
@TestMetadata("localDelegatedProperty.kts")
|
||||||
public void testLocalDelegatedProperty() throws Exception {
|
public void testLocalDelegatedProperty() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/localDelegatedProperty.kts");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/localDelegatedProperty.kts");
|
||||||
|
|||||||
Reference in New Issue
Block a user