Introduce Variable: Support destructuring declarations

#KT-6262
This commit is contained in:
Alexey Sedunov
2015-11-24 17:06:09 +03:00
parent 09f8aafb77
commit 7a40239e64
14 changed files with 297 additions and 44 deletions
@@ -0,0 +1,8 @@
class A
fun A.component1() = 1
fun A.component2() = 2
fun test() {
<selection>A()</selection>
}
@@ -0,0 +1,8 @@
class A
fun A.component1() = 1
fun A.component2() = 2
fun test() {
val a = A()
}
@@ -0,0 +1,7 @@
class A
operator fun A.component1() = 1
fun test() {
<selection>A()</selection>
}
@@ -0,0 +1,7 @@
class A
operator fun A.component1() = 1
fun test() {
val a = A()
}
@@ -0,0 +1,12 @@
class A
operator fun A.component1() = 1
operator fun A.component2() = 2
class B {
operator fun A.component3() = 3
}
fun test() {
<selection>A()</selection>
}
@@ -0,0 +1,12 @@
class A
operator fun A.component1() = 1
operator fun A.component2() = 2
class B {
operator fun A.component3() = 3
}
fun test() {
val (i, i1) = A()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
<selection>1 to 2</selection>
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (i, i1) = 1 to 2
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
(<selection>1 to 2</selection>).first
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test() {
val pair = 1 to 2
pair.first
}