diff --git a/idea/resources/inspectionDescriptions/ReplaceSingleLineLet.html b/idea/resources/inspectionDescriptions/ReplaceSingleLineLet.html
new file mode 100644
index 00000000000..7fbeb37606d
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/ReplaceSingleLineLet.html
@@ -0,0 +1,5 @@
+
+
+This inspection detects redundant '.let', when it includes only one call with lambda parameter as receiver.
+
+
diff --git a/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/after.kt.template b/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/after.kt.template
new file mode 100644
index 00000000000..d75d12fb427
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/after.kt.template
@@ -0,0 +1 @@
+text?.length
diff --git a/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/before.kt.template b/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/before.kt.template
new file mode 100644
index 00000000000..d2e7890d189
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/before.kt.template
@@ -0,0 +1 @@
+text?.let { it.length }
diff --git a/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/description.html b/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/description.html
new file mode 100644
index 00000000000..88bb8f96713
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSingleLineLetIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention removes redundant '.let', when it includes only one call with lambda parameter as receiver.
+
+
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index b77fe0a4797..b9869444ca3 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -1348,6 +1348,11 @@
Kotlin
+
+ org.jetbrains.kotlin.idea.intentions.ReplaceSingleLineLetIntention
+ Kotlin
+
+
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSingleLineLetIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSingleLineLetIntention.kt
new file mode 100644
index 00000000000..107e5fe906c
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSingleLineLetIntention.kt
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2010-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.idea.intentions
+
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.util.TextRange
+import org.jetbrains.kotlin.idea.caches.resolve.analyze
+import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
+import org.jetbrains.kotlin.lexer.KtToken
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.*
+import org.jetbrains.kotlin.psi.psiUtil.endOffset
+import org.jetbrains.kotlin.psi.psiUtil.getStartOffsetIn
+import org.jetbrains.kotlin.psi.psiUtil.startOffset
+import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
+import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
+
+class ReplaceSingleLineLetInspection : IntentionBasedInspection(ReplaceSingleLineLetIntention::class) {
+ override fun inspectionRange(element: KtCallExpression) = element.calleeExpression?.let {
+ val start = it.getStartOffsetIn(element)
+ TextRange(start, start + it.endOffset - it.startOffset)
+ }
+}
+
+class ReplaceSingleLineLetIntention : SelfTargetingOffsetIndependentIntention(
+ KtCallExpression::class.java,
+ "Remove redundant '.let' call"
+) {
+ override fun applyTo(element: KtCallExpression, editor: Editor?) {
+ val lambdaExpression = element.lambdaArguments.firstOrNull()?.getLambdaExpression() ?: return
+ val bodyExpression = lambdaExpression.bodyExpression?.children?.singleOrNull() ?: return
+ val dotQualifiedExpression = bodyExpression as? KtDotQualifiedExpression ?: return
+ val parent = element.parent
+ when (parent) {
+ is KtQualifiedExpression -> {
+ val factory = KtPsiFactory(element.project)
+ val receiver = parent.receiverExpression
+ parent.replace(dotQualifiedExpression.replaceFirstReceiver(factory, receiver, parent.operationSign == KtTokens.SAFE_ACCESS))
+ }
+ else -> {
+ element.replace(dotQualifiedExpression.deleteFirstReceiver())
+ }
+ }
+ }
+
+ private fun KtDotQualifiedExpression.deleteFirstReceiver(): KtExpression {
+ val receiver = receiverExpression
+ when (receiver) {
+ is KtDotQualifiedExpression -> receiver.deleteFirstReceiver()
+ else -> selectorExpression?.let { return this.replace(it) as KtExpression }
+ }
+ return this
+ }
+
+ private fun KtDotQualifiedExpression.replaceFirstReceiver(
+ factory: KtPsiFactory,
+ newReceiver: KtExpression,
+ safeAccess: Boolean = false
+ ): KtExpression {
+ val receiver = receiverExpression
+ when (receiver) {
+ is KtDotQualifiedExpression -> {
+ receiver.replaceFirstReceiver(factory, newReceiver, safeAccess)
+ }
+ else -> {
+ if (safeAccess) {
+ operationTokenNode.psi.replace(factory.createSafeCallNode().psi)
+ }
+ receiver.replace(newReceiver)
+ }
+ }
+ return this
+ }
+
+ override fun isApplicableTo(element: KtCallExpression): Boolean {
+ if (!isLetMethod(element)) return false
+ val lambdaExpression = element.lambdaArguments.firstOrNull()?.getLambdaExpression() ?: return false
+ val bodyExpression = lambdaExpression.bodyExpression?.children?.singleOrNull() ?: return false
+ val dotQualifiedExpression = bodyExpression as? KtDotQualifiedExpression ?: return false
+ val parameterName = lambdaExpression.getParameterName() ?: return false
+ val receiverExpression = dotQualifiedExpression.getLeftMostReceiverExpression()
+ if (receiverExpression.text != parameterName) return false
+ return !dotQualifiedExpression.receiverUsedAsArgument(parameterName)
+ }
+
+ private fun isLetMethod(element: KtCallExpression) =
+ element.calleeExpression?.text == "let" && isMethodCall(element, "kotlin.let")
+
+ private fun isMethodCall(expression: KtExpression, fqMethodName: String): Boolean {
+ val resolvedCall = expression.getResolvedCall(expression.analyze()) ?: return false
+ return resolvedCall.resultingDescriptor.fqNameUnsafe.asString() == fqMethodName
+ }
+
+ private fun KtLambdaExpression.getParameterName(): String? {
+ val parameters = valueParameters
+ if (parameters.size > 1) return null
+ return if (parameters.size == 1) parameters[0].text else "it"
+ }
+
+ private fun KtDotQualifiedExpression.getLeftMostReceiverExpression(): KtExpression =
+ (receiverExpression as? KtDotQualifiedExpression)?.getLeftMostReceiverExpression() ?: receiverExpression
+
+ private fun KtDotQualifiedExpression.receiverUsedAsArgument(receiverName: String): Boolean {
+ if ((selectorExpression as? KtCallExpression)?.valueArguments?.firstOrNull { it.text == receiverName } != null) return true
+ return (receiverExpression as? KtDotQualifiedExpression)?.receiverUsedAsArgument(receiverName) ?: false
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/.intention b/idea/testData/intentions/replaceSingleLineLetIntention/.intention
new file mode 100644
index 00000000000..dff5fcac91f
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/.intention
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.intentions.ReplaceSingleLineLetIntention
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/let.kt b/idea/testData/intentions/replaceSingleLineLetIntention/let.kt
new file mode 100644
index 00000000000..0b9b90037f2
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/let.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.length
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/let.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/let.kt.after
new file mode 100644
index 00000000000..08f96ff2517
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/let.kt.after
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.length
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letMultipleLines.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letMultipleLines.kt
new file mode 100644
index 00000000000..5f375de264d
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letMultipleLines.kt
@@ -0,0 +1,10 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.length
+ it.length
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt
new file mode 100644
index 00000000000..8eabad15e70
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String = ""
+ foo.let {
+ it.length
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt.after
new file mode 100644
index 00000000000..63ca0d692d5
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt.after
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String = ""
+ foo.length
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letNotUseParameterReceiver.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letNotUseParameterReceiver.kt
new file mode 100644
index 00000000000..5a36bd1d600
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letNotUseParameterReceiver.kt
@@ -0,0 +1,10 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ text ->
+ "".to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letNotUseReceiver.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letNotUseReceiver.kt
new file mode 100644
index 00000000000..c0d9c357bb3
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letNotUseReceiver.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ "".to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letUseIt.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letUseIt.kt
new file mode 100644
index 00000000000..4efefd69b99
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letUseIt.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.to(it)
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall1.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall1.kt
new file mode 100644
index 00000000000..9e5117ecc9f
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall1.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.to(it).to("").to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall2.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall2.kt
new file mode 100644
index 00000000000..b1f95237ce3
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall2.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.to("").to(it).to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall3.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall3.kt
new file mode 100644
index 00000000000..80d7191b9c1
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall3.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.to("").to("").to(it)
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letUseParameter.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letUseParameter.kt
new file mode 100644
index 00000000000..9881425472c
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letUseParameter.kt
@@ -0,0 +1,10 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ text ->
+ text.to(text)
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt
new file mode 100644
index 00000000000..540745b84d4
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt.after
new file mode 100644
index 00000000000..c836459393b
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt.after
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.to("")
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt
new file mode 100644
index 00000000000..97e796cf2d4
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ it.to("").to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt.after
new file mode 100644
index 00000000000..8b822fa52f9
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt.after
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.to("").to("")
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt b/idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt
new file mode 100644
index 00000000000..b7dcf0a44dd
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt
@@ -0,0 +1,10 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.let {
+ text ->
+ text.length
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt.after
new file mode 100644
index 00000000000..08f96ff2517
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt.after
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.length
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt b/idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt
new file mode 100644
index 00000000000..1e71048d0e4
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt
@@ -0,0 +1,11 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.toString()?.let {
+ it.to("")
+ }?.let {
+ it.to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt.after
new file mode 100644
index 00000000000..05cd5886c4c
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt.after
@@ -0,0 +1,9 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun foo() {
+ val foo: String? = null
+ foo?.toString()?.to("")?.let {
+ it.to("")
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/this.kt b/idea/testData/intentions/replaceSingleLineLetIntention/this.kt
new file mode 100644
index 00000000000..c34c1a65872
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/this.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun Int.foo(): Int {
+ return let { it.hashCode().hashCode() }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/this.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/this.kt.after
new file mode 100644
index 00000000000..bd7b5c17b54
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/this.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun Int.foo(): Int {
+ return hashCode().hashCode()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt b/idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt
new file mode 100644
index 00000000000..6c0e26bcb33
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun Int.foo(): Int {
+ return let { it.hashCode() }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt.after b/idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt.after
new file mode 100644
index 00000000000..399c9c1a372
--- /dev/null
+++ b/idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: true
+
+fun Int.foo(): Int {
+ return hashCode()
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
index 031ab8fd7a2..d9052ded1e0 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -10565,6 +10565,111 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
+ @TestMetadata("idea/testData/intentions/replaceSingleLineLetIntention")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ReplaceSingleLineLetIntention extends AbstractIntentionTest {
+ public void testAllFilesPresentInReplaceSingleLineLetIntention() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/replaceSingleLineLetIntention"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
+ }
+
+ @TestMetadata("let.kt")
+ public void testLet() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/let.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letMultipleLines.kt")
+ public void testLetMultipleLines() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letMultipleLines.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letNoSafeCall.kt")
+ public void testLetNoSafeCall() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letNoSafeCall.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letNotUseParameterReceiver.kt")
+ public void testLetNotUseParameterReceiver() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letNotUseParameterReceiver.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letNotUseReceiver.kt")
+ public void testLetNotUseReceiver() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letNotUseReceiver.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letUseIt.kt")
+ public void testLetUseIt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letUseIt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letUseItWithMultipleMethodCall1.kt")
+ public void testLetUseItWithMultipleMethodCall1() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall1.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letUseItWithMultipleMethodCall2.kt")
+ public void testLetUseItWithMultipleMethodCall2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letUseItWithMultipleMethodCall3.kt")
+ public void testLetUseItWithMultipleMethodCall3() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letUseItWithMultipleMethodCall3.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letUseParameter.kt")
+ public void testLetUseParameter() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letUseParameter.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letWithMethodCall.kt")
+ public void testLetWithMethodCall() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letWithMethodCall.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letWithMultipleMethodCall.kt")
+ public void testLetWithMultipleMethodCall() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letWithMultipleMethodCall.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("letWithParameter.kt")
+ public void testLetWithParameter() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/letWithParameter.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("sameLets.kt")
+ public void testSameLets() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/sameLets.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("this.kt")
+ public void testThis() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/this.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("thisShort.kt")
+ public void testThisShort() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSingleLineLetIntention/thisShort.kt");
+ doTest(fileName);
+ }
+ }
+
@TestMetadata("idea/testData/intentions/replaceSubstringWithDropLast")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)