Highlight use of toString() inside string interpolation as redundant #KT-10731 Fixed

This commit is contained in:
Kirill Rakhman
2016-08-14 15:20:44 +03:00
committed by Mikhail Glukhikh
parent 52dacd1d49
commit d68a681db5
17 changed files with 167 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.RemoveToStringInStringTemplateInspection
@@ -0,0 +1,5 @@
// "Remove 'toString()' call" "true"
operator fun Any.invoke() = this
fun foo(arg: Any) = "${arg().<caret>toString()}"
@@ -0,0 +1,5 @@
// "Remove 'toString()' call" "true"
operator fun Any.invoke() = this
fun foo(arg: Any) = "${arg()}"
@@ -0,0 +1,3 @@
// "Remove 'toString()' call" "true"
fun foo(arg: Any) = "arg = ${arg.<caret>toString()}"
@@ -0,0 +1,3 @@
// "Remove 'toString()' call" "true"
fun foo(arg: Any) = "arg = $arg"
@@ -0,0 +1,3 @@
// "Remove 'toString()' call" "true"
fun foo(arg: Any) = "arg = ${arg.<caret>toString()}xy"
@@ -0,0 +1,3 @@
// "Remove 'toString()' call" "true"
fun foo(arg: Any) = "arg = ${arg}xy"
@@ -0,0 +1,5 @@
// "Remove 'toString()' call" "true"
fun foo(s: String) = s
fun bar() = foo("a${"b".toString()<caret>}")
@@ -0,0 +1,5 @@
// "Remove 'toString()' call" "true"
fun foo(s: String) = s
fun bar() = foo("a${"b"<caret>}")