Files
kotlin-fork/idea/testData/inspections/convertLambdaToReference/test.kt
T
Mikhail Glukhikh a3b52fd8a6 Lambda to callable reference: inspection is optional depending on text length
(cherry picked from commit ce0c43c)
2016-07-18 17:10:31 +03:00

9 lines
352 B
Kotlin
Vendored

// Mostly tested as intention. Here we just test shouldSuggestToConvert()
// Should suggest to convert
class TheirWrapper(val x: Int)
val x = { y: Int -> TheirWrapper(y) }
// Should not suggest to convert (too long reference)
fun foo(arg: TheirWrapper, convert: (TheirWrapper) -> String) = convert(arg)
val y = foo(TheirWrapper(42)) { it.toString() }