FIR: add test fixing builder inference case

This commit is contained in:
Mikhail Glukhikh
2021-04-12 12:18:40 +03:00
parent f7147dc6f3
commit b58e5b182c
4 changed files with 64 additions and 0 deletions
@@ -0,0 +1,19 @@
interface KtScope {
fun getAllNames(): Set<String>
}
inline fun <E> buildSet(@BuilderInference builderAction: MutableSet<E>.() -> Unit): Set<E> {
return null!!
}
inline fun <R> withValidityAssertion(action: () -> R): R {
return action()
}
class KtFirCompositeScope(val subScopes: List<KtScope>) {
fun getAllNames(): Set<String> = withValidityAssertion {
buildSet {
subScopes.flatMapTo(this) { it.getAllNames() }
}
}
}