[FIR] add vararg arguments support, improve vararg parameters support

This commit is contained in:
Juan Chen
2020-01-27 19:51:35 -08:00
committed by Mikhail Glukhikh
parent 069fbffaa3
commit 188abc243a
75 changed files with 339 additions and 207 deletions
@@ -18,19 +18,20 @@ FILE fqName:<root> fileName:/samConversionInVarargs.kt
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:useVararg visibility:public modality:FINAL <> (foos:kotlin.Array<<root>.IFoo>) returnType:kotlin.Unit
VALUE_PARAMETER name:foos index:0 type:kotlin.Array<<root>.IFoo>
VALUE_PARAMETER name:foos index:0 type:kotlin.Array<<root>.IFoo> varargElementType:<root>.IFoo [vararg]
BLOCK_BODY
FUN name:testLambda visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun useVararg (foos: kotlin.Array<<root>.IFoo>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
foos: FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=LAMBDA
ERROR_CALL 'Cannot bind 2 arguments to useVararg call with 1 parameters' type=kotlin.Unit
FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
VARARG type=kotlin.Array<<root>.IFoo> varargElementType=<root>.IFoo
FUN name:testSeveralLambdas visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
ERROR_CALL 'Cannot bind 3 arguments to useVararg call with 1 parameters' type=kotlin.Unit
ERROR_CALL 'Cannot bind 4 arguments to useVararg call with 1 parameters' type=kotlin.Unit
FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:kotlin.Int
@@ -46,12 +47,13 @@ FILE fqName:<root> fileName:/samConversionInVarargs.kt
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
VARARG type=kotlin.Array<<root>.IFoo> varargElementType=<root>.IFoo
FUN name:withVarargOfInt visibility:public modality:FINAL <> (xs:kotlin.IntArray) returnType:kotlin.String
VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray
VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun withVarargOfInt (xs: kotlin.IntArray): kotlin.String declared in <root>'
RETURN type=kotlin.Nothing from='public final fun withVarargOfInt (vararg xs: kotlin.Int): kotlin.String declared in <root>'
CONST String type=kotlin.String value=""
FUN name:testAdaptedCR visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useVararg]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun withVarargOfInt (xs: kotlin.IntArray): kotlin.String declared in <root>' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.String> origin=null reflectionTarget=<same>
FUNCTION_REFERENCE 'public final fun withVarargOfInt (vararg xs: kotlin.Int): kotlin.String declared in <root>' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.String> origin=null reflectionTarget=<same>