KT-47939 fun interface constructor reference should throw NPE for null
This commit is contained in:
committed by
TeamCityServer
parent
e5eee9bab9
commit
0ccd7a7e0c
+10
-6
@@ -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))
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
+6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user