Skip to content

Support Kotlin function types #852

Open
@ArsenHD

Description

@ArsenHD

Description

In PR #825 lambdas became allowed as values for fields, method parameters or results if they have a type of some functional interface. However, this was not yet tested on Kotlin function types which also can be represented by lambdas. The goal is to investigate if current support of lambdas is compatible with Kotlin function types. If not, then it should be supported.

See examples of cases where we use lambdas in test class org.utbot.examples.lambda.CustomPredicateExampleTest.

Expected behavior

For functional interfaces we already generate lambdas by finding them somewhere in the available classes. The same should be done for function types. For example, given function type (Int) -> Int, we should be able to find lambdas for it just like we do for functional interface type java.util.function.Function<Integer, Integer>.

Environment

No specific steps to set up the environment are required, just generate tests for Kotlin methods with parameters of function types. It is worth, however, to produce tests in both Java and Kotlin to make sure everything works correctly for both languages.

Potential alternatives

Unknown.

Context

Function types in Kotlin are described here.

Metadata

Metadata

Assignees

Labels

lang-kotlinIssue is related to Kotlin language support

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions