Change .hashCode() to .bar() for some nullability fixes tests
Hash code can be no more used because in 1.3 we have nullable extension. This fixes two wrap with safe let call tests and one surround with null check test.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
// "Surround with null check" "true"
|
// "Surround with null check" "true"
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
fun Int.bar() = this
|
||||||
|
|
||||||
fun foo(arg: Int?) {
|
fun foo(arg: Int?) {
|
||||||
run(fun() = arg<caret>.hashCode())
|
run(fun() = arg<caret>.bar())
|
||||||
}
|
}
|
||||||
+3
-1
@@ -1,8 +1,10 @@
|
|||||||
// "Surround with null check" "true"
|
// "Surround with null check" "true"
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
fun Int.bar() = this
|
||||||
|
|
||||||
fun foo(arg: Int?) {
|
fun foo(arg: Int?) {
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
run(fun() = arg.hashCode())
|
run(fun() = arg.bar())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,4 +6,6 @@
|
|||||||
// ACTION: Replace with safe (?.) call
|
// ACTION: Replace with safe (?.) call
|
||||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||||
|
|
||||||
fun foo(arg: Int?) = arg<caret>.hashCode()
|
fun Int.bar() = this
|
||||||
|
|
||||||
|
fun foo(arg: Int?) = arg<caret>.bar()
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
// "Wrap with '?.let { ... }' call" "false"
|
// "Wrap with '?.let { ... }' call" "false"
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// ACTION: Add non-null asserted (!!) call
|
// ACTION: Add non-null asserted (!!) call
|
||||||
// ACTION: Introduce local variable
|
|
||||||
// ACTION: Replace with safe (?.) call
|
// ACTION: Replace with safe (?.) call
|
||||||
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int?
|
||||||
|
|
||||||
|
fun Int.bar() {}
|
||||||
|
|
||||||
class My(var x: Int?) {
|
class My(var x: Int?) {
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
x<caret>.hashCode()
|
x<caret>.bar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user