Files
kotlin-fork/idea/testData/inspections/convertLambdaToReference/test.kt
T
Mikhail Glukhikh 759e6643c6 ConvertLambdaToReference refactoring
Intention is not registered now; inspection is enabled by default now,
 but has highlight level of "No highlighting"
Inspection does not depend on text length now

So #KT-14335 Fixed
2017-05-10 14:56:37 +03:00

15 lines
535 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 suggest to convert despite of too long reference
fun foo(arg: TheirWrapper, convert: (TheirWrapper) -> String) = convert(arg)
val y = foo(TheirWrapper(42)) { it.toString() }
// Also should suggest to convert, but only call should be highlighted
fun bar(arg: Int, convert: (Int) -> TheirWrapper) = convert(arg)
val z = bar(42) {
TheirWrapper(it)
}