diff --git a/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt b/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt index 6c3aeb0c785..59b1953e9d6 100644 --- a/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt +++ b/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt @@ -2,5 +2,5 @@ package foo fun test() { Int::toByte - String::length + String::get } diff --git a/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.out b/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.out index 28791c792e4..ac5b7610718 100644 --- a/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.out +++ b/compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.out @@ -1,7 +1,7 @@ compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt:4:5: error: callable references for builtin members are not supported yet: 'Int::toByte' Int::toByte ^ -compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt:5:5: error: callable references for builtin members are not supported yet: 'String::length' - String::length +compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.kt:5:5: error: callable references for builtin members are not supported yet: 'String::get' + String::get ^ COMPILATION_ERROR diff --git a/compiler/testData/codegen/box/classes/innerClass.kt b/compiler/testData/codegen/box/classes/innerClass.kt index 55e807c14ea..8f43233aa95 100644 --- a/compiler/testData/codegen/box/classes/innerClass.kt +++ b/compiler/testData/codegen/box/classes/innerClass.kt @@ -1,7 +1,7 @@ class Outer(val foo: StringBuilder) { inner class Inner() { fun len() : Int { - return foo.length() + return foo.length } } diff --git a/compiler/testData/codegen/box/classes/kt940.kt b/compiler/testData/codegen/box/classes/kt940.kt index ebefd2ccaba..a81d971ffba 100644 --- a/compiler/testData/codegen/box/classes/kt940.kt +++ b/compiler/testData/codegen/box/classes/kt940.kt @@ -4,8 +4,8 @@ fun box() : String { val w = object : Comparator { override fun compare(o1 : String?, o2 : String?) : Int { - val l1 : Int = o1?.length() ?: 0 - val l2 = o2?.length() ?: 0 + val l1 : Int = o1?.length ?: 0 + val l2 = o2?.length ?: 0 return l1 - l2 } diff --git a/compiler/testData/codegen/box/closures/captureExtensionReceiver.kt b/compiler/testData/codegen/box/closures/captureExtensionReceiver.kt index 7018c749d54..bd78f48b9ef 100644 --- a/compiler/testData/codegen/box/closures/captureExtensionReceiver.kt +++ b/compiler/testData/codegen/box/closures/captureExtensionReceiver.kt @@ -3,12 +3,12 @@ interface B { } fun String.foo() = object : B { - override val bar: String = length().toString() + override val bar: String = length.toString() } class C { - fun String.extension() = this.length() + fun String.extension() = this.length fun String.fooInClass() = object : B { override val bar: String = extension().toString() diff --git a/compiler/testData/codegen/box/controlStructures/doWhile.kt b/compiler/testData/codegen/box/controlStructures/doWhile.kt index 8e04ad4fea2..f9b776c736c 100644 --- a/compiler/testData/codegen/box/controlStructures/doWhile.kt +++ b/compiler/testData/codegen/box/controlStructures/doWhile.kt @@ -8,7 +8,7 @@ fun box(): String { if (y != 5) return "Fail 2 $y" var z = "" - do { z += z.length() } while (z.length() < 5) + do { z += z.length } while (z.length < 5) if (z != "01234") return "Fail 3 $z" return "OK" diff --git a/compiler/testData/codegen/box/controlStructures/kt3273.kt b/compiler/testData/codegen/box/controlStructures/kt3273.kt index 9754ca8f5b8..187dc50ecf8 100644 --- a/compiler/testData/codegen/box/controlStructures/kt3273.kt +++ b/compiler/testData/codegen/box/controlStructures/kt3273.kt @@ -12,7 +12,7 @@ public fun testCoalesce() { else -> "Hello world" } - printlnMock(value.length()) + printlnMock(value.length) } fun box(): String { diff --git a/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt b/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt index c575e75a7f6..65a1868cf89 100644 --- a/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt +++ b/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt @@ -34,7 +34,7 @@ object StringHandler { fun box(): String { val a = A() a.foo = 42 - a.foo = a.foo + baz.length() + a.foo = a.foo + baz.length a.foo = 239 A.bar = baz + a.foo baz + A.bar diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt index 2aeeaa87138..00c6818a8ff 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringEscape.kt @@ -6,7 +6,7 @@ fun escapeChar(c : Char) : String? = when (c) { } tailrec fun String.escape(i : Int = 0, result : StringBuilder = StringBuilder()) : String = - if (i == length()) result.toString() + if (i == length) result.toString() else escape(i + 1, result.append(escapeChar(get(i)))) fun box() : String { diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt index 068cf1a576b..5cfd4e59e17 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/realStringRepeat.kt @@ -4,5 +4,5 @@ tailrec fun String.repeat(num : Int, acc : StringBuilder = StringBuilder()) : St fun box() : String { val s = "a".repeat(10000) - return if (s.length() == 10000) "OK" else "FAIL: ${s.length()}" + return if (s.length == 10000) "OK" else "FAIL: ${s.length}" } diff --git a/compiler/testData/codegen/box/extensionFunctions/whenFail.kt b/compiler/testData/codegen/box/extensionFunctions/whenFail.kt index e26924496c1..b4c5842b24c 100644 --- a/compiler/testData/codegen/box/extensionFunctions/whenFail.kt +++ b/compiler/testData/codegen/box/extensionFunctions/whenFail.kt @@ -1,5 +1,5 @@ fun StringBuilder.takeFirst(): Char { - if (this.length() == 0) return 0.toChar() + if (this.length == 0) return 0.toChar() val c = this.get(0) this.deleteCharAt(0) return c diff --git a/compiler/testData/codegen/box/intrinsics/compareTo.kt b/compiler/testData/codegen/box/intrinsics/compareTo.kt index c2eae39fc2c..ae6fe3f4ef0 100644 --- a/compiler/testData/codegen/box/intrinsics/compareTo.kt +++ b/compiler/testData/codegen/box/intrinsics/compareTo.kt @@ -11,6 +11,6 @@ fun box(): String { } } - if (sb.length() == 0) return "OK" + if (sb.length == 0) return "OK" return "Fail:\n$sb" } diff --git a/compiler/testData/codegen/box/intrinsics/stringFromCollection.kt b/compiler/testData/codegen/box/intrinsics/stringFromCollection.kt index 0abb5e5a043..daacb2d0131 100644 --- a/compiler/testData/codegen/box/intrinsics/stringFromCollection.kt +++ b/compiler/testData/codegen/box/intrinsics/stringFromCollection.kt @@ -2,6 +2,6 @@ fun box(): String { val list = java.util.ArrayList() list.add("0") list[0][0] - list[0].length() + list[0].length return "OK" } diff --git a/compiler/testData/codegen/box/primitiveTypes/kt684.kt b/compiler/testData/codegen/box/primitiveTypes/kt684.kt index adad3994920..90a792730b5 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt684.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt684.kt @@ -6,7 +6,7 @@ fun escapeChar(c : Char) : String? = when (c) { } fun String.escape(i : Int = 0, result : String = "") : String = - if (i == length()) result + if (i == length) result else escape(i + 1, result + escapeChar(get(i))) fun box() : String { @@ -19,7 +19,7 @@ fun box() : String { System.out?.println("}"); System.out?.println(); System.out?.println("fun String.escape(i : Int = 0, result : String = \"\") : String ="); - System.out?.println(" if (i == length()) result"); + System.out?.println(" if (i == length) result"); System.out?.println(" else escape(i + 1, result + escapeChar(this.get(i)))"); System.out?.println(); System.out?.println("fun main(args : Array) {"); diff --git a/compiler/testData/codegen/box/properties/kt3556.kt b/compiler/testData/codegen/box/properties/kt3556.kt index 6d480831de5..adce0368131 100644 --- a/compiler/testData/codegen/box/properties/kt3556.kt +++ b/compiler/testData/codegen/box/properties/kt3556.kt @@ -3,7 +3,7 @@ class Test { private val b : String get() = a fun outer() : Int { - return b.length() + return b.length } } diff --git a/compiler/testData/codegen/box/safeCall/kt247.kt b/compiler/testData/codegen/box/safeCall/kt247.kt index ccf66fbaf76..55a7fbe74f8 100644 --- a/compiler/testData/codegen/box/safeCall/kt247.kt +++ b/compiler/testData/codegen/box/safeCall/kt247.kt @@ -1,7 +1,7 @@ fun t1() : Boolean { val s1 : String? = "sff" val s2 : String? = null - return s1?.length() == 3 && s2?.length() == null + return s1?.length == 3 && s2?.length == null } fun t2() : Boolean { diff --git a/compiler/testData/codegen/box/strings/kt3571.kt b/compiler/testData/codegen/box/strings/kt3571.kt index 28346ef232f..960a37656a0 100644 --- a/compiler/testData/codegen/box/strings/kt3571.kt +++ b/compiler/testData/codegen/box/strings/kt3571.kt @@ -1,6 +1,6 @@ class Thing(delegate: CharSequence) : CharSequence by delegate fun box(): String { - val l = Thing("hello there").length() + val l = Thing("hello there").length return if (l == 11) "OK" else "Fail $l" } diff --git a/compiler/testData/codegen/box/strings/kt5956.kt b/compiler/testData/codegen/box/strings/kt5956.kt index 4a514d35813..037ee9ac1dc 100644 --- a/compiler/testData/codegen/box/strings/kt5956.kt +++ b/compiler/testData/codegen/box/strings/kt5956.kt @@ -4,7 +4,7 @@ class Thing(val delegate: CharSequence) : CharSequence { override fun get(index: Int): Char { throw UnsupportedOperationException() } - override fun length(): Int = 0 + override val length: Int get() = 0 override fun subSequence(start: Int, end: Int) = delegate.subSequence(start, end) } diff --git a/compiler/testData/codegen/box/strings/multilineStringsWithTemplates.kt b/compiler/testData/codegen/box/strings/multilineStringsWithTemplates.kt index bc9f1daa504..38e661755cd 100644 --- a/compiler/testData/codegen/box/strings/multilineStringsWithTemplates.kt +++ b/compiler/testData/codegen/box/strings/multilineStringsWithTemplates.kt @@ -14,7 +14,7 @@ fun box() : String { val test5 = """ - ${s.length()} + ${s.length} """ if (test5 != "\n 3\n") return "Fail 5: $test5" diff --git a/compiler/testData/codegen/box/super/kt4982.kt b/compiler/testData/codegen/box/super/kt4982.kt index 73b7df5c660..8c01d8f2212 100644 --- a/compiler/testData/codegen/box/super/kt4982.kt +++ b/compiler/testData/codegen/box/super/kt4982.kt @@ -13,7 +13,7 @@ fun box(): String { override fun condition(): Boolean { result = "OK" - return result.length() == 2 + return result.length== 2 } } diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java index 486b274dcab..a09e486d203 100644 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java +++ b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java @@ -2,16 +2,6 @@ import java.lang.*; import java.util.*; public class Test { - public static class IterableImpl implements Iterable { - public Iterator iterator() { return new IteratorImpl(); } - } - - public static class IteratorImpl implements Iterator { - public boolean hasNext() { return false; } - public String next() { return null; } - public void remove() { } - } - public static class MapEntryImpl implements Map.Entry { public String getKey() { return null; } public String getValue() { return null; } diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt index b63591c3be1..8332b235eda 100644 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt +++ b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt @@ -1,14 +1,8 @@ -class MyIterable : Test.IterableImpl() -class MyIterator : Test.IteratorImpl() +//class MyIterable : Test.IterableImpl() +//class MyIterator : Test.IteratorImpl() class MyMapEntry : Test.MapEntryImpl() fun box(): String { - MyIterable().iterator() - - val a = MyIterator() - a.hasNext() - a.next() - a.remove() val b = MyMapEntry() b.getKey() diff --git a/compiler/testData/codegen/boxWithStdlib/callableReference/function/listOfStringsMapLength.kt b/compiler/testData/codegen/boxWithStdlib/callableReference/function/listOfStringsMapLength.kt index 1e1deb2df86..060cdb78c15 100644 --- a/compiler/testData/codegen/boxWithStdlib/callableReference/function/listOfStringsMapLength.kt +++ b/compiler/testData/codegen/boxWithStdlib/callableReference/function/listOfStringsMapLength.kt @@ -1,2 +1,2 @@ fun box(): String = - if (listOf("abc", "de", "f").map(String::length) == listOf(3, 2, 1)) "OK" else "Fail" + if (listOf("abc", "de", "f").map(String::length.getter) == listOf(3, 2, 1)) "OK" else "Fail" diff --git a/compiler/testData/codegen/properties/propertyReceiverOnStack.kt b/compiler/testData/codegen/properties/propertyReceiverOnStack.kt index e94155ce0d6..3c9efcff1f8 100644 --- a/compiler/testData/codegen/properties/propertyReceiverOnStack.kt +++ b/compiler/testData/codegen/properties/propertyReceiverOnStack.kt @@ -1,6 +1,6 @@ class Evaluator(val expr: StringBuilder) { fun evaluateArg(): Int { - return expr.length() + return expr.length } } diff --git a/compiler/testData/diagnostics/tests/Casts.kt b/compiler/testData/diagnostics/tests/Casts.kt index 0e6d1a3fe01..7e320605db1 100644 --- a/compiler/testData/diagnostics/tests/Casts.kt +++ b/compiler/testData/diagnostics/tests/Casts.kt @@ -16,8 +16,8 @@ fun test() : Unit { checkSubtype(y as? Int?) val s = "" as Any - ("" as String?)?.length() - (data@("" as String?))?.length() - (@MustBeDocumented()( "" as String?))?.length() + ("" as String?)?.length + (data@("" as String?))?.length + (@MustBeDocumented()( "" as String?))?.length Unit } diff --git a/compiler/testData/diagnostics/tests/LateInit.kt b/compiler/testData/diagnostics/tests/LateInit.kt index 5720eeb4d0a..fd6ea57f61c 100644 --- a/compiler/testData/diagnostics/tests/LateInit.kt +++ b/compiler/testData/diagnostics/tests/LateInit.kt @@ -60,6 +60,6 @@ public class B { lateinit var a: String init { - a.length() + a.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/MultilineStringTemplates.kt b/compiler/testData/diagnostics/tests/MultilineStringTemplates.kt index 3ec9a7931c7..715007c246c 100644 --- a/compiler/testData/diagnostics/tests/MultilineStringTemplates.kt +++ b/compiler/testData/diagnostics/tests/MultilineStringTemplates.kt @@ -14,7 +14,7 @@ fun box() : String { val test5 = """ - ${s.length()} + ${s.length} """ if (test5 != "\n 3\n") return "Fail 5: $test5" diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt index 6c8e2c23e34..eed2f114ab8 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt @@ -19,7 +19,7 @@ class SomeClass { get() = "A" } -fun @receiver:Ann String.length2() = length() +fun @receiver:Ann String.length2() = length val @receiver:Ann String.extensionProperty: String get() = "A" \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt index 6da7eaec881..d6a4b3406e5 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt @@ -3,7 +3,7 @@ import kotlin.reflect.* val String.countCharacters: Int - get() = length() + get() = length var Int.meaning: Long get() = 42L diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturnInWhen.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturnInWhen.kt index e5487348b98..48419b7ba07 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturnInWhen.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturnInWhen.kt @@ -1,6 +1,6 @@ fun illegalWhenBlock(a: Any): Int { when(a) { is Int -> return a - is String -> return a.length() + is String -> return a.length } } diff --git a/compiler/testData/diagnostics/tests/dataFlow/assignment/kt6118.kt b/compiler/testData/diagnostics/tests/dataFlow/assignment/kt6118.kt index 9f1f0d3b629..1bf7d691182 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/assignment/kt6118.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/assignment/kt6118.kt @@ -3,14 +3,14 @@ fun foo(o: Any) { if (o is String) { val s = o as String - s.length() + s.length } } fun foo1(o: Any) { if (o is String) { - o.length() + o.length val s = o - s.length() + s.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValIsCheck.kt b/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValIsCheck.kt index eba5c0adf39..832f95b6945 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValIsCheck.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValIsCheck.kt @@ -1,12 +1,12 @@ fun test(a: Any?, flag: Boolean, x: Any?) { if (a !is String) return - a.length() + a.length val b: Any? if (flag) { b = a - b.length() + b.length } else { b = x diff --git a/compiler/testData/diagnostics/tests/dataFlow/assignment/when.kt b/compiler/testData/diagnostics/tests/dataFlow/assignment/when.kt index 8abde6098a9..924aca7f012 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/assignment/when.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/assignment/when.kt @@ -2,7 +2,7 @@ fun test(a: Any?) { when (a) { is String -> { val s = a - s.length() + s.length } "" -> { val s = a diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInMemberOfLocalClass.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInMemberOfLocalClass.kt index d006d747b35..89af7b42b1b 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInMemberOfLocalClass.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInMemberOfLocalClass.kt @@ -6,8 +6,8 @@ fun test(x: Any) { if (y !is String) return class Local { init { - x.length() - y.length() + x.length + y.length } } } diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassProperty.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassProperty.kt index 2644c4672ef..8d09ffa2c17 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassProperty.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassProperty.kt @@ -2,10 +2,10 @@ fun test(x: Any?) { if (x !is String) return class C { - val v = x.length() + val v = x.length val vGet: Int - get() = x.length() + get() = x.length val s: String = x } diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt index 7af5e48315b..ff9561985a0 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt @@ -1,7 +1,7 @@ fun foo(x: Any?) { if (x is String) { object : Base(x) { - fun bar() = x.length() + fun bar() = x.length } } } diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/NestedLocalClass.kt b/compiler/testData/diagnostics/tests/dataFlow/local/NestedLocalClass.kt index 9d168dc906e..3f2459f062e 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/NestedLocalClass.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/NestedLocalClass.kt @@ -4,7 +4,7 @@ fun test(x: Any) { class LocalOuter { inner class Local { init { - x.length() + x.length } } } diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt4332WhenBranches.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt4332WhenBranches.kt index 356300a8ab5..55f39e060d2 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt4332WhenBranches.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt4332WhenBranches.kt @@ -3,7 +3,7 @@ fun testWhen(t: String?, x: String?): Int { return when { t == null -> 0 - x == null -> t.length() // Wrong error report here. t can be inferred as not-null. (And it actually does if you replace when with if/else if) - else -> (t + x).length() + x == null -> t.length // Wrong error report here. t can be inferred as not-null. (And it actually does if you replace when with if/else if) + else -> (t + x).length } } diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/ScopeCheck.kt b/compiler/testData/diagnostics/tests/functionAsExpression/ScopeCheck.kt index b36419582fa..c7976fa07ac 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/ScopeCheck.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/ScopeCheck.kt @@ -8,7 +8,7 @@ fun test(param: String) { val local_val = 4 val bar = fun B.(fun_param: Int) { - param.length() + param.length b_fun() val inner_bar = local_val + fun_param diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.kt index 5049a26602a..ff76e5ca639 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.kt @@ -1,13 +1,13 @@ fun foo(x: T) { if (x is String?) { - x.length() + x.length if (x != null) { - x.length() + x.length } } if (x is String) { - x.length() + x.length } } diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt index af08791e7f9..b2c3edb509b 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt @@ -11,8 +11,8 @@ fun foo(x: T) { if (x != null) { if (x != null) {} - x.length() - x?.length() + x.length + x?.length x.bar1() x.bar2() @@ -23,11 +23,11 @@ fun foo(x: T) { x?.bar1() } - x.length() + x.length if (x is String) { - x.length() - x?.length() + x.length + x?.length x.bar1() x.bar2() @@ -35,8 +35,8 @@ fun foo(x: T) { } if (x is CharSequence) { - x.length() - x?.length() + x.length + x?.length x.bar1() x.bar2() diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt index 01a2fbdcc31..5781f113101 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt @@ -10,8 +10,8 @@ fun T.foo() { if (this != null) { if (this != null) {} - length() - this?.length() + length + this?.length bar1() bar2() @@ -22,11 +22,11 @@ fun T.foo() { this?.bar1() } - length() + length if (this is String) { - length() - this?.length() + length + this?.length bar1() bar2() diff --git a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt index 73f2cfe025d..fd99a22e995 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt @@ -8,11 +8,11 @@ fun T.bar3() {} fun T.let(f: (T) -> R): R = f(this) fun foo(x: T) { - x.length() - x?.length() + x.length + x?.length if (1 == 1) { - x!!.length() + x!!.length } @@ -24,5 +24,5 @@ fun foo(x: T) { x.bar3() - x?.let { it.length() } + x?.let { it.length } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt index d1794639129..a68067cba50 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt @@ -5,7 +5,7 @@ package n import java.util.* fun test() { - val foo = arrayList("").map { it -> it.length() }.fold(0, { x, y -> Math.max(x, y) }) + val foo = arrayList("").map { it -> it.length }.fold(0, { x, y -> Math.max(x, y) }) checkSubtype(foo) checkSubtype(foo) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2484.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2484.kt index 231c8f79721..6071cfac1b9 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2484.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2484.kt @@ -8,11 +8,11 @@ fun Array.forEach(operation: (T) -> Unit) : Unit { for (element in this) fun bar(operation: (String) -> Unit) = operation("") fun main(args: Array) { - args.forEach { a : String -> a.length() } // Type mismatch: (String) -> Unit required, (String) -> Int found - args.forEach { a -> a.length() } // Type mismatch: (String) -> Unit required, (String) -> Int found - args.forEach { it.length() } // This works! + args.forEach { a : String -> a.length } // Type mismatch: (String) -> Unit required, (String) -> Int found + args.forEach { a -> a.length } // Type mismatch: (String) -> Unit required, (String) -> Int found + args.forEach { it.length } // This works! - bar { a: String -> a.length() } - bar { a -> a.length() } - bar { it.length() } + bar { a: String -> a.length } + bar { a -> a.length } + bar { it.length } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt index 21606fd366c..afebc4c5fdc 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt @@ -9,8 +9,8 @@ import java.util.* fun foo(lines: List) { val w = max(lines, comparator {o1, o2 -> - val l1 : Int = o1.length() // Types of o1 and o2 are ERROR - val l2 = o2.length() + val l1 : Int = o1.length // Types of o1 and o2 are ERROR + val l2 = o2.length l1 - l2 }).sure() checkSubtype(w) diff --git a/compiler/testData/diagnostics/tests/inline/labeled.kt b/compiler/testData/diagnostics/tests/inline/labeled.kt index 283e5b7b18d..0599469f5e1 100644 --- a/compiler/testData/diagnostics/tests/inline/labeled.kt +++ b/compiler/testData/diagnostics/tests/inline/labeled.kt @@ -2,11 +2,11 @@ inline fun foo(bar1: (String.() -> Int) -> Int, bar2: (()->Int) -> Int) { bar1 label@ { - this@label.length() + this@label.length } bar1 { - this.length() + this.length } //unmute after KT-4247 fix //bar1 { diff --git a/compiler/testData/diagnostics/tests/j+k/SupertypeArgumentsNullability-SpecialTypes.kt b/compiler/testData/diagnostics/tests/j+k/SupertypeArgumentsNullability-SpecialTypes.kt index 55a63591ff5..1823253b9b3 100644 --- a/compiler/testData/diagnostics/tests/j+k/SupertypeArgumentsNullability-SpecialTypes.kt +++ b/compiler/testData/diagnostics/tests/j+k/SupertypeArgumentsNullability-SpecialTypes.kt @@ -15,6 +15,6 @@ public class Y extends X { // FILE: test.kt fun main() { - Y().foo().length() + Y().foo().length Y().bar(null) } diff --git a/compiler/testData/diagnostics/tests/j+k/kt1730_implementCharSequence.txt b/compiler/testData/diagnostics/tests/j+k/kt1730_implementCharSequence.txt index ef123c384ff..83585c73223 100644 --- a/compiler/testData/diagnostics/tests/j+k/kt1730_implementCharSequence.txt +++ b/compiler/testData/diagnostics/tests/j+k/kt1730_implementCharSequence.txt @@ -2,20 +2,20 @@ package public open class C : kotlin.CharSequence { public constructor C() + public open override /*1*/ val length: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @java.lang.Override() public open override /*1*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - @java.lang.Override() public open override /*1*/ fun length(): kotlin.Int @java.lang.Override() public open override /*1*/ fun subSequence(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): kotlin.CharSequence @java.lang.Override() public open override /*1*/ fun toString(): kotlin.String } public final class T : C { public constructor T() + public open override /*1*/ /*fake_override*/ val length: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @java.lang.Override() public open override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - @java.lang.Override() public open override /*1*/ /*fake_override*/ fun length(): kotlin.Int @java.lang.Override() public open override /*1*/ /*fake_override*/ fun subSequence(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): kotlin.CharSequence @java.lang.Override() public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/labels/kt4247.kt b/compiler/testData/diagnostics/tests/labels/kt4247.kt index 96dca2c2bfd..4160394e1f0 100644 --- a/compiler/testData/diagnostics/tests/labels/kt4247.kt +++ b/compiler/testData/diagnostics/tests/labels/kt4247.kt @@ -2,10 +2,10 @@ fun foo(bar1: (String.() -> Int) -> Int) { bar1 { - this.length() + this.length } bar1 { - this@bar1.length() + this@bar1.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt index 3aa126df2df..0e6ad442ad7 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt @@ -5,18 +5,18 @@ package kt244 fun f(s: String?) { if (s != null) { - s.length() //ok - var i = s.length() //error: Only safe calls are allowed on a nullable receiver - System.out.println(s.length()) //error + s.length //ok + var i = s.length //error: Only safe calls are allowed on a nullable receiver + System.out.println(s.length) //error } } // more tests class A(a: String?) { - val b = if (a != null) a.length() else 1 + val b = if (a != null) a.length else 1 init { if (a != null) { - val c = a.length() + val c = a.length } } @@ -24,7 +24,7 @@ class A(a: String?) { init { if (a is String) { - i = a.length() + i = a.length } else { i = 3 diff --git a/compiler/testData/diagnostics/tests/overload/kt7068.kt b/compiler/testData/diagnostics/tests/overload/kt7068.kt index 7a988fe4bf7..cc337d40b11 100644 --- a/compiler/testData/diagnostics/tests/overload/kt7068.kt +++ b/compiler/testData/diagnostics/tests/overload/kt7068.kt @@ -8,10 +8,10 @@ fun withLambda(o : Int, block : Int.(String) -> Unit) { fun test() { withLambda { - it.length() + it.length } withLambda { r -> // no error should be here - r.length() + r.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/overload/kt7068_2.kt b/compiler/testData/diagnostics/tests/overload/kt7068_2.kt index fe95127b85d..d038ee2264f 100644 --- a/compiler/testData/diagnostics/tests/overload/kt7068_2.kt +++ b/compiler/testData/diagnostics/tests/overload/kt7068_2.kt @@ -8,10 +8,10 @@ fun withLambda(block : Int.(String, String) -> Unit) { fun test() { withLambda { r -> - r.length() + r.length } withLambda { x, y -> - x.length() + y.length() + x.length + y.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/dereference.kt b/compiler/testData/diagnostics/tests/platformTypes/dereference.kt index 9a2af0559b2..78a8bfaae72 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/dereference.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/dereference.kt @@ -21,8 +21,8 @@ fun test(j: J) { j.j()!!.j() val ann = j.foo() - ann!!.length() - ann.length() + ann!!.length + ann.length val a = j.foo() a!!.j() diff --git a/compiler/testData/diagnostics/tests/platformTypes/elvis.kt b/compiler/testData/diagnostics/tests/platformTypes/elvis.kt index c3facb9e32b..ce6b32105a7 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/elvis.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/elvis.kt @@ -12,5 +12,5 @@ public class J { import p.* fun test(j: J) { - j.s()?.length() ?: "" + j.s()?.length ?: "" } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/inferenceInConditionals.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/inferenceInConditionals.kt index a35af95498a..fe37a7510fb 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/inferenceInConditionals.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/inferenceInConditionals.kt @@ -14,7 +14,7 @@ public class J { // FILE: k.kt fun safeCall(c: J?) { - c?.nn()?.length() + c?.nn()?.length } fun ifelse(c: J): Any? { diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt index 04c35b7a7ba..672e15d006f 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt @@ -16,7 +16,7 @@ public class J { fun foo(collection: Collection) { val mapped = collection.map { it.method() } - mapped[0].length() + mapped[0].length } public fun Iterable.map(transform: (T) -> R): List { diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.kt b/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.kt index 4ffd831a9ed..268c905ad05 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.kt @@ -4,6 +4,6 @@ fun foo() { val list = ArrayList() for (s in list) { - s.length() + s.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/safeCall.kt b/compiler/testData/diagnostics/tests/platformTypes/safeCall.kt index 5cfe19ee5bd..9c38f26a63d 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/safeCall.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/safeCall.kt @@ -11,5 +11,5 @@ public class J { import p.* fun test(j: J) { - j.s()?.length().checkType { _() } + j.s()?.length.checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt index 6fcbf059c48..e88fb877e9d 100644 --- a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt +++ b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt @@ -9,7 +9,7 @@ fun takeFirst(expr: StringBuilder): Char { } fun evaluateArg(expr: CharSequence, numbers: ArrayList): Int { - if (expr.length() == 0) throw Exception("Syntax error: Character expected"); + if (expr.length == 0) throw Exception("Syntax error: Character expected"); val c = takeFirst(expr) if (c >= '0' && c <= '9') { val n = c - '0' @@ -22,7 +22,7 @@ fun evaluateArg(expr: CharSequence, numbers: ArrayList): Int { fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateArg(expr, numbers) - if (expr.length() > 0) { + if (expr.length > 0) { } return lhs @@ -30,7 +30,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) - if (expr.length() > 0) { + if (expr.length > 0) { val c = expr.get(0) expr.deleteCharAt(0) } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet121.kt b/compiler/testData/diagnostics/tests/regressions/Jet121.kt index 5e4c5140413..b062181aaa9 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet121.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet121.kt @@ -3,7 +3,7 @@ package jet121 fun box() : String { val answer = apply("OK") { get(0) - length() + length } return if (answer == 2) "OK" else "FAIL" diff --git a/compiler/testData/diagnostics/tests/regressions/kt549.kt b/compiler/testData/diagnostics/tests/regressions/kt549.kt index 7de6508c75b..872ae3bc2a4 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt549.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt549.kt @@ -11,7 +11,7 @@ package demo } fun main(args : Array) { - for (a in filter(args, {it.length() > 1})) { + for (a in filter(args, {it.length > 1})) { System.out.println("Hello, ${a}!") } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt580.kt b/compiler/testData/diagnostics/tests/regressions/kt580.kt index 5512d5604f0..460aa8cc956 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt580.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt580.kt @@ -11,9 +11,9 @@ fun main() { val diffs = ArrayList() for (i in vals.indices) { for (j in i..vals.lastIndex()) // Type inference failed - diffs.add(vals[i].length() - vals[j].length()) + diffs.add(vals[i].length - vals[j].length) for (j in i..vals.lastIndex) // Type inference failed - diffs.add(vals[i].length() - vals[j].length()) + diffs.add(vals[i].length - vals[j].length) } } diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/kt5971NestedSafeCall.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/kt5971NestedSafeCall.kt index 3fdd642668b..33850f62a61 100644 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/kt5971NestedSafeCall.kt +++ b/compiler/testData/diagnostics/tests/resolve/nestedCalls/kt5971NestedSafeCall.kt @@ -5,5 +5,5 @@ fun foo(i: Int) {} fun test(s: String?) { - foo(s?.length()) + foo(s?.length) } diff --git a/compiler/testData/diagnostics/tests/scopes/kt939.kt b/compiler/testData/diagnostics/tests/scopes/kt939.kt index e2e8773b1be..6abc2f93dfa 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt939.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt939.kt @@ -3,16 +3,16 @@ package kt939 //KT-939 CommonSupertypes erases scopes associated to types fun compare(o1 : String?, o2 : String?) : Int { - val l1 = o1?.length() ?: 0 - val l2 = o2?.length() ?: 0 + val l1 = o1?.length ?: 0 + val l2 = o2?.length ?: 0 return l1 - l2 // '-' is unresolved, because the type of l1 is Int with an empty member scope } //KT-1117 Unresolved reference to multiply sign fun test() { - (System.getProperty("path.separator")?.length() ?: 4) * 55 + 5 + (System.getProperty("path.separator")?.length ?: 4) * 55 + 5 - val x = System.getProperty("path.separator")?.length() ?: 4 + val x = System.getProperty("path.separator")?.length ?: 4 x * 55 + 5 } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/dataFlowInDelegationCall.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/dataFlowInDelegationCall.kt index 207b99c9d00..201565f32c4 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/dataFlowInDelegationCall.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/dataFlowInDelegationCall.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER class A { constructor(x: Any, y: Any, z: Any) - constructor(x: String?, y: String?): this(x!!, x.length().toString() + y!!, "") { - x.length() + y.length() + constructor(x: String?, y: String?): this(x!!, x.length.toString() + y!!, "") { + x.length + y.length } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt index 134e0881e8a..eb251bd4f95 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt @@ -34,7 +34,7 @@ enum class D(val prop: Int) { }; constructor(): this(1) - constructor(x: String): this(x.length()) + constructor(x: String): this(x.length) abstract fun f(): Int } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/varargsInDelegationCallToSecondary.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/varargsInDelegationCallToSecondary.kt index 1dfd9cfe6af..61e925abad9 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/varargsInDelegationCallToSecondary.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/varargsInDelegationCallToSecondary.kt @@ -2,7 +2,7 @@ fun array(vararg x: T): Array = null!! open class B(x: Int) { - constructor(vararg y: String): this(y[0].length()) + constructor(vararg y: String): this(y[0].length) } class A : B { diff --git a/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt b/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt index 94778fe7ac0..cc0b0e0dd27 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt @@ -3,7 +3,7 @@ package foo fun dispatch(request: Request) { val url = request.getRequestURI() as String - if (request.getMethod()?.length() != 0) { + if (request.getMethod()?.length != 0) { } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvisRHS.kt b/compiler/testData/diagnostics/tests/smartCasts/elvisRHS.kt index 8a061d3f413..f886778d875 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvisRHS.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvisRHS.kt @@ -5,6 +5,6 @@ fun foo(p1: String?, p2: String?) { if (p2 != null) { val v = p1 ?: p2 - val size = v.length() + val size = v.length } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt5427.kt b/compiler/testData/diagnostics/tests/smartCasts/kt5427.kt index b1380b47ff9..73adfd31365 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt5427.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt5427.kt @@ -1,5 +1,5 @@ fun foo(p: String?): Int { // We should get smart cast here val x = if (p != null) { p } else "a" - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt5455.kt b/compiler/testData/diagnostics/tests/smartCasts/kt5455.kt index dfd04d194b2..6543540d5f8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt5455.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt5455.kt @@ -1,7 +1,7 @@ //KT-5455 Need warning about redundant type cast fun foo(o: Any): Int { if (o is String) { - return (o as String).length() + return (o as String).length } return -1 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt6819.kt b/compiler/testData/diagnostics/tests/smartCasts/kt6819.kt index d32ad6dbb29..c84703a834f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt6819.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt6819.kt @@ -1,7 +1,7 @@ public fun test(o: String?): Boolean { return when { - // Data flow info should propagate from o == null to o.length() - o == null, o.length() == 0 -> false + // Data flow info should propagate from o == null to o.length + o == null, o.length == 0 -> false else -> true } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.kt index 8eff15ae074..abb353c048b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.kt @@ -2,10 +2,10 @@ public fun foo(x: String?, y: String?): Int { while (true) { val z = x ?: if (y == null) break else y // z is not null in both branches - z.length() + z.length // y is nullable if x != null - y.length() + y.length } // y is null because of the break - return y.length() + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.kt index 4b1a967af17..8d2e0fcbce7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.kt @@ -7,11 +7,11 @@ public fun foo(x: String?): Int { null -> break@loop "abc" -> return 0 "xyz" -> return 1 - else -> x.length() + else -> x.length } // y is always Int after when checkSubtype(y) } // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.kt index aedf50d9a19..aa16e758b8d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.kt @@ -8,9 +8,9 @@ public fun foo(x: String?, z: String?, w: String?): Int { gav(w!!, if (x == null) break else x, z!!) } while (bar()) // w is not null because of w!! - w.length() + w.length // z is nullable despite of z!! - z.length() + z.length // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.kt index 117c46815b2..40e2d5e07e7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.kt @@ -7,7 +7,7 @@ public fun foo(x: String?, z: String?): Int { gav(if (x == null) break else x, z!!) } while (bar()) // z is nullable despite of z!! - z.length() + z.length // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.kt index 7299be8a01a..fffb1a2748f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.kt @@ -10,5 +10,5 @@ public fun foo(x: String?): Int { } while (bar()) y.hashCode() // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.kt index 6f96d3e035e..3d3edceb5be 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.kt @@ -7,7 +7,7 @@ public fun foo(x: String?, z: String?): Int { gav(z!!, if (x == null) break else x) } while (bar()) // z is not null because of z!! - z.length() + z.length // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.kt index 4801b8e1c6c..8def8cd1832 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.kt @@ -8,9 +8,9 @@ public fun foo(x: String?, z: String?, w: String?): Int { gav(z!!, w!!, if (x == null) break else x) } while (bar()) // w is not null because of w!! - w.length() + w.length // z is not null because of z!! - z.length() + z.length // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhile.kt index f9edd050ac7..9db6b9d161a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhile.kt @@ -3,9 +3,9 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // See KT-6283 do { - p!!.length() + p!!.length } while (!x()) // Do-while loop is executed at least once, so // p should be not null here - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileBreak.kt index 93e6a31aa59..cb5f34b05e6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileBreak.kt @@ -3,9 +3,9 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // See KT-6283 do { - p!!.length() + p!!.length if (p == "abc") break } while (!x()) // p should be smart casted despite of break - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileContinue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileContinue.kt index 6ec3d7cd88d..70d4ed9f855 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileContinue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileContinue.kt @@ -3,9 +3,9 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // See KT-6283 do { - p!!.length() + p!!.length if (p == "abc") continue } while (!x()) // p should be smart casted despite of continue - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt index d29465267e6..bb247bf53d4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt @@ -6,8 +6,8 @@ public fun foo(p: String?): Int { do { if (y()) break // We do not always reach this statement - p!!.length() + p!!.length } while (!x()) // Here we have do while loop but p is still nullable due to break before - return p.length() + return p.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyContinue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyContinue.kt index 834c9810bbd..dc1d3eff4d7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyContinue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyContinue.kt @@ -6,8 +6,8 @@ public fun foo(p: String?): Int { do { if (y()) continue // We do not always reach this statement - p!!.length() + p!!.length } while (!x()) // Here we have do while loop but p is still nullable due to continue before - return p.length() + return p.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInCondition.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInCondition.kt index 37f53f7c59a..0168e834b70 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInCondition.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInCondition.kt @@ -1,5 +1,5 @@ fun foo(s: String?): Int { do { - } while (s!!.length() > 0) - return s.length() + } while (s!!.length > 0) + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt index c72697a2b63..705c0b7bedf 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt @@ -3,7 +3,7 @@ fun bar(): Boolean { return true } fun foo(s: String?): Int { do { if (bar()) break - } while (s!!.length() > 0) + } while (s!!.length > 0) // This call is unsafe due to break - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt index e392871c41c..829b9ba539e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt @@ -3,8 +3,8 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // Exotic variant with unused literal do { -> - p!!.length() + p!!.length } while (!x()) - // Literal is not called so p.length() is unsafe - return p.length() + // Literal is not called so p.length is unsafe + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt index 1afadbba96d..2fef8ba84eb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt @@ -6,5 +6,5 @@ public fun foo(p: String?): Int { if (p != null) break } while (!x()) // p can be null despite of the break - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNull.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNull.kt index 3661b746aa9..4ca47a42fef 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNull.kt @@ -1,5 +1,5 @@ fun foo(s: String?): Int { do { } while (s==null) - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt index 04aa0fa09f2..96fc41f637f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt @@ -5,5 +5,5 @@ fun foo(s: String?): Int { if (bar()) break } while (s==null) // This call is unsafe due to break - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.kt index 56b08a3d058..f788080cbe0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.kt @@ -3,8 +3,8 @@ public fun foo(x: String?): Int { // After the check, smart cast should work x ?: break // x is not null in both branches - x.length() + x.length } while (true) // x is null because of the break - return x.length() + return x.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt index e48a55cabeb..b8b04d502f4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt @@ -2,8 +2,8 @@ public fun foo(x: String?, y: String?): Int { while (true) { x ?: if (y == null) break // y is nullable if x != null - y.length() + y.length } // y is null because of the break - return y.length() + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisInsideDoWhile.kt index e2af3839253..5bb737bf6b4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisInsideDoWhile.kt @@ -1,9 +1,9 @@ public fun foo(x: String?): Int { do { // After the check, smart cast should work - x ?: x!!.length() + x ?: x!!.length // x is not null in both branches - if (x.length() == 0) break + if (x.length == 0) break } while (true) - return x.length() + return x.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt index 68f8d3c9318..45024dd6817 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt @@ -2,8 +2,8 @@ public fun foo(x: String?, y: String?): Int { while (true) { (if (x != null) break else y) ?: y!! // y is not null in both branches but it's hard to determine - y.length() + y.length } // y can be null because of the break - return y.length() + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBlockInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBlockInsideDoWhile.kt index 065de3bb90c..b2d957d7677 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBlockInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBlockInsideDoWhile.kt @@ -5,8 +5,8 @@ public fun foo(p: String?, y: String?): Int { "null".toString() break } - y.length() - p!!.length() + y.length + p!!.length } while (true) - return y?.length() ?: -1 + return y?.length ?: -1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.kt index 65127af0d98..2bd253b2b5b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.kt @@ -10,5 +10,5 @@ public fun foo(x: String?): Int { } while (bar()) y.hashCode() // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.kt index 04fbcf20ece..864cce83de3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.kt @@ -6,5 +6,5 @@ public fun foo(x: String?): Int { // In future we can infer this initialization y.hashCode() // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.kt index f49853906d2..66ab61be372 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.kt @@ -3,8 +3,8 @@ public fun foo(x: String?): Int { // After the check, smart cast should work val y = if (x == null) break else x // y is not null in both branches - y.length() + y.length } // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifElseBlockInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifElseBlockInsideDoWhile.kt index 147d24f3769..5f4aa488db4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifElseBlockInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifElseBlockInsideDoWhile.kt @@ -3,13 +3,13 @@ public fun foo(x: String?, y: String?): Int { // After the check, smart cast should work if (x != null) { if (x == "abc") break - y!!.length() + y!!.length } else { - y!!.length() + y!!.length } // y!! in both branches - y.length() + y.length } while (true) // break is possible before so !! is necessary - return y!!.length() + return y!!.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifInsideDoWhile.kt index 95255ffb557..09617b6a02c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifInsideDoWhile.kt @@ -2,8 +2,8 @@ public fun foo(p: String?, y: String?): Int { do { // After the check, smart cast should work if (y == null) break - y.length() - p!!.length() + y.length + p!!.length } while (true) - return y?.length() ?: -1 + return y?.length ?: -1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.kt index a2b387ea0b4..973e37beb7b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.kt @@ -2,10 +2,10 @@ public fun foo(x: String?, y: String?): Int { while (true) { val z = (if (y == null) break else x) ?: y // z is not null in both branches - z.length() + z.length // y is not null in both branches - y.length() + y.length } // y is null because of the break - return y.length() + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhile.kt index 198527ac83b..3ff6ed8c64b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhile.kt @@ -3,11 +3,11 @@ fun x(): Boolean { return true } public fun foo(p: String?, r: String?): Int { do { do { - p!!.length() + p!!.length } while (r == null) } while (!x()) // Auto cast possible - r.length() + r.length // Auto cast possible - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhileWithLongContinue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhileWithLongContinue.kt index 679917a47fb..03414db1732 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhileWithLongContinue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedDoWhileWithLongContinue.kt @@ -3,12 +3,12 @@ fun x(): Boolean { return true } public fun foo(p: String?, r: String?): Int { outer@ do { do { - p!!.length() + p!!.length if (!x()) continue@outer } while (r == null) } while (!x()) // Auto cast NOT possible due to long continue - r.length() + r.length // Auto cast possible - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoops.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoops.kt index 3ada0b572ec..9ff47125c8f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoops.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoops.kt @@ -2,16 +2,16 @@ fun x(): Boolean { return true } public fun foo(p: String?, r: String?, q: String?): Int { while(true) { - q!!.length() + q!!.length do { do { - p!!.length() + p!!.length } while (!x()) } while (r == null) if (!x()) break } // Smart cast is possible everywhere - r.length() - q.length() - return p.length() + r.length + q.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsShort.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsShort.kt index df00140b236..8708c945c5b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsShort.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsShort.kt @@ -2,14 +2,14 @@ fun x(): Boolean { return true } public fun foo(p: String?, r: String?, q: String?): Int { while(true) { - q!!.length() + q!!.length do { - p!!.length() + p!!.length } while (r == null) if (!x()) break } // Smart cast is possible everywhere - r.length() - q.length() - return p.length() + r.length + q.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithBreak.kt index 2f6e3ee37cb..bcb4c446a58 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithBreak.kt @@ -2,17 +2,17 @@ fun x(): Boolean { return true } public fun foo(p: String?, r: String?, q: String?): Int { while(true) { - q!!.length() + q!!.length do { while(true) { - p!!.length() + p!!.length if (x()) break } } while (r == null) if (!x()) break } // Smart cast is possible everywhere - r.length() - q.length() - return p.length() + r.length + q.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.kt index 14f8e570c8b..9bf4c32eaad 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.kt @@ -2,10 +2,10 @@ fun x(p: String): Boolean { return p == "abc" } public fun foo(p: String?, r: String?, q: String?): Int { while(true) { - q!!.length() + q!!.length loop@ do { while(true) { - p!!.length() + p!!.length if (x(p)) break@loop if (x(q)) break } @@ -13,8 +13,8 @@ public fun foo(p: String?, r: String?, q: String?): Int { if (!x(p)) break } // Long break allows r == null - r.length() + r.length // Smart cast is possible - q.length() - return p.length() + q.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongContinue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongContinue.kt index 1a760a84dc3..40cd3d5834f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongContinue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongContinue.kt @@ -2,18 +2,18 @@ fun x(): Boolean { return true } public fun foo(p: String?, r: String?, q: String?): Int { outer@ while(true) { - q!!.length() + q!!.length do { if (x()) continue@outer do { - p!!.length() + p!!.length } while (!x()) } while (r == null) if (!x()) break } // Smart cast is possible only for q - q.length() + q.length // But not possible for the others - r.length() - return p.length() + r.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.kt index 58ea8171145..127e6e429d2 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.kt @@ -10,7 +10,7 @@ public fun foo(x: String?): Int { null -> break@loop "abc" -> return 0 "xyz" -> return 1 - else -> x.length() + else -> x.length } // y is always Int after when checkSubtype(y) @@ -18,5 +18,5 @@ public fun foo(x: String?): Int { // y is always Int even here checkSubtype(y) // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallBreakInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallBreakInsideDoWhile.kt index 506c9f9cc42..c62b3d6407e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallBreakInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallBreakInsideDoWhile.kt @@ -3,12 +3,12 @@ fun foo(x: String): String? = x fun calc(x: String?, y: String?): Int { do { // Smart cast because of x!! in receiver - foo(x!!)?.subSequence(0, if (x.length() > 0) 5 else break) - y!!.length() + foo(x!!)?.subSequence(0, if (x.length > 0) 5 else break) + y!!.length // x is not null in condition but we do not see it yet - } while (x.length() > 0) + } while (x.length > 0) // y is nullable because of break - y.length() + y.length // x is not null, at least in theory - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallInsideDoWhile.kt index 3ef931c764d..47edff50dd5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/safeCallInsideDoWhile.kt @@ -3,10 +3,10 @@ fun foo(x: String): String? = x fun calc(x: String?): Int { do { // Smart cast because of x!! in receiver - foo(x!!)?.subSequence(0, x.length()) + foo(x!!)?.subSequence(0, x.length) // Smart cast because of x!! in receiver - if (x.length() == 0) break + if (x.length == 0) break } while (true) // Here x is also not null - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/useInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/useInsideDoWhile.kt index 16f6a8ee1c1..c446a982058 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/useInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/useInsideDoWhile.kt @@ -1,9 +1,9 @@ public fun foo(p: String?, y: String?): Int { do { // After this !!, y. should be smartcasted in loop as well as outside - y!!.length() + y!!.length if (p == null) break - y.length() + y.length } while (true) - return y.length() + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.kt index c0d8fc61ccd..d0194e6b524 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.kt @@ -4,9 +4,9 @@ public fun foo(x: String?): Int { null -> break@loop "abc" -> return 0 "xyz" -> return 1 - else -> x.length() + else -> x.length } } // x is null because of the break - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whenReturnInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whenReturnInsideWhileTrue.kt index e801f7c68b7..cab8591b812 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whenReturnInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whenReturnInsideWhileTrue.kt @@ -9,5 +9,5 @@ public fun foo(x: String?): Int { } // x is not null because of the break // but we are not able to detect it - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileInCondition.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileInCondition.kt index 3227b106fc1..fffa934a232 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileInCondition.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileInCondition.kt @@ -1,6 +1,6 @@ fun foo(s: String?): Int { - while (s!!.length() > 0) { - s.length() + while (s!!.length > 0) { + s.length } - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileInConditionWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileInConditionWithBreak.kt index 4a4b48bc8f3..7662105e626 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileInConditionWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileInConditionWithBreak.kt @@ -1,9 +1,9 @@ fun bar(): Boolean { return true } fun foo(s: String?): Int { - while (s!!.length() > 0) { - s.length() + while (s!!.length > 0) { + s.length if (bar()) break } - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNull.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNull.kt index 8e0032fb9ff..9cd3289ca20 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNull.kt @@ -1,5 +1,5 @@ fun foo(s: String?): Int { while (s==null) { } - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt index 67fcf190d18..156e85dcf9b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt @@ -5,5 +5,5 @@ fun foo(s: String?): Int { if (bar()) break } // Call is unsafe due to break - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt index a288a8f99d2..a0c7777ef01 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt @@ -2,9 +2,9 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { while(x()) { - p!!.length() + p!!.length if (x()) break } // p is nullable because it's possible loop body is not executed at all - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt index 54c15c22340..dc7d8aeae2b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt @@ -3,9 +3,9 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // Like whileTrue but 2 == 2 is in use while(2 == 2) { - p!!.length() + p!!.length if (x()) break } // Smart cast should not work in this case, see KT-6284 - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrue.kt index c2b38d32499..ef0e54cb0ae 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrue.kt @@ -3,10 +3,10 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // KT-6284 while(true) { - p!!.length() + p!!.length if (x()) break } // while (true) loop body is executed at least once // so p is not null here - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.kt index a5d79f870c6..9cce427adc7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.kt @@ -5,8 +5,8 @@ public fun foo(p: String?): Int { if (x()) break if (p==null) return -1 // p is not null - p.length() + p.length } // p can be null because break is earlier than return - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt index 963f56cc8d9..3a9b8232955 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt @@ -4,8 +4,8 @@ public fun foo(p: String?): Int { while(true) { if (x()) break // We do not always reach this statement - p!!.length() + p!!.length } // Here we have while (true) loop but p is nullable due to break before - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueReturn.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueReturn.kt index 96c9d2a91d0..a29256d9fe9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueReturn.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueReturn.kt @@ -5,9 +5,9 @@ public fun foo(p: String?): Int { if (p==null) return -1 if (x()) break // p is not null - p.length() + p.length } // while (true) loop body with return is executed at least once // so p is not null here - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.kt b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.kt index 9e11061b29c..31b5b252b98 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.kt @@ -7,5 +7,5 @@ abstract class A(val s: String) { fun foo(o: String?): Int { val a = object : A(o!!){} a.bar() - return o.length() + return o.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt index 2ced3f89cc8..6cbdc76ca22 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.kt @@ -5,7 +5,7 @@ public class X { public fun fn(): Int { if (y != null) // With non-default getter smartcast is not possible - return y.length() + return y.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/kt4409.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/kt4409.kt index e561417654d..1612dec16e6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/kt4409.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/kt4409.kt @@ -5,7 +5,7 @@ public interface A { public class B(override public val x: Any) : A { fun foo(): Int { if (x is String) { - return x.length() + return x.length } else { return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt index 7b4520f88ae..10449588bdd 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/otherModule.kt @@ -17,7 +17,7 @@ import a.X public fun X.gav(): Int { if (x != null) // Smart cast is not possible if definition is in another module - return x.length() + return x.length else return 0 } @@ -29,7 +29,7 @@ package a public fun X.gav(): Int { if (x != null) // Even if it's in the same package - return x.length() + return x.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/protected.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/protected.kt index 08ac5719d4f..5938c6ef746 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/protected.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/protected.kt @@ -3,7 +3,7 @@ public open class X { public fun fn(): Int { if (x != null) // Smartcast is possible for protected value property in the same class - return x.length() + return x.length else return 0 } @@ -12,6 +12,6 @@ public open class X { public class Y: X() { public fun bar(): Int { // Smartcast is possible even in derived class - return if (x != null) x.length() else 0 + return if (x != null) x.length else 0 } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/simple.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/simple.kt index 74d84052059..057bac1ee61 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/simple.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/simple.kt @@ -4,7 +4,7 @@ public class X { if (x != null) // Smartcast is possible because it's value property with default getter // used in the same module - return x.length() + return x.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt index 7b12ff2b7af..8b8e840c20a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.kt @@ -4,10 +4,10 @@ public class X { public fun fn(): Int { if (x != null) // Smartcast is not possible for variable properties - return x.length() + return x.length else if (y != null) // Even if they are private - return y.length() + return y.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.kt index bf551175f8f..e0bc7ea6e0e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.kt @@ -1,6 +1,6 @@ fun calc(x: List?): Int { // x should be non-null in arguments list, including inner call - x?.get(x.get(x.size - 1).length()) + x?.get(x.get(x.size - 1).length) // but not also here! return x.size } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/extension.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/extension.kt index cec0ecccfd6..37ac263e0ab 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/extension.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/extension.kt @@ -2,5 +2,5 @@ fun String.foo(arg: Int) = this[arg] fun calc(x: String?) { // x should be non-null in arguments list - x?.foo(x.length() - 1) + x?.foo(x.length - 1) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt index 05e303c791e..6a16153f6ca 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt @@ -2,5 +2,5 @@ fun String.bar(s: String) = s fun foo(s: String?) { s?.bar(s) - s?.get(s.length()) + s?.get(s.length) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.kt index bd114a24f58..47992c242fe 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.kt @@ -2,7 +2,7 @@ fun foo(x: String): String? = x fun calc(x: String?, y: String?): Int { // Smart cast because of y!! in receiver - x?.subSequence(y!!.subSequence(0, 1).length(), y.length()) + x?.subSequence(y!!.subSequence(0, 1).length, y.length) // No smart cast possible - return y.length() + return y.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideCall.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideCall.kt index bd716372771..a94da840c8e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideCall.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideCall.kt @@ -4,5 +4,5 @@ fun foo(y: Int): Int { fun calc(x: List?): Int { // x should be non-null in arguments list - return foo(x?.get(x.size - 1)!!.length()) + return foo(x?.get(x.size - 1)!!.length) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/property.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/property.kt index cc091c171bf..cae7573f388 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/property.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/property.kt @@ -1,6 +1,6 @@ data class MyClass(val x: String?) fun foo(y: MyClass): Int { - val z = y.x?.subSequence(0, y.x.length()) - return z?.length() ?: -1 + val z = y.x?.subSequence(0, y.x.length) + return z?.length ?: -1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiver.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiver.kt index 37b8d93dc99..dd51e96a060 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiver.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiver.kt @@ -2,7 +2,7 @@ fun foo(x: String): String? = x fun calc(x: String?): Int { // Smart cast because of x!! in receiver - foo(x!!)?.subSequence(0, x.length()) + foo(x!!)?.subSequence(0, x.length) // Smart cast because of x!! in receiver - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChain.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChain.kt index 0d832764e9c..12b83f02cdb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChain.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChain.kt @@ -2,7 +2,7 @@ fun foo(x: String): String? = x fun calc(x: String?): Int { // Smart cast because of x!! in receiver - foo(x!!)?.subSequence(0, x.length())?.length() + foo(x!!)?.subSequence(0, x.length)?.length // Smart cast because of x!! in receiver - return x.length() + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt index 471e94ac0a9..0f3c1e2d2ef 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt @@ -2,7 +2,7 @@ fun foo(x: String): String? = x fun calc(x: String?, y: Int?): Int { // Smart cast because of x!! in receiver - foo(x!!)?.subSequence(y!!, x.length())?.length() + foo(x!!)?.subSequence(y!!, x.length)?.length // No smart cast possible return y } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/assignment.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/assignment.kt index 2d4fbf48c3b..c2b167db7f8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/assignment.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/assignment.kt @@ -2,9 +2,9 @@ fun foo() { var v: Any = 42 v.length() v = "abc" - v.length() + v.length v = 42 v.length() v = "abc" - v.length() + v.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/doWhileWithMiddleBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/doWhileWithMiddleBreak.kt index 603f5f77f34..95a78781df3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/doWhileWithMiddleBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/doWhileWithMiddleBreak.kt @@ -3,7 +3,7 @@ fun x(): Boolean { return true } public fun foo(pp: Any): Int { var p = pp do { - (p as String).length() + (p as String).length if (p == "abc") break p = 42 } while (!x()) diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhile.kt index 198103b38ea..73e308875ac 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhile.kt @@ -9,7 +9,7 @@ public fun foo(xx: Any): Int { y = "abc" } // y!! in both branches - y.length() + y.length } while (!(x is String)) - return x.length() + return x.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhileWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhileWithBreak.kt index 57226d4b288..1cc97318e41 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhileWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/ifElseBlockInsideDoWhileWithBreak.kt @@ -9,7 +9,7 @@ public fun foo(xx: Any): Int { y = "abc" } // y!! in both branches - y.length() + y.length } while (true) // We could have smart cast here but with break it's hard to detect return x.length() diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIs.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIs.kt index dec7ee43d4c..f71d500a469 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIs.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIs.kt @@ -1,5 +1,5 @@ public fun bar(s: String) { - System.out.println("Length of $s is ${s.length()}") + System.out.println("Length of $s is ${s.length}") } public fun foo() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsAnd.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsAnd.kt index a6c2d839660..6deccd56323 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsAnd.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsAnd.kt @@ -6,7 +6,7 @@ fun get(): Any { fun foo(): Int { var ss: Any = get() - return if (ss is String && ss.length() > 0) + return if (ss is String && ss.length > 0) 1 else 0 diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsChanged.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsChanged.kt index 89bb8a61ffc..577641ad08f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsChanged.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/ifVarIsChanged.kt @@ -1,5 +1,5 @@ public fun bar(s: String) { - System.out.println("Length of $s is ${s.length()}") + System.out.println("Length of $s is ${s.length}") } public fun foo() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt index c0b560d3c28..18fb6da5faa 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt @@ -1,7 +1,7 @@ class MyClass(var p: String?) fun bar(s: String): Int { - return s.length() + return s.length } fun foo(m: MyClass): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/propertyNotNeeded.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/propertyNotNeeded.kt index 4ee8c235c41..631449c8f14 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/propertyNotNeeded.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/propertyNotNeeded.kt @@ -1,7 +1,7 @@ class MyClass(var p: String?) fun bar(s: String?): Int { - return s?.length() ?: -1 + return s?.length ?: -1 } fun foo(m: MyClass): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/varAsUse.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/varAsUse.kt index 3d1c084c500..ab10dc7566d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/varAsUse.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/varAsUse.kt @@ -4,6 +4,6 @@ fun get(): Any { fun foo(): Int { var c: Any = get() - (c as String).length() - return c.length() // Previous line should make as unnecessary here. + (c as String).length + return c.length // Previous line should make as unnecessary here. } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/whileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/whileTrue.kt index 9333c060982..3bbf2191c1f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/whileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/whileTrue.kt @@ -3,7 +3,7 @@ fun x(): Boolean { return true } public fun foo(pp: Any): Int { var p = pp while(true) { - (p as String).length() + (p as String).length if (x()) break p = 42 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/whileWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/whileWithBreak.kt index 5babe4a7f82..664695deede 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/whileWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/whileWithBreak.kt @@ -7,7 +7,7 @@ fun list(start: String) { if (e==null) return while (e is String) { // Smart cast due to the loop condition - if (e.length() == 0) + if (e.length == 0) break // We still have smart cast here despite of a break e = e.next() diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.kt index b1f7ef5f918..1515296a1e4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.kt @@ -1,10 +1,10 @@ fun foo() { var v: String? = null - v.length() + v.length v = "abc" - v.length() + v.length v = null - v.length() + v.length v = "abc" - v.length() + v.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/doWhileWithMiddleBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/doWhileWithMiddleBreak.kt index f22c5f70fd0..acb36871a81 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/doWhileWithMiddleBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/doWhileWithMiddleBreak.kt @@ -3,10 +3,10 @@ fun x(): Boolean { return true } public fun foo(pp: String?): Int { var p = pp do { - p!!.length() + p!!.length if (p == "abc") break p = null } while (!x()) // Smart cast is NOT possible here - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNull.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNull.kt index df0d175e361..f4b95b5b07d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNull.kt @@ -1,5 +1,5 @@ public fun fooNotNull(s: String) { - System.out.println("Length of $s is ${s.length()}") + System.out.println("Length of $s is ${s.length}") } public fun foo() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNullAnd.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNullAnd.kt index be1b1d8a7d5..9b44f62be27 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNullAnd.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNotNullAnd.kt @@ -6,7 +6,7 @@ fun get(): String? { fun foo(): Int { var ss:String? = get() - return if (ss != null && ss.length() > 0) + return if (ss != null && ss.length > 0) 1 else 0 diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullElse.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullElse.kt index c9c82755282..b94515da18c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullElse.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullElse.kt @@ -1,5 +1,5 @@ public fun fooNotNull(s: String) { - System.out.println("Length of $s is ${s.length()}") + System.out.println("Length of $s is ${s.length}") } public fun foo() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullReturn.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullReturn.kt index 8264a48eafb..1b9bc8f36ce 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullReturn.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/ifVarNullReturn.kt @@ -1,5 +1,5 @@ public fun fooNotNull(s: String) { - System.out.println("Length of $s is ${s.length()}") + System.out.println("Length of $s is ${s.length}") } public fun foo() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/inference.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/inference.kt index 6620e89f9b4..79848be802e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/inference.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/inference.kt @@ -2,20 +2,20 @@ fun f() { var s: String? s = "a" - var s1 = "" // String – ? + var s1 = "" // String � ? if (s != null) { // Redundant - s1.length() + s1.length // We can do smartcast here and below s1 = s.toString() // return String? - s1.length() + s1.length s1 = s - s1.length() + s1.length // It's just an assignment without smartcast val s2 = s // But smartcast can be done here - s2.length() + s2.length // And also here val s3 = s.toString() - s3.length() + s3.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt index ea52b2ba131..40e3476b7b0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt @@ -1,7 +1,7 @@ fun foo() { var v: String? = "xyz" // It is possible in principle to provide smart cast here - v.length() + v.length v = null - v.length() + v.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedDoWhile.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedDoWhile.kt index b89489ce0fb..3373e469d66 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedDoWhile.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedDoWhile.kt @@ -5,11 +5,11 @@ public fun foo(pp: String?, rr: String?): Int { var r = rr do { do { - p!!.length() + p!!.length } while (r == null) } while (!x()) // Auto cast possible - r.length() + r.length // Auto cast possible - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedLoops.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedLoops.kt index 5a33c314e6a..304bb17d817 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedLoops.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedLoops.kt @@ -3,17 +3,17 @@ fun x(): Boolean { return true } public fun foo(qq: String?): Int { var q = qq while(true) { - q!!.length() + q!!.length var r = q do { var p = r do { // p = r, r = q and q is not null - p.length() + p.length } while (!x()) } while (r == null) // r = q and q is not null if (!x()) break } // Smart cast is possible - return q.length() + return q.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.kt index f09b93bde05..e58eeca864d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.kt @@ -13,7 +13,7 @@ class MyClass { m = create() // See KT-7428 for ((k, v) in m) - res += (k.length() + v.length()) + res += (k.length + v.length) return res } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt index 7ca8c6d0e19..2ae32c96ee8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInClosure.kt @@ -7,11 +7,11 @@ public fun foo() { } else if (s == null) { return -2 } else { - return s.length() // Here smartcast is possible, at least in principle + return s.length // Here smartcast is possible, at least in principle } } if (s != null) { System.out.println(closure()) - System.out.println(s.length()) // Here smartcast is not possible due to a closure predecessor + System.out.println(s.length) // Here smartcast is not possible due to a closure predecessor } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInSafeClosure.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInSafeClosure.kt index 9f1c937904b..c91d59f95b8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInSafeClosure.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInSafeClosure.kt @@ -10,6 +10,6 @@ public fun foo() { if (s != null) { System.out.println(closure()) // Smart cast is possible but closure makes it harder to understand - System.out.println(s.length()) + System.out.println(s.length) } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCheck.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCheck.kt index 4dd10de19e1..b45a09d256d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCheck.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCheck.kt @@ -4,6 +4,6 @@ fun get(): String? { fun foo(): Int { var c: String? = get() - c!!.length() - return c.length() // Previous line should make !! unnecessary here. + c!!.length + return c.length // Previous line should make !! unnecessary here. } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.kt index 6485a49b3c0..db479c7c1cc 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.kt @@ -1,5 +1,5 @@ fun foo(): Int { var s: String? = "abc" s = null - return s.length() + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrue.kt index c1badf92700..b0aefa6dfb1 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrue.kt @@ -3,11 +3,11 @@ fun x(): Boolean { return true } public fun foo(pp: String?): Int { var p = pp while(true) { - p!!.length() + p!!.length if (x()) break p = null } // Smart cast is NOT possible here // (we could provide it but p = null makes it much harder) - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBracketSet.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBracketSet.kt index 46066b1dd96..c0b0a3e06e9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBracketSet.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBracketSet.kt @@ -3,11 +3,11 @@ fun x(): Boolean { return true } public fun foo(pp: String?): Int { var p = pp while(true) { - p!!.length() + p!!.length if (x()) break (((p))) = null } // Smart cast is NOT possible here // (we could provide it but p = null makes it much harder) - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBrackets.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBrackets.kt index fa06b703870..8e90da94cc4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBrackets.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/whileTrueWithBrackets.kt @@ -3,11 +3,11 @@ fun x(): Boolean { return true } public fun foo(pp: String?): Int { var p = pp while(true) { - p!!.length() + p!!.length if (x()) break (p) = null } // Smart cast is NOT possible here // (we could provide it but p = null makes it much harder) - return p.length() + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt index 07e822a3ee7..5415a21cea7 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/CompiledClass.kt @@ -2,5 +2,5 @@ import java.io.File fun foo(file: File) { - file.absolutePath.length() + file.absolutePath.length } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt index 9e8e420de96..dfe10b33f48 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt @@ -1,7 +1,7 @@ // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { - javaClass.getSomething().length() - javaClass.something.length() + javaClass.getSomething().length + javaClass.something.length } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt index e29804b9690..1b2ae16b243 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt @@ -1,7 +1,7 @@ // FILE: KotlinFile.kt fun foo(javaInterface: JavaInterface) { val value = javaInterface.compute { "" } - value.length() + value.length } // FILE: JavaInterface.java diff --git a/compiler/testData/diagnostics/tests/when/kt4434.kt b/compiler/testData/diagnostics/tests/when/kt4434.kt index c103e1000ee..18116da4566 100644 --- a/compiler/testData/diagnostics/tests/when/kt4434.kt +++ b/compiler/testData/diagnostics/tests/when/kt4434.kt @@ -4,7 +4,7 @@ package test fun foo(): Int { val a = "a" - return if (a.length() > 0) { + return if (a.length > 0) { when (a) { "a" -> 1 } @@ -16,7 +16,7 @@ fun foo(): Int { fun bar(): Int { val a = "a" - if (a.length() > 0) { + if (a.length > 0) { return when (a) { "a" -> 1 } diff --git a/compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt b/compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt index 7eea23c14d3..df17f0fad3e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt @@ -1,11 +1,11 @@ class A(val x: Array) { - val y: Int = x[0].toString().length() + val y: Int = x[0].toString().length fun foo(a: T) { x[0] = a } - fun bar(a: Array): Int = a[0].toString().length() + fun bar(a: Array): Int = a[0].toString().length } fun baz(a: Array): String = a[0].toString() diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget/ReceiverTarget.kt b/compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget/ReceiverTarget.kt index 85577c83616..35675040951 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget/ReceiverTarget.kt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget/ReceiverTarget.kt @@ -7,14 +7,14 @@ annotation class Ann class A { fun @receiver:Ann String.myLength(@Ann q:String): Int { - return length() + return length } val @receiver:Ann String.myLength2: Int - get() = length() + get() = length var @receiver:[Ann] String.myLength3: Int - get() = length() + get() = length set(v) {} } \ No newline at end of file diff --git a/idea/testData/checker/regression/DoubleDefine.kt b/idea/testData/checker/regression/DoubleDefine.kt index f6f269b27d2..2f3a0c515e2 100644 --- a/idea/testData/checker/regression/DoubleDefine.kt +++ b/idea/testData/checker/regression/DoubleDefine.kt @@ -9,7 +9,7 @@ fun takeFirst(expr: StringBuilder): Char { } fun evaluateArg(expr: CharSequence, numbers: ArrayList): Int { - if (expr.length() == 0) throw Exception("Syntax error: Character expected"); + if (expr.length == 0) throw Exception("Syntax error: Character expected"); val c = takeFirst(expr) if (c >= '0' && c <= '9') { val n = c - '0' @@ -22,7 +22,7 @@ fun evaluateArg(expr: CharSequence, numbers: ArrayList): Int { fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateArg(expr, numbers) - if (expr.length() > 0) { + if (expr.length > 0) { } return lhs @@ -30,7 +30,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) - if (expr.length() > 0) { + if (expr.length > 0) { val c = expr.get(0) expr.deleteCharAt(0) } diff --git a/idea/testData/checker/regression/Jet121.kt b/idea/testData/checker/regression/Jet121.kt index e911e7332b9..28f47188156 100644 --- a/idea/testData/checker/regression/Jet121.kt +++ b/idea/testData/checker/regression/Jet121.kt @@ -3,7 +3,7 @@ package jet121 fun box(): String { val answer = apply("OK") { get(0) - length() + length } return if (answer == 2) "OK" else "FAIL" diff --git a/idea/testData/debugger/tinyApp/outs/unsafeCall.out b/idea/testData/debugger/tinyApp/outs/unsafeCall.out index 5018402b25e..b06c10c70b7 100644 --- a/idea/testData/debugger/tinyApp/outs/unsafeCall.out +++ b/idea/testData/debugger/tinyApp/outs/unsafeCall.out @@ -2,8 +2,8 @@ LineBreakpoint created at unsafeCall.kt:8 !JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! unsafeCall.UnsafeCallPackage Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' unsafeCall.kt:8 -Compile bytecode for s1.length() -Compile bytecode for s2.length() +Compile bytecode for s1.length +Compile bytecode for s2.length Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt index 2fe268ded5a..89e4643bbc3 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt @@ -8,8 +8,8 @@ fun main(args: Array) { args.size() } -// EXPRESSION: s1.length() +// EXPRESSION: s1.length // RESULT: 1: I -// EXPRESSION: s2.length() +// EXPRESSION: s2.length // RESULT: java.lang.NullPointerException: Ljava/lang/NullPointerException; \ No newline at end of file diff --git a/idea/testData/inspections/cleanup/cleanup.kt b/idea/testData/inspections/cleanup/cleanup.kt index a6273bea671..5d8dd295b16 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt +++ b/idea/testData/inspections/cleanup/cleanup.kt @@ -20,11 +20,11 @@ fun foo() { } fun unnecessarySafeCall(x: String) { - x?.length() + x?.length } fun unnecessaryExclExcl(x: String) { - x!!.length() + x!!.length } fun unnecessaryCast(x: String) = x as String diff --git a/idea/testData/inspections/cleanup/cleanup.kt.after b/idea/testData/inspections/cleanup/cleanup.kt.after index 26c99b101ca..6693f79f2c4 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt.after +++ b/idea/testData/inspections/cleanup/cleanup.kt.after @@ -19,11 +19,11 @@ fun foo() { } fun unnecessarySafeCall(x: String) { - x.length() + x.length } fun unnecessaryExclExcl(x: String) { - x.length() + x.length } fun unnecessaryCast(x: String) = x diff --git a/idea/testData/inspections/unusedReceiverParameter/calledInFunction.kt b/idea/testData/inspections/unusedReceiverParameter/calledInFunction.kt index 5239e9386e5..51e1bac0082 100644 --- a/idea/testData/inspections/unusedReceiverParameter/calledInFunction.kt +++ b/idea/testData/inspections/unusedReceiverParameter/calledInFunction.kt @@ -1,3 +1,3 @@ fun String.foo() { - println(length()) + println(length) } \ No newline at end of file diff --git a/idea/testData/inspections/unusedReceiverParameter/implicitReceiverOfExtensionFunction.kt b/idea/testData/inspections/unusedReceiverParameter/implicitReceiverOfExtensionFunction.kt index 118ddecc9a0..bc88b2ccb4a 100644 --- a/idea/testData/inspections/unusedReceiverParameter/implicitReceiverOfExtensionFunction.kt +++ b/idea/testData/inspections/unusedReceiverParameter/implicitReceiverOfExtensionFunction.kt @@ -2,4 +2,4 @@ private fun String.foo() { otherExt() } -fun String.otherExt() = length() +fun String.otherExt() = length diff --git a/idea/testData/inspections/unusedReceiverParameter/irrelevantCallInFunction.kt b/idea/testData/inspections/unusedReceiverParameter/irrelevantCallInFunction.kt index 6bb7a4ff209..9b35f869275 100644 --- a/idea/testData/inspections/unusedReceiverParameter/irrelevantCallInFunction.kt +++ b/idea/testData/inspections/unusedReceiverParameter/irrelevantCallInFunction.kt @@ -1,5 +1,5 @@ fun String.foo() { fun String.local() { - println(length()) + println(length) } } \ No newline at end of file diff --git a/idea/testData/inspections/unusedReceiverParameter/usedInProperty.kt b/idea/testData/inspections/unusedReceiverParameter/usedInProperty.kt index 29e39b87750..0545a8a1028 100644 --- a/idea/testData/inspections/unusedReceiverParameter/usedInProperty.kt +++ b/idea/testData/inspections/unusedReceiverParameter/usedInProperty.kt @@ -1,5 +1,5 @@ val String.doubleLength: Int - get() = length() * 2 + get() = length * 2 fun main(args: Array) { "".doubleLength diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt index e1140a067a2..e46f095b494 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt @@ -5,7 +5,7 @@ fun main(args: Array) { val foo: String? = "abc" if (foo != null) { doSomething ("Hello") - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt index 16c3129b7fc..33259df89a8 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt @@ -3,7 +3,7 @@ fun main(args: Array) { var foo: String? = "foo" var bar: String? = "bar" if (foo != null) { - bar?.length() + bar?.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt index 38c29b095d5..dfb67445d55 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionComparesNullWithNull.kt @@ -2,7 +2,7 @@ fun main(args: Array) { val foo = "foo" if (null == null) { - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt index 13b6b740395..f6432dc4382 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt @@ -4,7 +4,7 @@ fun T.compareTo(a: T): Int = 0 fun main(args: Array) { val foo = "foo" if (foo > null) { - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt index dca0b65b5a7..681e65feeee 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt @@ -4,7 +4,7 @@ fun String?.times(a: Int): Boolean = a == 0 fun main(args: Array) { val foo: String = "foo" if (foo * 10) { - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt index ed772c7354e..728bc651f0d 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt @@ -8,7 +8,7 @@ fun main(args: Array) { val foo = maybeFoo() doSomething(foo) if (foo != null) { - foo.length() + foo.length } else { null diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after index 2065935924f..1333ac3b987 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after @@ -7,5 +7,5 @@ fun doSomething(a: T) {} fun main(args: Array) { val foo = maybeFoo() doSomething(foo) - foo?.length() + foo?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt index ad692c4df57..e78849e13b2 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt @@ -6,7 +6,7 @@ val x = maybeFoo() fun main(args: Array) { if (x != null) { - x.length() + x.length } else { null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after index 6665cb79390..336763c63b8 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after @@ -5,5 +5,5 @@ fun maybeFoo(): String? { val x = maybeFoo() fun main(args: Array) { - x?.length() + x?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt index 878ed352205..410f549fae4 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyCondition.kt @@ -2,7 +2,7 @@ fun main(args: Array) { val foo = "foo" if () { - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt index f4ce36dade9..1175234b604 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) { - foo.length() + foo.length } else { diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyElseBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt index 783bdd89eb3..6898c3e73b6 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt @@ -7,6 +7,6 @@ fun main(args: Array) { if (foo == null) { } else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt index 380ad91c1a9..0fa6af278bc 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) { - foo.length() + foo.length } else { null diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt index 477185371da..1704670fb88 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) - foo.length() + foo.length else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt index 17506cf365e..0c1862c362a 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt @@ -8,6 +8,6 @@ fun main(args: Array) { null } else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt.after index 81d4655758b..4bbf14d33eb 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAsExpression.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - val x = maybeFoo()?.length() + val x = maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt index 9e40449ed9d..6f3bbb05e81 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt @@ -7,5 +7,5 @@ fun main(args: Array) { if (foo == null) null else - foo.length() + foo.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt index 477185371da..1704670fb88 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) - foo.length() + foo.length else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt index ab438d560f9..4a4e380e71e 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt @@ -3,6 +3,6 @@ fun main(args: Array) { val foo: String? = "foo" if { - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt index 540f6c9c2ad..fe5c1033f6d 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt @@ -5,6 +5,6 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt index 034d969048b..12cf26a8d30 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt @@ -3,7 +3,7 @@ fun main(args: Array) { val foo: String? = "foo" val bar: String? = null if (foo == bar) { - foo?.length() + foo?.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt index a679c325061..248646563b1 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt @@ -3,7 +3,7 @@ fun main(args: Array) { val foo: String? = "foo" val bar: String? = null if (foo == bar) { - bar?.length() + bar?.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt index 35dd651a2d1..d7bc397240b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt @@ -5,6 +5,6 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo == null) else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt index ae1e3e1ce87..cdd13643c7a 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt @@ -7,5 +7,5 @@ fun main(args: Array) { if (maybeFoo() == null) null else - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt index 93916d260df..5c49d8494d4 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt @@ -8,5 +8,5 @@ fun main(args: Array) { if (foo == null) null else - foo?.length() + foo?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt index 1911aec56ba..355382ecf92 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt @@ -4,7 +4,7 @@ fun doSomething(a: T) {} fun main(args: Array) { val foo: String? = "abc" if (foo != null) { - foo.length() + foo.length } else { doSomething("Hi") diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt index 741c7b8201b..775eda6f9fd 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt @@ -7,5 +7,5 @@ fun main(args: Array) { if (null == foo) null else - foo.length() + foo.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt index 446ee02b391..1b01ec846fb 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (null != foo) - foo.length() + foo.length else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt index 0df98e87828..5fc8dcf9896 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt @@ -3,9 +3,9 @@ fun main(args: Array) { val foo: String? = "foo" if (foo == null) { - foo.length() + foo.length } else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt b/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt index d43059eb084..50461c5b885 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt @@ -1,5 +1,5 @@ fun main(args: Array) { val x: String? = null val y: String? = "Hello" - val z = (x ?: y)?.length() + val z = (x ?: y)?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt.after index 918fb5c14ac..122322899c0 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/binaryExpressionLhs.kt.after @@ -2,5 +2,5 @@ fun main(args: Array) { val x: String? = null val y: String? = "Hello" val s = x ?: y - val z = if (s != null) s.length() else null + val z = if (s != null) s.length else null } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt index e6d6a17999d..b5ed02052f1 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt @@ -1,4 +1,4 @@ fun foo(): String? = "foo" fun main(args: Array) { - foo()?.length() + foo()?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after index cac21479944..e46d5734ba6 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after @@ -1,5 +1,5 @@ fun foo(): String? = "foo" fun main(args: Array) { val foo = foo() - if (foo != null) foo.length() + if (foo != null) foo.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt index d15f4d385e6..c139cb26f16 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt @@ -1,4 +1,4 @@ fun foo(): String? = "foo" fun main(args: Array) { - (foo())?.length() + (foo())?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after index cac21479944..e46d5734ba6 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after @@ -1,5 +1,5 @@ fun foo(): String? = "foo" fun main(args: Array) { val foo = foo() - if (foo != null) foo.length() + if (foo != null) foo.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt index 5b20d44d0a7..9bfdab5a00e 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt @@ -9,5 +9,5 @@ class Foo { fun main(args: Array) { val a = Foo() - doSomething(a.b?.length()) + doSomething(a.b?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after index 6023c6ef532..83148aeeb5d 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after @@ -10,5 +10,5 @@ class Foo { fun main(args: Array) { val a = Foo() val b = a.b - doSomething(if (b != null) b.length() else null) + doSomething(if (b != null) b.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt b/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt index 0358241c05a..eeba12cf5a0 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val x: String? = "abc" - x?.length() + x?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt.after index e27bd6269ca..837ffd1f033 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localValAsReceiver.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val x: String? = "abc" - if (x != null) x.length() + if (x != null) x.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt index bac1a9b0cca..854d092e4b9 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt @@ -2,5 +2,5 @@ fun doSomething(a: T) {} fun main(args: Array) { val a: String? = "A" - doSomething(a?.length()) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after index bc4f3b6d894..f51978ee6a4 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after @@ -2,5 +2,5 @@ fun doSomething(a: T) {} fun main(args: Array) { val a: String? = "A" - doSomething(if (a != null) a.length() else null) + doSomething(if (a != null) a.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt index 8ba64a77bd7..e3d5106731e 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt @@ -2,6 +2,6 @@ fun doSomething(a: T) {} fun main(args: Array) { var a: String? = "A" - doSomething(a?.length()) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after index 4a6d7aa7a2d..442b699eb87 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after @@ -3,6 +3,6 @@ fun doSomething(a: T) {} fun main(args: Array) { var a: String? = "A" val a1 = a - doSomething(if (a1 != null) a1.length() else null) + doSomething(if (a1 != null) a1.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt b/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt index 7326b1d277a..5e04bb3e59e 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val x: String? = "abc" - val y = x?.length() + val y = x?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt.after index 3fe4c6eabbd..328d3df4a49 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/resultAssignedToLocalVal.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val x: String? = "abc" - val y = if (x != null) x.length() else null + val y = if (x != null) x.length else null } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt index 3528d419492..895100a9970 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt @@ -3,5 +3,5 @@ fun f(s: Int?) { fun main(args: Array) { val x: String? = "foo" - f(x?.length()) + f(x?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after index d304090ca46..79623722267 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after @@ -3,5 +3,5 @@ fun f(s: Int?) { fun main(args: Array) { val x: String? = "foo" - f(if (x != null) x.length() else null) + f(if (x != null) x.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt index a9e79d8e66e..399cea3f21b 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - foo?.length() + foo?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after index 7edbddc06a4..91b7da93332 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - if (foo != null) foo.length() + if (foo != null) foo.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt index 362ca42d6d5..d7bc97f1bcf 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - (foo)?.length() + (foo)?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after index 7edbddc06a4..91b7da93332 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - if (foo != null) foo.length() + if (foo != null) foo.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt index 7d59ddf2097..cda046018dd 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt @@ -2,5 +2,5 @@ fun doSomething(a: T) {} val a: String? = "A" fun main(args: Array) { - doSomething(a?.length()) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after index 084ed52d5b2..6e492136395 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after @@ -2,5 +2,5 @@ fun doSomething(a: T) {} val a: String? = "A" fun main(args: Array) { - doSomething(if (a != null) a.length() else null) + doSomething(if (a != null) a.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt index 7764dd6b2a6..7993bb0bb8c 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt @@ -4,5 +4,5 @@ val a: String? get() = "" fun main(args: Array) { - doSomething(a?.length()) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after index 27276cfda12..7d53cbd7e57 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after @@ -5,5 +5,5 @@ val a: String? fun main(args: Array) { val a1 = a - doSomething(if (a1 != null) a1.length() else null) + doSomething(if (a1 != null) a1.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt index 025d2cb3f84..36f93c10162 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt @@ -1,4 +1,4 @@ var a: String? = "A" fun main(args: Array) { - a?.length() + a?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt.after index 6912d6e8d0d..a812766889e 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVar.kt.after @@ -1,5 +1,5 @@ var a: String? = "A" fun main(args: Array) { val a1 = a - if (a1 != null) a1.length() + if (a1 != null) a1.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt index 305056ba6f4..07ceabf3af2 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt @@ -3,5 +3,5 @@ var a: String? set(v) {} fun main(args: Array) { - a?.length() + a?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt.after index 56500375724..383889841e2 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVarCustomGetter.kt.after @@ -4,5 +4,5 @@ var a: String? fun main(args: Array) { val a1 = a - if (a1 != null) a1.length() + if (a1 != null) a1.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt index 2e8b1bdd99a..82c1bd1734f 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt @@ -1,4 +1,4 @@ -fun foo(arg: String?): Int? = arg?.length() +fun foo(arg: String?): Int? = arg?.length fun main(args: Array) { foo("bar") } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt.after index 4929adf5d1d..2be935e3ce5 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsFunctionRhs.kt.after @@ -1,4 +1,4 @@ -fun foo(arg: String?): Int? = if (arg != null) arg.length() else null +fun foo(arg: String?): Int? = if (arg != null) arg.length else null fun main(args: Array) { foo("bar") } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt index 8fac3f4df26..5f676080296 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - val y = if (true) foo?.length() else null + val y = if (true) foo?.length else null } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after index 9aa3f0e4882..934df9a48d2 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - val y = if (true) if (foo != null) foo.length() else null else null + val y = if (true) if (foo != null) foo.length else null else null } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt index 7aef1933cf5..bcb92df6cd2 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt @@ -1,6 +1,6 @@ fun doSth(): Int? { val x: String? = "abc" - return x?.length() + return x?.length } fun main(args: Array) { val y = doSth() diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after index f6cd676ae57..97656a5c0cf 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after @@ -1,6 +1,6 @@ fun doSth(): Int? { val x: String? = "abc" - return if (x != null) x.length() else null + return if (x != null) x.length else null } fun main(args: Array) { val y = doSth() diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt index 3c803c93d22..fac801cbee7 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt @@ -1,6 +1,6 @@ fun main(args: Array) { val foo: String? = "foo" if (true) { - foo?.length() + foo?.length } } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after index 6531d3ce562..4845e7f7f61 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after @@ -1,6 +1,6 @@ fun main(args: Array) { val foo: String? = "foo" if (true) { - if (foo != null) foo.length() + if (foo != null) foo.length } } diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt index 4b07fa3ca73..51ede2c0e1f 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt @@ -1,5 +1,5 @@ fun String.not(): Boolean { - return length() == 0 + return length == 0 } fun foo(a: Boolean, b: Boolean) : Boolean { diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after index d347eb23746..5a36e3b8012 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after @@ -1,5 +1,5 @@ fun String.not(): Boolean { - return length() == 0 + return length == 0 } fun foo(a: Boolean, b: Boolean) : Boolean { diff --git a/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt b/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt index 72a1344c8f3..aaaca4621fb 100644 --- a/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt +++ b/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false -val foo = { s: String, n: Int -> s.length() - n/2 > 1 } +val foo = { s: String, n: Int -> s.length - n/2 > 1 } fun test() { foo("1", 2) diff --git a/idea/testData/intentions/convertParameterToReceiver/localFun.kt b/idea/testData/intentions/convertParameterToReceiver/localFun.kt index ac59fbf3138..2a1d7d9ceab 100644 --- a/idea/testData/intentions/convertParameterToReceiver/localFun.kt +++ b/idea/testData/intentions/convertParameterToReceiver/localFun.kt @@ -1,6 +1,6 @@ fun test() { fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } foo("1", 2) diff --git a/idea/testData/intentions/convertParameterToReceiver/localFun.kt.after b/idea/testData/intentions/convertParameterToReceiver/localFun.kt.after index 3c912f74b77..a013bac475b 100644 --- a/idea/testData/intentions/convertParameterToReceiver/localFun.kt.after +++ b/idea/testData/intentions/convertParameterToReceiver/localFun.kt.after @@ -1,6 +1,6 @@ fun test() { fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } "1".foo(2) diff --git a/idea/testData/intentions/convertParameterToReceiver/memberFun.kt b/idea/testData/intentions/convertParameterToReceiver/memberFun.kt index e88dfdf486c..f07191d9313 100644 --- a/idea/testData/intentions/convertParameterToReceiver/memberFun.kt +++ b/idea/testData/intentions/convertParameterToReceiver/memberFun.kt @@ -1,7 +1,7 @@ // WITH_RUNTIME class A { fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertParameterToReceiver/memberFun.kt.after b/idea/testData/intentions/convertParameterToReceiver/memberFun.kt.after index c4834b73373..91e7b17b4d9 100644 --- a/idea/testData/intentions/convertParameterToReceiver/memberFun.kt.after +++ b/idea/testData/intentions/convertParameterToReceiver/memberFun.kt.after @@ -1,7 +1,7 @@ // WITH_RUNTIME class A { fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertParameterToReceiver/noParameterUnderCaret.kt b/idea/testData/intentions/convertParameterToReceiver/noParameterUnderCaret.kt index b067c5c9de5..c0daa2f9ffd 100644 --- a/idea/testData/intentions/convertParameterToReceiver/noParameterUnderCaret.kt +++ b/idea/testData/intentions/convertParameterToReceiver/noParameterUnderCaret.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt b/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt index a8fe21ca2c3..36ee3df6528 100644 --- a/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt +++ b/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt @@ -1,5 +1,5 @@ fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt.after b/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt.after index 76ee33f66b6..7e71664c023 100644 --- a/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt.after +++ b/idea/testData/intentions/convertParameterToReceiver/topLevelFun.kt.after @@ -1,5 +1,5 @@ fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertParameterToReceiver/withExtensionReceiver.kt b/idea/testData/intentions/convertParameterToReceiver/withExtensionReceiver.kt index 58e0cbfb09f..50db235396f 100644 --- a/idea/testData/intentions/convertParameterToReceiver/withExtensionReceiver.kt +++ b/idea/testData/intentions/convertParameterToReceiver/withExtensionReceiver.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false fun Any.foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertReceiverToParameter/localFun.kt b/idea/testData/intentions/convertReceiverToParameter/localFun.kt index 76455bc1dbe..3000d79c4c9 100644 --- a/idea/testData/intentions/convertReceiverToParameter/localFun.kt +++ b/idea/testData/intentions/convertReceiverToParameter/localFun.kt @@ -1,6 +1,6 @@ fun test() { fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } "1".foo(2) diff --git a/idea/testData/intentions/convertReceiverToParameter/localFun.kt.after b/idea/testData/intentions/convertReceiverToParameter/localFun.kt.after index a4a6689d831..b0aa3679e01 100644 --- a/idea/testData/intentions/convertReceiverToParameter/localFun.kt.after +++ b/idea/testData/intentions/convertReceiverToParameter/localFun.kt.after @@ -1,6 +1,6 @@ fun test() { fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } foo("1", 2) diff --git a/idea/testData/intentions/convertReceiverToParameter/memberFun.kt b/idea/testData/intentions/convertReceiverToParameter/memberFun.kt index 1878dfd71c4..c481218900b 100644 --- a/idea/testData/intentions/convertReceiverToParameter/memberFun.kt +++ b/idea/testData/intentions/convertReceiverToParameter/memberFun.kt @@ -1,7 +1,7 @@ // WITH_RUNTIME class A { fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertReceiverToParameter/memberFun.kt.after b/idea/testData/intentions/convertReceiverToParameter/memberFun.kt.after index da4e19acea5..bbecb61d564 100644 --- a/idea/testData/intentions/convertReceiverToParameter/memberFun.kt.after +++ b/idea/testData/intentions/convertReceiverToParameter/memberFun.kt.after @@ -1,7 +1,7 @@ // WITH_RUNTIME class A { fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertReceiverToParameter/noReceiverUnderCaret.kt b/idea/testData/intentions/convertReceiverToParameter/noReceiverUnderCaret.kt index 6c4040d0ff8..1371c604c2f 100644 --- a/idea/testData/intentions/convertReceiverToParameter/noReceiverUnderCaret.kt +++ b/idea/testData/intentions/convertReceiverToParameter/noReceiverUnderCaret.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } \ No newline at end of file diff --git a/idea/testData/intentions/convertReceiverToParameter/notExtension.kt b/idea/testData/intentions/convertReceiverToParameter/notExtension.kt index 1a51f8fdf44..b6a3cd96cc4 100644 --- a/idea/testData/intentions/convertReceiverToParameter/notExtension.kt +++ b/idea/testData/intentions/convertReceiverToParameter/notExtension.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } \ No newline at end of file diff --git a/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt b/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt index 5ae8846e73c..8eeca1be819 100644 --- a/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt +++ b/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt @@ -1,5 +1,5 @@ fun String.foo(n: Int): Boolean { - return length() - n/2 > 1 + return length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt.after b/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt.after index ad8a5f2bcf4..ad87c709992 100644 --- a/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt.after +++ b/idea/testData/intentions/convertReceiverToParameter/topLevelFun.kt.after @@ -1,5 +1,5 @@ fun foo(s: String, n: Int): Boolean { - return s.length() - n/2 > 1 + return s.length - n/2 > 1 } fun test() { diff --git a/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt b/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt index 1d4f323f9ce..c0913e52198 100644 --- a/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt +++ b/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt @@ -4,5 +4,5 @@ fun foo(p: List): Int { // return -1 if null return -1 } - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt.after b/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt.after index d8079d811ef..37d306d64bd 100644 --- a/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt.after +++ b/idea/testData/intentions/ifNullToElvis/CommentInBlock.kt.after @@ -1,4 +1,4 @@ fun foo(p: List): Int { val v = p[0] ?: return -1 // return -1 if null - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/Comments.kt b/idea/testData/intentions/ifNullToElvis/Comments.kt index 2aa1c6bdaef..643cc724e10 100644 --- a/idea/testData/intentions/ifNullToElvis/Comments.kt +++ b/idea/testData/intentions/ifNullToElvis/Comments.kt @@ -2,5 +2,5 @@ fun foo(p: List): Int { val v = p[0] // now check if v is null if (v == null/* null */) return -1 // return -1 - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/Comments.kt.after b/idea/testData/intentions/ifNullToElvis/Comments.kt.after index 690207a2def..45251facf01 100644 --- a/idea/testData/intentions/ifNullToElvis/Comments.kt.after +++ b/idea/testData/intentions/ifNullToElvis/Comments.kt.after @@ -2,5 +2,5 @@ fun foo(p: List): Int { val v = p[0] ?: return -1 /* null */ // now check if v is null // return -1 - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/Comments2.kt b/idea/testData/intentions/ifNullToElvis/Comments2.kt index ce462b54c9a..9d73c0f3df0 100644 --- a/idea/testData/intentions/ifNullToElvis/Comments2.kt +++ b/idea/testData/intentions/ifNullToElvis/Comments2.kt @@ -4,5 +4,5 @@ fun foo(p: List): Int { // we should do something with it return -1 // let's return -1 } // end of if - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/Comments2.kt.after b/idea/testData/intentions/ifNullToElvis/Comments2.kt.after index 04e676ef183..173a507b95c 100644 --- a/idea/testData/intentions/ifNullToElvis/Comments2.kt.after +++ b/idea/testData/intentions/ifNullToElvis/Comments2.kt.after @@ -3,5 +3,5 @@ fun foo(p: List): Int { // we should do something with it // let's return -1 // end of if - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/NotExit.kt b/idea/testData/intentions/ifNullToElvis/NotExit.kt index ce91eaaefdf..9f39addbf74 100644 --- a/idea/testData/intentions/ifNullToElvis/NotExit.kt +++ b/idea/testData/intentions/ifNullToElvis/NotExit.kt @@ -2,7 +2,7 @@ fun foo(p: List): Int? { val v = p[0] if (v == null) bar() - return v?.length() + return v?.length } fun bar(){} \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/OtherVar1.kt b/idea/testData/intentions/ifNullToElvis/OtherVar1.kt index f956f4365dc..07286f20aaa 100644 --- a/idea/testData/intentions/ifNullToElvis/OtherVar1.kt +++ b/idea/testData/intentions/ifNullToElvis/OtherVar1.kt @@ -5,7 +5,7 @@ class C { fun foo(p: List): Int { val v = p[0] if (this.v == null) return -1 - return v!!.length() + return v!!.length } } diff --git a/idea/testData/intentions/ifNullToElvis/OtherVar2.kt b/idea/testData/intentions/ifNullToElvis/OtherVar2.kt index f0764475964..8a2c8e8564d 100644 --- a/idea/testData/intentions/ifNullToElvis/OtherVar2.kt +++ b/idea/testData/intentions/ifNullToElvis/OtherVar2.kt @@ -5,7 +5,7 @@ class C { fun foo(p: List): Int { val v = p[0] if (x == null) return -1 - return v!!.length() + return v!!.length } } diff --git a/idea/testData/intentions/ifNullToElvis/Return.kt b/idea/testData/intentions/ifNullToElvis/Return.kt index a2eb900e9d3..dbad6266197 100644 --- a/idea/testData/intentions/ifNullToElvis/Return.kt +++ b/idea/testData/intentions/ifNullToElvis/Return.kt @@ -1,5 +1,5 @@ fun foo(p: List): Int { val v = p[0] if (v == null) return -1 - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/ifNullToElvis/Return.kt.after b/idea/testData/intentions/ifNullToElvis/Return.kt.after index d0c49ad031c..98ba917d325 100644 --- a/idea/testData/intentions/ifNullToElvis/Return.kt.after +++ b/idea/testData/intentions/ifNullToElvis/Return.kt.after @@ -1,4 +1,4 @@ fun foo(p: List): Int { val v = p[0] ?: return -1 - return v.length() + return v.length } \ No newline at end of file diff --git a/idea/testData/intentions/removeCurlyBracesFromTemplate/necessaryBrackets1.kt b/idea/testData/intentions/removeCurlyBracesFromTemplate/necessaryBrackets1.kt index b268658eed5..ba0e7fbdcc9 100644 --- a/idea/testData/intentions/removeCurlyBracesFromTemplate/necessaryBrackets1.kt +++ b/idea/testData/intentions/removeCurlyBracesFromTemplate/necessaryBrackets1.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false fun foo() { val x = "x" - val y = "${x.length()}" + val y = "${x.length}" } \ No newline at end of file diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt b/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt index 19ee42083a5..a7629721364 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt +++ b/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt @@ -6,5 +6,5 @@ fun oldFun(): String = "" fun newFun(): String = "" fun foo() { - val value = oldFun().length() + val value = oldFun().length } diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt.after b/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt.after index d227ca59814..d2e41a9fc47 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt.after +++ b/idea/testData/quickfix/deprecatedSymbolUsage/callChainBug.kt.after @@ -6,5 +6,5 @@ fun oldFun(): String = "" fun newFun(): String = "" fun foo() { - val value = newFun().length() + val value = newFun().length } diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt b/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt index f3bac81282a..f2fc7904998 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt +++ b/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt @@ -8,7 +8,7 @@ fun Int.newFun(): Int = this fun foo(list: List): Int { return list .filter { it.isNotEmpty() } - .map { it.length() } + .map { it.length } .first() .oldFun() } diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt.after b/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt.after index bbf154c867e..af1cc4c4c9e 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt.after +++ b/idea/testData/quickfix/deprecatedSymbolUsage/keepLineBreaks/lineBreakAfterReceiverRuntime.kt.after @@ -8,7 +8,7 @@ fun Int.newFun(): Int = this fun foo(list: List): Int { return list .filter { it.isNotEmpty() } - .map { it.length() } + .map { it.length } .first() .newFun() } diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt b/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt index 8a701b7c697..32eebd8eefe 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt +++ b/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt @@ -2,9 +2,9 @@ interface I { @Deprecated("", ReplaceWith("newFun(p1, p2, p3)")) - fun oldFun(p1: String, p2: Int = p1.length(), p3: String? = p1) + fun oldFun(p1: String, p2: Int = p1.length, p3: String? = p1) - fun newFun(x: String, y: Int = x.length(), z: String? = "a") + fun newFun(x: String, y: Int = x.length, z: String? = "a") } fun foo(i: I) { diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt.after b/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt.after index 9742afcbcc3..2b8d3476671 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt.after +++ b/idea/testData/quickfix/deprecatedSymbolUsage/optionalParameters/optionalParameters4.kt.after @@ -2,9 +2,9 @@ interface I { @Deprecated("", ReplaceWith("newFun(p1, p2, p3)")) - fun oldFun(p1: String, p2: Int = p1.length(), p3: String? = p1) + fun oldFun(p1: String, p2: Int = p1.length, p3: String? = p1) - fun newFun(x: String, y: Int = x.length(), z: String? = "a") + fun newFun(x: String, y: Int = x.length, z: String? = "a") } fun foo(i: I) { diff --git a/idea/testData/quickfix/expressions/removeUselessCastInParens.kt b/idea/testData/quickfix/expressions/removeUselessCastInParens.kt index 716cba232ac..481652bf24e 100644 --- a/idea/testData/quickfix/expressions/removeUselessCastInParens.kt +++ b/idea/testData/quickfix/expressions/removeUselessCastInParens.kt @@ -1,7 +1,7 @@ // "Remove cast" "true" fun test(x: Any): Int { if (x is String) { - return (x as String).length() + return (x as String).length } return -1 } diff --git a/idea/testData/quickfix/expressions/removeUselessCastInParens.kt.after b/idea/testData/quickfix/expressions/removeUselessCastInParens.kt.after index c64487319d9..3d9cc67db25 100644 --- a/idea/testData/quickfix/expressions/removeUselessCastInParens.kt.after +++ b/idea/testData/quickfix/expressions/removeUselessCastInParens.kt.after @@ -1,7 +1,7 @@ // "Remove cast" "true" fun test(x: Any): Int { if (x is String) { - return x.length() + return x.length } return -1 } diff --git a/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt b/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt index f246dfab42f..2422453b1cb 100644 --- a/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt +++ b/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt @@ -1,4 +1,4 @@ // "Remove unnecessary non-null assertion (!!)" "true" fun test(value : String) : Int { - return value!!.length() + return value!!.length } diff --git a/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt.after b/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt.after index ce60477f285..9872deea316 100644 --- a/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt.after +++ b/idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt.after @@ -1,4 +1,4 @@ // "Remove unnecessary non-null assertion (!!)" "true" fun test(value : String) : Int { - return value.length() + return value.length } diff --git a/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt b/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt index 67e71e7d938..7fc292b62bc 100644 --- a/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt +++ b/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt @@ -1,7 +1,7 @@ // "Add constructor parameters from Base(String)" "true" open class Base private constructor(p1: Int, val p2: Int) { private constructor() : this(0, 1) - protected constructor(s: String) : this(s.length(), 1) + protected constructor(s: String) : this(s.length, 1) } class C : Base diff --git a/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt.after b/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt.after index 159dc4e4743..ed3586570d4 100644 --- a/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt.after +++ b/idea/testData/quickfix/supertypeInitialization/primaryConstructorInaccessible.kt.after @@ -1,7 +1,7 @@ // "Add constructor parameters from Base(String)" "true" open class Base private constructor(p1: Int, val p2: Int) { private constructor() : this(0, 1) - protected constructor(s: String) : this(s.length(), 1) + protected constructor(s: String) : this(s.length, 1) } class C(s: String) : Base(s) diff --git a/idea/testData/refactoring/changeSignature/AddNewReceiverAfter.kt b/idea/testData/refactoring/changeSignature/AddNewReceiverAfter.kt index 56a08b091d0..51b7bca45af 100644 --- a/idea/testData/refactoring/changeSignature/AddNewReceiverAfter.kt +++ b/idea/testData/refactoring/changeSignature/AddNewReceiverAfter.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return s.length() - k > 0 + return s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/AddNewReceiverBefore.kt b/idea/testData/refactoring/changeSignature/AddNewReceiverBefore.kt index d649f0ec86c..0f30bdb4e6d 100644 --- a/idea/testData/refactoring/changeSignature/AddNewReceiverBefore.kt +++ b/idea/testData/refactoring/changeSignature/AddNewReceiverBefore.kt @@ -1,5 +1,5 @@ fun foo(s: String, k: Int): Boolean { - return s.length() - k > 0 + return s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberAfter.kt b/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberAfter.kt index 076001c7e7a..02e7d9dc22b 100644 --- a/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberAfter.kt +++ b/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberAfter.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, n: Int): Boolean { - return s.length() * this@A.k - n.inc() + this@A.k > 0 + return s.length * this@A.k - n.inc() + this@A.k > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberBefore.kt b/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberBefore.kt index d5aff63d1c2..8bee8085759 100644 --- a/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberBefore.kt +++ b/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberBefore.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(s: String, n: Int): Boolean { - return s.length() * this.k - n.inc() + k > 0 + return s.length * this.k - n.inc() + k > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberConflictBefore.kt b/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberConflictBefore.kt index 73f5da431f0..ac8e6a3e0bc 100644 --- a/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberConflictBefore.kt +++ b/idea/testData/refactoring/changeSignature/AddNewReceiverForMemberConflictBefore.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(s: String, n: Int): Boolean { - return s.length()*this.k - n.inc() + k > 0 + return s.length*this.k - n.inc() + k > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ChangeReceiverAfter.kt b/idea/testData/refactoring/changeSignature/ChangeReceiverAfter.kt index cf30fdeb921..58c0e12b043 100644 --- a/idea/testData/refactoring/changeSignature/ChangeReceiverAfter.kt +++ b/idea/testData/refactoring/changeSignature/ChangeReceiverAfter.kt @@ -1,5 +1,5 @@ fun String.foo(x: X, k: Int): Boolean { - return x.k + length() - k > 0 + return x.k + length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ChangeReceiverBefore.kt b/idea/testData/refactoring/changeSignature/ChangeReceiverBefore.kt index 7025ce39359..b4fd2375b6e 100644 --- a/idea/testData/refactoring/changeSignature/ChangeReceiverBefore.kt +++ b/idea/testData/refactoring/changeSignature/ChangeReceiverBefore.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberAfter.kt b/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberAfter.kt index 3a25e6d7502..dd5693c7cf5 100644 --- a/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberAfter.kt +++ b/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberAfter.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun String.foo(x: X, k: Int): Boolean { - return x.k + length() - k + this@A.k/2 > 0 + return x.k + length - k + this@A.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberBefore.kt b/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberBefore.kt index 4d056b66e96..d060a9a79b0 100644 --- a/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberBefore.kt +++ b/idea/testData/refactoring/changeSignature/ChangeReceiverForMemberBefore.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k + this@A.k/2 > 0 + return this.k + s.length - k + this@A.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1After.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1After.kt index ca30af21c0c..53f768b8669 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1After.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1Before.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1Before.kt index 98b9a274a9a..4f2651ded92 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver1Before.kt @@ -1,5 +1,5 @@ fun foo(x: X, s: String, k: Int): Boolean { - return x.k + s.length() - k > 0 + return x.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2After.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2After.kt index ca30af21c0c..53f768b8669 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2After.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2Before.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2Before.kt index 499141e4a8d..782c01eb890 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiver2Before.kt @@ -1,5 +1,5 @@ fun foo(s: String, x: X, k: Int): Boolean { - return x.k + s.length() - k > 0 + return x.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1After.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1After.kt index 5206fa61448..6b798781745 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1After.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k + this@A.k/2 > 0 + return this.k + s.length - k + this@A.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1Before.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1Before.kt index bae82c496cc..83380e604e5 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember1Before.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(x: X, s: String, k: Int): Boolean { - return x.k + s.length() - k + this.k/2 > 0 + return x.k + s.length - k + this.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2After.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2After.kt index 5206fa61448..6b798781745 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2After.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k + this@A.k/2 > 0 + return this.k + s.length - k + this@A.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2Before.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2Before.kt index a95562544e5..fc7e4af4155 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMember2Before.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(s: String, x: X, k: Int): Boolean { - return x.k + s.length() - k + this.k/2 > 0 + return x.k + s.length - k + this.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMemberConflictBefore.kt b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMemberConflictBefore.kt index 26d1929ad4e..f7becab2f20 100644 --- a/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMemberConflictBefore.kt +++ b/idea/testData/refactoring/changeSignature/ConvertParameterToReceiverForMemberConflictBefore.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(x: X, s: String, k: Int): Boolean { - return x.k + s.length() - k + this.k/2 > 0 + return x.k + s.length - k + this.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1After.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1After.kt index d530e82a29a..1c2c834e0ae 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1After.kt @@ -1,5 +1,5 @@ fun foo(x: X, s: String, k: Int): Boolean { - return x.k + s.length() - k > 0 + return x.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1Before.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1Before.kt index 7d5cd45ea83..89dfc45f171 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter1Before.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2After.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2After.kt index 319c82ec7d8..955e65ba1a2 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2After.kt @@ -1,5 +1,5 @@ fun foo(s: String, x: X, k: Int): Boolean { - return x.k + s.length() - k > 0 + return x.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2Before.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2Before.kt index 7d5cd45ea83..89dfc45f171 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameter2Before.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1After.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1After.kt index d1f496d2bd6..010d29db62b 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1After.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(x: X, s: String, k: Int): Boolean { - return x.k + s.length() - k + this.k/2 > 0 + return x.k + s.length - k + this.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1Before.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1Before.kt index 4d056b66e96..d060a9a79b0 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember1Before.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k + this@A.k/2 > 0 + return this.k + s.length - k + this@A.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2After.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2After.kt index afb255d5293..374a0883337 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2After.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2After.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(s: String, x: X, k: Int): Boolean { - return x.k + s.length() - k + this.k/2 > 0 + return x.k + s.length - k + this.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2Before.kt b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2Before.kt index 4d056b66e96..d060a9a79b0 100644 --- a/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2Before.kt +++ b/idea/testData/refactoring/changeSignature/ConvertReceiverToParameterForMember2Before.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k + this@A.k/2 > 0 + return this.k + s.length - k + this@A.k/2 > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamAfter.1.kt b/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamAfter.1.kt index 260f9a89d4d..77d87bcecea 100644 --- a/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamAfter.1.kt +++ b/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamAfter.1.kt @@ -6,13 +6,13 @@ open class X: A() { open class Y: B() { fun foo(x: Int): String? { - return x.length() * 2 + return x.length * 2 } } open class Z: X() { fun foo(x: Int): String? { - return x.length() + return x.length } } diff --git a/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamBefore.1.kt b/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamBefore.1.kt index 5d5c2bde50c..f2c5044a5e8 100644 --- a/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamBefore.1.kt +++ b/idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamBefore.1.kt @@ -6,13 +6,13 @@ open class X: A() { open class Y: B() { fun foo(s: String): Int { - return s.length() * 2 + return s.length * 2 } } open class Z: X() { fun foo(s: String): Int { - return s.length() + return s.length } } diff --git a/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamAfter.1.kt b/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamAfter.1.kt index 17a9939cfcc..908245cc85e 100644 --- a/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamAfter.1.kt +++ b/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamAfter.1.kt @@ -6,13 +6,13 @@ open class X: A() { open class Y: B() { fun foo(x: Int): String? { - return s.length() * 2 + return s.length * 2 } } open class Z: X() { fun foo(x: Int): String? { - return s.length() + return s.length } } diff --git a/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamBefore.1.kt b/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamBefore.1.kt index 5d5c2bde50c..f2c5044a5e8 100644 --- a/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamBefore.1.kt +++ b/idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamBefore.1.kt @@ -6,13 +6,13 @@ open class X: A() { open class Y: B() { fun foo(s: String): Int { - return s.length() * 2 + return s.length * 2 } } open class Z: X() { fun foo(s: String): Int { - return s.length() + return s.length } } diff --git a/idea/testData/refactoring/changeSignature/RemoveReceiverAfter.kt b/idea/testData/refactoring/changeSignature/RemoveReceiverAfter.kt index 0e17b87b953..43e8dfac069 100644 --- a/idea/testData/refactoring/changeSignature/RemoveReceiverAfter.kt +++ b/idea/testData/refactoring/changeSignature/RemoveReceiverAfter.kt @@ -1,5 +1,5 @@ fun foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/RemoveReceiverBefore.kt b/idea/testData/refactoring/changeSignature/RemoveReceiverBefore.kt index f2d66b1a50b..708058dead2 100644 --- a/idea/testData/refactoring/changeSignature/RemoveReceiverBefore.kt +++ b/idea/testData/refactoring/changeSignature/RemoveReceiverBefore.kt @@ -1,5 +1,5 @@ fun X.foo(s: String, k: Int): Boolean { - return this.k + s.length() - k > 0 + return this.k + s.length - k > 0 } class X(val k: Int) diff --git a/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberAfter.kt b/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberAfter.kt index f3340fe4ef6..286bd9187d2 100644 --- a/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberAfter.kt +++ b/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberAfter.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun foo(s: String, n: Int): Boolean { - return s.length() * this.k - n.inc() + this@A.k > 0 + return s.length * this.k - n.inc() + this@A.k > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberBefore.kt b/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberBefore.kt index 4cfef972081..fadc2fb4315 100644 --- a/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberBefore.kt +++ b/idea/testData/refactoring/changeSignature/RemoveReceiverForMemberBefore.kt @@ -1,6 +1,6 @@ class A(val k: Int) { fun X.foo(s: String, n: Int): Boolean { - return s.length() * this.k - n.inc() + this@A.k > 0 + return s.length * this.k - n.inc() + this@A.k > 0 } fun test() { diff --git a/idea/testData/refactoring/changeSignature/ThisReplacementAfter.kt b/idea/testData/refactoring/changeSignature/ThisReplacementAfter.kt index a0f0512cc18..176c0c7b402 100644 --- a/idea/testData/refactoring/changeSignature/ThisReplacementAfter.kt +++ b/idea/testData/refactoring/changeSignature/ThisReplacementAfter.kt @@ -3,7 +3,7 @@ class C { fun f() { fun local(any: Any) { if (any is String) { - any.length() + any.length } } } diff --git a/idea/testData/refactoring/changeSignature/ThisReplacementBefore.kt b/idea/testData/refactoring/changeSignature/ThisReplacementBefore.kt index db43f5ea1b1..f33fc531a0e 100644 --- a/idea/testData/refactoring/changeSignature/ThisReplacementBefore.kt +++ b/idea/testData/refactoring/changeSignature/ThisReplacementBefore.kt @@ -3,7 +3,7 @@ class C { fun f() { fun Any.local() { if (this is String) { - this.length() + this.length } } } diff --git a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt index 99546e95cfc..903ada643a9 100644 --- a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt +++ b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt @@ -4,5 +4,5 @@ // PARAM_DESCRIPTOR: val property: (kotlin.String..kotlin.String?) defined in test fun test() { val property = System.getProperty("some") - val n = property?.length() + val n = property?.length } \ No newline at end of file diff --git a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt.after b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt.after index 50f48bb630b..9efe244a1b3 100644 --- a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt.after +++ b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithNull.kt.after @@ -7,4 +7,4 @@ fun test() { val n = i(property) } -private fun i(property: String?) = property?.length() \ No newline at end of file +private fun i(property: String?) = property?.length \ No newline at end of file diff --git a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt index e3da5db7cd2..1e8d12d5c24 100644 --- a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt +++ b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt @@ -4,5 +4,5 @@ // PARAM_DESCRIPTOR: val property: (kotlin.String..kotlin.String?) defined in test fun test() { val property = System.getProperty("some") - val n = property.length() + val n = property.length } \ No newline at end of file diff --git a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt.after b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt.after index 21d2fede2f3..c491e999205 100644 --- a/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt.after +++ b/idea/testData/refactoring/extractFunction/parameters/candidateTypes/flexibleTypesWithoutNull.kt.after @@ -7,4 +7,4 @@ fun test() { val n = i(property) } -private fun i(property: String) = property.length() +private fun i(property: String) = property.length diff --git a/libraries/stdlib/test/text/StringTest.kt b/libraries/stdlib/test/text/StringTest.kt index 6081c1fe5fc..aa9c8694ae8 100644 --- a/libraries/stdlib/test/text/StringTest.kt +++ b/libraries/stdlib/test/text/StringTest.kt @@ -664,7 +664,7 @@ ${" "} """.trimIndent() assertEquals(23, deindented.lines().size()) - val indents = deindented.lines().map { "^\\s*".toRegex().match(it)!!.value.size } + val indents = deindented.lines().map { "^\\s*".toRegex().match(it)!!.value.length } assertEquals(0, indents.min()) assertEquals(42, indents.max()) assertEquals(1, deindented.lines().count { it.isEmpty() })