FIR: record and serialize the modifier "fun" for functional interface

This commit is contained in:
Jinseong Jeon
2020-06-05 15:00:03 -07:00
committed by Mikhail Glukhikh
parent 6a2fed33d3
commit 0d2552b0b6
24 changed files with 33 additions and 196 deletions
@@ -98,7 +98,7 @@ class FirElementSerializer private constructor(
regularClass?.isExternal == true, regularClass?.isExternal == true,
regularClass?.isExpect == true, regularClass?.isExpect == true,
regularClass?.isInline == true, regularClass?.isInline == true,
false // TODO: klass.isFun not supported yet regularClass?.isFun == true
) )
if (flags != builder.flags) { if (flags != builder.flags) {
builder.flags = flags builder.flags = flags
@@ -183,7 +183,7 @@ class Fir2IrClassifierStorage(
isExternal = regularClass.isExternal, isExternal = regularClass.isExternal,
isInline = regularClass.isInline, isInline = regularClass.isInline,
isExpect = regularClass.isExpect, isExpect = regularClass.isExpect,
isFun = false // TODO FirRegularClass.isFun isFun = regularClass.isFun
).apply { ).apply {
metadata = FirMetadataSource.Class(regularClass, descriptor) metadata = FirMetadataSource.Class(regularClass, descriptor)
descriptor.bind(this) descriptor.bind(this)
@@ -382,6 +382,7 @@ class DeclarationsConverter(
isCompanion = modifiers.isCompanion() && classKind == ClassKind.OBJECT isCompanion = modifiers.isCompanion() && classKind == ClassKind.OBJECT
isData = modifiers.isDataClass() isData = modifiers.isDataClass()
isInline = modifiers.isInlineClass() isInline = modifiers.isInlineClass()
isFun = modifiers.isFunctionalInterface()
} }
buildRegularClass { buildRegularClass {
@@ -78,6 +78,10 @@ class Modifier(
return classModifiers.contains(ClassModifier.COMPANION) return classModifiers.contains(ClassModifier.COMPANION)
} }
fun isFunctionalInterface(): Boolean {
return classModifiers.contains(ClassModifier.FUN)
}
fun hasOverride(): Boolean { fun hasOverride(): Boolean {
return memberModifiers.contains(MemberModifier.OVERRIDE) return memberModifiers.contains(MemberModifier.OVERRIDE)
} }
@@ -11,7 +11,8 @@ enum class ClassModifier {
DATA, DATA,
INLINE, INLINE,
INNER, INNER,
COMPANION COMPANION,
FUN
} }
enum class MemberModifier { enum class MemberModifier {
@@ -670,6 +670,7 @@ class RawFirBuilder(
isCompanion = (classOrObject as? KtObjectDeclaration)?.isCompanion() == true isCompanion = (classOrObject as? KtObjectDeclaration)?.isCompanion() == true
isData = classOrObject.hasModifier(DATA_KEYWORD) isData = classOrObject.hasModifier(DATA_KEYWORD)
isInline = classOrObject.hasModifier(INLINE_KEYWORD) isInline = classOrObject.hasModifier(INLINE_KEYWORD)
isFun = classOrObject.hasModifier(FUN_KEYWORD)
} }
withCapturedTypeParameters { withCapturedTypeParameters {
if (!status.isInner) context.capturedTypeParameters = context.capturedTypeParameters.clear() if (!status.isInner) context.capturedTypeParameters = context.capturedTypeParameters.clear()
@@ -39,6 +39,7 @@ interface FirDeclarationStatus : FirElement {
val isStatic: Boolean val isStatic: Boolean
val isFromSealedClass: Boolean val isFromSealedClass: Boolean
val isFromEnumClass: Boolean val isFromEnumClass: Boolean
val isFun: Boolean
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitDeclarationStatus(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitDeclarationStatus(this, data)
} }
@@ -38,6 +38,7 @@ interface FirResolvedDeclarationStatus : FirDeclarationStatus {
override val isStatic: Boolean override val isStatic: Boolean
override val isFromSealedClass: Boolean override val isFromSealedClass: Boolean
override val isFromEnumClass: Boolean override val isFromEnumClass: Boolean
override val isFun: Boolean
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitResolvedDeclarationStatus(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitResolvedDeclarationStatus(this, data)
} }
@@ -37,6 +37,7 @@ inline val FirRegularClass.isInner get() = status.isInner
inline val FirRegularClass.isCompanion get() = status.isCompanion inline val FirRegularClass.isCompanion get() = status.isCompanion
inline val FirRegularClass.isData get() = status.isData inline val FirRegularClass.isData get() = status.isData
inline val FirRegularClass.isInline get() = status.isInline inline val FirRegularClass.isInline get() = status.isInline
inline val FirRegularClass.isFun get() = status.isFun
inline val FirMemberDeclaration.modality get() = status.modality inline val FirMemberDeclaration.modality get() = status.modality
inline val FirMemberDeclaration.visibility get() = status.visibility inline val FirMemberDeclaration.visibility get() = status.visibility
inline val FirMemberDeclaration.allowsToHaveFakeOverride: Boolean inline val FirMemberDeclaration.allowsToHaveFakeOverride: Boolean
@@ -136,6 +136,12 @@ open class FirDeclarationStatusImpl(
this[FROM_ENUM] = value this[FROM_ENUM] = value
} }
override var isFun: Boolean
get() = this[FUN]
set(value) {
this[FUN] = value
}
private enum class Modifier(val mask: Int) { private enum class Modifier(val mask: Int) {
EXPECT(0x1), EXPECT(0x1),
ACTUAL(0x2), ACTUAL(0x2),
@@ -153,7 +159,8 @@ open class FirDeclarationStatusImpl(
SUSPEND(0x2000), SUSPEND(0x2000),
STATIC(0x4000), STATIC(0x4000),
FROM_SEALED(0x8000), FROM_SEALED(0x8000),
FROM_ENUM(0x10000) FROM_ENUM(0x10000),
FUN(0x20000)
} }
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {} override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {}
@@ -323,7 +323,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
generateBooleanFields( generateBooleanFields(
"expect", "actual", "override", "operator", "infix", "inline", "tailRec", "expect", "actual", "override", "operator", "infix", "inline", "tailRec",
"external", "const", "lateInit", "inner", "companion", "data", "suspend", "static", "external", "const", "lateInit", "inner", "companion", "data", "suspend", "static",
"fromSealedClass", "fromEnumClass" "fromSealedClass", "fromEnumClass", "fun"
) )
} }
@@ -1,5 +1,4 @@
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_REFLECT // WITH_REFLECT
// FILE: box.kt // FILE: box.kt
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo $this: VALUE_PARAMETER name:<this> type:<root>.IFoo
@@ -17,7 +17,7 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
overridden: overridden:
public open fun toString (): kotlin.String declared in kotlin.Any public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any $this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:IFoo2 modality:ABSTRACT visibility:public superTypes:[<root>.IFoo] CLASS INTERFACE name:IFoo2 modality:ABSTRACT visibility:public [fun] superTypes:[<root>.IFoo]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo2 $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo2
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit [fake_override] FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit [fake_override]
overridden: overridden:
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/withAdaptationForSam.kt FILE fqName:<root> fileName:/withAdaptationForSam.kt
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo $this: VALUE_PARAMETER name:<this> type:<root>.IFoo
@@ -1,147 +0,0 @@
FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument_fi.kt
CLASS INTERFACE name:IRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IRunnable
FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.IRunnable) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IRunnable
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:foo1 visibility:public modality:FINAL <> (r:<root>.IRunnable, s:kotlin.Array<out kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:r index:0 type:<root>.IRunnable
VALUE_PARAMETER name:s index:1 type:kotlin.Array<out kotlin.String> varargElementType:kotlin.String [vararg]
BLOCK_BODY
FUN name:foo2 visibility:public modality:FINAL <> (r1:<root>.IRunnable, r2:<root>.IRunnable, s:kotlin.Array<out kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:r1 index:0 type:<root>.IRunnable
VALUE_PARAMETER name:r2 index:1 type:<root>.IRunnable
VALUE_PARAMETER name:s index:2 type:kotlin.Array<out kotlin.String> varargElementType:kotlin.String [vararg]
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.Unit>, r:<root>.IRunnable, s:kotlin.String, arr:kotlin.Array<kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.Unit>
VALUE_PARAMETER name:r index:1 type:<root>.IRunnable
VALUE_PARAMETER name:s index:2 type:kotlin.String
VALUE_PARAMETER name:arr index:3 type:kotlin.Array<kotlin.String>
BLOCK_BODY
CALL 'public final fun foo1 (r: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 's: kotlin.String declared in <root>.test' type=kotlin.String origin=null
CALL 'public final fun foo1 (r: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
CALL 'public final fun foo1 (r: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
GET_VAR 'fn: kotlin.Function0<kotlin.Unit> declared in <root>.test' type=kotlin.Function0<kotlin.Unit> origin=null
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 's: kotlin.String declared in <root>.test' type=kotlin.String origin=null
CALL 'public final fun foo1 (r: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
GET_VAR 'fn: kotlin.Function0<kotlin.Unit> declared in <root>.test' type=kotlin.Function0<kotlin.Unit> origin=null
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
CALL 'public final fun foo1 (r: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: GET_VAR 'r: <root>.IRunnable declared in <root>.test' type=<root>.IRunnable origin=null
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 's: kotlin.String declared in <root>.test' type=kotlin.String origin=null
CALL 'public final fun foo1 (r: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: GET_VAR 'r: <root>.IRunnable declared in <root>.test' type=<root>.IRunnable origin=null
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
CALL 'public final fun foo2 (r1: <root>.IRunnable, r2: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
r2: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 's: kotlin.String declared in <root>.test' type=kotlin.String origin=null
CALL 'public final fun foo2 (r1: <root>.IRunnable, r2: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
r2: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
CALL 'public final fun foo2 (r1: <root>.IRunnable, r2: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
GET_VAR 'fn: kotlin.Function0<kotlin.Unit> declared in <root>.test' type=kotlin.Function0<kotlin.Unit> origin=null
r2: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 's: kotlin.String declared in <root>.test' type=kotlin.String origin=null
CALL 'public final fun foo2 (r1: <root>.IRunnable, r2: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
GET_VAR 'fn: kotlin.Function0<kotlin.Unit> declared in <root>.test' type=kotlin.Function0<kotlin.Unit> origin=null
r2: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
CALL 'public final fun foo2 (r1: <root>.IRunnable, r2: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: GET_VAR 'r: <root>.IRunnable declared in <root>.test' type=<root>.IRunnable origin=null
r2: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
GET_VAR 's: kotlin.String declared in <root>.test' type=kotlin.String origin=null
CALL 'public final fun foo2 (r1: <root>.IRunnable, r2: <root>.IRunnable, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: GET_VAR 'r: <root>.IRunnable declared in <root>.test' type=<root>.IRunnable origin=null
r2: TYPE_OP type=<root>.IRunnable origin=SAM_CONVERSION typeOperand=<root>.IRunnable
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>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
s: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface IRunnable { fun interface IRunnable {
@@ -1,34 +0,0 @@
FILE fqName:<root> fileName:/basicFunInterfaceConversion.kt
CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo
FUN name:invoke visibility:public modality:ABSTRACT <> ($this:<root>.Foo) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.Foo
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 <> (f:<root>.Foo) returnType:kotlin.String
VALUE_PARAMETER name:f index:0 type:<root>.Foo
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (f: <root>.Foo): kotlin.String declared in <root>'
CALL 'public abstract fun invoke (): kotlin.String declared in <root>.Foo' type=kotlin.String origin=null
$this: GET_VAR 'f: <root>.Foo declared in <root>.foo' type=<root>.Foo origin=null
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.String declared in <root>'
CALL 'public final fun foo (f: <root>.Foo): kotlin.String declared in <root>' type=kotlin.String origin=null
f: TYPE_OP type=<root>.Foo origin=SAM_CONVERSION typeOperand=<root>.Foo
FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test'
CONST String type=kotlin.String value="OK"
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions // !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface Foo { fun interface Foo {
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/castFromAny.kt FILE fqName:<root> fileName:/castFromAny.kt
CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable
FUN name:invoke visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit FUN name:invoke visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.KRunnable $this: VALUE_PARAMETER name:<this> type:<root>.KRunnable
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/partialSam.kt FILE fqName:<root> fileName:/partialSam.kt
CLASS INTERFACE name:Fn modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:Fn modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Fn<T of <root>.Fn, R of <root>.Fn> $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Fn<T of <root>.Fn, R of <root>.Fn>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
TYPE_PARAMETER name:R index:1 variance: superTypes:[kotlin.Any?] TYPE_PARAMETER name:R index:1 variance: superTypes:[kotlin.Any?]
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/samConversionInVarargs.kt FILE fqName:<root> fileName:/samConversionInVarargs.kt
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo, i:kotlin.Int) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo $this: VALUE_PARAMETER name:<this> type:<root>.IFoo
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/samConversionInVarargsMixed.kt FILE fqName:<root> fileName:/samConversionInVarargsMixed.kt
CLASS INTERFACE name:MyRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:MyRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyRunnable $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyRunnable
FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.MyRunnable) returnType:kotlin.Unit FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.MyRunnable) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.MyRunnable $this: VALUE_PARAMETER name:<this> type:<root>.MyRunnable
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/samConversionOnCallableReference.kt FILE fqName:<root> fileName:/samConversionOnCallableReference.kt
CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable
FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.KRunnable $this: VALUE_PARAMETER name:<this> type:<root>.KRunnable
@@ -1,5 +1,5 @@
FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable $this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable
FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.KRunnable $this: VALUE_PARAMETER name:<this> type:<root>.KRunnable