Generate public constructor for anonymous objects if it inside inline fun
#KT-9331 Fixed
This commit is contained in:
@@ -341,7 +341,7 @@ public class AsmUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (memberDescriptor instanceof ConstructorDescriptor && isAnonymousObject(memberDescriptor.getContainingDeclaration())) {
|
if (memberDescriptor instanceof ConstructorDescriptor && isAnonymousObject(memberDescriptor.getContainingDeclaration())) {
|
||||||
return NO_FLAG_PACKAGE_PRIVATE;
|
return getVisibilityAccessFlagForAnonymous((ClassDescriptor) memberDescriptor.getContainingDeclaration());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memberDescriptor instanceof SyntheticJavaPropertyDescriptor) {
|
if (memberDescriptor instanceof SyntheticJavaPropertyDescriptor) {
|
||||||
|
|||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return A().doSomething().run()
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
interface Run {
|
||||||
|
fun run(): String
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class A {
|
||||||
|
inline fun doSomething(): Run {
|
||||||
|
return object : Run {
|
||||||
|
override fun run(): String = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return A().doSomething()
|
||||||
|
}
|
||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
internal class A {
|
||||||
|
inline fun doSomething(): String {
|
||||||
|
return {
|
||||||
|
"OK"
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return A().doSomething("OK")
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
internal class A {
|
||||||
|
inline fun doSomething(s: String): String {
|
||||||
|
return {
|
||||||
|
s
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -97,6 +97,24 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
doTestMultiFileWithInlineCheck(fileName);
|
doTestMultiFileWithInlineCheck(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constructorVisibility.1.kt")
|
||||||
|
public void testConstructorVisibility() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/constructorVisibility.1.kt");
|
||||||
|
doTestMultiFileWithInlineCheck(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constructorVisibilityInConstLambda.1.kt")
|
||||||
|
public void testConstructorVisibilityInConstLambda() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.1.kt");
|
||||||
|
doTestMultiFileWithInlineCheck(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constructorVisibilityInLambda.1.kt")
|
||||||
|
public void testConstructorVisibilityInLambda() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.1.kt");
|
||||||
|
doTestMultiFileWithInlineCheck(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8133.1.kt")
|
@TestMetadata("kt8133.1.kt")
|
||||||
public void testKt8133() throws Exception {
|
public void testKt8133() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt8133.1.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt8133.1.kt");
|
||||||
|
|||||||
+18
@@ -97,6 +97,24 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
doBoxTestWithInlineCheck(fileName);
|
doBoxTestWithInlineCheck(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constructorVisibility.1.kt")
|
||||||
|
public void testConstructorVisibility() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/constructorVisibility.1.kt");
|
||||||
|
doBoxTestWithInlineCheck(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constructorVisibilityInConstLambda.1.kt")
|
||||||
|
public void testConstructorVisibilityInConstLambda() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInConstLambda.1.kt");
|
||||||
|
doBoxTestWithInlineCheck(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constructorVisibilityInLambda.1.kt")
|
||||||
|
public void testConstructorVisibilityInLambda() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/constructorVisibilityInLambda.1.kt");
|
||||||
|
doBoxTestWithInlineCheck(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8133.1.kt")
|
@TestMetadata("kt8133.1.kt")
|
||||||
public void testKt8133() throws Exception {
|
public void testKt8133() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt8133.1.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt8133.1.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user