Don't generate secondary constructors for inline class wrapper
This commit is contained in:
@@ -454,8 +454,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
try {
|
||||
lookupConstructorExpressionsInClosureIfPresent();
|
||||
constructorCodegen.generatePrimaryConstructor(delegationFieldsInfo, superClassAsmType);
|
||||
for (ClassConstructorDescriptor secondaryConstructor : DescriptorUtilsKt.getSecondaryConstructors(descriptor)) {
|
||||
constructorCodegen.generateSecondaryConstructor(secondaryConstructor, superClassAsmType);
|
||||
if (!descriptor.isInline()) {
|
||||
for (ClassConstructorDescriptor secondaryConstructor : DescriptorUtilsKt.getSecondaryConstructors(descriptor)) {
|
||||
constructorCodegen.generateSecondaryConstructor(secondaryConstructor, superClassAsmType);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CompilationException | ProcessCanceledException e) {
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Foo(val x: Int) {
|
||||
constructor(x: Long) : this(x.toInt())
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
@kotlin.Metadata
|
||||
static class Foo$Erased {
|
||||
method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
|
||||
public static method constructor(p0: int): int
|
||||
public static method constructor(p0: long): int
|
||||
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
|
||||
public static method hashCode(p0: int): int
|
||||
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final field x: int
|
||||
public method <init>(p0: int): void
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public final method getX(): int
|
||||
public method hashCode(): int
|
||||
public method toString(): java.lang.String
|
||||
public final method unbox(): int
|
||||
}
|
||||
+5
@@ -284,6 +284,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/computablePropertiesInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassConstructors.kt")
|
||||
public void testInlineClassConstructors() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noBridgesForErasedInlineClass.kt")
|
||||
public void testNoBridgesForErasedInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user