提交 0ac44306 编写于 作者: M Mikhail Glukhikh

KT-12100 convert try / finally to use: 'this' receiver is now left as is

上级 f513514c
......@@ -51,6 +51,10 @@ class ConvertTryFinallyToUseCallIntention : SelfTargetingOffsetIndependentIntent
appendName(resourceName)
appendFixedText(".")
}
else if (finallyExpressionReceiver is KtThisExpression) {
appendFixedText(finallyExpressionReceiver.text)
appendFixedText(".")
}
appendFixedText("use {")
if (resourceName != null) {
......
......@@ -3,5 +3,5 @@ import java.io.File
import java.io.BufferedReader
fun BufferedReader.foo() {
use { this.readLine() }
this.use { this.readLine() }
}
\ No newline at end of file
......@@ -8,6 +8,6 @@ class MyCloseable : Closeable {
fun process(x: Int) = x
fun Int.foo() {
use { this@MyCloseable.process(this) }
this@MyCloseable.use { this@MyCloseable.process(this) }
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册