google / google/truth

Method to create a Correspondence in which the lambda is last (for Kotlin)

Open
#544 6 comments 0 reactions 0 assignees View on GitHub
P3 type=enhancement
Dominant language
Java
Stars
2.8k
Forks
275
Avg merge
7m
Merged PRs (30d)
4

Description

In kotlin, if the last argument of a method is a lambda, it can be moved out of the parentheses.
Therefore it would be great if you could swap the predicate and the description of `Correspondence.from`.

Then this:
```kotlin
val CONTAINS_SUBSTRING =
Correspondence.from(
{ left, right ->
left != null && right != null && left.contains(right)
}, "contains")
```

would be come this:
```kotlin
val CONTAINS_SUBSTRING = Correspondence.from("contains") { left, right ->
left != null && right != null && left.contains(right)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.