JVM_IR KT-45934 don't generate declaration stubs for delegates
This commit is contained in:
committed by
TeamCityServer
parent
cc415f62b5
commit
e89ab71bf8
Generated
+6
@@ -244,6 +244,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/classes/kt45853.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45934.kt")
|
||||
public void testKt45934() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/classes/kt45934.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInDataClassDefaultParameter.kt")
|
||||
public void testLambdaInDataClassDefaultParameter() throws Exception {
|
||||
|
||||
+3
-1
@@ -56,7 +56,9 @@ class SyntheticDeclarationsGenerator(context: GeneratorContext) : DeclarationDes
|
||||
|
||||
override fun visitFunctionDescriptor(descriptor: FunctionDescriptor, data: IrDeclarationContainer?) {
|
||||
require(data != null)
|
||||
if (descriptor.visibility != DescriptorVisibilities.INVISIBLE_FAKE) {
|
||||
if (descriptor.visibility != DescriptorVisibilities.INVISIBLE_FAKE &&
|
||||
descriptor.kind != CallableMemberDescriptor.Kind.DELEGATION // Skip mismatching delegates, see KT-46120
|
||||
) {
|
||||
symbolTable.declareSimpleFunctionIfNotExists(descriptor) {
|
||||
createFunctionStub(descriptor, it).insertDeclaration(data)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// FILE: kt45934.kt
|
||||
|
||||
class C(client: J) : I by client
|
||||
|
||||
// FILE: I.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface I {
|
||||
<C> List<C> foo();
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class J implements I {
|
||||
@Override
|
||||
public List<String> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
// source: 'kt45934.kt'
|
||||
private synthetic final field $$delegate_0: J
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: J): void
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
FILE fqName:<root> fileName:/kt45934.kt
|
||||
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> (client:<root>.J) returnType:<root>.C [primary]
|
||||
VALUE_PARAMETER name:client index:0 type:<root>.J
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I]'
|
||||
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <C> ($this:<root>.C) returnType:@[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of <root>.C.foo?>?
|
||||
overridden:
|
||||
public abstract fun foo <C> (): @[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of <root>.I.foo?>? declared in <root>.I
|
||||
TYPE_PARAMETER name:C index:0 variance: superTypes:[@[FlexibleNullability] kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun foo <C> (): @[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of <root>.C.foo?>? declared in <root>.C'
|
||||
CALL 'public abstract fun foo <C> (): @[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of <root>.I.foo?>? declared in <root>.I' type=@[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of <root>.C.foo?>? origin=null
|
||||
<C>: <none>
|
||||
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.I visibility:local [final]' type=<root>.I origin=null
|
||||
receiver: GET_VAR '<this>: <root>.C declared in <root>.C.foo' type=<root>.C origin=null
|
||||
FIELD DELEGATE name:<$$delegate_0> type:<root>.I visibility:local [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'client: <root>.J declared in <root>.C.<init>' type=<root>.J origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.I
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// SKIP_KT_DUMP
|
||||
|
||||
// FILE: kt45934.kt
|
||||
|
||||
class C(client: J) : I by client
|
||||
|
||||
// FILE: I.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface I {
|
||||
<C> List<C> foo();
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class J implements I {
|
||||
@Override
|
||||
public List<String> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
FILE fqName:<root> fileName:/kt45934.kt
|
||||
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> (client:<root>.J) returnType:<root>.C [primary]
|
||||
VALUE_PARAMETER name:client index:0 type:<root>.J
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I]'
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.J visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'client: <root>.J declared in <root>.C.<init>' type=<root>.J origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.I
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
Generated
+6
@@ -244,6 +244,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/classes/kt45853.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45934.kt")
|
||||
public void testKt45934() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/classes/kt45934.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInDataClassDefaultParameter.kt")
|
||||
public void testLambdaInDataClassDefaultParameter() throws Exception {
|
||||
|
||||
+5
@@ -180,6 +180,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45853a.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45934.kt")
|
||||
public void testKt45934() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45934.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunction.kt");
|
||||
|
||||
+5
@@ -180,6 +180,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45853a.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45934.kt")
|
||||
public void testKt45934() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt45934.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunction.kt");
|
||||
|
||||
Reference in New Issue
Block a user