Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/regressions/kt35943.kt
T
Pavel Kirpichenkov cb0b44273d [NI] Check stub types in result type
An uninferred parameter stub may leak through calculation of CST(Inv<Uninferred Stub>, Nothing) into a result type.
A stub type in the result type means a type error. So we can afford recalculating
CST with stub-containing types filtered out, since its an error anyway.
This prevents stub types leakages and helps with reporting type error diagnostics.

KT-35914 Fixed
KT-35943 Fixed
2020-01-20 11:11:31 +03:00

10 lines
181 B
Kotlin
Vendored

// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_EXPRESSION
class Inv<I>
fun <T> create(): Inv<T> = TODO()
fun main() {
<!TYPE_MISMATCH!>if (true) create() else null<!>
}