KT-12628: !! is now correctly added to array expressions

(cherry picked from commit 56c9d7e)
This commit is contained in:
Mikhail Glukhikh
2016-07-27 17:52:48 +03:00
committed by Mikhail Glukhikh
parent 47493c1a65
commit a9c30e878b
6 changed files with 31 additions and 0 deletions
@@ -95,6 +95,9 @@ class AddExclExclCallFix(val psiElement: PsiElement) : ExclExclCallFix() {
return sibling
}
}
else if (psiElement is KtArrayAccessExpression) {
return psiElement.arrayExpression
}
else if (psiElement is KtExpression) {
return psiElement
}
+4
View File
@@ -0,0 +1,4 @@
// "Add non-null asserted (!!) call" "true"
operator fun Int.get(row: Int, column: Int) = this
fun foo(arg: Int?) = arg<caret>[42, 13]
@@ -0,0 +1,4 @@
// "Add non-null asserted (!!) call" "true"
operator fun Int.get(row: Int, column: Int) = this
fun foo(arg: Int?) = arg!![42, 13]
+4
View File
@@ -0,0 +1,4 @@
// "Add non-null asserted (!!) call" "true"
operator fun Int.get(row: Int, column: Int) = if (row == column) this else null
fun foo(arg: Int) = arg[42, 13]<caret>.hashCode()
@@ -0,0 +1,4 @@
// "Add non-null asserted (!!) call" "true"
operator fun Int.get(row: Int, column: Int) = if (row == column) this else null
fun foo(arg: Int) = arg[42, 13]!!.hashCode()
@@ -4809,6 +4809,18 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
doTest(fileName);
}
@TestMetadata("unsafeCall4.kt")
public void testUnsafeCall4() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/expressions/unsafeCall4.kt");
doTest(fileName);
}
@TestMetadata("unsafeCall5.kt")
public void testUnsafeCall5() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/expressions/unsafeCall5.kt");
doTest(fileName);
}
@TestMetadata("uselessCastStaticAssertIsFine.kt")
public void testUselessCastStaticAssertIsFine() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/expressions/uselessCastStaticAssertIsFine.kt");