[FIR2IR] Properly approximate intersection types during fir2ir conversion
^KT-62544 Fixed
This commit is contained in:
committed by
Space Team
parent
8c6da9fddb
commit
9366847e96
+7
-8
@@ -8,7 +8,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public open fun runStatic (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
r: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
|
||||
@@ -20,7 +20,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
|
||||
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
r: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
|
||||
@@ -32,9 +32,9 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
|
||||
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
r1: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
r2: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
r2: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
|
||||
@@ -47,7 +47,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
|
||||
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
r1: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
r2: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable?
|
||||
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
@@ -77,8 +77,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
|
||||
CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
|
||||
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
|
||||
r: GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
|
||||
FUN name:test6 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
@@ -99,7 +98,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
|
||||
r: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable?
|
||||
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
|
||||
TYPE_OP type=kotlin.Function<kotlin.Any> origin=IMPLICIT_CAST typeOperand=kotlin.Function<kotlin.Any>
|
||||
GET_VAR 'a: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.test7' type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=null
|
||||
FUN name:test8 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
fun test1(a: Function0<Unit>) {
|
||||
when {
|
||||
a is Runnable -> { // BLOCK
|
||||
runStatic(r = a /*as Runnable */)
|
||||
runStatic(r = a /*as Any */)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ fun test1(a: Function0<Unit>) {
|
||||
fun test2(a: Function0<Unit>) {
|
||||
when {
|
||||
a is Runnable -> { // BLOCK
|
||||
J().run1(r = a /*as Runnable */)
|
||||
J().run1(r = a /*as Any */)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ fun test2(a: Function0<Unit>) {
|
||||
fun test3(a: Function0<Unit>) {
|
||||
when {
|
||||
a is Runnable -> { // BLOCK
|
||||
J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */)
|
||||
J().run2(r1 = a /*as Any */, r2 = a /*as Any */)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ fun test3(a: Function0<Unit>) {
|
||||
fun test4(a: Function0<Unit>, b: Function0<Unit>) {
|
||||
when {
|
||||
a is Runnable -> { // BLOCK
|
||||
J().run2(r1 = a /*as Runnable */, r2 = b /*-> @FlexibleNullability Runnable? */)
|
||||
J().run2(r1 = a /*as Any */, r2 = b /*-> @FlexibleNullability Runnable? */)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ fun test5x(a: Any) {
|
||||
when {
|
||||
a is Runnable -> { // BLOCK
|
||||
a /*as Runnable */ as Function0<Unit> /*~> Unit */
|
||||
J().run1(r = a /*as Runnable */)
|
||||
J().run1(r = a)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ fun test6(a: Any) {
|
||||
|
||||
fun test7(a: Function1<Int, Int>) {
|
||||
a as Function0<Unit> /*~> Unit */
|
||||
J().run1(r = a /*as Function0<Unit> */ /*-> @FlexibleNullability Runnable? */)
|
||||
J().run1(r = a /*as Function<Any> */ /*-> @FlexibleNullability Runnable? */)
|
||||
}
|
||||
|
||||
fun test8(a: Function0<Unit>) {
|
||||
|
||||
Reference in New Issue
Block a user