Write script descriptor type to ASM_TYPE slice
#KT-20707 Fixed
This commit is contained in:
+9
-2
@@ -193,8 +193,15 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitScript(@NotNull KtScript script) {
|
public void visitScript(@NotNull KtScript script) {
|
||||||
classStack.push(bindingContext.get(SCRIPT, script));
|
ClassDescriptor scriptDescriptor = bindingContext.get(SCRIPT, script);
|
||||||
nameStack.push(AsmUtil.internalNameByFqNameWithoutInnerClasses(script.getFqName()));
|
// working around a problem with shallow analysis
|
||||||
|
if (scriptDescriptor == null) return;
|
||||||
|
|
||||||
|
String scriptInternalName = AsmUtil.internalNameByFqNameWithoutInnerClasses(script.getFqName());
|
||||||
|
recordClosure(scriptDescriptor, scriptInternalName);
|
||||||
|
|
||||||
|
classStack.push(scriptDescriptor);
|
||||||
|
nameStack.push(scriptInternalName);
|
||||||
script.acceptChildren(this);
|
script.acceptChildren(this);
|
||||||
nameStack.pop();
|
nameStack.pop();
|
||||||
classStack.pop();
|
classStack.pop();
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
enum class Build { Debug, Release }
|
||||||
|
|
||||||
|
fun applySomething(build: Build) = when (build) {
|
||||||
|
Build.Debug -> "OK"
|
||||||
|
Build.Release -> "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
val rv = applySomething(Build.Debug)
|
||||||
|
|
||||||
|
// expected: rv: OK
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
>>> enum class Build { Debug, Release }
|
||||||
|
|
||||||
|
>>> fun applySomething(build: Build) = when (build) {
|
||||||
|
... Build.Debug -> "OK"
|
||||||
|
... Build.Release -> "fail"
|
||||||
|
...}
|
||||||
|
>>> applySomething(Build.Debug)
|
||||||
|
OK
|
||||||
@@ -78,6 +78,12 @@ public class ScriptCodegenTestGenerated extends AbstractScriptCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt20707.kts")
|
||||||
|
public void testKt20707() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/kt20707.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");
|
||||||
|
|||||||
@@ -245,6 +245,12 @@ public class ReplInterpreterTestGenerated extends AbstractReplInterpreterTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt15407.repl")
|
||||||
|
public void testKt15407() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/repl/controlFlow/kt15407.repl");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loopWithWrongLabel.repl")
|
@TestMetadata("loopWithWrongLabel.repl")
|
||||||
public void testLoopWithWrongLabel() throws Exception {
|
public void testLoopWithWrongLabel() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/repl/controlFlow/loopWithWrongLabel.repl");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/repl/controlFlow/loopWithWrongLabel.repl");
|
||||||
|
|||||||
Reference in New Issue
Block a user