Move Left/Right: Support type constraints

#KT-26525 Fixed
This commit is contained in:
Alexey Sedunov
2018-09-04 20:04:03 +03:00
parent a20857beb9
commit 26c02cd8bb
6 changed files with 27 additions and 0 deletions
@@ -28,6 +28,7 @@ class KotlinMoveLeftRightHandler : MoveElementLeftRightHandler() {
is KtArrayAccessExpression -> return element.indexExpressions.toTypedArray()
is KtTypeParameterList -> return element.parameters.toTypedArray()
is KtSuperTypeList -> return element.entries.toTypedArray()
is KtTypeConstraintList -> return element.constraints.toTypedArray()
//TODO
// is KtClass -> if (element.isEnum()) return element.declarations.filterIsInstance<KtEnumEntry>().toTypedArray()
}
@@ -0,0 +1,4 @@
// MOVE: right
interface Foo<E>
interface Bar<K, V>
interface Baz<E, K, N> where B : <caret>Bar<E, K>, E: Any, F: Foo<E>
@@ -0,0 +1,4 @@
// MOVE: right
interface Foo<E>
interface Bar<K, V>
interface Baz<E, K, N> where E: Any, B : <caret>Bar<E, K>, F: Foo<E>
@@ -0,0 +1,4 @@
// MOVE: left
interface Foo<E>
interface Bar<K, V>
interface Baz<E, K, N> where B : Bar<E, K>, <caret>E: Any, F: Foo<E>
@@ -0,0 +1,4 @@
// MOVE: left
interface Foo<E>
interface Bar<K, V>
interface Baz<E, K, N> where <caret>E: Any, B : Bar<E, K>, F: Foo<E>
@@ -98,4 +98,14 @@ public class MoveLeftRightTestGenerated extends AbstractMoveLeftRightTest {
public void testTypeArgs() throws Exception {
runTest("idea/testData/codeInsight/moveLeftRight/typeArgs.kt");
}
@TestMetadata("typeConstraints1.kt")
public void testTypeConstraints1() throws Exception {
runTest("idea/testData/codeInsight/moveLeftRight/typeConstraints1.kt");
}
@TestMetadata("typeConstraints2.kt")
public void testTypeConstraints2() throws Exception {
runTest("idea/testData/codeInsight/moveLeftRight/typeConstraints2.kt");
}
}