FIR2IR: support substitution for SAM types
This commit is contained in:
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
fun test1(f: Function1<String, String>): C<String?> {
|
||||
return C<String?>(jxx = f /*-> J<X?, X?>? */)
|
||||
return C<String?>(jxx = f /*-> J<String?, String?>? */)
|
||||
}
|
||||
|
||||
fun test2(x: Any) {
|
||||
x as Function1<String, String> /*~> Unit */
|
||||
C<String?>(jxx = x /*as Function1<String, String> */ /*-> J<X?, X?>? */) /*~> Unit */
|
||||
C<String?>(jxx = x /*as Function1<String, String> */ /*-> J<String?, String?>? */) /*~> Unit */
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (f: kotlin.Function1<kotlin.String, kotlin.String>): <root>.C<kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String?> origin=null
|
||||
<class: X>: kotlin.String?
|
||||
jxx: TYPE_OP type=<root>.J<X of <root>.C?, X of <root>.C?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.C?, X of <root>.C?>?
|
||||
jxx: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test1' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
@@ -16,6 +16,6 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall.kt
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String?> origin=null
|
||||
<class: X>: kotlin.String?
|
||||
jxx: TYPE_OP type=<root>.J<X of <root>.C?, X of <root>.C?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.C?, X of <root>.C?>?
|
||||
jxx: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.String>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||
|
||||
Vendored
+4
-4
@@ -1,5 +1,5 @@
|
||||
fun test3(f1: Function1<String, String>, f2: Function1<Int, String>): D<Int?, String?> {
|
||||
return C<String?>(jxx = f1 /*-> J<X?, X?>? */).D<Int?>(jxy = f2 /*-> J<String?, Y?>? */)
|
||||
return C<String?>(jxx = f1 /*-> J<String?, String?>? */).D<Int?>(jxy = f2 /*-> J<String?, Int?>? */)
|
||||
}
|
||||
|
||||
class Outer<T1 : Any?> {
|
||||
@@ -29,14 +29,14 @@ class Outer<T1 : Any?> {
|
||||
}
|
||||
|
||||
fun test4(f: Function1<String, String>, g: Function1<Any, String>): Inner<Any?, String?> {
|
||||
return Outer<String?>(j11 = f /*-> J<T1, T1> */).Inner<Any?>(j12 = g /*-> J<String?, T2> */)
|
||||
return Outer<String?>(j11 = f /*-> J<String?, String?> */).Inner<Any?>(j12 = g /*-> J<String?, Any?> */)
|
||||
}
|
||||
|
||||
fun testGenericJavaCtor1(f: Function1<String, Int>): G<String?> {
|
||||
return G<String?, Int?>(x = f /*-> J<TCtor?, TClass?>? */)
|
||||
return G<String?, Int?>(x = f /*-> J<Int?, String?>? */)
|
||||
}
|
||||
|
||||
fun testGenericJavaCtor2(x: Any) {
|
||||
x as Function1<String, Int> /*~> Unit */
|
||||
G<String?, Int?>(x = x /*as Function1<String, Int> */ /*-> J<TCtor?, TClass?>? */) /*~> Unit */
|
||||
G<String?, Int?>(x = x /*as Function1<String, Int> */ /*-> J<Int?, String?>? */) /*~> Unit */
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -8,9 +8,9 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
<class: Y>: kotlin.Int?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String?> origin=null
|
||||
<class: X>: kotlin.String?
|
||||
jxx: TYPE_OP type=<root>.J<X of <root>.C?, X of <root>.C?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.C?, X of <root>.C?>?
|
||||
jxx: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>?
|
||||
GET_VAR 'f1: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
jxy: TYPE_OP type=<root>.J<kotlin.String?, Y of <root>.C.D?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, Y of <root>.C.D?>?
|
||||
jxy: TYPE_OP type=<root>.J<kotlin.String?, kotlin.Int?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.Int?>?
|
||||
GET_VAR 'f2: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
|
||||
CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
@@ -86,9 +86,9 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
<class: T2>: kotlin.Any?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) [primary] declared in <root>.Outer' type=<root>.Outer<kotlin.String?> origin=null
|
||||
<class: T1>: kotlin.String?
|
||||
j11: TYPE_OP type=<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> origin=SAM_CONVERSION typeOperand=<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>
|
||||
j11: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
j12: TYPE_OP type=<root>.J<kotlin.String?, T2 of <root>.Outer.Inner> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, T2 of <root>.Outer.Inner>
|
||||
j12: TYPE_OP type=<root>.J<kotlin.String?, kotlin.Any?> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.Any?>
|
||||
GET_VAR 'g: kotlin.Function1<kotlin.Any, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.Any, kotlin.String> origin=null
|
||||
FUN name:testGenericJavaCtor1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Int>) returnType:<root>.G<kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
@@ -97,7 +97,7 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: <root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<kotlin.String?> origin=null
|
||||
<class: TClass>: kotlin.String?
|
||||
<TCtor>: kotlin.Int?
|
||||
x: TYPE_OP type=<root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>? origin=SAM_CONVERSION typeOperand=<root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?
|
||||
x: TYPE_OP type=<root>.J<kotlin.Int?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.Int?, kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.Int> declared in <root>.testGenericJavaCtor1' type=kotlin.Function1<kotlin.String, kotlin.Int> origin=null
|
||||
FUN name:testGenericJavaCtor2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
@@ -109,6 +109,6 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: <root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<kotlin.String?> origin=null
|
||||
<class: TClass>: kotlin.String?
|
||||
<TCtor>: kotlin.Int?
|
||||
x: TYPE_OP type=<root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>? origin=SAM_CONVERSION typeOperand=<root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?
|
||||
x: TYPE_OP type=<root>.J<kotlin.Int?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.Int?, kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.Int> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
|
||||
+6
-6
@@ -16,7 +16,7 @@ fun test3() {
|
||||
return bar<String?>(j = local fun <anonymous>(x: String): String? {
|
||||
return x
|
||||
}
|
||||
/*-> J<X?>? */)
|
||||
/*-> J<String?>? */)
|
||||
}
|
||||
|
||||
fun test4(a: Any) {
|
||||
@@ -26,16 +26,16 @@ fun test4(a: Any) {
|
||||
|
||||
fun test5(a: Any) {
|
||||
a as Function1<String, String> /*~> Unit */
|
||||
bar<String?>(j = a /*as Function1<String, String> */ /*-> J<X?>? */)
|
||||
bar<String?>(j = a /*as Function1<String, String> */ /*-> J<String?>? */)
|
||||
}
|
||||
|
||||
fun <T : Any?> test6(a: Function1<T, T>) {
|
||||
bar<T?>(j = a /*-> J<X?>? */)
|
||||
bar<T?>(j = a /*-> J<T?>? */)
|
||||
}
|
||||
|
||||
fun <T : Any?> test7(a: Any) {
|
||||
a as Function1<T, T> /*~> Unit */
|
||||
bar<T?>(j = a /*as Function1<T, T> */ /*-> J<X?>? */)
|
||||
bar<T?>(j = a /*as Function1<T, T> */ /*-> J<T?>? */)
|
||||
}
|
||||
|
||||
fun test8(efn: @ExtensionFunctionType Function1<String, String>): J<String?> {
|
||||
@@ -43,9 +43,9 @@ fun test8(efn: @ExtensionFunctionType Function1<String, String>): J<String?> {
|
||||
}
|
||||
|
||||
fun test9(efn: @ExtensionFunctionType Function1<String, String>) {
|
||||
bar<String?>(j = efn /*-> J<X?>? */)
|
||||
bar<String?>(j = efn /*-> J<String?>? */)
|
||||
}
|
||||
|
||||
fun test10(fn: Function1<Int, String>) {
|
||||
bar2x<Int?>(j2x = fn /*-> J2X<Y?>? */)
|
||||
bar2x<Int?>(j2x = fn /*-> J2X<Int?>? */)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (): kotlin.Unit declared in <root>'
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String?
|
||||
j: TYPE_OP type=<root>.J<X of <root>.H.bar?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.H.bar?>?
|
||||
j: TYPE_OP type=<root>.J<kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.String, kotlin.String?> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.String) returnType:kotlin.String?
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
@@ -49,7 +49,7 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String?
|
||||
j: TYPE_OP type=<root>.J<X of <root>.H.bar?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.H.bar?>?
|
||||
j: TYPE_OP type=<root>.J<kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.String>
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
|
||||
FUN name:test6 visibility:public modality:FINAL <T> (a:kotlin.Function1<T of <root>.test6, T of <root>.test6>) returnType:kotlin.Unit
|
||||
@@ -58,7 +58,7 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: T of <root>.test6?
|
||||
j: TYPE_OP type=<root>.J<X of <root>.H.bar?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.H.bar?>?
|
||||
j: TYPE_OP type=<root>.J<T of <root>.test6?>? origin=SAM_CONVERSION typeOperand=<root>.J<T of <root>.test6?>?
|
||||
GET_VAR 'a: kotlin.Function1<T of <root>.test6, T of <root>.test6> declared in <root>.test6' type=kotlin.Function1<T of <root>.test6, T of <root>.test6> origin=null
|
||||
FUN name:test7 visibility:public modality:FINAL <T> (a:kotlin.Any) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
@@ -69,7 +69,7 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test7' type=kotlin.Any origin=null
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: T of <root>.test7?
|
||||
j: TYPE_OP type=<root>.J<X of <root>.H.bar?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.H.bar?>?
|
||||
j: TYPE_OP type=<root>.J<T of <root>.test7?>? origin=SAM_CONVERSION typeOperand=<root>.J<T of <root>.test7?>?
|
||||
TYPE_OP type=kotlin.Function1<T of <root>.test7, T of <root>.test7> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<T of <root>.test7, T of <root>.test7>
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test7' type=kotlin.Any origin=null
|
||||
FUN name:test8 visibility:public modality:FINAL <> (efn:@[ExtensionFunctionType] kotlin.Function1<kotlin.String, kotlin.String>) returnType:<root>.J<kotlin.String?>
|
||||
@@ -83,12 +83,12 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String?
|
||||
j: TYPE_OP type=<root>.J<X of <root>.H.bar?>? origin=SAM_CONVERSION typeOperand=<root>.J<X of <root>.H.bar?>?
|
||||
j: TYPE_OP type=<root>.J<kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?>?
|
||||
GET_VAR 'efn: @[ExtensionFunctionType] kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test9' type=@[ExtensionFunctionType] kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test10 visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.String>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun bar2x <Y> (j2x: <root>.J2X<Y of <root>.H.bar2x?>?): kotlin.Unit declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<Y>: kotlin.Int?
|
||||
j2x: TYPE_OP type=<root>.J2X<Y of <root>.H.bar2x?>? origin=SAM_CONVERSION typeOperand=<root>.J2X<Y of <root>.H.bar2x?>?
|
||||
j2x: TYPE_OP type=<root>.J2X<kotlin.Int?>? origin=SAM_CONVERSION typeOperand=<root>.J2X<kotlin.Int?>?
|
||||
GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.test10' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ fun test7(a: Function1<Int, Int>) {
|
||||
}
|
||||
|
||||
fun test8(a: Function0<Unit>) {
|
||||
J().run1(r = id<Function0<Unit>?>(x = a) /*-> Runnable? */)
|
||||
J().run1(r = id<Function0<Unit>?>(x = a /*-> Function0<Unit>? */) /*-> Runnable? */)
|
||||
}
|
||||
|
||||
fun test9() {
|
||||
|
||||
+2
-1
@@ -104,7 +104,8 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable?
|
||||
CALL 'public open fun id <T> (x: T of <root>.J.id?): T of <root>.J.id? declared in <root>.J' type=kotlin.Function0<kotlin.Unit>? origin=null
|
||||
<T>: kotlin.Function0<kotlin.Unit>?
|
||||
x: GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test8' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
x: TYPE_OP type=kotlin.Function0<kotlin.Unit>? origin=SAM_CONVERSION typeOperand=kotlin.Function0<kotlin.Unit>?
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test8' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
FUN name:test9 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun run1 (r: java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
|
||||
Reference in New Issue
Block a user