Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/nullability/nullToGeneric.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

36 lines
700 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
fun <E> bar(x: E) {}
fun <T> foo(): T {
val x1: T = <!NULL_FOR_NONNULL_TYPE!>null<!>
val x2: T? = null
bar<T>(<!NULL_FOR_NONNULL_TYPE!>null<!>)
bar<T?>(null)
return <!NULL_FOR_NONNULL_TYPE!>null<!>
}
fun <T> baz(): T? = null
fun <T> foobar(): T = <!NULL_FOR_NONNULL_TYPE!>null<!>
class A<F> {
fun xyz(x: F) {}
fun foo(): F {
val x1: F = <!NULL_FOR_NONNULL_TYPE!>null<!>
val x2: F? = null
xyz(<!NULL_FOR_NONNULL_TYPE!>null<!>)
bar<F?>(null)
return <!NULL_FOR_NONNULL_TYPE!>null<!>
}
fun baz(): F? = null
fun foobar(): F = <!NULL_FOR_NONNULL_TYPE!>null<!>
}