[TEST] Add irText test for DefinitelyNotNull type
This commit is contained in:
committed by
TeamCityServer
parent
d809e260cb
commit
4424512bd6
Generated
+48
@@ -2704,6 +2704,48 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNull.kt")
|
||||
public void testDefinitelyNonNull() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNullOverride.kt")
|
||||
public void testDefinitelyNonNullOverride() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNullSAM.kt")
|
||||
public void testDefinitelyNonNullSAM() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullSAM.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNullWithJava.kt")
|
||||
public void testDefinitelyNonNullWithJava() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullWithJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullAsArgument.kt")
|
||||
public void testDefinitelyNotNullAsArgument() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullAsArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullAsReceiver.kt")
|
||||
public void testDefinitelyNotNullAsReceiver() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullAsReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullWithIntersection1.kt")
|
||||
public void testDefinitelyNotNullWithIntersection1() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
@@ -2830,6 +2872,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeCheckOnDefinitelyNotNull.kt")
|
||||
public void testTypeCheckOnDefinitelyNotNull() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/typeCheckOnDefinitelyNotNull.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/ir/irText/types/nullChecks")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
@@ -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=null
|
||||
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,12 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
|
||||
fun <T> elvisLike(x: T, y: T & Any): T & Any = x ?: y
|
||||
|
||||
fun main() {
|
||||
elvisLike<String>("", "").length // OK
|
||||
elvisLike<String?>(null, "").length // OK
|
||||
|
||||
elvisLike("", "").length // OK
|
||||
elvisLike(null, "").length // OK
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fun <T : Any?> elvisLike(x: T, y: (T & Any)): (T & Any) {
|
||||
return { // BLOCK
|
||||
val tmp0_elvis_lhs: T = x
|
||||
when {
|
||||
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> y
|
||||
else -> tmp0_elvis_lhs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
}
|
||||
|
||||
@@ -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:OPEN <> ($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>.D & Any}>, 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>.D & Any}>
|
||||
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>.D & Any}>, 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>.D & Any}>
|
||||
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>.D & Any}>, 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>.D & Any}>
|
||||
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
|
||||
@@ -0,0 +1,33 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
// SKIP_KT_DUMP
|
||||
|
||||
open class B<T> {
|
||||
open fun foo(t: T) {}
|
||||
open fun bar(t: T) {}
|
||||
open fun qux(b: B<T>) {}
|
||||
open fun <F> six(t: T, q: F) {}
|
||||
}
|
||||
|
||||
class D<T> : B<T & Any>() {
|
||||
override fun foo(t: T & Any) {}
|
||||
}
|
||||
|
||||
|
||||
// KT-49420
|
||||
//interface I1<T> {
|
||||
// fun foo(t: T)
|
||||
// fun bar(t: T)
|
||||
//}
|
||||
//
|
||||
//interface I2<T> {
|
||||
// fun foo(t: T)
|
||||
// fun bar(t: T)
|
||||
//}
|
||||
//
|
||||
//
|
||||
//interface II<T> : I1<T>, I2<T & Any> {
|
||||
// override fun foo(t: T & Any)
|
||||
//}
|
||||
//
|
||||
//abstract class Q : II<String?>
|
||||
@@ -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<@[ParameterName(name = 'x')] {@[ParameterName(name = 'x')] 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:public <> () 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:OPEN <> ($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 'public 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>.AC>) 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>.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>.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$null 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>.AD & Any}>) 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>.AD & 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>.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
|
||||
@@ -0,0 +1,33 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
// SKIP_KT_DUMP
|
||||
|
||||
fun interface FIn<in T> {
|
||||
fun f(x: T)
|
||||
}
|
||||
|
||||
class Test<S> {
|
||||
fun foo() = FIn<S & Any> { sx -> sx.toString() }
|
||||
}
|
||||
|
||||
fun <T> bar() {
|
||||
object : FIn<T & Any> {
|
||||
override fun f(sx: (T & Any)) { sx.toString() }
|
||||
}
|
||||
}
|
||||
|
||||
interface I1<in T> {
|
||||
val l: T.() -> Unit
|
||||
}
|
||||
|
||||
interface I2<in T> {
|
||||
val sam: FIn<T>
|
||||
}
|
||||
|
||||
abstract class AC<T> : I1<T>, I2<T> {
|
||||
override val sam: FIn<T> = FIn(l)
|
||||
}
|
||||
|
||||
abstract class AD<T> : AC<T & Any>() {
|
||||
override val l: (T & Any).() -> Unit = { }
|
||||
}
|
||||
@@ -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] T of <root>.A): @[EnhancedNullability] 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 & 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,19 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
|
||||
// FILE: A.java
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public interface A<T> {
|
||||
public T foo(T x) { return x; }
|
||||
@NotNull
|
||||
public T bar(@NotNull T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface B<T1> : A<T1> {
|
||||
override fun foo(x: T1): T1
|
||||
override fun bar(x: T1 & Any): T1 & 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)
|
||||
|
||||
}
|
||||
@@ -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 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:OPEN <> ($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:OPEN <> ($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 open 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 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,21 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
|
||||
interface I<T> {
|
||||
fun input(t: T)
|
||||
fun output(): T
|
||||
}
|
||||
|
||||
fun <T> foo(i: I<T & Any>) { i.input(i.output()) }
|
||||
|
||||
fun <T> bar(i: I<out T & Any>) = i.output()
|
||||
|
||||
fun <T> qux(t: T, i: I<in T & Any>) { i.input(t!!) }
|
||||
|
||||
class C<TT>(val t: TT): I<TT & Any> {
|
||||
override fun input(t: TT & Any) {}
|
||||
override fun output(): TT & Any = t!!
|
||||
}
|
||||
|
||||
// TODO: FE gets crashed on that method, KT-49419
|
||||
//fun <T1 , T2 : I<T1 & Any>> foo2(p1: T, p2: T2) { p2.input(p1!!) }
|
||||
@@ -0,0 +1,38 @@
|
||||
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>())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
FILE fqName:<root> fileName:/definitelyNotNullAsReceiver.kt
|
||||
FUN name:foo visibility:public modality:FINAL <T> ($receiver:{T of <root>.foo & Any}) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:{T of <root>.foo & Any}
|
||||
BLOCK_BODY
|
||||
FUN name:foo visibility:public modality:FINAL <T> (l:kotlin.Function1<{T of <root>.foo & Any}, kotlin.Unit>) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:l index:0 type:kotlin.Function1<{T of <root>.foo & Any}, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun foo <T> (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.String?
|
||||
$receiver: CONST String type=kotlin.String value=""
|
||||
CALL 'public final fun foo <T> (l: kotlin.Function1<{T of <root>.foo & Any}, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.String?
|
||||
l: FUN_EXPR type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.String) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR 'it: kotlin.String declared in <root>.box.<anonymous>' type=kotlin.String origin=null
|
||||
@@ -0,0 +1,10 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
|
||||
fun <T> (T & Any).foo() {}
|
||||
fun <T> foo(l: (T & Any) -> Unit) {}
|
||||
|
||||
fun box() {
|
||||
"".foo<String?>()
|
||||
foo<String?> { "$it" }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fun <T : Any?> (T & Any).foo() {
|
||||
}
|
||||
|
||||
fun <T : Any?> foo(l: Function1<(T & Any), Unit>) {
|
||||
}
|
||||
|
||||
fun box() {
|
||||
"".foo<String?>()
|
||||
foo<String?>(l = local fun <anonymous>(it: String) {
|
||||
it /*~> 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=GET_ARRAY_ELEMENT
|
||||
$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
|
||||
@@ -0,0 +1,20 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
// SKIP_KT_DUMP
|
||||
|
||||
class In<in I>
|
||||
|
||||
fun <S> select(x: S, y: S, z: S): S = x
|
||||
|
||||
fun <T> foo(a: Array<In<T & Any>>, b: Array<In<String>>, c: Array<In<T>>) =
|
||||
select(a, b, c)[0].ofType(true)
|
||||
|
||||
inline fun <reified K> In<K>.ofType(y: Any?) =
|
||||
y is K
|
||||
|
||||
fun test() {
|
||||
val a1 = arrayOf(In<Int>())
|
||||
val a2 = arrayOf(In<String>())
|
||||
val a3 = arrayOf(In<Int>())
|
||||
foo(a1, a2, a3)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
FILE fqName:<root> fileName:/typeCheckOnDefinitelyNotNull.kt
|
||||
FUN name:asFoo visibility:public modality:FINAL <T> (t:T of <root>.asFoo) returnType:{T of <root>.asFoo & Any}
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.asFoo
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun asFoo <T> (t: T of <root>.asFoo): {T of <root>.asFoo & Any} declared in <root>'
|
||||
TYPE_OP type={T of <root>.asFoo & Any} origin=CAST typeOperand={T of <root>.asFoo & Any}
|
||||
GET_VAR 't: T of <root>.asFoo declared in <root>.asFoo' type=T of <root>.asFoo origin=null
|
||||
FUN name:safeAsFoo visibility:public modality:FINAL <T> (t:T of <root>.safeAsFoo) returnType:T of <root>.safeAsFoo?
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.safeAsFoo
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun safeAsFoo <T> (t: T of <root>.safeAsFoo): T of <root>.safeAsFoo? declared in <root>'
|
||||
TYPE_OP type=T of <root>.safeAsFoo? origin=SAFE_CAST typeOperand={T of <root>.safeAsFoo & Any}
|
||||
GET_VAR 't: T of <root>.safeAsFoo declared in <root>.safeAsFoo' type=T of <root>.safeAsFoo origin=null
|
||||
FUN name:implicitAsFoo 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 implicitAsFoo <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>.implicitAsFoo
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.implicitAsFoo' 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>.implicitAsFoo & Any} origin=IMPLICIT_CAST typeOperand={T of <root>.implicitAsFoo & Any}
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.implicitAsFoo' type=kotlin.Any origin=null
|
||||
@@ -0,0 +1,8 @@
|
||||
//!LANGUAGE: +DefinitelyNonNullableTypes
|
||||
// IGNORE_BACKEND_FIR: ANY
|
||||
|
||||
fun <T> asFoo(t: T) = t as (T & Any)
|
||||
fun <T> safeAsFoo(t: T) = t as? (T & Any)
|
||||
|
||||
inline fun <reified T : CharSequence?> implicitAsFoo(x: Any) =
|
||||
if (x !is T) 0 else x.length
|
||||
@@ -0,0 +1,15 @@
|
||||
fun <T : Any?> asFoo(t: T): (T & Any) {
|
||||
return t as (T & Any)
|
||||
}
|
||||
|
||||
fun <T : Any?> safeAsFoo(t: T): T? {
|
||||
return t as? (T & Any)
|
||||
}
|
||||
|
||||
inline fun <reified T : CharSequence?> implicitAsFoo(x: Any): Int {
|
||||
return when {
|
||||
x !is T -> 0
|
||||
else -> x /*as (T & Any) */.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+48
@@ -2704,6 +2704,48 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNull.kt")
|
||||
public void testDefinitelyNonNull() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNullOverride.kt")
|
||||
public void testDefinitelyNonNullOverride() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNullSAM.kt")
|
||||
public void testDefinitelyNonNullSAM() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullSAM.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNonNullWithJava.kt")
|
||||
public void testDefinitelyNonNullWithJava() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullWithJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullAsArgument.kt")
|
||||
public void testDefinitelyNotNullAsArgument() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullAsArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullAsReceiver.kt")
|
||||
public void testDefinitelyNotNullAsReceiver() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullAsReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullWithIntersection1.kt")
|
||||
public void testDefinitelyNotNullWithIntersection1() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
@@ -2830,6 +2872,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeCheckOnDefinitelyNotNull.kt")
|
||||
public void testTypeCheckOnDefinitelyNotNull() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/typeCheckOnDefinitelyNotNull.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/ir/irText/types/nullChecks")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
@@ -1996,6 +1996,36 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNonNull.kt")
|
||||
public void testDefinitelyNonNull() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNonNullOverride.kt")
|
||||
public void testDefinitelyNonNullOverride() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNonNullSAM.kt")
|
||||
public void testDefinitelyNonNullSAM() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNonNullSAM.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullAsArgument.kt")
|
||||
public void testDefinitelyNotNullAsArgument() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullAsArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullAsReceiver.kt")
|
||||
public void testDefinitelyNotNullAsReceiver() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullAsReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullWithIntersection1.kt")
|
||||
public void testDefinitelyNotNullWithIntersection1() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt");
|
||||
@@ -2081,6 +2111,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeCheckOnDefinitelyNotNull.kt")
|
||||
public void testTypeCheckOnDefinitelyNotNull() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/typeCheckOnDefinitelyNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/ir/irText/types/nullChecks")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user