PSI2IR: Fix delegated members generation

When generating bodies for members implemented by delegation, invoke
corresponding delegate member, not an interface member. Otherwise we
might lose platform-specific nullability information in case of mixed
Kotlin-Java hierarchies, as in
implicitNotNullOnDelegatedImplementation.kt
This commit is contained in:
Dmitry Petrov
2019-12-30 16:04:24 +03:00
parent cc0b231b3b
commit d622542824
9 changed files with 670 additions and 93 deletions
@@ -126,6 +126,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt");
}
@TestMetadata("implicitNotNullOnDelegatedImplementation.kt")
public void testImplicitNotNullOnDelegatedImplementation() throws Exception {
runTest("compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("compiler/testData/ir/irText/classes/initBlock.kt");
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DelegationResolver
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.propertyIfAccessor
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
@@ -142,8 +143,8 @@ class ClassGenerator(
private fun generateFakeOverrideMemberDeclarations(irClass: IrClass, ktClassOrObject: KtPureClassOrObject) {
irClass.descriptor.unsubstitutedMemberScope.getContributedDescriptors()
.mapNotNull {
it.safeAs<CallableMemberDescriptor>().takeIf {
it?.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
it.safeAs<CallableMemberDescriptor>().takeIf { memberDescriptor ->
memberDescriptor?.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
}
}
.sortedByRenderer()
@@ -154,31 +155,25 @@ class ClassGenerator(
private fun generateMembersDeclaredInSupertypeList(irClass: IrClass, ktClassOrObject: KtClassOrObject) {
val ktSuperTypeList = ktClassOrObject.getSuperTypeList() ?: return
val delegatedMembers = irClass.descriptor.unsubstitutedMemberScope
.getContributedDescriptors(DescriptorKindFilter.CALLABLES)
.filterIsInstance<CallableMemberDescriptor>()
.filter { it.kind == CallableMemberDescriptor.Kind.DELEGATION }
.sortedByRenderer()
if (delegatedMembers.isEmpty()) return
for (ktEntry in ktSuperTypeList.entries) {
if (ktEntry is KtDelegatedSuperTypeEntry) {
generateDelegatedImplementationMembers(irClass, ktEntry, delegatedMembers)
generateDelegatedImplementationMembers(irClass, ktEntry)
}
}
}
private fun generateDelegatedImplementationMembers(
irClass: IrClass,
ktEntry: KtDelegatedSuperTypeEntry,
delegatedMembers: List<CallableMemberDescriptor>
ktEntry: KtDelegatedSuperTypeEntry
) {
val ktDelegateExpression = ktEntry.delegateExpression!!
val delegateType = getTypeInferredByFrontendOrFail(ktDelegateExpression)
val superType = getOrFail(BindingContext.TYPE, ktEntry.typeReference!!)
val superTypeConstructorDescriptor = superType.constructor.declarationDescriptor
val superClass = superTypeConstructorDescriptor as? ClassDescriptor
?: throw AssertionError("Unexpected supertype constructor for delegation: $superTypeConstructorDescriptor")
val delegateDescriptor = IrImplementingDelegateDescriptorImpl(irClass.descriptor, delegateType, superType)
val irDelegateField = context.symbolTable.declareField(
ktDelegateExpression.startOffsetSkippingComments, ktDelegateExpression.endOffset,
@@ -188,10 +183,17 @@ class ClassGenerator(
)
irClass.addMember(irDelegateField)
val delegatesMap = DelegationResolver.getDelegates(irClass.descriptor, superClass, delegateType)
val delegatedMembers = delegatesMap.keys.toList().sortedByRenderer()
for (delegatedMember in delegatedMembers) {
val overriddenMember = delegatedMember.overriddenDescriptors.find { it.containingDeclaration.original == superClass.original }
if (overriddenMember != null) {
generateDelegatedMember(irClass, irDelegateField, delegatedMember, overriddenMember)
val delegateToMember = delegatesMap[delegatedMember]
?: throw AssertionError(
"No corresponding member in delegate type $delegateType for $delegatedMember overriding $overriddenMember"
)
generateDelegatedMember(irClass, irDelegateField, delegatedMember, delegateToMember)
}
}
}
@@ -200,30 +202,27 @@ class ClassGenerator(
irClass: IrClass,
irDelegate: IrField,
delegatedMember: CallableMemberDescriptor,
overriddenMember: CallableMemberDescriptor
delegateToMember: CallableMemberDescriptor
) {
when (delegatedMember) {
is FunctionDescriptor ->
generateDelegatedFunction(irClass, irDelegate, delegatedMember, overriddenMember as FunctionDescriptor)
is PropertyDescriptor ->
generateDelegatedProperty(irClass, irDelegate, delegatedMember, overriddenMember as PropertyDescriptor)
is FunctionDescriptor -> generateDelegatedFunction(irClass, irDelegate, delegatedMember, delegateToMember as FunctionDescriptor)
is PropertyDescriptor -> generateDelegatedProperty(irClass, irDelegate, delegatedMember, delegateToMember as PropertyDescriptor)
}
}
private fun generateDelegatedProperty(
irClass: IrClass,
irDelegate: IrField,
delegated: PropertyDescriptor,
overridden: PropertyDescriptor
delegatedDescriptor: PropertyDescriptor,
delegateToDescriptor: PropertyDescriptor
) {
irClass.addMember(generateDelegatedProperty(irDelegate, delegated, overridden))
irClass.addMember(generateDelegatedProperty(irDelegate, delegatedDescriptor, delegateToDescriptor))
}
private fun generateDelegatedProperty(
irDelegate: IrField,
delegatedDescriptor: PropertyDescriptor,
overriddenDescriptor: PropertyDescriptor
delegateToDescriptor: PropertyDescriptor
): IrProperty {
val startOffset = irDelegate.startOffset
val endOffset = irDelegate.endOffset
@@ -233,10 +232,10 @@ class ClassGenerator(
delegatedDescriptor
)
irProperty.getter = generateDelegatedFunction(irDelegate, delegatedDescriptor.getter!!, overriddenDescriptor.getter!!)
irProperty.getter = generateDelegatedFunction(irDelegate, delegatedDescriptor.getter!!, delegateToDescriptor.getter!!)
if (delegatedDescriptor.isVar) {
irProperty.setter = generateDelegatedFunction(irDelegate, delegatedDescriptor.setter!!, overriddenDescriptor.setter!!)
irProperty.setter = generateDelegatedFunction(irDelegate, delegatedDescriptor.setter!!, delegateToDescriptor.setter!!)
}
return irProperty
}
@@ -244,74 +243,82 @@ class ClassGenerator(
private fun generateDelegatedFunction(
irClass: IrClass,
irDelegate: IrField,
delegated: FunctionDescriptor,
overridden: FunctionDescriptor
delegatedDescriptor: FunctionDescriptor,
delegateToDescriptor: FunctionDescriptor
) {
irClass.addMember(generateDelegatedFunction(irDelegate, delegated, overridden))
irClass.addMember(generateDelegatedFunction(irDelegate, delegatedDescriptor, delegateToDescriptor))
}
private fun generateDelegatedFunction(
irDelegate: IrField,
delegated: FunctionDescriptor,
overridden: FunctionDescriptor
delegatedDescriptor: FunctionDescriptor,
delegateToDescriptor: FunctionDescriptor
): IrSimpleFunction =
context.symbolTable.declareSimpleFunctionWithOverrides(
irDelegate.startOffset, irDelegate.endOffset,
IrDeclarationOrigin.DELEGATED_MEMBER,
delegated
delegatedDescriptor
).buildWithScope { irFunction ->
FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction)
// TODO could possibly refer to scoped type parameters for property accessors
irFunction.returnType = delegated.returnType!!.toIrType()
irFunction.returnType = delegatedDescriptor.returnType!!.toIrType()
irFunction.body = generateDelegateFunctionBody(irDelegate, delegated, overridden, irFunction)
irFunction.body = generateDelegateFunctionBody(irDelegate, delegatedDescriptor, delegateToDescriptor, irFunction)
}
private fun generateDelegateFunctionBody(
irDelegate: IrField,
delegated: FunctionDescriptor,
overridden: FunctionDescriptor,
delegatedDescriptor: FunctionDescriptor,
delegateToDescriptor: FunctionDescriptor,
irDelegatedFunction: IrSimpleFunction
): IrBlockBodyImpl {
val startOffset = irDelegate.startOffset
val endOffset = irDelegate.endOffset
val irBlockBody = IrBlockBodyImpl(startOffset, endOffset)
val substitutedOverridden = substituteOverriddenDescriptorForDelegate(delegated, overridden)
val returnType = substitutedOverridden.returnType!!
val irReturnType = returnType.toIrType()
val originalSymbol = context.symbolTable.referenceFunction(overridden.original)
val substitutedDelegateTo = substituteDelegateToDescriptor(delegatedDescriptor, delegateToDescriptor)
val returnType = substitutedDelegateTo.returnType!!
val delegateToSymbol = context.symbolTable.referenceFunction(delegateToDescriptor.original)
val irCall = IrCallImpl(
startOffset, endOffset, irReturnType,
originalSymbol,
substitutedOverridden.typeParametersCount
startOffset, endOffset,
returnType.toIrType(),
delegateToSymbol,
substitutedDelegateTo.typeParametersCount
).apply {
context.callToSubstitutedDescriptorMap[this] = substitutedOverridden
val typeArguments = getTypeArgumentsForOverriddenDescriptorDelegatingCall(delegated, overridden)
context.callToSubstitutedDescriptorMap[this] = substitutedDelegateTo
val typeArguments = getTypeArgumentsForOverriddenDescriptorDelegatingCall(delegatedDescriptor, delegateToDescriptor)
putTypeArguments(typeArguments) { it.toIrType() }
}
val dispatchReceiverParameter = irDelegatedFunction.dispatchReceiverParameter!!
val dispatchReceiverType = dispatchReceiverParameter.type
irCall.dispatchReceiver =
IrGetFieldImpl(
startOffset, endOffset,
irDelegate.symbol,
irDelegate.type,
IrGetValueImpl(
val dispatchReceiverParameter = irDelegatedFunction.dispatchReceiverParameter!!
dispatchReceiver =
IrGetFieldImpl(
startOffset, endOffset,
dispatchReceiverType,
dispatchReceiverParameter.symbol
irDelegate.symbol,
irDelegate.type,
IrGetValueImpl(
startOffset, endOffset,
dispatchReceiverParameter.type,
dispatchReceiverParameter.symbol
)
)
)
irCall.extensionReceiver =
irDelegatedFunction.extensionReceiverParameter?.let { extensionReceiver ->
IrGetValueImpl(startOffset, endOffset, extensionReceiver.type, extensionReceiver.symbol)
extensionReceiver =
irDelegatedFunction.extensionReceiverParameter?.let { extensionReceiver ->
IrGetValueImpl(startOffset, endOffset, extensionReceiver.type, extensionReceiver.symbol)
}
mapValueParameters { overriddenValueParameter ->
val delegatedValueParameter = delegatedDescriptor.valueParameters[overriddenValueParameter.index]
val irDelegatedValueParameter = irDelegatedFunction.getIrValueParameter(delegatedValueParameter)
IrGetValueImpl(startOffset, endOffset, irDelegatedValueParameter.type, irDelegatedValueParameter.symbol)
}
irCall.mapValueParameters { overriddenValueParameter ->
val delegatedValueParameter = delegated.valueParameters[overriddenValueParameter.index]
val irDelegatedValueParameter = irDelegatedFunction.getIrValueParameter(delegatedValueParameter)
IrGetValueImpl(startOffset, endOffset, irDelegatedValueParameter.type, irDelegatedValueParameter.symbol)
}
if (KotlinBuiltIns.isUnit(returnType) || KotlinBuiltIns.isNothing(returnType)) {
irBlockBody.statements.add(irCall)
} else {
@@ -322,22 +329,23 @@ class ClassGenerator(
}
@Suppress("UNCHECKED_CAST")
private fun <D : CallableMemberDescriptor> substituteOverriddenDescriptorForDelegate(delegated: D, overridden: D): D =
// PropertyAccessorDescriptor doesn't support 'substitute' right now, so we substitute the corresponding property instead.
private fun <D : CallableMemberDescriptor> substituteDelegateToDescriptor(delegated: D, overridden: D): D =
// PropertyAccessorDescriptor doesn't support 'substitute', so we substitute the corresponding property instead.
when (overridden) {
is PropertyGetterDescriptor -> substituteOverriddenDescriptorForDelegate(
is PropertyGetterDescriptor -> substituteDelegateToDescriptor(
(delegated as PropertyGetterDescriptor).correspondingProperty,
overridden.correspondingProperty
).getter as D
is PropertySetterDescriptor -> substituteOverriddenDescriptorForDelegate(
is PropertySetterDescriptor -> substituteDelegateToDescriptor(
(delegated as PropertySetterDescriptor).correspondingProperty,
overridden.correspondingProperty
).setter as D
else -> {
val delegatedTypeParameters = delegated.typeParameters
val substitutor =
TypeSubstitutor.create(
overridden.typeParameters.associate {
val delegatedDefaultType = delegated.typeParameters[it.index].defaultType
val delegatedDefaultType = delegatedTypeParameters[it.index].defaultType
it.typeConstructor to TypeProjectionImpl(delegatedDefaultType)
}
)
@@ -346,13 +354,13 @@ class ClassGenerator(
}
private fun getTypeArgumentsForOverriddenDescriptorDelegatingCall(
delegated: FunctionDescriptor,
overridden: FunctionDescriptor
delegatedDescriptor: FunctionDescriptor,
delegateToDescriptor: FunctionDescriptor
): Map<TypeParameterDescriptor, KotlinType>? {
val keys = overridden.propertyIfAccessor.original.typeParameters
val keys = delegateToDescriptor.propertyIfAccessor.original.typeParameters
if (keys.isEmpty()) return null
val values = delegated.propertyIfAccessor.typeParameters
val values = delegatedDescriptor.propertyIfAccessor.typeParameters
val typeArguments = newHashMapWithExpectedSize<TypeParameterDescriptor, KotlinType>(keys.size)
for ((i, overriddenTypeParameter) in keys.withIndex()) {
@@ -1,15 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// FILE: Delegation.java
public class Delegation {
public static class ReturnNull {
public String foo() {
return null;
}
}
}
// FILE: 1.kt
// FILE: delegation.kt
interface Tr {
fun foo(): String
@@ -19,8 +8,7 @@ class DelegateTo : Delegation.ReturnNull(), Tr {
override fun foo() = super<Delegation.ReturnNull>.foo()
}
class DelegateFrom : Tr by DelegateTo() {
}
class DelegateFrom : Tr by DelegateTo()
fun box(): String {
try {
@@ -31,3 +19,13 @@ fun box(): String {
return "OK"
}
}
// FILE: Delegation.java
public class Delegation {
public static class ReturnNull {
public String foo() {
return null;
}
}
}
@@ -209,7 +209,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Test1
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun bar (): kotlin.Int declared in <root>.Test1'
CALL 'public abstract fun bar (): kotlin.Int declared in <root>.IBase' type=kotlin.Int origin=null
CALL 'public open fun bar (): kotlin.Int declared in <root>.BaseImpl' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.BaseImpl visibility:private [final]' type=<root>.BaseImpl origin=null
receiver: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1.bar' type=<root>.Test1 origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.Test1, x:kotlin.Int, s:kotlin.String) returnType:kotlin.Unit
@@ -219,7 +219,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
VALUE_PARAMETER name:x index:0 type:kotlin.Int
VALUE_PARAMETER name:s index:1 type:kotlin.String
BLOCK_BODY
CALL 'public abstract fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
CALL 'public open fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in <root>.BaseImpl' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.BaseImpl visibility:private [final]' type=<root>.BaseImpl origin=null
receiver: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1.foo' type=<root>.Test1 origin=null
x: GET_VAR 'x: kotlin.Int declared in <root>.Test1.foo' type=kotlin.Int origin=null
@@ -230,7 +230,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Test1
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
BLOCK_BODY
CALL 'public abstract fun qux (): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
CALL 'public open fun qux (): kotlin.Unit declared in <root>.BaseImpl' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.BaseImpl visibility:private [final]' type=<root>.BaseImpl origin=null
receiver: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1.qux' type=<root>.Test1 origin=null
$receiver: GET_VAR '<this>: kotlin.String declared in <root>.Test1.qux' type=kotlin.String origin=null
@@ -262,7 +262,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun bar (): kotlin.Int declared in <root>.Test2'
CALL 'public abstract fun bar (): kotlin.Int declared in <root>.IBase' type=kotlin.Int origin=null
CALL 'public open fun bar (): kotlin.Int declared in <root>.BaseImpl' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.BaseImpl visibility:private [final]' type=<root>.BaseImpl origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.bar' type=<root>.Test2 origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.Test2, x:kotlin.Int, s:kotlin.String) returnType:kotlin.Unit
@@ -272,7 +272,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
VALUE_PARAMETER name:x index:0 type:kotlin.Int
VALUE_PARAMETER name:s index:1 type:kotlin.String
BLOCK_BODY
CALL 'public abstract fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
CALL 'public open fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in <root>.BaseImpl' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.BaseImpl visibility:private [final]' type=<root>.BaseImpl origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.foo' type=<root>.Test2 origin=null
x: GET_VAR 'x: kotlin.Int declared in <root>.Test2.foo' type=kotlin.Int origin=null
@@ -283,7 +283,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
BLOCK_BODY
CALL 'public abstract fun qux (): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
CALL 'public open fun qux (): kotlin.Unit declared in <root>.BaseImpl' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.BaseImpl visibility:private [final]' type=<root>.BaseImpl origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.qux' type=<root>.Test2 origin=null
$receiver: GET_VAR '<this>: kotlin.String declared in <root>.Test2.qux' type=kotlin.String origin=null
@@ -61,7 +61,7 @@ FILE fqName:<root> fileName:/delegatedImplementationWithExplicitOverride.kt
public abstract fun foo (): kotlin.Unit declared in <root>.IFooBar
$this: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.IFooBar' type=kotlin.Unit origin=null
CALL 'public open fun foo (): kotlin.Unit declared in <root>.FooBarImpl' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:C$IFooBar$delegate type:<root>.FooBarImpl visibility:private [final]' type=<root>.FooBarImpl origin=null
receiver: GET_VAR '<this>: <root>.C declared in <root>.C.foo' type=<root>.C origin=null
FUN name:bar visibility:public modality:OPEN <> ($this:<root>.C) returnType:kotlin.Unit
@@ -0,0 +1,229 @@
FILE fqName:<root> fileName:/implicitNotNullOnDelegatedImplementation.kt
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K1 modality:FINAL visibility:public superTypes:[<root>.JFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K1
CONSTRUCTOR visibility:public <> () returnType:<root>.K1 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K1 modality:FINAL visibility:public superTypes:[<root>.JFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.JFoo) returnType:kotlin.String [fake_override,operator]
overridden:
public open fun foo (): kotlin.String [operator] declared in <root>.JFoo
$this: VALUE_PARAMETER name:<this> type:<root>.JFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K2 modality:FINAL visibility:public superTypes:[<root>.JFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K2
CONSTRUCTOR visibility:public <> () returnType:<root>.K2 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K2 modality:FINAL visibility:public superTypes:[<root>.JFoo]'
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.K2) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.K2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in <root>.K2'
CALL 'public open fun foo (): kotlin.String [operator] declared in <root>.JFoo' type=kotlin.String origin=null
$this: ERROR_CALL 'Unresolved reference: super<R|JFoo|>' type=<root>.JFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K3 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K3
CONSTRUCTOR visibility:public <> () returnType:<root>.K3 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JUnrelatedFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K3 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K4 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K4
CONSTRUCTOR visibility:public <> () returnType:<root>.K4 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JUnrelatedFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K4 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]'
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.K4) returnType:kotlin.String?
$this: VALUE_PARAMETER name:<this> type:<root>.K4
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String? declared in <root>.K4'
CALL 'public open fun foo (): kotlin.String? [operator] declared in <root>.JUnrelatedFoo' type=kotlin.String? origin=null
$this: ERROR_CALL 'Unresolved reference: super<R|JUnrelatedFoo|>' type=<root>.JUnrelatedFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestJFoo modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestJFoo
CONSTRUCTOR visibility:public <> () returnType:<root>.TestJFoo [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestJFoo modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK1 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK1
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK1 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK1 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK2 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK2
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK2 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK2 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK3 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK3
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK3 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK3 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK4 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK4
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK4 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK4 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,47 @@
// FILE: implicitNotNullOnDelegatedImplementation.kt
interface IFoo {
fun foo(): String
}
class K1 : JFoo()
class K2 : JFoo() {
override fun foo() = super.foo()
}
class K3 : JUnrelatedFoo(), IFoo
class K4 : JUnrelatedFoo(), IFoo {
override fun foo() = super.foo()
}
class TestJFoo : IFoo by JFoo() {
// nullability assertion in 'foo()'
}
class TestK1 : IFoo by K1() {
// nullability assertion in 'foo()'
}
class TestK2 : IFoo by K2() {
// no nullability assertion in 'foo()'
}
class TestK3 : IFoo by K3() {
// no nullability assertion in 'foo()'
}
class TestK4 : IFoo by K4() {
// nullability assertion in 'foo()'
}
// FILE: JFoo.java
public class JFoo implements IFoo {
public String foo() { return null; }
}
// FILE: JUnrelatedFoo.java
public class JUnrelatedFoo {
public String foo() { return null; }
}
@@ -0,0 +1,285 @@
FILE fqName:<root> fileName:/implicitNotNullOnDelegatedImplementation.kt
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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 [operator] declared in kotlin.Any
$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 declared in kotlin.Any
$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 declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K1 modality:FINAL visibility:public superTypes:[<root>.JFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K1
CONSTRUCTOR visibility:public <> () returnType:<root>.K1 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K1 modality:FINAL visibility:public superTypes:[<root>.JFoo]'
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>.JFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.JFoo) returnType:kotlin.String [fake_override]
overridden:
public open fun foo (): kotlin.String declared in <root>.JFoo
$this: VALUE_PARAMETER name:<this> type:<root>.JFoo
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>.JFoo
$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>.JFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K2 modality:FINAL visibility:public superTypes:[<root>.JFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K2
CONSTRUCTOR visibility:public <> () returnType:<root>.K2 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K2 modality:FINAL visibility:public superTypes:[<root>.JFoo]'
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.K2) returnType:kotlin.String
overridden:
public open fun foo (): kotlin.String declared in <root>.JFoo
$this: VALUE_PARAMETER name:<this> type:<root>.K2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.K2'
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
CALL 'public open fun foo (): kotlin.String declared in <root>.JFoo' superQualifier='CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JFoo modality:OPEN visibility:public superTypes:[<root>.IFoo]' type=kotlin.String origin=null
$this: GET_VAR '<this>: <root>.K2 declared in <root>.K2.foo' type=<root>.K2 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>.JFoo
$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>.JFoo
$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>.JFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K3 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K3
CONSTRUCTOR visibility:public <> () returnType:<root>.K3 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JUnrelatedFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K3 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]'
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>.JUnrelatedFoo
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.IFoo) returnType:kotlin.String [fake_override]
overridden:
public open fun foo (): kotlin.String? declared in <root>.JUnrelatedFoo
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo
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>.JUnrelatedFoo
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.IFoo
$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>.JUnrelatedFoo
public open fun toString (): kotlin.String [fake_override] declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:K4 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K4
CONSTRUCTOR visibility:public <> () returnType:<root>.K4 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JUnrelatedFoo'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K4 modality:FINAL visibility:public superTypes:[<root>.JUnrelatedFoo; <root>.IFoo]'
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.K4) returnType:kotlin.String?
overridden:
public open fun foo (): kotlin.String? declared in <root>.JUnrelatedFoo
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.K4
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String? declared in <root>.K4'
CALL 'public open fun foo (): kotlin.String? declared in <root>.JUnrelatedFoo' superQualifier='CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JUnrelatedFoo modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.String? origin=null
$this: GET_VAR '<this>: <root>.K4 declared in <root>.K4.foo' type=<root>.K4 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>.JUnrelatedFoo
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.IFoo
$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>.JUnrelatedFoo
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.IFoo
$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>.JUnrelatedFoo
public open fun toString (): kotlin.String [fake_override] declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestJFoo modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestJFoo
CONSTRUCTOR visibility:public <> () returnType:<root>.TestJFoo [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestJFoo modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FIELD DELEGATE name:TestJFoo$IFoo$delegate type:<root>.JFoo visibility:private [final]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.JFoo' type=<root>.JFoo origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.TestJFoo) returnType:kotlin.String
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.TestJFoo
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.TestJFoo'
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
CALL 'public open fun foo (): kotlin.String declared in <root>.JFoo' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:TestJFoo$IFoo$delegate type:<root>.JFoo visibility:private [final]' type=<root>.JFoo origin=null
receiver: GET_VAR '<this>: <root>.TestJFoo declared in <root>.TestJFoo.foo' type=<root>.TestJFoo 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>.IFoo
$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>.IFoo
$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>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK1 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK1
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK1 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK1 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FIELD DELEGATE name:TestK1$IFoo$delegate type:<root>.K1 visibility:private [final]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.K1' type=<root>.K1 origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.TestK1) returnType:kotlin.String
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.TestK1
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.TestK1'
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
CALL 'public open fun foo (): kotlin.String [fake_override] declared in <root>.K1' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:TestK1$IFoo$delegate type:<root>.K1 visibility:private [final]' type=<root>.K1 origin=null
receiver: GET_VAR '<this>: <root>.TestK1 declared in <root>.TestK1.foo' type=<root>.TestK1 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>.IFoo
$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>.IFoo
$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>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK2 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK2
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK2 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK2 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FIELD DELEGATE name:TestK2$IFoo$delegate type:<root>.K2 visibility:private [final]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.K2' type=<root>.K2 origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.TestK2) returnType:kotlin.String
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.TestK2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.TestK2'
CALL 'public open fun foo (): kotlin.String declared in <root>.K2' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:TestK2$IFoo$delegate type:<root>.K2 visibility:private [final]' type=<root>.K2 origin=null
receiver: GET_VAR '<this>: <root>.TestK2 declared in <root>.TestK2.foo' type=<root>.TestK2 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>.IFoo
$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>.IFoo
$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>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK3 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK3
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK3 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK3 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FIELD DELEGATE name:TestK3$IFoo$delegate type:<root>.K3 visibility:private [final]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.K3' type=<root>.K3 origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.TestK3) returnType:kotlin.String
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.TestK3
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.TestK3'
CALL 'public open fun foo (): kotlin.String [fake_override] declared in <root>.K3' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:TestK3$IFoo$delegate type:<root>.K3 visibility:private [final]' type=<root>.K3 origin=null
receiver: GET_VAR '<this>: <root>.TestK3 declared in <root>.TestK3.foo' type=<root>.TestK3 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>.IFoo
$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>.IFoo
$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>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:TestK4 modality:FINAL visibility:public superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestK4
CONSTRUCTOR visibility:public <> () returnType:<root>.TestK4 [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK4 modality:FINAL visibility:public superTypes:[<root>.IFoo]'
FIELD DELEGATE name:TestK4$IFoo$delegate type:<root>.K4 visibility:private [final]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.K4' type=<root>.K4 origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.TestK4) returnType:kotlin.String
overridden:
public abstract fun foo (): kotlin.String declared in <root>.IFoo
$this: VALUE_PARAMETER name:<this> type:<root>.TestK4
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.TestK4'
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
CALL 'public open fun foo (): kotlin.String? declared in <root>.K4' type=kotlin.String? origin=null
$this: GET_FIELD 'FIELD DELEGATE name:TestK4$IFoo$delegate type:<root>.K4 visibility:private [final]' type=<root>.K4 origin=null
receiver: GET_VAR '<this>: <root>.TestK4 declared in <root>.TestK4.foo' type=<root>.TestK4 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>.IFoo
$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>.IFoo
$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>.IFoo
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -125,6 +125,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/classes/enumWithSecondaryCtor.kt");
}
@TestMetadata("implicitNotNullOnDelegatedImplementation.kt")
public void testImplicitNotNullOnDelegatedImplementation() throws Exception {
runTest("compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("compiler/testData/ir/irText/classes/initBlock.kt");