Replace with safe calls forbidden for comparisons #KT-13432 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-08-22 14:57:31 +03:00
parent 1fbd6678a5
commit c07906fac4
5 changed files with 16 additions and 19 deletions
@@ -0,0 +1,12 @@
// "Replace with safe (?.) call" "false"
// ERROR: Infix call corresponds to a dot-qualified call 'p1.compareTo(p2)' which is not allowed on a nullable receiver 'p1'. Use '?.'-qualified call instead
// ACTION: Add non-null asserted (!!) call
// ACTION: Flip '>'
// ACTION: Replace overloaded operator with function call
class SafeType {
operator fun compareTo(other : SafeType) = 0
}
fun safeA(p1: SafeType?, p2: SafeType) {
val v8 = p1 <caret>> p2
}