Prevent expression selector from selecting just a label

Previously, extract variable could act on e.g. 'break@outerLoop' and
extract the label, leading into nonsensical 'val x = @outerLoop'.
Prevent JetRefactoringUtil.selectExpression from returning label
expressions to fix this.

 #KT-4515 Fixed
This commit is contained in:
Tuomas Tynkkynen
2014-02-06 09:56:51 -08:00
committed by Nikolay Krasko
parent 998d2c5ec8
commit 7a2321460d
8 changed files with 53 additions and 6 deletions
@@ -0,0 +1,7 @@
fun f() {
@loop while (true) {
break@lo<selection>o</selection>p
}
}
// KT-4515: Extract variable can attempt to extract a label from a labelled statement.
/* break@loop */
@@ -0,0 +1,6 @@
class Foo() {
val s = this@F<selection>o</selection>o.toString()
}
// KT-4515: Extract variable can attempt to extract a label from a labelled statement.
/* this@Foo */