Fix NPE caused by nullability checks optimizations
Mostly this commit replaces instances of original BasicValue from ASM
with ones of StrictBasicValue having strict equals implementation
Optimization issue was related to non-symmetric 'equals':
- NotNullBasicValue("java/lang/Object").equals(BasicValue("java/lang/Object")) == false
- BasicValue("java/lang/Object").equals(NotNullBasicValue("java/lang/Object")) == true
#KT-14242 Fixed
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// See KT-14242
|
||||
var x = 1
|
||||
fun box(): String {
|
||||
val any: Any? = when (1) {
|
||||
x -> null
|
||||
else -> Any()
|
||||
}
|
||||
|
||||
// Must not be NPE here
|
||||
val hashCode = any?.hashCode()
|
||||
|
||||
return hashCode?.toString() ?: "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user