Fix for KT-14330 java.lang.IllegalArgumentException: Parameter specified as non-null is null: method ... parameter value
#KT-14330 Fixed
This commit is contained in:
@@ -181,7 +181,7 @@ class PropertyReferenceCodegen(
|
||||
if (KotlinBuiltIns.isUnit(key)) {
|
||||
return TypeProjectionImpl(key)
|
||||
}
|
||||
return TypeProjectionImpl(key.builtIns.anyType)
|
||||
return TypeProjectionImpl(key.builtIns.nullableAnyType)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
data class Foo(var bar: Int?)
|
||||
|
||||
fun box(): String {
|
||||
val receiver = Foo(1)
|
||||
Foo::bar.set(receiver, null)
|
||||
return if (receiver.bar == null) "OK" else "fail ${receiver.bar}"
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
var recivier : Any? = "fail"
|
||||
var value2 : Any? = "fail2"
|
||||
|
||||
var <T> T.bar : T
|
||||
get() = this
|
||||
set(value) { recivier = this; value2 = value}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
String?::bar.set(null, null)
|
||||
if (recivier != null) "fail 1: ${recivier}"
|
||||
if (value2 != null) "fail 2: ${value2}"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1992,6 +1992,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt14330.kt")
|
||||
public void testKt14330() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/property/kt14330.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt14330_2.kt")
|
||||
public void testKt14330_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/property/kt14330_2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6870_privatePropertyReference.kt")
|
||||
public void testKt6870_privatePropertyReference() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/property/kt6870_privatePropertyReference.kt");
|
||||
|
||||
Reference in New Issue
Block a user