Support new form of definitely non-nullable types: T & Any

^KT-26245 In Progress
This commit is contained in:
Denis.Zharkov
2021-08-09 12:10:51 +03:00
committed by teamcityserver
parent cdd8d1c163
commit 302eacbf59
53 changed files with 2139 additions and 196 deletions
@@ -0,0 +1,17 @@
// FIR_IDENTICAL
// SKIP_TXT
// !LANGUAGE: -DefinitelyNotNullTypeParameters
fun Any.bar() {}
fun Boolean.baz() {}
var x: Int = 0
inline fun <reified T> foo(v: Any?): T {
if (x > 0) 1 else v as T <!SYNTAX!>& Any<!>
if (x > 1) 2 else v as? T <!SYNTAX!>& Any<!>
if (x > 2) 3 else v is T <!SYNTAX!>& Any<!>
if (x > 3) 4 else v !is T <!SYNTAX!>& Any<!>
return v as T <!SYNTAX!>& Any<!>
}