Added KT-4579 makeTypeExplicitInLambda and makeTypeImplicitInLambda intentions
This commit is contained in:
committed by
Alexander Udalov
parent
1ef785eb1a
commit
6066d19de5
@@ -0,0 +1,9 @@
|
||||
public class TestingUse {
|
||||
fun test5(coerced: (x: Int) -> Unit, a: Int): Unit {
|
||||
return coerced(5)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val coercion = TestingUse().test5({<caret>x -> x + 2}, 20)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class TestingUse {
|
||||
fun test5(coerced: (x: Int) -> Unit, a: Int): Unit {
|
||||
return coerced(5)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val coercion = TestingUse().test5({(x: Int): Unit -> x + 2}, 20)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun main() {
|
||||
val x = {<caret>(): Unit -> }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestingUse {
|
||||
fun test3(double: (a: Int) -> Int, b: Int): Int {
|
||||
return double(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test3({<caret>it * 2}, 20)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestingUse {
|
||||
fun test3(double: (a: Int) -> Int, b: Int): Int {
|
||||
return double(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test3({(it: Int): Int -> it * 2}, 20)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun main() {
|
||||
val oom: (Int)->Int = {<caret>
|
||||
it * 2
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun main() {
|
||||
val oom: (Int)->Int = {
|
||||
(it: Int): Int ->
|
||||
it * 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val oom = {<caret> -> 42}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val oom = {(): Int -> 42}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun main() {
|
||||
val sum : (Int, Int) -> Int = { (x, y) -> <caret>x + y }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class TestingUse {
|
||||
fun test6(funcLitfunc: ((x: Int) -> Int) -> Boolean, innerfunc: (y: Int) -> Int): Unit {
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val funcInfunc = TestingUse().test6({<caret>f -> f(5) > 20}, {x -> x + 2})
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class TestingUse {
|
||||
fun test6(funcLitfunc: ((x: Int) -> Int) -> Boolean, innerfunc: (y: Int) -> Int): Unit {
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val funcInfunc = TestingUse().test6({(f: (Int) -> Int): Boolean -> f(5) > 20}, {x -> x + 2})
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
val foo: (Long) -> String = {<caret>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
it.toString()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
val foo: (Long) -> String = {
|
||||
(it: Long): String ->
|
||||
|
||||
|
||||
it.toString()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class TestingUse {
|
||||
fun test4(printNum: (a: Int, b: String) -> Unit, c: Int): Int {
|
||||
printNum(c, "This number is")
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test4({(<caret>x, str) -> }, 5)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class TestingUse {
|
||||
fun test4(printNum: (a: Int, b: String) -> Unit, c: Int): Int {
|
||||
printNum(c, "This number is")
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test4({(x: Int, str: String): Unit -> }, 5)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val foo: (Int) -> String = {(x: Int) -> "This number is " + x<caret>}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val foo: (Int) -> String = {(x: Int): String -> "This number is " + x}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val bar: (Array<String>) -> Int = {<caret>(arr): Int -> arr.size}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val bar: (Array<String>) -> Int = {(arr: Array<String>): Int -> arr.size}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val randomFunction: (x: kotlin.Int, y: kotlin.String) -> kotlin.Int = {(<caret>x, str) -> x}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val randomFunction: (x: kotlin.Int, y: kotlin.String) -> kotlin.Int = {(x: Int, str: String): Int -> x}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val randomFunction: kotlin.Array<kotlin.Int>.(x: Int) -> Boolean = {<caret>y -> if (this[0] < y) true else false}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val randomFunction: kotlin.Array<kotlin.Int>.(x: Int) -> Boolean = { Array<Int>.(y: Int): Boolean -> if (this[0] < y) true else false}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestingUse {
|
||||
fun test3(double: (a: Int) -> Int, b: Int): Int {
|
||||
return double(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test3({<caret>x -> 2*x}, 20)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestingUse {
|
||||
fun test3(double: (a: Int) -> Int, b: Int): Int {
|
||||
return double(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test3({(x: Int): Int -> 2*x}, 20)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestingUse {
|
||||
fun test(sum: Int.(a: Int) -> Int, b: Int): Int {
|
||||
return b.sum(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test({ <caret>x -> x + 2 }, 20)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class TestingUse {
|
||||
fun test(sum: Int.(a: Int) -> Int, b: Int): Int {
|
||||
return b.sum(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test({ Int.(x: Int): Int -> x + 2 }, 20)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun main() {
|
||||
val sum = { Int.(<caret>x: Int, y: Int) : Int -> x + y }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Cannot infer a type for this parameter. To specify it explicitly use the {(p : Type) -> ...} notation
|
||||
// ERROR: Cannot infer a type for this parameter. To specify it explicitly use the {(p : Type) -> ...} notation
|
||||
fun main() {
|
||||
val sum = { (x, <caret>y) -> x + y // Type of x and y cannot be inferred, so intention can't be used
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class TestingUse {
|
||||
fun test(sum: Int.(a: Int) -> Int, b: Int): Int {
|
||||
return b.sum(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test({ Int.(x: Int): Int -> x + 2 <caret>}, 20)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class TestingUse {
|
||||
fun test(sum: Int.(a: Int) -> Int, b: Int): Int {
|
||||
return b.sum(b)
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = TestingUse().test({ x -> x + 2 }, 20)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val sum = { (<caret>x: Int, y: Int): Int -> x + y }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val sum = { x, y -> x + y }
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun main() {
|
||||
val sum = { (x: Int, y: Int) -> <caret>x + y }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class TestingUse {
|
||||
fun test6(funcLitfunc: ((x: Int) -> Int) -> Boolean, innerfunc: (y: Int) -> Int): Unit {
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val funcInfunc = TestingUse().test6({<caret>(f: (Int) -> Int): Boolean -> f(5) > 20}, {x -> x + 2})
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class TestingUse {
|
||||
fun test6(funcLitfunc: ((x: Int) -> Int) -> Boolean, innerfunc: (y: Int) -> Int): Unit {
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val funcInfunc = TestingUse().test6({ f -> f(5) > 20}, {x -> x + 2})
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val f = {<caret> (x: Int, str: String): Unit -> x }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val f = { x, str -> x }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val foo: (Int) -> String = {(x: Int) -> "This number is " + x<caret>}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val foo: (Int) -> String = { x -> "This number is " + x}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val bar: (Array<String>) -> Int = {<caret>(arr): Int -> arr.size}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val bar: (Array<String>) -> Int = { arr -> arr.size}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val double = { (<caret>x: Int) -> x * 2 }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val double = { x -> x * 2 }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun testing(x: Int, y: Int, f: (a: Int, b: Int) -> Int): Int {
|
||||
return f(x, y)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val num = testing(1, 2, { x, y -> x + y <caret>})
|
||||
}
|
||||
Reference in New Issue
Block a user