Inspectopedia Help

Function with '= { ... }' and inferred return type

Reports functions with = { ... } and inferred return type.

Example:

fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.

The quick fix removes braces:

fun sum(a: Int, b: Int) = a + b

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023