FIR: don't change explicitly given anonymous function type
This commit is contained in:
committed by
TeamCityServer
parent
533e802c8d
commit
a6d4f9c3b0
Generated
+6
@@ -2494,6 +2494,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/FlushFromAnonymous.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionLiteralGenericSignature.kt")
|
||||
public void testFunctionLiteralGenericSignature() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/functionLiteralGenericSignature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ImplicitReceiverStack.kt")
|
||||
public void testImplicitReceiverStack() throws Exception {
|
||||
|
||||
+9
-3
@@ -747,6 +747,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
)
|
||||
}
|
||||
var lambda = anonymousFunction
|
||||
val initialReturnTypeRef = lambda.returnTypeRef
|
||||
val valueParameters = when {
|
||||
resolvedLambdaAtom != null -> obtainValueParametersFromResolvedLambdaAtom(resolvedLambdaAtom, lambda)
|
||||
else -> lambda.valueParameters
|
||||
@@ -788,17 +789,22 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
(it as? FirExpression)?.typeRef is FirImplicitUnitTypeRef
|
||||
}
|
||||
|
||||
val returnType =
|
||||
if (implicitReturns.isNotEmpty() || lambda.returnType?.isUnit == true) {
|
||||
val returnType = when {
|
||||
initialReturnTypeRef is FirResolvedTypeRef -> {
|
||||
initialReturnTypeRef.coneType
|
||||
}
|
||||
implicitReturns.isNotEmpty() || lambda.returnType?.isUnit == true -> {
|
||||
// i.e., early return, e.g., l@{ ... return@l ... }
|
||||
// Note that the last statement will be coerced to Unit if needed.
|
||||
session.builtinTypes.unitType.type
|
||||
} else {
|
||||
}
|
||||
else -> {
|
||||
// Otherwise, compute the common super type of all possible return expressions
|
||||
session.typeContext.commonSuperTypeOrNull(
|
||||
returnStatements.mapNotNull { (it as? FirExpression)?.resultType?.coneType }
|
||||
) ?: session.builtinTypes.unitType.type
|
||||
}
|
||||
}
|
||||
lambda.replaceReturnTypeRef(
|
||||
lambda.returnTypeRef.resolvedTypeFromPrototype(returnType).also {
|
||||
session.lookupTracker?.recordTypeResolveAsLookup(it, lambda.source, null)
|
||||
|
||||
Vendored
-3
@@ -1,6 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FIR status: Fail, expected: kotlin.jvm.functions.Function1<java.util.List<java.lang.Double>, java.util.List<java.lang.Integer>>,
|
||||
// actual: interface kotlin.jvm.functions.Function1
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
import java.util.Date
|
||||
|
||||
+8
-8
@@ -3,16 +3,16 @@
|
||||
|
||||
fun test1(): Int = <!RETURN_TYPE_MISMATCH!>{ <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
fun test2(): Int = <!RETURN_TYPE_MISMATCH!>{ 1 }<!>
|
||||
val test3: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
val test4: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { 1 }<!>
|
||||
val test3: () -> Int = fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }
|
||||
val test4: () -> Int = fun (): Int = { 1 }
|
||||
fun test5(): Int { return <!RETURN_TYPE_MISMATCH!>{ 1 }<!> }
|
||||
fun test6(): Int = <!RETURN_TYPE_MISMATCH!>fun (): Int = 1<!>
|
||||
|
||||
fun outer() {
|
||||
fun test1(): Int = <!RETURN_TYPE_MISMATCH!>{ <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
fun test2(): Int = <!RETURN_TYPE_MISMATCH!>{ 1 }<!>
|
||||
val test3: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
val test4: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { 1 }<!>
|
||||
val test3: () -> Int = fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }
|
||||
val test4: () -> Int = fun (): Int = { 1 }
|
||||
fun test5(): Int { return <!RETURN_TYPE_MISMATCH!>{ 1 }<!> }
|
||||
fun test6(): Int = <!RETURN_TYPE_MISMATCH!>fun (): Int = 1<!>
|
||||
}
|
||||
@@ -20,16 +20,16 @@ fun outer() {
|
||||
class Outer {
|
||||
fun test1(): Int = <!RETURN_TYPE_MISMATCH!>{ <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
fun test2(): Int = <!RETURN_TYPE_MISMATCH!>{ 1 }<!>
|
||||
val test3: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
val test4: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { 1 }<!>
|
||||
val test3: () -> Int = fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }
|
||||
val test4: () -> Int = fun (): Int = { 1 }
|
||||
fun test5(): Int { return <!RETURN_TYPE_MISMATCH!>{ 1 }<!> }
|
||||
fun test6(): Int = <!RETURN_TYPE_MISMATCH!>fun (): Int = 1<!>
|
||||
|
||||
class Nested {
|
||||
fun test1(): Int = <!RETURN_TYPE_MISMATCH!>{ <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
fun test2(): Int = <!RETURN_TYPE_MISMATCH!>{ 1 }<!>
|
||||
val test3: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>
|
||||
val test4: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun (): Int = { 1 }<!>
|
||||
val test3: () -> Int = fun (): Int = { <!RETURN_NOT_ALLOWED!>return<!> 1 }
|
||||
val test4: () -> Int = fun (): Int = { 1 }
|
||||
fun test5(): Int { return <!RETURN_TYPE_MISMATCH!>{ 1 }<!> }
|
||||
fun test6(): Int = <!RETURN_TYPE_MISMATCH!>fun (): Int = 1<!>
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,10 +3,10 @@
|
||||
interface A
|
||||
fun devNull(a: Any?){}
|
||||
|
||||
val generic_fun = fun<!TYPE_PARAMETERS_NOT_ALLOWED!><T><!>(t: <!UNRESOLVED_REFERENCE!>T<!>): T = null!!
|
||||
val extension_generic_fun = fun<!TYPE_PARAMETERS_NOT_ALLOWED!><T><!><!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): T = null!!
|
||||
val generic_fun = fun<!TYPE_PARAMETERS_NOT_ALLOWED!><T><!>(t: <!UNRESOLVED_REFERENCE!>T<!>): <!UNRESOLVED_REFERENCE!>T<!> = null!!
|
||||
val extension_generic_fun = fun<!TYPE_PARAMETERS_NOT_ALLOWED!><T><!><!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): <!UNRESOLVED_REFERENCE!>T<!> = null!!
|
||||
|
||||
fun fun_with_where() = fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> <!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): T where T: A = null!!
|
||||
fun fun_with_where() = fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> <!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): <!UNRESOLVED_REFERENCE!>T<!> where T: A = null!!
|
||||
|
||||
|
||||
fun outer() {
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
FILE fqName:<root> fileName:/functionLiteralGenericSignature.kt
|
||||
PROPERTY name:unitFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:unitFun type:kotlin.Function0<kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.unitFun'
|
||||
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-unitFun> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:unitFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-unitFun> (): kotlin.Function0<kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:unitFun type:kotlin.Function0<kotlin.Unit> visibility:private [final,static]' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
PROPERTY name:intFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:intFun type:kotlin.Function0<kotlin.Int> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.intFun'
|
||||
CONST Int type=kotlin.Int value=42
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-intFun> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Int>
|
||||
correspondingProperty: PROPERTY name:intFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-intFun> (): kotlin.Function0<kotlin.Int> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:intFun type:kotlin.Function0<kotlin.Int> visibility:private [final,static]' type=kotlin.Function0<kotlin.Int> origin=null
|
||||
PROPERTY name:stringParamFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:stringParamFun type:kotlin.Function1<kotlin.String, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.String) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (x: kotlin.String): kotlin.Unit declared in <root>.stringParamFun'
|
||||
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-stringParamFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.String, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:stringParamFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-stringParamFun> (): kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stringParamFun type:kotlin.Function1<kotlin.String, kotlin.Unit> visibility:private [final,static]' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
|
||||
PROPERTY name:listFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:listFun type:kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (l:kotlin.collections.List<kotlin.String>) returnType:kotlin.collections.List<kotlin.String>
|
||||
VALUE_PARAMETER name:l index:0 type:kotlin.collections.List<kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (l: kotlin.collections.List<kotlin.String>): kotlin.collections.List<kotlin.String> declared in <root>.listFun'
|
||||
GET_VAR 'l: kotlin.collections.List<kotlin.String> declared in <root>.listFun.<anonymous>' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-listFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>>
|
||||
correspondingProperty: PROPERTY name:listFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-listFun> (): kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:listFun type:kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> visibility:private [final,static]' type=kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> origin=null
|
||||
PROPERTY name:mutableListFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:mutableListFun type:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> (l:kotlin.collections.MutableList<kotlin.Double>) returnType:kotlin.collections.MutableList<kotlin.Int>
|
||||
VALUE_PARAMETER name:l index:0 type:kotlin.collections.MutableList<kotlin.Double>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <no name provided> (l: kotlin.collections.MutableList<kotlin.Double>): kotlin.collections.MutableList<kotlin.Int> declared in <root>.mutableListFun'
|
||||
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=kotlin.Nothing origin=EXCLEXCL
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-mutableListFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>>
|
||||
correspondingProperty: PROPERTY name:mutableListFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-mutableListFun> (): kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:mutableListFun type:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> visibility:private [final,static]' type=kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> origin=null
|
||||
PROPERTY name:funWithIn visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:funWithIn type:kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> (x:kotlin.Comparable<kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Comparable<kotlin.String>
|
||||
BLOCK_BODY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-funWithIn> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:funWithIn visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-funWithIn> (): kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:funWithIn type:kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> visibility:private [final,static]' type=kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> origin=null
|
||||
PROPERTY name:extensionFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:extensionFun type:@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> ($receiver:kotlin.Any) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-extensionFun> visibility:public modality:FINAL <> () returnType:@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:extensionFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-extensionFun> (): @[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:extensionFun type:@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> visibility:private [final,static]' type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> origin=null
|
||||
PROPERTY name:extensionWithArgFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:extensionWithArgFun type:@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> ($receiver:kotlin.Long, x:kotlin.Any) returnType:java.util.Date
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Long
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <no name provided> (x: kotlin.Any): java.util.Date declared in <root>.extensionWithArgFun'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.util.Date' type=java.util.Date origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-extensionWithArgFun> visibility:public modality:FINAL <> () returnType:@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date>
|
||||
correspondingProperty: PROPERTY name:extensionWithArgFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-extensionWithArgFun> (): @[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:extensionWithArgFun type:@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> visibility:private [final,static]' type=@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> origin=null
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
val unitFun: Function0<Unit>
|
||||
field = local fun <anonymous>() {
|
||||
return Unit
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val intFun: Function0<Int>
|
||||
field = local fun <anonymous>(): Int {
|
||||
return 42
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val stringParamFun: Function1<String, Unit>
|
||||
field = local fun <anonymous>(x: String) {
|
||||
return Unit
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val listFun: Function1<List<String>, List<String>>
|
||||
field = local fun <anonymous>(l: List<String>): List<String> {
|
||||
return l
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val mutableListFun: Function1<MutableList<Double>, MutableList<Int>>
|
||||
field = local fun <no name provided>(l: MutableList<Double>): MutableList<Int> {
|
||||
return CHECK_NOT_NULL<Nothing>(arg0 = null)
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val funWithIn: Function1<Comparable<String>, Unit>
|
||||
field = local fun <no name provided>(x: Comparable<String>) {
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val extensionFun: @ExtensionFunctionType Function1<Any, Unit>
|
||||
field = local fun Any.<no name provided>() {
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val extensionWithArgFun: @ExtensionFunctionType Function2<Long, Any, Date>
|
||||
field = local fun Long.<no name provided>(x: Any): Date {
|
||||
return Date()
|
||||
}
|
||||
|
||||
get
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
FILE fqName:<root> fileName:/functionLiteralGenericSignature.kt
|
||||
PROPERTY name:unitFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:unitFun type:kotlin.Function0<kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.unitFun'
|
||||
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-unitFun> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:unitFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-unitFun> (): kotlin.Function0<kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:unitFun type:kotlin.Function0<kotlin.Unit> visibility:private [final,static]' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
PROPERTY name:intFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:intFun type:kotlin.Function0<kotlin.Int> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.intFun'
|
||||
CONST Int type=kotlin.Int value=42
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-intFun> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Int>
|
||||
correspondingProperty: PROPERTY name:intFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-intFun> (): kotlin.Function0<kotlin.Int> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:intFun type:kotlin.Function0<kotlin.Int> visibility:private [final,static]' type=kotlin.Function0<kotlin.Int> origin=null
|
||||
PROPERTY name:stringParamFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:stringParamFun type:kotlin.Function1<kotlin.String, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.String) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (x: kotlin.String): kotlin.Unit declared in <root>.stringParamFun'
|
||||
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-stringParamFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.String, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:stringParamFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-stringParamFun> (): kotlin.Function1<kotlin.String, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stringParamFun type:kotlin.Function1<kotlin.String, kotlin.Unit> visibility:private [final,static]' type=kotlin.Function1<kotlin.String, kotlin.Unit> origin=null
|
||||
PROPERTY name:listFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:listFun type:kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (l:kotlin.collections.List<kotlin.String>) returnType:kotlin.collections.List<kotlin.String>
|
||||
VALUE_PARAMETER name:l index:0 type:kotlin.collections.List<kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (l: kotlin.collections.List<kotlin.String>): kotlin.collections.List<kotlin.String> declared in <root>.listFun'
|
||||
GET_VAR 'l: kotlin.collections.List<kotlin.String> declared in <root>.listFun.<anonymous>' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-listFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>>
|
||||
correspondingProperty: PROPERTY name:listFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-listFun> (): kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:listFun type:kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> visibility:private [final,static]' type=kotlin.Function1<kotlin.collections.List<kotlin.String>, kotlin.collections.List<kotlin.String>> origin=null
|
||||
PROPERTY name:mutableListFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:mutableListFun type:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> origin=ANONYMOUS_FUNCTION
|
||||
FUN LOCAL_FUNCTION name:<no name provided> visibility:local modality:FINAL <> (l:kotlin.collections.MutableList<kotlin.Double>) returnType:kotlin.collections.MutableList<kotlin.Int>
|
||||
VALUE_PARAMETER name:l index:0 type:kotlin.collections.MutableList<kotlin.Double>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <no name provided> (l: kotlin.collections.MutableList<kotlin.Double>): kotlin.collections.MutableList<kotlin.Int> declared in <root>.mutableListFun'
|
||||
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=kotlin.Nothing origin=EXCLEXCL
|
||||
<T0>: kotlin.Nothing
|
||||
arg0: CONST Null type=kotlin.Nothing? value=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-mutableListFun> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>>
|
||||
correspondingProperty: PROPERTY name:mutableListFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-mutableListFun> (): kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:mutableListFun type:kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> visibility:private [final,static]' type=kotlin.Function1<kotlin.collections.MutableList<kotlin.Double>, kotlin.collections.MutableList<kotlin.Int>> origin=null
|
||||
PROPERTY name:funWithIn visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:funWithIn type:kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> origin=ANONYMOUS_FUNCTION
|
||||
FUN LOCAL_FUNCTION name:<no name provided> visibility:local modality:FINAL <> (x:kotlin.Comparable<kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Comparable<kotlin.String>
|
||||
BLOCK_BODY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-funWithIn> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:funWithIn visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-funWithIn> (): kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:funWithIn type:kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> visibility:private [final,static]' type=kotlin.Function1<kotlin.Comparable<kotlin.String>, kotlin.Unit> origin=null
|
||||
PROPERTY name:extensionFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:extensionFun type:@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> origin=ANONYMOUS_FUNCTION
|
||||
FUN LOCAL_FUNCTION name:<no name provided> visibility:local modality:FINAL <> ($receiver:kotlin.Any) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-extensionFun> visibility:public modality:FINAL <> () returnType:@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:extensionFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-extensionFun> (): @[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:extensionFun type:@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> visibility:private [final,static]' type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Any, kotlin.Unit> origin=null
|
||||
PROPERTY name:extensionWithArgFun visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:extensionWithArgFun type:@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> origin=ANONYMOUS_FUNCTION
|
||||
FUN LOCAL_FUNCTION name:<no name provided> visibility:local modality:FINAL <> ($receiver:kotlin.Long, x:kotlin.Any) returnType:java.util.Date
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Long
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <no name provided> (x: kotlin.Any): java.util.Date declared in <root>.extensionWithArgFun'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.util.Date' type=java.util.Date origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-extensionWithArgFun> visibility:public modality:FINAL <> () returnType:@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date>
|
||||
correspondingProperty: PROPERTY name:extensionWithArgFun visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-extensionWithArgFun> (): @[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:extensionWithArgFun type:@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> visibility:private [final,static]' type=@[ExtensionFunctionType] kotlin.Function2<kotlin.Long, kotlin.Any, java.util.Date> origin=null
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.Date
|
||||
|
||||
val unitFun = { }
|
||||
val intFun = { 42 }
|
||||
val stringParamFun = { x: String -> }
|
||||
val listFun = { l: List<String> -> l }
|
||||
val mutableListFun = fun (l: MutableList<Double>): MutableList<Int> = null!!
|
||||
val funWithIn = fun (x: Comparable<String>) {}
|
||||
|
||||
val extensionFun = fun Any.() {}
|
||||
val extensionWithArgFun = fun Long.(x: Any): Date = Date()
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
val unitFun: Function0<Unit>
|
||||
field = local fun <anonymous>() {
|
||||
return Unit
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val intFun: Function0<Int>
|
||||
field = local fun <anonymous>(): Int {
|
||||
return 42
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val stringParamFun: Function1<String, Unit>
|
||||
field = local fun <anonymous>(x: String) {
|
||||
return Unit
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val listFun: Function1<List<String>, List<String>>
|
||||
field = local fun <anonymous>(l: List<String>): List<String> {
|
||||
return l
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val mutableListFun: Function1<MutableList<Double>, MutableList<Int>>
|
||||
field = local fun <no name provided>(l: MutableList<Double>): MutableList<Int> {
|
||||
return CHECK_NOT_NULL<Nothing>(arg0 = null)
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val funWithIn: Function1<Comparable<String>, Unit>
|
||||
field = local fun <no name provided>(x: Comparable<String>) {
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val extensionFun: @ExtensionFunctionType Function1<Any, Unit>
|
||||
field = local fun Any.<no name provided>() {
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val extensionWithArgFun: @ExtensionFunctionType Function2<Long, Any, Date>
|
||||
field = local fun Long.<no name provided>(x: Any): Date {
|
||||
return Date()
|
||||
}
|
||||
|
||||
get
|
||||
Generated
+6
@@ -2494,6 +2494,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/FlushFromAnonymous.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionLiteralGenericSignature.kt")
|
||||
public void testFunctionLiteralGenericSignature() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/functionLiteralGenericSignature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ImplicitReceiverStack.kt")
|
||||
public void testImplicitReceiverStack() throws Exception {
|
||||
|
||||
@@ -1857,6 +1857,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/firProblems/FlushFromAnonymous.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionLiteralGenericSignature.kt")
|
||||
public void testFunctionLiteralGenericSignature() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/functionLiteralGenericSignature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplicitReceiverStack.kt")
|
||||
public void testImplicitReceiverStack() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/ImplicitReceiverStack.kt");
|
||||
|
||||
Reference in New Issue
Block a user