has Return Value
Indicates whether a declaration has a non-Unit
return value.
If a declaration explicitly specifies a return type, hasReturnValue returns true only if the declared type is not
Unit
.For declarations without an explicit return type:
If the declaration has a block body, hasReturnValue always returns
false
.Example:
fun sampleFunction() { "some text" } // hasReturnValue == false
Content copied to clipboardIf the declaration has an expression body, hasReturnValue always returns
true
.Examples:
fun sampleFunction1() = SampleClass() // hasReturnValue == true
fun sampleFunction2() = println("some text") // hasReturnValue == true, because Konsist is not able to
// determine value of the "println("some text")" expressionContent copied to clipboard
Content copied to clipboard