Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt
T
2021-05-28 15:36:19 +03:00

33 lines
635 B
Kotlin
Vendored

// !LANGUAGE: +StableBuilderInference
// WITH_RUNTIME
interface A {
fun foo(): MutableList<String>
}
@ExperimentalStdlibApi
fun main() {
buildList {
add(3)
object : A {
override fun foo(): MutableList<String> = this@buildList
}
}
buildList {
add(3)
val x: String = get(0)
}
buildList {
add("3")
val x: MutableList<Int> = this@buildList
}
buildList {
val y: CharSequence = ""
add(y)
val x: MutableList<String> = this@buildList
}
buildList {
add("")
val x: StringBuilder = get(0)
}
}