Insert brackets in "Convert reference to lambda" if necessary
So #KT-16394 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
0348561cd2
commit
ec64a7e422
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = if (x == 1)
|
||||
<caret>this::bar
|
||||
else
|
||||
this::bar
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = if (x == 1)
|
||||
({ this.bar() })
|
||||
else
|
||||
this::bar
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = if (x == 1)
|
||||
this::bar
|
||||
else
|
||||
<caret>this::bar
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = if (x == 1)
|
||||
this::bar
|
||||
else
|
||||
({ this.bar() })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = if (x == 1) {
|
||||
this::bar
|
||||
} else {
|
||||
<caret>this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = if (x == 1) {
|
||||
this::bar
|
||||
} else {
|
||||
{ this.bar() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
fun bar(a: String) = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: (a: String) -> Int = if (x == 1) this::bar else <caret>this::bar
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
fun bar(a: String) = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: (a: String) -> Int = if (x == 1) this::bar else { a: String -> this.bar(a) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = when (x) {
|
||||
1 -> <caret>this::bar
|
||||
else -> this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = when (x) {
|
||||
1 -> ({ this.bar() })
|
||||
else -> this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = when (x) {
|
||||
1 -> this::bar
|
||||
else -> <caret>this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = when (x) {
|
||||
1 -> this::bar
|
||||
else -> ({ this.bar() })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = when (x) {
|
||||
1 -> {
|
||||
<caret>this::bar
|
||||
}
|
||||
else -> {
|
||||
this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Test {
|
||||
fun bar() = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: () -> Int = when (x) {
|
||||
1 -> {
|
||||
{ this.bar() }
|
||||
}
|
||||
else -> {
|
||||
this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar(a: String) = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: (a: String) -> Int = when (x) {
|
||||
1 -> <caret>this::bar
|
||||
else -> this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
fun bar(a: String) = 1
|
||||
|
||||
fun test(x: Int) {
|
||||
val foo: (a: String) -> Int = when (x) {
|
||||
1 -> { a: String -> this.bar(a) }
|
||||
else -> this::bar
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user