mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Use NoScopeRecordCliBindingTrace as default trace in GenerationUtils
NB we use 'Intrinsics.areEqual(Double, Double)' and
'Intrinsics.areEqual(Float, Float)', because right now we take
nullability from the inferred type of the expression (which is 'Any?' in
the test cases).
We should probably reconsider this in case of more exact information
available from the data flow analysis, e.g., in case of
fun test(x: Any?) =
x is Serializable && x is Double? && x == 0.0
We statically know that 'x' is not null in 'x == 0.0' (although it's
neither nullability of it's numeric type 'Double?' nor the nullability
of the inferred type 'Any?').
There might be some edge effects in the performance related to byte code
size and preventive unboxing and so on.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double?) a == b else null!!
|
||||
|
||||
fun equals6(a: Any?, b: Any?) = if (a is Double? && b is Double) a == b else null!!
|
||||
@@ -17,7 +18,5 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 1 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z
|
||||
// 1 areEqual \(DLjava/lang/Double;\)Z
|
||||
// 1 areEqual \(Ljava/lang/Double;D\)Z
|
||||
// 3 areEqual \(Ljava/lang/Double;Ljava/lang/Double;\)Z
|
||||
// 3 areEqual
|
||||
|
||||
@@ -19,4 +19,5 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 0 areEqual
|
||||
// 3 areEqual \(Ljava/lang/Object;Ljava/lang/Object;\)Z
|
||||
// 3 areEqual
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float?) a == b else null!!
|
||||
|
||||
fun equals6(a: Any?, b: Any?) = if (a is Float? && b is Float) a == b else null!!
|
||||
@@ -17,7 +18,5 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 1 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z
|
||||
// 1 areEqual \(FLjava/lang/Float;\)Z
|
||||
// 1 areEqual \(Ljava/lang/Float;F\)Z
|
||||
// 3 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z
|
||||
// 3 areEqual
|
||||
|
||||
@@ -19,4 +19,5 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 0 areEqual
|
||||
// 3 areEqual \(Ljava/lang/Object;Ljava/lang/Object;\)Z
|
||||
// 3 areEqual
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
fun box(): String {
|
||||
val plusZero: Any = 0.0
|
||||
val minusZero: Any = -0.0
|
||||
|
||||
@@ -28,4 +28,5 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 0 areEqual
|
||||
// 4 areEqual \(Ljava/lang/Object;Ljava/lang/Object;\)Z
|
||||
// 4 areEqual
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
fun box(): String {
|
||||
val nullValue: Any? = null
|
||||
val nullDouble: Double? = null
|
||||
|
||||
@@ -26,4 +26,5 @@ fun box(): String {
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
// 0 areEqual
|
||||
// 4 areEqual \(Ljava/lang/Object;Ljava/lang/Object;\)Z
|
||||
// 4 areEqual
|
||||
|
||||
Reference in New Issue
Block a user