KT-47939 fun interface constructor reference should throw NPE for null

This commit is contained in:
Dmitry Petrov
2021-12-07 15:09:24 +03:00
committed by TeamCityServer
parent e5eee9bab9
commit 0ccd7a7e0c
15 changed files with 245 additions and 102 deletions
@@ -501,7 +501,7 @@ internal class AdapterGenerator(
callableReference.convertWithOffsets { startOffset: Int, endOffset: Int ->
// {
// fun <ADAPTER_FUN>(function: <FUN_TYPE>): <FUN_INTERFACE_TYPE> =
// <FUN_INTERFACE_TYPE>(function)
// <FUN_INTERFACE_TYPE>(function!!)
// ::<ADAPTER_FUN>
// }
@@ -581,12 +581,16 @@ internal class AdapterGenerator(
startOffset, endOffset,
listOf(
IrReturnImpl(
startOffset, endOffset, components.irBuiltIns.nothingType,
irAdapterFunction.symbol,
startOffset, endOffset, components.irBuiltIns.nothingType, irAdapterFunction.symbol,
IrTypeOperatorCallImpl(
startOffset, endOffset,
irSamType, IrTypeOperator.SAM_CONVERSION, irSamType,
IrGetValueImpl(startOffset, endOffset, irFunctionParameter.symbol)
startOffset, endOffset, irSamType, IrTypeOperator.SAM_CONVERSION, irSamType,
IrCallImpl(
startOffset, endOffset, irFunctionType, irBuiltIns.checkNotNullSymbol,
typeArgumentsCount = 1, valueArgumentsCount = 1, origin = IrStatementOrigin.EXCLEXCL
).apply {
putTypeArgument(0, irFunctionType)
putValueArgument(0, IrGetValueImpl(startOffset, endOffset, irFunctionParameter.symbol))
}
)
)
)
@@ -3602,6 +3602,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
public void testFunInterfaceConstructorEquality() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorEquality.kt");
}
@Test
@TestMetadata("funInterfaceConstructorThrowsNpe.kt")
public void testFunInterfaceConstructorThrowsNpe() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorThrowsNpe.kt");
}
}
@Nested
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.builtins.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.synthetic.FunctionInterfaceConstructorDescriptor
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.declarations.DescriptorMetadataSource
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
@@ -43,6 +44,8 @@ import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeProjectionImpl
import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS
class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) {
@@ -88,7 +91,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
statementGenerator.generateCallReceiver(
ktCallableReference,
resolvedDescriptor,
resolvedCall.dispatchReceiver, resolvedCall.extensionReceiver,resolvedCall.contextReceivers,
resolvedCall.dispatchReceiver, resolvedCall.extensionReceiver, resolvedCall.contextReceivers,
isSafe = false
).call { dispatchReceiverValue, extensionReceiverValue, _ ->
generateCallableReference(
@@ -119,7 +122,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
): IrExpression {
// {
// fun <ADAPTER_FUN>(function: <FUN_TYPE>): <FUN_INTERFACE_TYPE> =
// <FUN_INTERFACE_TYPE>(function)
// <FUN_INTERFACE_TYPE>(function!!)
// ::<ADAPTER_FUN>
// }
val startOffset = ktCallableReference.startOffsetSkippingComments
@@ -176,23 +179,40 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
irAdapterFun.dispatchReceiverParameter = null
irAdapterFun.extensionReceiverParameter = null
val irFnParameter = createAdapterParameter(startOffset, endOffset, functionParameter.name, 0, functionParameter.type)
val fnType = functionParameter.type
val irFnParameter = createAdapterParameter(startOffset, endOffset, functionParameter.name, 0, fnType)
val irFnType = irFnParameter.type
val checkNotNull = context.irBuiltIns.checkNotNullSymbol.descriptor
val checkNotNullSubstituted =
checkNotNull.substitute(
TypeSubstitutor.create(
mapOf(checkNotNull.typeParameters[0].typeConstructor to TypeProjectionImpl(fnType))
)
) ?: throw AssertionError("Substitution failed for $checkNotNull: T=$fnType")
irAdapterFun.valueParameters = listOf(irFnParameter)
irAdapterFun.body =
context.irFactory.createBlockBody(
startOffset, endOffset,
listOf(
IrReturnImpl(
startOffset, endOffset, context.irBuiltIns.nothingType,
irAdapterFun.symbol,
IrTypeOperatorCallImpl(
startOffset, endOffset,
irSamType, IrTypeOperator.SAM_CONVERSION, irSamType,
IrGetValueImpl(startOffset, endOffset, irFnParameter.symbol)
)
IrBlockBodyBuilder(
context,
Scope(irAdapterFun.symbol),
startOffset,
endOffset
).blockBody {
+irReturn(
irSamConversion(
irCall(context.irBuiltIns.checkNotNullSymbol).also { irCall ->
this@ReflectionReferencesGenerator.context.callToSubstitutedDescriptorMap[irCall] =
checkNotNullSubstituted
irCall.type = irFnType
irCall.putTypeArgument(0, irFnType)
irCall.putValueArgument(0, irGet(irFnParameter))
},
irSamType
)
)
)
}
}
}
}
@@ -317,6 +317,9 @@ fun IrBuilderWithScope.irImplicitCast(argument: IrExpression, type: IrType) =
fun IrBuilderWithScope.irReinterpretCast(argument: IrExpression, type: IrType) =
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.REINTERPRET_CAST, type, argument)
fun IrBuilderWithScope.irSamConversion(argument: IrExpression, type: IrType) =
typeOperator(type, argument, IrTypeOperator.SAM_CONVERSION, type)
fun IrBuilderWithScope.irInt(value: Int, type: IrType = context.irBuiltIns.intType) =
IrConstImpl.int(startOffset, endOffset, type, value)
@@ -96,9 +96,22 @@ class IrBuiltInsOverDescriptors(
val symbol = symbolTable.declareSimpleFunctionIfNotExists(operatorDescriptor) {
val operator = irFactory.createFunction(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, it, Name.identifier(name), DescriptorVisibilities.PUBLIC, Modality.FINAL,
returnType, isInline = false, isExternal = false, isTailrec = false, isSuspend = false,
isOperator = false, isInfix = false, isExpect = false, isFakeOverride = false
UNDEFINED_OFFSET,
UNDEFINED_OFFSET,
BUILTIN_OPERATOR,
it,
Name.identifier(name),
DescriptorVisibilities.PUBLIC,
Modality.FINAL,
returnType,
isInline = false,
isExternal = false,
isTailrec = false,
isSuspend = false,
isOperator = false,
isInfix = false,
isExpect = false,
isFakeOverride = false
)
operator.parent = operatorsPackageFragment
operatorsPackageFragment.declarations += operator
@@ -160,49 +173,53 @@ class IrBuiltInsOverDescriptors(
)
}
val typeParameterSymbol = IrTypeParameterSymbolImpl(typeParameterDescriptor)
val typeParameter = irFactory.createTypeParameter(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, typeParameterSymbol, Name.identifier("T0"), 0, true, Variance.INVARIANT
).apply {
superTypes += anyType
}
return symbolTable.declareSimpleFunctionIfNotExists(operatorDescriptor) { operatorSymbol ->
val typeParameter = symbolTable.declareGlobalTypeParameter(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
BUILTIN_OPERATOR,
typeParameterDescriptor
).apply {
superTypes += anyType
}
val typeParameterSymbol = typeParameter.symbol
val returnIrType = IrSimpleTypeBuilder().run {
classifier = typeParameterSymbol
kotlinType = returnKotlinType
hasQuestionMark = false
buildSimpleType()
}
val returnIrType = IrSimpleTypeBuilder().run {
classifier = typeParameterSymbol
kotlinType = returnKotlinType
hasQuestionMark = false
buildSimpleType()
}
val valueIrType = IrSimpleTypeBuilder().run {
classifier = typeParameterSymbol
kotlinType = valueKotlinType
hasQuestionMark = true
buildSimpleType()
}
val valueIrType = IrSimpleTypeBuilder().run {
classifier = typeParameterSymbol
kotlinType = valueKotlinType
hasQuestionMark = true
buildSimpleType()
}
return symbolTable.declareSimpleFunctionIfNotExists(operatorDescriptor) {
val operator = irFactory.createFunction(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, it, name, DescriptorVisibilities.PUBLIC, Modality.FINAL, returnIrType,
irFactory.createFunction(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR,
operatorSymbol, name,
DescriptorVisibilities.PUBLIC, Modality.FINAL,
returnIrType,
isInline = false, isExternal = false, isTailrec = false, isSuspend = false, isOperator = false, isInfix = false,
isExpect = false, isFakeOverride = false
)
operator.parent = operatorsPackageFragment
operatorsPackageFragment.declarations += operator
).also { operator ->
operator.parent = operatorsPackageFragment
operatorsPackageFragment.declarations += operator
val valueParameterSymbol = IrValueParameterSymbolImpl(valueParameterDescriptor)
val valueParameter = irFactory.createValueParameter(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, valueParameterSymbol, Name.identifier("arg0"), 0,
valueIrType, null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false
)
val valueParameterSymbol = IrValueParameterSymbolImpl(valueParameterDescriptor)
val valueParameter = irFactory.createValueParameter(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, valueParameterSymbol, Name.identifier("arg0"), 0,
valueIrType, null, isCrossinline = false, isNoinline = false, isHidden = false, isAssignable = false
)
valueParameter.parent = operator
typeParameter.parent = operator
valueParameter.parent = operator
typeParameter.parent = operator
operator.valueParameters += valueParameter
operator.typeParameters += typeParameter
operator
operator.valueParameters += valueParameter
operator.typeParameters += typeParameter
}
}.symbol
}
@@ -265,6 +282,7 @@ class IrBuiltInsOverDescriptors(
val string = builtIns.stringType
override val stringType = string.toIrType()
override val stringClass = builtIns.string.toIrSymbol()
// TODO: check if correct
override val charSequenceClass = findClass(Name.identifier("CharSequence"), "kotlin")!!
@@ -341,7 +359,8 @@ class IrBuiltInsOverDescriptors(
override val doubleArray = builtIns.getPrimitiveArrayClassDescriptor(PrimitiveType.DOUBLE).toIrSymbol()
override val booleanArray = builtIns.getPrimitiveArrayClassDescriptor(PrimitiveType.BOOLEAN).toIrSymbol()
override val primitiveArraysToPrimitiveTypes = PrimitiveType.values().associate { builtIns.getPrimitiveArrayClassDescriptor(it).toIrSymbol() to it }
override val primitiveArraysToPrimitiveTypes =
PrimitiveType.values().associate { builtIns.getPrimitiveArrayClassDescriptor(it).toIrSymbol() to it }
override val primitiveTypesToPrimitiveArrays = primitiveArraysToPrimitiveTypes.map { (k, v) -> v to k }.toMap()
override val primitiveArrayElementTypes = primitiveArraysToPrimitiveTypes.mapValues { primitiveTypeToIrType[it.value] }
override val primitiveArrayForType = primitiveArrayElementTypes.asSequence().associate { it.value to it.key }
@@ -353,16 +372,24 @@ class IrBuiltInsOverDescriptors(
}.toMap()
override val lessFunByOperandType = primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.LESS)
override val lessOrEqualFunByOperandType = primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.LESS_OR_EQUAL)
override val greaterOrEqualFunByOperandType = primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.GREATER_OR_EQUAL)
override val greaterFunByOperandType = primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.GREATER)
override val lessOrEqualFunByOperandType =
primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.LESS_OR_EQUAL)
override val greaterOrEqualFunByOperandType =
primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.GREATER_OR_EQUAL)
override val greaterFunByOperandType =
primitiveIrTypesWithComparisons.defineComparisonOperatorForEachIrType(BuiltInOperatorNames.GREATER)
override val ieee754equalsFunByOperandType =
primitiveFloatingPointIrTypes.map {
it.classifierOrFail to defineOperator(BuiltInOperatorNames.IEEE754_EQUALS, booleanType, listOf(it.makeNullable(), it.makeNullable()))
it.classifierOrFail to defineOperator(
BuiltInOperatorNames.IEEE754_EQUALS,
booleanType,
listOf(it.makeNullable(), it.makeNullable())
)
}.toMap()
val booleanNot = builtIns.boolean.unsubstitutedMemberScope.getContributedFunctions(Name.identifier("not"), NoLookupLocation.FROM_BACKEND).single()
val booleanNot =
builtIns.boolean.unsubstitutedMemberScope.getContributedFunctions(Name.identifier("not"), NoLookupLocation.FROM_BACKEND).single()
override val booleanNotSymbol = symbolTable.referenceSimpleFunction(booleanNot)
override val eqeqeqSymbol = defineOperator(BuiltInOperatorNames.EQEQEQ, booleanType, listOf(anyNType, anyNType))
@@ -371,8 +398,10 @@ class IrBuiltInsOverDescriptors(
override val throwIseSymbol = defineOperator(BuiltInOperatorNames.THROW_ISE, nothingType, listOf())
override val andandSymbol = defineOperator(BuiltInOperatorNames.ANDAND, booleanType, listOf(booleanType, booleanType))
override val ororSymbol = defineOperator(BuiltInOperatorNames.OROR, booleanType, listOf(booleanType, booleanType))
override val noWhenBranchMatchedExceptionSymbol = defineOperator(BuiltInOperatorNames.NO_WHEN_BRANCH_MATCHED_EXCEPTION, nothingType, listOf())
override val illegalArgumentExceptionSymbol = defineOperator(BuiltInOperatorNames.ILLEGAL_ARGUMENT_EXCEPTION, nothingType, listOf(stringType))
override val noWhenBranchMatchedExceptionSymbol =
defineOperator(BuiltInOperatorNames.NO_WHEN_BRANCH_MATCHED_EXCEPTION, nothingType, listOf())
override val illegalArgumentExceptionSymbol =
defineOperator(BuiltInOperatorNames.ILLEGAL_ARGUMENT_EXCEPTION, nothingType, listOf(stringType))
override val checkNotNullSymbol = defineCheckNotNullOperator()
@@ -476,7 +505,7 @@ class IrBuiltInsOverDescriptors(
}
}
private fun <T: Any> getFunctionsByKey(
private fun <T : Any> getFunctionsByKey(
name: Name,
vararg packageNameSegments: String,
makeKey: (SimpleFunctionDescriptor) -> T?
@@ -1129,7 +1129,7 @@ fun SymbolTable.noUnboundLeft(message: String) {
assert(unbound.isEmpty()) {
"$message\n" +
unbound.joinToString("\n") {
"$it ${it.signature?.toString() ?: "(NON-PUBLIC API)"}: ${it.descriptor}"
"${it::class.simpleName} $it ${it.signature?.toString() ?: "(NON-PUBLIC API)"}: ${it.descriptor}"
}
}
}
@@ -0,0 +1,32 @@
// !LANGUAGE: +KotlinFunInterfaceConstructorReference
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// DONT_TARGET_EXACT_BACKEND: JVM
// ^ old JVM BE generates bogus code
// FILE: funInterfaceConstructorThrowsNpe.kt
fun interface KSupplier<T> {
fun get(): T
}
val ks: (() -> String) -> KSupplier<String> =
::KSupplier
fun box(): String {
try {
ks(J.fn)
return "ks(null) should throw NPE"
} catch (e: NullPointerException) {
return "OK"
}
}
// FILE: J.java
import kotlin.jvm.functions.Function0;
public class J {
public static Function0<String> fn = null;
}
@@ -65,7 +65,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test1a visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable>
BLOCK_BODY
@@ -76,7 +78,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1a.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1a.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test1b visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction<<root>.KRunnable>
BLOCK_BODY
@@ -87,7 +91,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1b.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1b.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>>
BLOCK_BODY
@@ -98,7 +104,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test2a visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>>
BLOCK_BODY
@@ -109,7 +117,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2a.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=EXCLEXCL
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2a.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a' type=kotlin.reflect.KFunction1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>>
BLOCK_BODY
@@ -120,7 +130,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function1<kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3' type=kotlin.reflect.KFunction1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test3a visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>>
BLOCK_BODY
@@ -131,7 +143,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3a.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function1<kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3a.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a' type=kotlin.reflect.KFunction1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test3b visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction<<root>.KConsumer<kotlin.String>>
BLOCK_BODY
@@ -142,5 +156,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3b.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=EXCLEXCL
<T0>: kotlin.Function1<kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>.test3b.KConsumer' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b' type=kotlin.reflect.KFunction1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -19,7 +19,7 @@ fun interface KConsumer<T : Any?> {
fun test1(): KFunction1<Function0<Unit>, KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return function /*-> KRunnable */
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
@@ -29,7 +29,7 @@ fun test1(): KFunction1<Function0<Unit>, KRunnable> {
fun test1a(): KFunction1<Function0<Unit>, KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return function /*-> KRunnable */
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
@@ -39,7 +39,7 @@ fun test1a(): KFunction1<Function0<Unit>, KRunnable> {
fun test1b(): KFunction<KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return function /*-> KRunnable */
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
@@ -49,7 +49,7 @@ fun test1b(): KFunction<KRunnable> {
fun test2(): Function1<Function0<String>, KSupplier<String>> {
return { // BLOCK
local fun KSupplier(function: Function0<String>): KSupplier<String> {
return function /*-> KSupplier<String> */
return CHECK_NOT_NULL<Function0<String>>(arg0 = function) /*-> KSupplier<String> */
}
::KSupplier
@@ -59,7 +59,7 @@ fun test2(): Function1<Function0<String>, KSupplier<String>> {
fun test2a(): Function1<Function0<String>, KSupplier<String>> {
return { // BLOCK
local fun KSupplier(function: Function0<String>): KSupplier<String> {
return function /*-> KSupplier<String> */
return CHECK_NOT_NULL<Function0<String>>(arg0 = function) /*-> KSupplier<String> */
}
::KSupplier
@@ -69,7 +69,7 @@ fun test2a(): Function1<Function0<String>, KSupplier<String>> {
fun test3(): Function1<Function1<String, Unit>, KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<String, Unit>): KConsumer<String> {
return function /*-> KConsumer<String> */
return CHECK_NOT_NULL<Function1<String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
@@ -79,7 +79,7 @@ fun test3(): Function1<Function1<String, Unit>, KConsumer<String>> {
fun test3a(): Function1<Function1<String, Unit>, KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<String, Unit>): KConsumer<String> {
return function /*-> KConsumer<String> */
return CHECK_NOT_NULL<Function1<String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
@@ -89,7 +89,7 @@ fun test3a(): Function1<Function1<String, Unit>, KConsumer<String>> {
fun test3b(): KFunction<KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<String, Unit>): KConsumer<String> {
return function /*-> KConsumer<String> */
return CHECK_NOT_NULL<Function1<String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
@@ -65,7 +65,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test1a visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable>
BLOCK_BODY
@@ -76,7 +78,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1a.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1a.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test1b visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction<<root>.KRunnable>
BLOCK_BODY
@@ -87,7 +91,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1b.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.Unit> origin=null
<T0>: kotlin.Function0<kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.Unit> declared in <root>.test1b.KRunnable' type=kotlin.Function0<kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KRunnable (function: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>.test1b' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.Unit>, <root>.KRunnable> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>>
BLOCK_BODY
@@ -98,7 +104,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=null
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test2a visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>>
BLOCK_BODY
@@ -109,7 +117,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a'
TYPE_OP type=<root>.KSupplier<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KSupplier<kotlin.String>
GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2a.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function0<kotlin.String> origin=null
<T0>: kotlin.Function0<kotlin.String>
arg0: GET_VAR 'function: kotlin.Function0<kotlin.String> declared in <root>.test2a.KSupplier' type=kotlin.Function0<kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun KSupplier (function: kotlin.Function0<kotlin.String>): <root>.KSupplier<kotlin.String> declared in <root>.test2a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function0<kotlin.String>, <root>.KSupplier<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>>
BLOCK_BODY
@@ -120,7 +130,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
<T0>: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test3a visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Function1<kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>>
BLOCK_BODY
@@ -131,7 +143,9 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3a.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
<T0>: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3a.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
FUN name:test3b visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction<<root>.KConsumer<kotlin.String>>
BLOCK_BODY
@@ -142,5 +156,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b'
TYPE_OP type=<root>.KConsumer<kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.KConsumer<kotlin.String>
GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3b.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
<T0>: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>
arg0: GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in <root>.test3b.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null
FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): <root>.KConsumer<kotlin.String> declared in <root>.test3b' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, <root>.KConsumer<kotlin.String>> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget=<same>
@@ -19,7 +19,7 @@ typealias KCS = KConsumer<String>
fun test1(): KFunction1<@ParameterName(name = "function") Function0<Unit>, KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return function /*-> KRunnable */
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
@@ -29,7 +29,7 @@ fun test1(): KFunction1<@ParameterName(name = "function") Function0<Unit>, KRunn
fun test1a(): KFunction1<@ParameterName(name = "function") Function0<Unit>, KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return function /*-> KRunnable */
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
@@ -39,7 +39,7 @@ fun test1a(): KFunction1<@ParameterName(name = "function") Function0<Unit>, KRun
fun test1b(): KFunction<KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return function /*-> KRunnable */
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
@@ -49,7 +49,7 @@ fun test1b(): KFunction<KRunnable> {
fun test2(): Function1<Function0<String>, KSupplier<String>> {
return { // BLOCK
local fun KSupplier(function: Function0<String>): KSupplier<String> {
return function /*-> KSupplier<String> */
return CHECK_NOT_NULL<Function0<String>>(arg0 = function) /*-> KSupplier<String> */
}
::KSupplier
@@ -59,7 +59,7 @@ fun test2(): Function1<Function0<String>, KSupplier<String>> {
fun test2a(): Function1<Function0<String>, KSupplier<String>> {
return { // BLOCK
local fun KSupplier(function: Function0<String>): KSupplier<String> {
return function /*-> KSupplier<String> */
return CHECK_NOT_NULL<Function0<String>>(arg0 = function) /*-> KSupplier<String> */
}
::KSupplier
@@ -69,7 +69,7 @@ fun test2a(): Function1<Function0<String>, KSupplier<String>> {
fun test3(): Function1<Function1<String, Unit>, KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer<String> {
return function /*-> KConsumer<String> */
return CHECK_NOT_NULL<Function1<@ParameterName(name = "x") String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
@@ -79,7 +79,7 @@ fun test3(): Function1<Function1<String, Unit>, KConsumer<String>> {
fun test3a(): Function1<Function1<String, Unit>, KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer<String> {
return function /*-> KConsumer<String> */
return CHECK_NOT_NULL<Function1<@ParameterName(name = "x") String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
@@ -89,7 +89,7 @@ fun test3a(): Function1<Function1<String, Unit>, KConsumer<String>> {
fun test3b(): KFunction<KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer<String> {
return function /*-> KConsumer<String> */
return CHECK_NOT_NULL<Function1<@ParameterName(name = "x") String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
@@ -3518,6 +3518,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testFunInterfaceConstructor() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructor.kt");
}
@Test
@TestMetadata("funInterfaceConstructorThrowsNpe.kt")
public void testFunInterfaceConstructorThrowsNpe() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorThrowsNpe.kt");
}
}
@Nested
@@ -3602,6 +3602,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
public void testFunInterfaceConstructorEquality() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorEquality.kt");
}
@Test
@TestMetadata("funInterfaceConstructorThrowsNpe.kt")
public void testFunInterfaceConstructorThrowsNpe() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorThrowsNpe.kt");
}
}
@Nested
@@ -3078,6 +3078,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructor.kt");
}
@TestMetadata("funInterfaceConstructorThrowsNpe.kt")
public void ignoreFunInterfaceConstructorThrowsNpe() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorThrowsNpe.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@@ -2514,7 +2514,7 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
public class FunInterfaceConstructor {
@Test
public void testAllFilesPresentInFunInterfaceConstructor() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/funInterfaceConstructor"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/funInterfaceConstructor"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test