JVM_IR KT-43877 fix generic signatures for SAM-converted lambdas

This commit is contained in:
Dmitry Petrov
2020-12-11 15:41:02 +03:00
parent dc11c2de77
commit b7330a9e14
56 changed files with 1014 additions and 59 deletions
@@ -12178,6 +12178,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -15922,6 +15927,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -159,8 +159,8 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
private val adaptedReferenceOriginalTarget: IrFunction? = adapteeCall?.symbol?.owner
private val isAdaptedReference = adaptedReferenceOriginalTarget != null
private val isKotlinFunInterface =
samSuperType != null && samSuperType.getClass()?.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
private val samInterface = samSuperType?.getClass()
private val isKotlinFunInterface = samInterface != null && !samInterface.isFromJava()
private val needToGenerateSamEqualsHashCodeMethods =
isKotlinFunInterface && (isAdaptedReference || !isLambda)
@@ -196,6 +196,14 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
context.ir.symbols.functionAdapter.defaultType
else null,
)
if (samInterface != null && origin == JvmLoweredDeclarationOrigin.LAMBDA_IMPL) {
// Old back-end generates formal type parameters as in SAM supertype.
// Here we create formal type parameters with same names and equivalent upper bounds.
// We don't really perform any type substitutions within class body
// (it's all fine as soon as we have required generic signatures and don't fail anywhere).
// NB this would no longer matter if we generate SAM wrapper classes as synthetic.
typeParameters = createFakeFormalTypeParameters(samInterface.typeParameters, this)
}
createImplicitParameterDeclarationWithWrappedDescriptor()
copyAttributes(irFunctionReference)
if (isLambda) {
@@ -203,6 +211,24 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
}
}
private fun createFakeFormalTypeParameters(sourceTypeParameters: List<IrTypeParameter>, irClass: IrClass): List<IrTypeParameter> {
if (sourceTypeParameters.isEmpty()) return emptyList()
val fakeTypeParameters = sourceTypeParameters.map {
buildTypeParameter(irClass) {
updateFrom(it)
name = it.name
}
}
val typeRemapper = IrTypeParameterRemapper(sourceTypeParameters.associateWith { fakeTypeParameters[it.index] })
for (fakeTypeParameter in fakeTypeParameters) {
val sourceTypeParameter = sourceTypeParameters[fakeTypeParameter.index]
fakeTypeParameter.superTypes = sourceTypeParameter.superTypes.map { typeRemapper.remapType(it) }
}
return fakeTypeParameters
}
private val receiverField = context.ir.symbols.functionReferenceReceiverField.owner
fun build(): IrExpression = context.createJvmIrBuilder(currentScope!!.scope.scopeOwnerSymbol).run {
@@ -390,7 +416,11 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
isSuspend = callee.isSuspend
}.apply {
overriddenSymbols += superMethod
dispatchReceiverParameter = parentAsClass.thisReceiver!!.copyTo(this)
dispatchReceiverParameter = buildReceiverParameter(
this,
IrDeclarationOrigin.INSTANCE_RECEIVER,
functionReferenceClass.symbol.defaultType
)
if (isLambda) createLambdaInvokeMethod() else createFunctionReferenceInvokeMethod(receiverVar)
}
@@ -427,8 +457,9 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
// will put it into a field.
if (samSuperType == null)
irImplicitCast(
irGetField(irGet(dispatchReceiverParameter!!),
this@FunctionReferenceBuilder.receiverField
irGetField(
irGet(dispatchReceiverParameter!!),
this@FunctionReferenceBuilder.receiverField
),
boundReceiver.second.type
)
@@ -1075,11 +1075,13 @@ private fun makeKotlinType(
classDescriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark)
} catch (e: Throwable) {
throw RuntimeException(
"Classifier: $classDescriptor\n" +
"Classifier: ${classifier.owner.render()}\n" +
"Type parameters:\n" +
classDescriptor.defaultType.constructor.parameters.withIndex()
.joinToString(separator = "\n") {
"${it.index}: ${(it.value as IrBasedTypeParameterDescriptor).owner.render()}"
val irTypeParameter = (it.value as IrBasedTypeParameterDescriptor).owner
"${it.index}: ${irTypeParameter.render()} " +
"of ${irTypeParameter.parent.render()}"
} +
"\nType arguments:\n" +
arguments.withIndex()
@@ -18,8 +18,10 @@ import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.ir.util.isAnonymousObject
import org.jetbrains.kotlin.ir.util.isPropertyAccessor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import org.jetbrains.kotlin.types.typeUtil.makeNullable
@@ -177,6 +179,10 @@ val IrClass.typeConstructorParameters: Sequence<IrTypeParameter>
// Ideally this should be fixed in FE.
null
}
current.isAnonymousObject -> {
// Anonymous classes don't capture type parameters.
null
}
parent is IrClass && current is IrClass && !current.isInner ->
null
else ->
@@ -0,0 +1,17 @@
fun interface FunIFace<T, R> {
fun call(ic: T): R
}
fun <T, R> bar(value: T, f: FunIFace<T, R>): R {
return f.call(value)
}
class X(val value: Any)
fun <T> gfn(a: X): T =
bar(a) {
it.value as T
}
fun box() =
gfn<String>(X("OK"))
@@ -0,0 +1,8 @@
fun <T> test(): String {
val x = object {
fun <S> foo() = "OK"
}
return x.foo<Any>()
}
fun box() = test<Int>()
@@ -0,0 +1,18 @@
// WITH_SIGNATURES
fun <T> test() {
val x = object {
fun <S1> foo() {}
fun <S2> S2.ext() {}
val <S3> S3.extVal
get() = 1
var <S4> S4.extVar
get() = 1
set(value) {}
}
x.foo<Any>()
}
@@ -0,0 +1,19 @@
@kotlin.Metadata
public final class<null> AnonymousObjectInGenericFunKt$test$x$1 {
// source: 'anonymousObjectInGenericFun.kt'
public final <<S1:Ljava/lang/Object;>()V> method foo(): void
public final <<S2:Ljava/lang/Object;>(TS2;)V> method ext(p0: java.lang.Object): void
public final <<S3:Ljava/lang/Object;>(TS3;)I> method getExtVal(p0: java.lang.Object): int
public final <<S4:Ljava/lang/Object;>(TS4;)I> method getExtVar(p0: java.lang.Object): int
public final <<S4:Ljava/lang/Object;>(TS4;I)V> method setExtVar(p0: java.lang.Object, p1: int): void
<null> method <init>(): void
enclosing method AnonymousObjectInGenericFunKt.test()V
inner (anonymous) class AnonymousObjectInGenericFunKt$test$x$1
}
@kotlin.Metadata
public final class<null> AnonymousObjectInGenericFunKt {
// source: 'anonymousObjectInGenericFun.kt'
public final static <<T:Ljava/lang/Object;>()V> method test(): void
inner (anonymous) class AnonymousObjectInGenericFunKt$test$x$1
}
@@ -0,0 +1,12 @@
// WITH_SIGNATURES
// FILE: t.kt
fun interface Sam<T> {
fun get(): T
}
fun <T> expectsSam(sam: Sam<T>) = sam.get()
fun <T> foo(): T = null!!
fun <T> genericSam(): T = expectsSam(::foo)
@@ -0,0 +1,36 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
synthetic final class<Lkotlin/jvm/internal/FunctionReferenceImpl;Lkotlin/jvm/functions/Function0<TT;>;> TKt$genericSam$1 {
// source: 't.kt'
public final <()TT;> method invoke(): java.lang.Object
static <null> method <clinit>(): void
<null> method <init>(): void
enclosing method TKt.genericSam()Ljava/lang/Object;
public final static field <null> INSTANCE: TKt$genericSam$1
inner (anonymous) class TKt$genericSam$1
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public <null> method equals(p0: java.lang.Object): boolean
public synthetic final <null> method get(): java.lang.Object
public <null> method getFunctionDelegate(): kotlin.Function
public <null> method hashCode(): int
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>()TT;> method foo(): java.lang.Object
public final static <<T:Ljava/lang/Object;>()TT;> method genericSam(): java.lang.Object
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
inner (anonymous) class TKt$genericSam$1
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
synthetic final class<Ljava/lang/Object;LSam<TT;>;Lkotlin/jvm/internal/FunctionAdapter;> TKt$genericSam$1 {
// source: 't.kt'
public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function
public final <()TT;> method get(): java.lang.Object
static <null> method <clinit>(): void
<null> method <init>(): void
public final <null> method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final <null> method hashCode(): int
enclosing method TKt.genericSam()Ljava/lang/Object;
public final static field <null> INSTANCE: TKt$genericSam$1
inner (anonymous) class TKt$genericSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>()TT;> method foo(): java.lang.Object
public final static <<T:Ljava/lang/Object;>()TT;> method genericSam(): java.lang.Object
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
inner (anonymous) class TKt$genericSam$1
}
@@ -0,0 +1,18 @@
// WITH_SIGNATURES
// FILE: t.kt
fun <T> foo(): T = null!!
fun <T> genericSam(): T = J.g(::foo)
// FILE: J.java
public class J {
static <T> T g(Sam<T> s) {
return s.get();
}
}
// FILE: Sam.java
public interface Sam<T> {
T get();
}
@@ -0,0 +1,26 @@
@kotlin.Metadata
synthetic final class<Lkotlin/jvm/internal/FunctionReferenceImpl;Lkotlin/jvm/functions/Function0<TT;>;> TKt$genericSam$1 {
// source: 't.kt'
public final <()TT;> method invoke(): java.lang.Object
static <null> method <clinit>(): void
<null> method <init>(): void
enclosing method TKt.genericSam()Ljava/lang/Object;
public final static field <null> INSTANCE: TKt$genericSam$1
inner (anonymous) class TKt$genericSam$1
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic final <null> method get(): java.lang.Object
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>()TT;> method foo(): java.lang.Object
public final static <<T:Ljava/lang/Object;>()TT;> method genericSam(): java.lang.Object
inner (anonymous) class TKt$genericSam$1
}
@@ -0,0 +1,18 @@
@kotlin.Metadata
synthetic final class<Ljava/lang/Object;LSam<TT;>;> TKt$genericSam$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
static <null> method <clinit>(): void
<null> method <init>(): void
enclosing method TKt.genericSam()Ljava/lang/Object;
public final static field <null> INSTANCE: TKt$genericSam$1
inner (anonymous) class TKt$genericSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>()TT;> method foo(): java.lang.Object
public final static <<T:Ljava/lang/Object;>()TT;> method genericSam(): java.lang.Object
inner (anonymous) class TKt$genericSam$1
}
@@ -0,0 +1,12 @@
// WITH_SIGNATURES
// FILE: t.kt
fun interface Sam<T> {
fun get(): T
}
fun <T> expectsSam(sam: Sam<T>) = sam.get()
fun foo(): String = ""
fun specializedSam(): String = expectsSam(::foo)
@@ -0,0 +1,37 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public <null> method equals(p0: java.lang.Object): boolean
public synthetic final <null> method get(): java.lang.Object
public <null> method getFunctionDelegate(): kotlin.Function
public <null> method hashCode(): int
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
synthetic final class<Lkotlin/jvm/internal/FunctionReferenceImpl;Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
static <null> method <clinit>(): void
<null> method <init>(): void
public synthetic bridge <null> method invoke(): java.lang.Object
public final @org.jetbrains.annotations.NotNull <null> method invoke(): java.lang.String
enclosing method TKt.specializedSam()Ljava/lang/String;
public final static field <null> INSTANCE: TKt$specializedSam$1
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
public final static @org.jetbrains.annotations.NotNull <null> method foo(): java.lang.String
public final static @org.jetbrains.annotations.NotNull <null> method specializedSam(): java.lang.String
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,29 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
synthetic final class<Ljava/lang/Object;LSam<Ljava/lang/String;>;Lkotlin/jvm/internal/FunctionAdapter;> TKt$specializedSam$1 {
// source: 't.kt'
public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function
static <null> method <clinit>(): void
<null> method <init>(): void
public final <null> method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public synthetic bridge <null> method get(): java.lang.Object
public final @org.jetbrains.annotations.NotNull <null> method get(): java.lang.String
public final <null> method hashCode(): int
enclosing method TKt.specializedSam()Ljava/lang/String;
public final static field <null> INSTANCE: TKt$specializedSam$1
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
public final static @org.jetbrains.annotations.NotNull <null> method foo(): java.lang.String
public final static @org.jetbrains.annotations.NotNull <null> method specializedSam(): java.lang.String
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,18 @@
// WITH_SIGNATURES
// FILE: t.kt
fun foo(): String = ""
fun specializedSam(): String = J.g(::foo)
// FILE: J.java
public class J {
static <T> T g(Sam<T> s) {
return s.get();
}
}
// FILE: Sam.java
public interface Sam<T> {
T get();
}
@@ -0,0 +1,27 @@
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic final <null> method get(): java.lang.Object
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
synthetic final class<Lkotlin/jvm/internal/FunctionReferenceImpl;Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
static <null> method <clinit>(): void
<null> method <init>(): void
public synthetic bridge <null> method invoke(): java.lang.Object
public final @org.jetbrains.annotations.NotNull <null> method invoke(): java.lang.String
enclosing method TKt.specializedSam()Ljava/lang/String;
public final static field <null> INSTANCE: TKt$specializedSam$1
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <null> method foo(): java.lang.String
public final static @org.jetbrains.annotations.NotNull <null> method specializedSam(): java.lang.String
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,19 @@
@kotlin.Metadata
synthetic final class<Ljava/lang/Object;LSam<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
static <null> method <clinit>(): void
<null> method <init>(): void
public synthetic bridge <null> method get(): java.lang.Object
public final @org.jetbrains.annotations.NotNull <null> method get(): java.lang.String
enclosing method TKt.specializedSam()Ljava/lang/String;
public final static field <null> INSTANCE: TKt$specializedSam$1
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <null> method foo(): java.lang.String
public final static @org.jetbrains.annotations.NotNull <null> method specializedSam(): java.lang.String
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,10 @@
// WITH_SIGNATURES
// FILE: t.kt
fun interface Sam<T> {
fun get(): T
}
fun <T> expectsSam(sam: Sam<T>) = sam.get()
fun <T> genericSam(f: () -> T): T = expectsSam(f)
@@ -0,0 +1,23 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public <null> method equals(p0: java.lang.Object): boolean
public synthetic final <null> method get(): java.lang.Object
public <null> method getFunctionDelegate(): kotlin.Function
public <null> method hashCode(): int
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
}
@@ -0,0 +1,25 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function
<null> method <init>(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
public final <null> method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public synthetic final <null> method get(): java.lang.Object
public final <null> method hashCode(): int
private synthetic final field <null> function: kotlin.jvm.functions.Function0
final inner class TKt$sam$Sam$0
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
final inner class TKt$sam$Sam$0
}
@@ -1,5 +1,5 @@
// WITH_SIGNATURES
// FILE: samGenericSuperinterface.kt
// FILE: t.kt
fun <T> genericSam(f: () -> T): T = J.g(f)
@@ -1,13 +1,13 @@
@kotlin.Metadata
final class<null> SamGenericSuperinterfaceKt$sam$Sam$0 {
// source: 'samGenericSuperinterface.kt'
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic final <null> method get(): java.lang.Object
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
public final class<null> SamGenericSuperinterfaceKt {
// source: 'samGenericSuperinterface.kt'
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
}
@@ -1,15 +1,15 @@
@kotlin.Metadata
final class<null> SamGenericSuperinterfaceKt$sam$Sam$0 {
// source: 'samGenericSuperinterface.kt'
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
public synthetic final <null> method get(): java.lang.Object
private synthetic final field <null> function: kotlin.jvm.functions.Function0
final inner class SamGenericSuperinterfaceKt$sam$Sam$0
final inner class TKt$sam$Sam$0
}
@kotlin.Metadata
public final class<null> SamGenericSuperinterfaceKt {
// source: 'samGenericSuperinterface.kt'
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
final inner class SamGenericSuperinterfaceKt$sam$Sam$0
final inner class TKt$sam$Sam$0
}
@@ -0,0 +1,10 @@
// WITH_SIGNATURES
// FILE: t.kt
fun interface Sam<T> {
fun get(): T
}
fun <T> expectsSam(sam: Sam<T>) = sam.get()
fun <T> genericSamGet(f: () -> T): T = expectsSam({ f() })
@@ -0,0 +1,23 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<TT;>;> TKt$genericSamGet$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
synthetic final field <null> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$genericSamGet$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
inner (anonymous) class TKt$genericSamGet$1
}
@@ -0,0 +1,23 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<TT;>;> TKt$genericSamGet$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
<(Lkotlin/jvm/functions/Function0<+TT;>;)V> method <init>(p0: kotlin.jvm.functions.Function0): void
enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
synthetic final field <Lkotlin/jvm/functions/Function0<TT;>;> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$genericSamGet$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
inner (anonymous) class TKt$genericSamGet$1
}
@@ -0,0 +1,22 @@
// WITH_SIGNATURES
// FILE: t.kt
fun <T> genericSam(f: () -> T): Sam<T> = J.sam({ f() })
fun <T> genericSamGet(f: () -> T): T = J.get({ f() })
// FILE: J.java
public class J {
static <T> T get(Sam<T> s) {
return s.get();
}
static <T> Sam<T> sam(Sam<T> s) {
return s;
}
}
// FILE: Sam.java
public interface Sam<T> {
T get();
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<TT;>;> TKt$genericSam$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
enclosing method TKt.genericSam(Lkotlin/jvm/functions/Function0;)LSam;
synthetic final field <null> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$genericSam$1
}
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<TT;>;> TKt$genericSamGet$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
synthetic final field <null> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$genericSamGet$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)LSam<TT;>;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): Sam
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
inner (anonymous) class TKt$genericSam$1
inner (anonymous) class TKt$genericSamGet$1
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<TT;>;> TKt$genericSam$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
<(Lkotlin/jvm/functions/Function0<+TT;>;)V> method <init>(p0: kotlin.jvm.functions.Function0): void
enclosing method TKt.genericSam(Lkotlin/jvm/functions/Function0;)LSam;
synthetic final field <Lkotlin/jvm/functions/Function0<TT;>;> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$genericSam$1
}
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<TT;>;> TKt$genericSamGet$1 {
// source: 't.kt'
public final <()TT;> method get(): java.lang.Object
<(Lkotlin/jvm/functions/Function0<+TT;>;)V> method <init>(p0: kotlin.jvm.functions.Function0): void
enclosing method TKt.genericSamGet(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
synthetic final field <Lkotlin/jvm/functions/Function0<TT;>;> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$genericSamGet$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)LSam<TT;>;> method genericSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): Sam
public final static <<T:Ljava/lang/Object;>(Lkotlin/jvm/functions/Function0<+TT;>;)TT;> method genericSamGet(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
inner (anonymous) class TKt$genericSam$1
inner (anonymous) class TKt$genericSamGet$1
}
@@ -0,0 +1,10 @@
// WITH_SIGNATURES
// FILE: t.kt
fun interface Sam<T> {
fun get(): T
}
fun <T> expectsSam(sam: Sam<T>) = sam.get()
fun specializedSam(f: () -> String) = expectsSam({ f() })
@@ -0,0 +1,24 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic bridge <null> method get(): java.lang.Object
public final @org.jetbrains.annotations.NotNull <null> method get(): java.lang.String
enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;
synthetic final field <null> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,24 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
<(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)V> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic bridge <null> method get(): java.lang.Object
public final @org.jetbrains.annotations.NotNull <null> method get(): java.lang.String
enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;
synthetic final field <Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,16 @@
// WITH_SIGNATURES
// FILE: t.kt
fun specializedSam(f: () -> String) = J.g({ f() })
// FILE: J.java
public class J {
static <T> T g(Sam<T> s) {
return s.get();
}
}
// FILE: Sam.java
public interface Sam<T> {
T get();
}
@@ -0,0 +1,17 @@
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic bridge <null> method get(): java.lang.Object
public final <null> method get(): java.lang.String
enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;
synthetic final field <null> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,17 @@
@kotlin.Metadata
final class<<T:Ljava/lang/Object;>Ljava/lang/Object;LSam<Ljava/lang/String;>;> TKt$specializedSam$1 {
// source: 't.kt'
<(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)V> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic bridge <null> method get(): java.lang.Object
public final <null> method get(): java.lang.String
enclosing method TKt.specializedSam(Lkotlin/jvm/functions/Function0;)Ljava/lang/String;
synthetic final field <Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;> $f: kotlin.jvm.functions.Function0
inner (anonymous) class TKt$specializedSam$1
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
inner (anonymous) class TKt$specializedSam$1
}
@@ -0,0 +1,10 @@
// WITH_SIGNATURES
// FILE: t.kt
fun interface Sam<T> {
fun get(): T
}
fun <T> expectsSam(sam: Sam<T>) = sam.get()
fun specializedSam(f: () -> String) = expectsSam(f)
@@ -0,0 +1,23 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public <null> method equals(p0: java.lang.Object): boolean
public synthetic final <null> method get(): java.lang.Object
public <null> method getFunctionDelegate(): kotlin.Function
public <null> method hashCode(): int
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
}
@@ -0,0 +1,25 @@
@kotlin.Metadata
public interface<<T:Ljava/lang/Object;>Ljava/lang/Object;> Sam {
// source: 't.kt'
public abstract <()TT;> method get(): java.lang.Object
}
@kotlin.Metadata
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function
<null> method <init>(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
public final <null> method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public synthetic final <null> method get(): java.lang.Object
public final <null> method hashCode(): int
private synthetic final field <null> function: kotlin.jvm.functions.Function0
final inner class TKt$sam$Sam$0
}
@kotlin.Metadata
public final class<null> TKt {
// source: 't.kt'
public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
public final static <<T:Ljava/lang/Object;>(LSam<TT;>;)TT;> method expectsSam(@org.jetbrains.annotations.NotNull p0: Sam): java.lang.Object
final inner class TKt$sam$Sam$0
}
@@ -1,5 +1,5 @@
// WITH_SIGNATURES
// FILE: samGenericSuperinterface.kt
// FILE: t.kt
fun specializedSam(f: () -> String) = J.g(f)
@@ -1,13 +1,13 @@
@kotlin.Metadata
final class<null> SamGenericSuperinterfaceKt$sam$Sam$0 {
// source: 'samGenericSuperinterface.kt'
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(p0: kotlin.jvm.functions.Function0): void
public synthetic final <null> method get(): java.lang.Object
private synthetic final field <null> function: kotlin.jvm.functions.Function0
}
@kotlin.Metadata
public final class<null> SamGenericSuperinterfaceKt {
// source: 'samGenericSuperinterface.kt'
public final class<null> TKt {
// source: 't.kt'
public final static <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
}
@@ -1,15 +1,15 @@
@kotlin.Metadata
final class<null> SamGenericSuperinterfaceKt$sam$Sam$0 {
// source: 'samGenericSuperinterface.kt'
final class<null> TKt$sam$Sam$0 {
// source: 't.kt'
<null> method <init>(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
public synthetic final <null> method get(): java.lang.Object
private synthetic final field <null> function: kotlin.jvm.functions.Function0
final inner class SamGenericSuperinterfaceKt$sam$Sam$0
final inner class TKt$sam$Sam$0
}
@kotlin.Metadata
public final class<null> SamGenericSuperinterfaceKt {
// source: 'samGenericSuperinterface.kt'
public final class<null> TKt {
// source: 't.kt'
public final static <(Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;)Ljava/lang/String;> method specializedSam(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.String
final inner class SamGenericSuperinterfaceKt$sam$Sam$0
final inner class TKt$sam$Sam$0
}
@@ -12178,6 +12178,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -15922,6 +15927,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -39,6 +39,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt");
}
@TestMetadata("callableNameIntrinsic.kt")
public void testCallableNameIntrinsic() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt");
@@ -209,21 +214,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/rawTypeInSignature.kt");
}
@TestMetadata("samAdapterAndInlinedOne.kt")
public void testSamAdapterAndInlinedOne() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt");
}
@TestMetadata("samGenericSuperinterface.kt")
public void testSamGenericSuperinterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt");
}
@TestMetadata("samSpecializedGenericSuperinterface.kt")
public void testSamSpecializedGenericSuperinterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt");
}
@TestMetadata("varargsBridge.kt")
public void testVarargsBridge() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt");
@@ -1495,6 +1485,84 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
}
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/sam")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Sam extends AbstractBytecodeListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInSam() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("callableRefGenericFunInterface.kt")
public void testCallableRefGenericFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt");
}
@TestMetadata("callableRefGenericSamInterface.kt")
public void testCallableRefGenericSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt");
}
@TestMetadata("callableRefSpecializedFunInterface.kt")
public void testCallableRefSpecializedFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt");
}
@TestMetadata("callableRefSpecializedSamInterface.kt")
public void testCallableRefSpecializedSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt");
}
@TestMetadata("genericFunInterface.kt")
public void testGenericFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt");
}
@TestMetadata("genericSamInterface.kt")
public void testGenericSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt");
}
@TestMetadata("lambdaGenericFunInterface.kt")
public void testLambdaGenericFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt");
}
@TestMetadata("lambdaGenericSamInterface.kt")
public void testLambdaGenericSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt");
}
@TestMetadata("lambdaSpecializedFunInterface.kt")
public void testLambdaSpecializedFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt");
}
@TestMetadata("lambdaSpecializedSamInterface.kt")
public void testLambdaSpecializedSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt");
}
@TestMetadata("samAdapterAndInlinedOne.kt")
public void testSamAdapterAndInlinedOne() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.kt");
}
@TestMetadata("specializedFunInterface.kt")
public void testSpecializedFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt");
}
@TestMetadata("specializedSamInterface.kt")
public void testSpecializedSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -12178,6 +12178,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -15922,6 +15927,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -12178,6 +12178,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -15922,6 +15927,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -39,6 +39,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/anonymousObjectInGenericFun.kt");
}
@TestMetadata("callableNameIntrinsic.kt")
public void testCallableNameIntrinsic() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt");
@@ -209,21 +214,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/rawTypeInSignature.kt");
}
@TestMetadata("samAdapterAndInlinedOne.kt")
public void testSamAdapterAndInlinedOne() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt");
}
@TestMetadata("samGenericSuperinterface.kt")
public void testSamGenericSuperinterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/samGenericSuperinterface.kt");
}
@TestMetadata("samSpecializedGenericSuperinterface.kt")
public void testSamSpecializedGenericSuperinterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/samSpecializedGenericSuperinterface.kt");
}
@TestMetadata("varargsBridge.kt")
public void testVarargsBridge() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/varargsBridge.kt");
@@ -1495,6 +1485,84 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
}
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/sam")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Sam extends AbstractIrBytecodeListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInSam() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("callableRefGenericFunInterface.kt")
public void testCallableRefGenericFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface.kt");
}
@TestMetadata("callableRefGenericSamInterface.kt")
public void testCallableRefGenericSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface.kt");
}
@TestMetadata("callableRefSpecializedFunInterface.kt")
public void testCallableRefSpecializedFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface.kt");
}
@TestMetadata("callableRefSpecializedSamInterface.kt")
public void testCallableRefSpecializedSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface.kt");
}
@TestMetadata("genericFunInterface.kt")
public void testGenericFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/genericFunInterface.kt");
}
@TestMetadata("genericSamInterface.kt")
public void testGenericSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/genericSamInterface.kt");
}
@TestMetadata("lambdaGenericFunInterface.kt")
public void testLambdaGenericFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.kt");
}
@TestMetadata("lambdaGenericSamInterface.kt")
public void testLambdaGenericSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.kt");
}
@TestMetadata("lambdaSpecializedFunInterface.kt")
public void testLambdaSpecializedFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.kt");
}
@TestMetadata("lambdaSpecializedSamInterface.kt")
public void testLambdaSpecializedSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.kt");
}
@TestMetadata("samAdapterAndInlinedOne.kt")
public void testSamAdapterAndInlinedOne() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/samAdapterAndInlinedOne.kt");
}
@TestMetadata("specializedFunInterface.kt")
public void testSpecializedFunInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/specializedFunInterface.kt");
}
@TestMetadata("specializedSamInterface.kt")
public void testSpecializedSamInterface() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/sam/specializedSamInterface.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/specialBridges")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -10408,6 +10408,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -13752,6 +13757,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -10408,6 +10408,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -13752,6 +13757,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -10408,6 +10408,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("subtypeOfFunctionalTypeToFunInterfaceConversion.kt")
public void testSubtypeOfFunctionalTypeToFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/subtypeOfFunctionalTypeToFunInterfaceConversion.kt");
@@ -13817,6 +13822,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");
@@ -5259,6 +5259,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("compiler/testData/codegen/box/funInterface/equality")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -8043,6 +8048,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("anonymousObjectInGenericFun.kt")
public void testAnonymousObjectInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInGenericFun.kt");
}
@TestMetadata("anonymousObjectInsideElvis.kt")
public void testAnonymousObjectInsideElvis() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInsideElvis.kt");