FIR: support DefinitelyNotNull types

#KT-49465 Fixed
This commit is contained in:
Mikhael Bogdanov
2022-01-26 12:32:56 +01:00
parent bd31cbaebf
commit 15e08893aa
53 changed files with 1092 additions and 133 deletions
@@ -30,7 +30,7 @@ FILE fqName:<root> fileName:/bangbang.kt
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): X of <root>.test3 declared in <root>'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=X of <root>.test3 origin=EXCLEXCL
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={X of <root>.test3 & Any} origin=EXCLEXCL
<T0>: X of <root>.test3
arg0: GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
FUN name:useString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
@@ -0,0 +1,75 @@
FILE fqName:<root> fileName:/implicitCastToNonNull.kt
FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:kotlin.Int
VALUE_PARAMETER name:x index:0 type:kotlin.String?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.String?): kotlin.Int declared in <root>'
WHEN type=kotlin.Int origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'x: kotlin.String? declared in <root>.test1' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'x: kotlin.String? declared in <root>.test1' type=kotlin.String? origin=null
FUN name:test2 visibility:public modality:FINAL <T> (x:T of <root>.test2) returnType:kotlin.Int
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?]
VALUE_PARAMETER name:x index:0 type:T of <root>.test2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 <T> (x: T of <root>.test2): kotlin.Int declared in <root>'
WHEN type=kotlin.Int origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=T of <root>.test2 origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=T of <root>.test2 origin=null
FUN name:test3 visibility:public modality:FINAL <T> (x:kotlin.Any) returnType:kotlin.Int [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?]
VALUE_PARAMETER name:x index:0 type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test3 <T> (x: kotlin.Any): kotlin.Int [inline] declared in <root>'
WHEN type=kotlin.Int origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=T of <root>.test3
GET_VAR 'x: kotlin.Any declared in <root>.test3' type=kotlin.Any origin=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
$this: TYPE_OP type={T of <root>.test3 & Any} origin=IMPLICIT_CAST typeOperand={T of <root>.test3 & Any}
GET_VAR 'x: kotlin.Any declared in <root>.test3' type=kotlin.Any origin=null
FUN name:test4 visibility:public modality:FINAL <T> (x:kotlin.Any?) returnType:kotlin.Int [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence]
VALUE_PARAMETER name:x index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test4 <T> (x: kotlin.Any?): kotlin.Int [inline] declared in <root>'
WHEN type=kotlin.Int origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=T of <root>.test4
GET_VAR 'x: kotlin.Any? declared in <root>.test4' type=kotlin.Any? origin=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
$this: TYPE_OP type=T of <root>.test4 origin=IMPLICIT_CAST typeOperand=T of <root>.test4
GET_VAR 'x: kotlin.Any? declared in <root>.test4' type=kotlin.Any? origin=null
FUN name:test5 visibility:public modality:FINAL <T, S> (x:T of <root>.test5, fn:kotlin.Function1<S of <root>.test5, kotlin.Unit>) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[S of <root>.test5?]
TYPE_PARAMETER name:S index:1 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:x index:0 type:T of <root>.test5
VALUE_PARAMETER name:fn index:1 type:kotlin.Function1<S of <root>.test5, kotlin.Unit>
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'x: T of <root>.test5 declared in <root>.test5' type=T of <root>.test5 origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function1<S of <root>.test5, kotlin.Unit> declared in <root>.test5' type=kotlin.Function1<S of <root>.test5, kotlin.Unit> origin=VARIABLE_AS_FUNCTION
p1: GET_VAR 'x: T of <root>.test5 declared in <root>.test5' type=T of <root>.test5 origin=null
@@ -0,0 +1,33 @@
fun test1(x: String?): Int {
return when {
EQEQ(arg0 = x, arg1 = null) -> 0
else -> x.<get-length>()
}
}
fun <T : CharSequence?> test2(x: T): Int {
return when {
EQEQ(arg0 = x, arg1 = null) -> 0
else -> x.<get-length>()
}
}
inline fun <reified T : CharSequence?> test3(x: Any): Int {
return when {
x !is T -> 0
else -> x /*as (T & Any) */.<get-length>()
}
}
inline fun <reified T : CharSequence> test4(x: Any?): Int {
return when {
x !is T -> 0
else -> x /*as T */.<get-length>()
}
}
fun <T : S?, S : Any?> test5(x: T, fn: Function1<S, Unit>) {
when {
EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x)
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
fun test1(x: String?) =
if (x == null) 0 else x.length
@@ -0,0 +1,82 @@
FILE fqName:<root> fileName:/implicitCastToTypeParameter.kt
FUN name:test1 visibility:public modality:FINAL <T> ($receiver:kotlin.Any) returnType:T of <root>.test1? [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 <T> (): T of <root>.test1? [inline] declared in <root>'
WHEN type=T of <root>.test1? origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.test1
GET_VAR '<this>: kotlin.Any declared in <root>.test1' type=kotlin.Any origin=null
then: TYPE_OP type=T of <root>.test1 origin=IMPLICIT_CAST typeOperand=T of <root>.test1
GET_VAR '<this>: kotlin.Any declared in <root>.test1' type=kotlin.Any origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Null type=kotlin.Nothing? value=null
CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo<T of <root>.Foo>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
PROPERTY name:asT visibility:public modality:FINAL [val]
FUN name:<get-asT> visibility:public modality:FINAL <T> ($receiver:<root>.Foo<T of <root>.<get-asT>>) returnType:T of <root>.<get-asT>? [inline]
correspondingProperty: PROPERTY name:asT visibility:public modality:FINAL [val]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Foo<T of <root>.<get-asT>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-asT> <T> (): T of <root>.<get-asT>? [inline] declared in <root>'
WHEN type=T of <root>.<get-asT>? origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.<get-asT>
GET_VAR '<this>: <root>.Foo<T of <root>.<get-asT>> declared in <root>.<get-asT>' type=<root>.Foo<T of <root>.<get-asT>> origin=null
then: TYPE_OP type=T of <root>.<get-asT> origin=IMPLICIT_CAST typeOperand=T of <root>.<get-asT>
GET_VAR '<this>: <root>.Foo<T of <root>.<get-asT>> declared in <root>.<get-asT>' type=<root>.Foo<T of <root>.<get-asT>> origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Null type=kotlin.Nothing? value=null
CLASS CLASS name:Bar modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Bar<T of <root>.Bar>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.Bar<T of <root>.Bar> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:test visibility:public modality:FINAL <> ($this:<root>.Bar<T of <root>.Bar>, arg:kotlin.Any) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Bar<T of <root>.Bar>
VALUE_PARAMETER name:arg index:0 type:kotlin.Any
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=T of <root>.Bar origin=CAST typeOperand=T of <root>.Bar
GET_VAR 'arg: kotlin.Any declared in <root>.Bar.test' type=kotlin.Any origin=null
CALL 'public final fun useT (t: T of <root>.Bar): kotlin.Unit declared in <root>.Bar' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Bar<T of <root>.Bar> declared in <root>.Bar.test' type=<root>.Bar<T of <root>.Bar> origin=null
t: TYPE_OP type={T of <root>.Bar & Any} origin=IMPLICIT_CAST typeOperand={T of <root>.Bar & Any}
GET_VAR 'arg: kotlin.Any declared in <root>.Bar.test' type=kotlin.Any origin=null
FUN name:useT visibility:public modality:FINAL <> ($this:<root>.Bar<T of <root>.Bar>, t:T of <root>.Bar) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Bar<T of <root>.Bar>
VALUE_PARAMETER name:t index:0 type:T of <root>.Bar
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,35 @@
inline fun <reified T : Any> Any.test1(): T? {
return when {
<this> is T -> <this> /*as T */
else -> null
}
}
interface Foo<T : Any?> {
}
val <reified T : Any> Foo<T>.asT: T?
inline get(): T? {
return when {
<this> is T -> <this> /*as T */
else -> null
}
}
class Bar<T : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
fun test(arg: Any) {
arg as T /*~> Unit */
<this>.useT(t = arg /*as (T & Any) */)
}
fun useT(t: T) {
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
inline fun <reified T : Any> Any.test1(): T? =
if (this is T) this else null
@@ -77,14 +77,14 @@ FILE fqName:<root> fileName:/AbstractMutableMap.kt
VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out @[EnhancedNullability] V of <root>.MyMap>
FUN FAKE_OVERRIDE name:merge visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>, p0:@[EnhancedNullability] K of <root>.MyMap, p1:@[EnhancedNullability] V of <root>.MyMap, p2:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] V of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>) returnType:V of <root>.MyMap? [fake_override]
overridden:
public open fun merge (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] V of kotlin.collections.AbstractMutableMap, p2: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] V of kotlin.collections.AbstractMutableMap, in @[EnhancedNullability] V of kotlin.collections.AbstractMutableMap, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
public open fun merge (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, p2: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, in @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>
VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] K of <root>.MyMap
VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] V of <root>.MyMap
VALUE_PARAMETER name:p2 index:2 type:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] V of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>
FUN FAKE_OVERRIDE name:computeIfPresent visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>, p0:@[EnhancedNullability] K of <root>.MyMap, p1:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>) returnType:V of <root>.MyMap? [fake_override]
overridden:
public open fun computeIfPresent (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, in @[EnhancedNullability] V of kotlin.collections.AbstractMutableMap, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
public open fun computeIfPresent (p0: @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, p1: @[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of kotlin.collections.AbstractMutableMap, in @[EnhancedNullability] {@[EnhancedNullability] V of kotlin.collections.AbstractMutableMap & Any}, out V of kotlin.collections.AbstractMutableMap?>): V of kotlin.collections.AbstractMutableMap? [fake_override] declared in kotlin.collections.AbstractMutableMap
$this: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableMap<K of kotlin.collections.MutableMap, V of kotlin.collections.MutableMap>
VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] K of <root>.MyMap
VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] java.util.function.BiFunction<in @[EnhancedNullability] K of <root>.MyMap, in @[EnhancedNullability] V of <root>.MyMap, out V of <root>.MyMap?>
@@ -0,0 +1,45 @@
FILE fqName:<root> fileName:/definitelyNonNull.kt
FUN name:elvisLike visibility:public modality:FINAL <T> (x:T of <root>.elvisLike, y:{T of <root>.elvisLike & Any}) returnType:{T of <root>.elvisLike & Any}
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:x index:0 type:T of <root>.elvisLike
VALUE_PARAMETER name:y index:1 type:{T of <root>.elvisLike & Any}
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun elvisLike <T> (x: T of <root>.elvisLike, y: {T of <root>.elvisLike & Any}): {T of <root>.elvisLike & Any} declared in <root>'
BLOCK type={T of <root>.elvisLike & Any} origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:T of <root>.elvisLike [val]
GET_VAR 'x: T of <root>.elvisLike declared in <root>.elvisLike' type=T of <root>.elvisLike origin=null
WHEN type={T of <root>.elvisLike & Any} origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: T of <root>.elvisLike [val] declared in <root>.elvisLike' type=T of <root>.elvisLike origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: GET_VAR 'y: {T of <root>.elvisLike & Any} declared in <root>.elvisLike' type={T of <root>.elvisLike & Any} origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_0: T of <root>.elvisLike [val] declared in <root>.elvisLike' type=T of <root>.elvisLike origin=null
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'public final fun elvisLike <T> (x: T of <root>.elvisLike, y: {T of <root>.elvisLike & Any}): {T of <root>.elvisLike & Any} declared in <root>' type=kotlin.String origin=null
<T>: kotlin.String
x: CONST String type=kotlin.String value=""
y: CONST String type=kotlin.String value=""
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'public final fun elvisLike <T> (x: T of <root>.elvisLike, y: {T of <root>.elvisLike & Any}): {T of <root>.elvisLike & Any} declared in <root>' type=kotlin.String origin=null
<T>: kotlin.String?
x: CONST Null type=kotlin.Nothing? value=null
y: CONST String type=kotlin.String value=""
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'public final fun elvisLike <T> (x: T of <root>.elvisLike, y: {T of <root>.elvisLike & Any}): {T of <root>.elvisLike & Any} declared in <root>' type=kotlin.String origin=null
<T>: kotlin.String
x: CONST String type=kotlin.String value=""
y: CONST String type=kotlin.String value=""
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'public final fun elvisLike <T> (x: T of <root>.elvisLike, y: {T of <root>.elvisLike & Any}): {T of <root>.elvisLike & Any} declared in <root>' type=kotlin.String origin=null
<T>: kotlin.String?
x: CONST Null type=kotlin.Nothing? value=null
y: CONST String type=kotlin.String value=""
@@ -0,0 +1,17 @@
fun <T : Any?> elvisLike(x: T, y: (T & Any)): (T & Any) {
return { // BLOCK
val <elvis>: T = x
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> y
else -> <elvis>
}
}
}
fun main() {
elvisLike<String>(x = "", y = "").<get-length>() /*~> Unit */
elvisLike<String?>(x = null, y = "").<get-length>() /*~> Unit */
elvisLike<String>(x = "", y = "").<get-length>() /*~> Unit */
elvisLike<String?>(x = null, y = "").<get-length>() /*~> Unit */
}
@@ -1,5 +1,4 @@
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
fun <T> elvisLike(x: T, y: T & Any): T & Any = x ?: y
@@ -0,0 +1,83 @@
FILE fqName:<root> fileName:/definitelyNonNullOverride.kt
CLASS CLASS name:B modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B<T of <root>.B>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.B<T of <root>.B> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[kotlin.Any]'
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.B<T of <root>.B>, t:T of <root>.B) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:t index:0 type:T of <root>.B
BLOCK_BODY
FUN name:bar visibility:public modality:OPEN <> ($this:<root>.B<T of <root>.B>, t:T of <root>.B) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:t index:0 type:T of <root>.B
BLOCK_BODY
FUN name:qux visibility:public modality:OPEN <> ($this:<root>.B<T of <root>.B>, b:<root>.B<T of <root>.B>) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:b index:0 type:<root>.B<T of <root>.B>
BLOCK_BODY
FUN name:six visibility:public modality:OPEN <F> ($this:<root>.B<T of <root>.B>, t:T of <root>.B, q:F of <root>.B.six) returnType:kotlin.Unit
TYPE_PARAMETER name:F index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:t index:0 type:T of <root>.B
VALUE_PARAMETER name:q index:1 type:F of <root>.B.six
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.B<{T of <root>.D & Any}>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.D<T of <root>.D>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.D<T of <root>.D> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B'
<T>: {T of <root>.D & Any}
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:D modality:FINAL visibility:public superTypes:[<root>.B<{T of <root>.D & Any}>]'
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.D<T of <root>.D>, t:{T of <root>.D & Any}) returnType:kotlin.Unit
overridden:
public open fun foo (t: T of <root>.B): kotlin.Unit declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:<root>.D<T of <root>.D>
VALUE_PARAMETER name:t index:0 type:{T of <root>.D & Any}
BLOCK_BODY
FUN FAKE_OVERRIDE name:bar visibility:public modality:OPEN <> ($this:<root>.B<T of <root>.B>, t:{T of <root>.D & Any}) returnType:kotlin.Unit [fake_override]
overridden:
public open fun bar (t: T of <root>.B): kotlin.Unit declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:t index:0 type:{T of <root>.D & Any}
FUN FAKE_OVERRIDE name:qux visibility:public modality:OPEN <> ($this:<root>.B<T of <root>.B>, b:<root>.B<{T of <root>.D & Any}>) returnType:kotlin.Unit [fake_override]
overridden:
public open fun qux (b: <root>.B<T of <root>.B>): kotlin.Unit declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:b index:0 type:<root>.B<{T of <root>.D & Any}>
FUN FAKE_OVERRIDE name:six visibility:public modality:OPEN <F> ($this:<root>.B<T of <root>.B>, t:{T of <root>.D & Any}, q:F of <root>.D.six) returnType:kotlin.Unit [fake_override]
overridden:
public open fun six <F> (t: T of <root>.B, q: F of <root>.B.six): kotlin.Unit declared in <root>.B
TYPE_PARAMETER name:F index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.B<T of <root>.B>
VALUE_PARAMETER name:t index:0 type:{T of <root>.D & Any}
VALUE_PARAMETER name:q index:1 type:F of <root>.D.six
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -1,5 +1,4 @@
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
// SKIP_KT_DUMP
open class B<T> {
@@ -0,0 +1,223 @@
FILE fqName:<root> fileName:/definitelyNonNullSAM.kt
CLASS INTERFACE name:FIn modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.FIn<T of <root>.FIn>
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
FUN name:f visibility:public modality:ABSTRACT <> ($this:<root>.FIn<T of <root>.FIn>, x:T of <root>.FIn) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.FIn<T of <root>.FIn>
VALUE_PARAMETER name:x index:0 type:T of <root>.FIn
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test<S of <root>.Test>
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.Test<S of <root>.Test> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.Test<S of <root>.Test>) returnType:<root>.FIn<{S of <root>.Test & Any}>
$this: VALUE_PARAMETER name:<this> type:<root>.Test<S of <root>.Test>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): <root>.FIn<{S of <root>.Test & Any}> declared in <root>.Test'
TYPE_OP type=<root>.FIn<{S of <root>.Test & Any}> origin=SAM_CONVERSION typeOperand=<root>.FIn<{S of <root>.Test & Any}>
FUN_EXPR type=kotlin.Function1<{S of <root>.Test & Any}, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (sx:{S of <root>.Test & Any}) returnType:kotlin.Unit
VALUE_PARAMETER name:sx index:0 type:{S of <root>.Test & Any}
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null
$this: GET_VAR 'sx: {S of <root>.Test & Any} declared in <root>.Test.foo.<anonymous>' type={S of <root>.Test & Any} origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:bar visibility:public modality:FINAL <T> () returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=<root>.bar.<no name provided><T of <root>.bar> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.FIn<{T of <root>.bar & Any}>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.bar.<no name provided><T of <root>.bar>
CONSTRUCTOR visibility:private <> () returnType:<root>.bar.<no name provided><T of <root>.bar> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.FIn<{T of <root>.bar & Any}>]'
FUN name:f visibility:public modality:FINAL <> ($this:<root>.bar.<no name provided><T of <root>.bar>, sx:{T of <root>.bar & Any}) returnType:kotlin.Unit
overridden:
public abstract fun f (x: T of <root>.FIn): kotlin.Unit declared in <root>.FIn
$this: VALUE_PARAMETER name:<this> type:<root>.bar.<no name provided><T of <root>.bar>
VALUE_PARAMETER name:sx index:0 type:{T of <root>.bar & Any}
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null
$this: GET_VAR 'sx: {T of <root>.bar & Any} declared in <root>.bar.<no name provided>.f' type={T of <root>.bar & Any} origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.FIn
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.FIn
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.FIn
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.bar.<no name provided>' type=<root>.bar.<no name provided><T of <root>.bar> origin=OBJECT_LITERAL
CLASS INTERFACE name:I1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.I1<T of <root>.I1>
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
PROPERTY name:l visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-l> visibility:public modality:ABSTRACT <> ($this:<root>.I1<T of <root>.I1>) returnType:@[ExtensionFunctionType] kotlin.Function1<T of <root>.I1, kotlin.Unit>
correspondingProperty: PROPERTY name:l visibility:public modality:ABSTRACT [val]
$this: VALUE_PARAMETER name:<this> type:<root>.I1<T of <root>.I1>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:I2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.I2<T of <root>.I2>
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
PROPERTY name:sam visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-sam> visibility:public modality:ABSTRACT <> ($this:<root>.I2<T of <root>.I2>) returnType:<root>.FIn<T of <root>.I2>
correspondingProperty: PROPERTY name:sam visibility:public modality:ABSTRACT [val]
$this: VALUE_PARAMETER name:<this> type:<root>.I2<T of <root>.I2>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:AC modality:ABSTRACT visibility:public superTypes:[<root>.I1<T of <root>.AC>; <root>.I2<T of <root>.AC>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.AC<T of <root>.AC>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.AC<T of <root>.AC> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:AC modality:ABSTRACT visibility:public superTypes:[<root>.I1<T of <root>.AC>; <root>.I2<T of <root>.AC>]'
PROPERTY name:sam visibility:public modality:OPEN [val]
overridden:
public abstract sam: <root>.FIn<T of <root>.I2> [val]
FIELD PROPERTY_BACKING_FIELD name:sam type:<root>.FIn<T of <root>.AC> visibility:private [final]
EXPRESSION_BODY
TYPE_OP type=<root>.FIn<T of <root>.AC> origin=SAM_CONVERSION typeOperand=<root>.FIn<T of <root>.AC>
CALL 'public abstract fun <get-l> (): @[ExtensionFunctionType] kotlin.Function1<T of <root>.AC, kotlin.Unit> [fake_override] declared in <root>.AC' type=@[ExtensionFunctionType] kotlin.Function1<T of <root>.AC, kotlin.Unit> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.AC<T of <root>.AC> declared in <root>.AC' type=<root>.AC<T of <root>.AC> origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-sam> visibility:public modality:OPEN <> ($this:<root>.AC<T of <root>.AC>) returnType:<root>.FIn<T of <root>.AC>
correspondingProperty: PROPERTY name:sam visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-sam> (): <root>.FIn<T of <root>.I2> declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:<root>.AC<T of <root>.AC>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-sam> (): <root>.FIn<T of <root>.AC> declared in <root>.AC'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:sam type:<root>.FIn<T of <root>.AC> visibility:private [final]' type=<root>.FIn<T of <root>.AC> origin=null
receiver: GET_VAR '<this>: <root>.AC<T of <root>.AC> declared in <root>.AC.<get-sam>' type=<root>.AC<T of <root>.AC> origin=null
PROPERTY FAKE_OVERRIDE name:l visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract l: @[ExtensionFunctionType] kotlin.Function1<T of <root>.I1, kotlin.Unit> [val]
FUN FAKE_OVERRIDE name:<get-l> visibility:public modality:ABSTRACT <> ($this:<root>.I1<T of <root>.I1>) returnType:@[ExtensionFunctionType] kotlin.Function1<T of <root>.AC, kotlin.Unit> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:l visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract fun <get-l> (): @[ExtensionFunctionType] kotlin.Function1<T of <root>.I1, kotlin.Unit> declared in <root>.I1
$this: VALUE_PARAMETER name:<this> type:<root>.I1<T of <root>.I1>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I1
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I1
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.I1
public open fun toString (): kotlin.String [fake_override] declared in <root>.I2
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:AD modality:ABSTRACT visibility:public superTypes:[<root>.AC<{T of <root>.AD & Any}>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.AD<T of <root>.AD>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.AD<T of <root>.AD> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.AC'
<T>: {T of <root>.AD & Any}
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:AD modality:ABSTRACT visibility:public superTypes:[<root>.AC<{T of <root>.AD & Any}>]'
PROPERTY name:l visibility:public modality:OPEN [val]
overridden:
public abstract l: @[ExtensionFunctionType] kotlin.Function1<T of <root>.AC, kotlin.Unit> [fake_override,val]
FIELD PROPERTY_BACKING_FIELD name:l type:@[ExtensionFunctionType] kotlin.Function1<{T of <root>.AD & Any}, kotlin.Unit> visibility:private [final]
EXPRESSION_BODY
FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<{T of <root>.AD & Any}, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:{T of <root>.AD & Any}) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:{T of <root>.AD & Any}
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.AD.l'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-l> visibility:public modality:OPEN <> ($this:<root>.AD<T of <root>.AD>) returnType:@[ExtensionFunctionType] kotlin.Function1<{T of <root>.AD & Any}, kotlin.Unit>
correspondingProperty: PROPERTY name:l visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-l> (): @[ExtensionFunctionType] kotlin.Function1<T of <root>.AC, kotlin.Unit> [fake_override] declared in <root>.AC
$this: VALUE_PARAMETER name:<this> type:<root>.AD<T of <root>.AD>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-l> (): @[ExtensionFunctionType] kotlin.Function1<{T of <root>.AD & Any}, kotlin.Unit> declared in <root>.AD'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:l type:@[ExtensionFunctionType] kotlin.Function1<{T of <root>.AD & Any}, kotlin.Unit> visibility:private [final]' type=@[ExtensionFunctionType] kotlin.Function1<{T of <root>.AD & Any}, kotlin.Unit> origin=null
receiver: GET_VAR '<this>: <root>.AD<T of <root>.AD> declared in <root>.AD.<get-l>' type=<root>.AD<T of <root>.AD> origin=null
PROPERTY FAKE_OVERRIDE name:sam visibility:public modality:OPEN [fake_override,val]
overridden:
public open sam: <root>.FIn<T of <root>.AC> [val]
FUN FAKE_OVERRIDE name:<get-sam> visibility:public modality:OPEN <> ($this:<root>.AC<T of <root>.AC>) returnType:<root>.FIn<{T of <root>.AD & Any}> [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:sam visibility:public modality:OPEN [fake_override,val]
overridden:
public open fun <get-sam> (): <root>.FIn<T of <root>.AC> declared in <root>.AC
$this: VALUE_PARAMETER name:<this> type:<root>.AC<T of <root>.AC>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.AC
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.AC
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.AC
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -1,5 +1,4 @@
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
// SKIP_KT_DUMP
fun interface FIn<in T> {
@@ -0,0 +1,27 @@
FILE fqName:<root> fileName:/main.kt
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[<root>.A<T1 of <root>.B>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B<T1 of <root>.B>
TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?]
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.B<T1 of <root>.B>, x:T1 of <root>.B) returnType:T1 of <root>.B
overridden:
public abstract fun foo (x: @[FlexibleNullability] T of <root>.A?): @[FlexibleNullability] T of <root>.A? declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:<root>.B<T1 of <root>.B>
VALUE_PARAMETER name:x index:0 type:T1 of <root>.B
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.B<T1 of <root>.B>, x:{T1 of <root>.B & Any}) returnType:{T1 of <root>.B & Any}
overridden:
public abstract fun bar (x: @[EnhancedNullability] {@[EnhancedNullability] T of <root>.A & Any}): @[EnhancedNullability] {@[EnhancedNullability] T of <root>.A & Any} declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:<root>.B<T1 of <root>.B>
VALUE_PARAMETER name:x index:0 type:{T1 of <root>.B & Any}
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,5 @@
interface B<T1 : Any?> : A<T1> {
abstract override fun foo(x: T1): T1
abstract override fun bar(x: (T1 & Any)): (T1 & Any)
}
@@ -1,6 +1,5 @@
//!LANGUAGE: +DefinitelyNonNullableTypes
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: ANY
// FILE: A.java
import org.jetbrains.annotations.*;
@@ -0,0 +1,95 @@
FILE fqName:<root> fileName:/definitelyNotNullAsArgument.kt
CLASS INTERFACE name:I modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.I<T of <root>.I>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
FUN name:input visibility:public modality:ABSTRACT <> ($this:<root>.I<T of <root>.I>, t:T of <root>.I) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.I<T of <root>.I>
VALUE_PARAMETER name:t index:0 type:T of <root>.I
FUN name:output visibility:public modality:ABSTRACT <> ($this:<root>.I<T of <root>.I>) returnType:T of <root>.I
$this: VALUE_PARAMETER name:<this> type:<root>.I<T of <root>.I>
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:FINAL <T> (i:<root>.I<{T of <root>.foo & Any}>) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:i index:0 type:<root>.I<{T of <root>.foo & Any}>
BLOCK_BODY
CALL 'public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'i: <root>.I<{T of <root>.foo & Any}> declared in <root>.foo' type=<root>.I<{T of <root>.foo & Any}> origin=null
t: CALL 'public abstract fun output (): T of <root>.I declared in <root>.I' type={T of <root>.foo & Any} origin=null
$this: GET_VAR 'i: <root>.I<{T of <root>.foo & Any}> declared in <root>.foo' type=<root>.I<{T of <root>.foo & Any}> origin=null
FUN name:bar visibility:public modality:FINAL <T> (i:<root>.I<out {T of <root>.bar & Any}>) returnType:{T of <root>.bar & Any}
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:i index:0 type:<root>.I<out {T of <root>.bar & Any}>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun bar <T> (i: <root>.I<out {T of <root>.bar & Any}>): {T of <root>.bar & Any} declared in <root>'
CALL 'public abstract fun output (): T of <root>.I declared in <root>.I' type={T of <root>.bar & Any} origin=null
$this: GET_VAR 'i: <root>.I<out {T of <root>.bar & Any}> declared in <root>.bar' type=<root>.I<out {T of <root>.bar & Any}> origin=null
FUN name:qux visibility:public modality:FINAL <T> (t:T of <root>.qux, i:<root>.I<in {T of <root>.qux & Any}>) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:t index:0 type:T of <root>.qux
VALUE_PARAMETER name:i index:1 type:<root>.I<in {T of <root>.qux & Any}>
BLOCK_BODY
CALL 'public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'i: <root>.I<in {T of <root>.qux & Any}> declared in <root>.qux' type=<root>.I<in {T of <root>.qux & Any}> origin=null
t: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={T of <root>.qux & Any} origin=EXCLEXCL
<T0>: T of <root>.qux
arg0: GET_VAR 't: T of <root>.qux declared in <root>.qux' type=T of <root>.qux origin=null
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I<{TT of <root>.C & Any}>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C<TT of <root>.C>
TYPE_PARAMETER name:TT index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (t:TT of <root>.C) returnType:<root>.C<TT of <root>.C> [primary]
VALUE_PARAMETER name:t index:0 type:TT of <root>.C
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[<root>.I<{TT of <root>.C & Any}>]'
PROPERTY name:t visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:t type:TT of <root>.C visibility:private [final]
EXPRESSION_BODY
GET_VAR 't: TT of <root>.C declared in <root>.C.<init>' type=TT of <root>.C origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-t> visibility:public modality:FINAL <> ($this:<root>.C<TT of <root>.C>) returnType:TT of <root>.C
correspondingProperty: PROPERTY name:t visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.C<TT of <root>.C>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-t> (): TT of <root>.C declared in <root>.C'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:t type:TT of <root>.C visibility:private [final]' type=TT of <root>.C origin=null
receiver: GET_VAR '<this>: <root>.C<TT of <root>.C> declared in <root>.C.<get-t>' type=<root>.C<TT of <root>.C> origin=null
FUN name:input visibility:public modality:FINAL <> ($this:<root>.C<TT of <root>.C>, t:{TT of <root>.C & Any}) returnType:kotlin.Unit
overridden:
public abstract fun input (t: T of <root>.I): kotlin.Unit declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:<root>.C<TT of <root>.C>
VALUE_PARAMETER name:t index:0 type:{TT of <root>.C & Any}
BLOCK_BODY
FUN name:output visibility:public modality:FINAL <> ($this:<root>.C<TT of <root>.C>) returnType:{TT of <root>.C & Any}
overridden:
public abstract fun output (): T of <root>.I declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:<root>.C<TT of <root>.C>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun output (): {TT of <root>.C & Any} declared in <root>.C'
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={TT of <root>.C & Any} origin=EXCLEXCL
<T0>: TT of <root>.C
arg0: CALL 'public final fun <get-t> (): TT of <root>.C declared in <root>.C' type=TT of <root>.C origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.C<TT of <root>.C> declared in <root>.C.output' type=<root>.C<TT of <root>.C> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.I
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,37 @@
interface I<T : Any?> {
abstract fun input(t: T)
abstract fun output(): T
}
fun <T : Any?> foo(i: I<(T & Any)>) {
i.input(t = i.output())
}
fun <T : Any?> bar(i: I<out (T & Any)>): (T & Any) {
return i.output()
}
fun <T : Any?> qux(t: T, i: I<in (T & Any)>) {
i.input(t = CHECK_NOT_NULL<T>(arg0 = t))
}
class C<TT : Any?> : I<(TT & Any)> {
constructor(t: TT) /* primary */ {
super/*Any*/()
/* <init>() */
}
val t: TT
field = t
get
override fun input(t: (TT & Any)) {
}
override fun output(): (TT & Any) {
return CHECK_NOT_NULL<TT>(arg0 = <this>.<get-t>())
}
}
@@ -1,5 +1,4 @@
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
interface I<T> {
fun input(t: T)
@@ -1,5 +1,5 @@
// FIR_IDENTICAL
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
fun <T> (T & Any).foo() {}
fun <T> foo(l: (T & Any) -> Unit) {}
@@ -0,0 +1,80 @@
FILE fqName:<root> fileName:/definitelyNotNullWithIntersection1.kt
CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<I of <root>.In>
TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> () returnType:<root>.In<I of <root>.In> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:select visibility:public modality:FINAL <S> (x:S of <root>.select, y:S of <root>.select, z:S of <root>.select) returnType:S of <root>.select
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:x index:0 type:S of <root>.select
VALUE_PARAMETER name:y index:1 type:S of <root>.select
VALUE_PARAMETER name:z index:2 type:S of <root>.select
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun select <S> (x: S of <root>.select, y: S of <root>.select, z: S of <root>.select): S of <root>.select declared in <root>'
GET_VAR 'x: S of <root>.select declared in <root>.select' type=S of <root>.select origin=null
FUN name:foo visibility:public modality:FINAL <T> (a:kotlin.Array<<root>.In<{T of <root>.foo & Any}>>, b:kotlin.Array<<root>.In<kotlin.String>>, c:kotlin.Array<<root>.In<T of <root>.foo>>) returnType:kotlin.Boolean
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:a index:0 type:kotlin.Array<<root>.In<{T of <root>.foo & Any}>>
VALUE_PARAMETER name:b index:1 type:kotlin.Array<<root>.In<kotlin.String>>
VALUE_PARAMETER name:c index:2 type:kotlin.Array<<root>.In<T of <root>.foo>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<{T of <root>.foo & Any}>>, b: kotlin.Array<<root>.In<kotlin.String>>, c: kotlin.Array<<root>.In<T of <root>.foo>>): kotlin.Boolean declared in <root>'
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
<K>: kotlin.Any
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<kotlin.Nothing> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select, z: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<kotlin.Nothing>> origin=null
<S>: kotlin.Array<out <root>.In<kotlin.Nothing>>
x: GET_VAR 'a: kotlin.Array<<root>.In<{T of <root>.foo & Any}>> declared in <root>.foo' type=kotlin.Array<<root>.In<{T of <root>.foo & Any}>> origin=null
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
z: GET_VAR 'c: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
index: CONST Int type=kotlin.Int value=0
y: CONST Boolean type=kotlin.Boolean value=true
FUN name:ofType visibility:public modality:FINAL <K> ($receiver:<root>.In<K of <root>.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline]
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<K of <root>.ofType>
VALUE_PARAMETER name:y index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>'
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K of <root>.ofType
GET_VAR 'y: kotlin.Any? declared in <root>.ofType' type=kotlin.Any? origin=null
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:a1 type:kotlin.Array<<root>.In<kotlin.Int>> [val]
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
<T>: <root>.In<kotlin.Int>
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.Int>> varargElementType=<root>.In<kotlin.Int>
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.Int> origin=null
<class: I>: kotlin.Int
VAR name:a2 type:kotlin.Array<<root>.In<kotlin.String>> [val]
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
<T>: <root>.In<kotlin.String>
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.String>> varargElementType=<root>.In<kotlin.String>
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.String> origin=null
<class: I>: kotlin.String
VAR name:a3 type:kotlin.Array<<root>.In<kotlin.Int>> [val]
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
<T>: <root>.In<kotlin.Int>
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.Int>> varargElementType=<root>.In<kotlin.Int>
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.Int> origin=null
<class: I>: kotlin.Int
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun foo <T> (a: kotlin.Array<<root>.In<{T of <root>.foo & Any}>>, b: kotlin.Array<<root>.In<kotlin.String>>, c: kotlin.Array<<root>.In<T of <root>.foo>>): kotlin.Boolean declared in <root>' type=kotlin.Boolean origin=null
<T>: kotlin.Int
a: GET_VAR 'val a1: kotlin.Array<<root>.In<kotlin.Int>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
b: GET_VAR 'val a2: kotlin.Array<<root>.In<kotlin.String>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
c: GET_VAR 'val a3: kotlin.Array<<root>.In<kotlin.Int>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
@@ -1,5 +1,4 @@
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
// SKIP_KT_DUMP
class In<in I>
@@ -1,5 +1,5 @@
// FIR_IDENTICAL
//!LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND_FIR: ANY
fun <T> asFoo(t: T) = t as (T & Any)
fun <T> safeAsFoo(t: T) = t as? (T & Any)