[WASM] Add receiver capturing to callable references

This commit is contained in:
Igor Yakovlev
2021-09-17 11:57:38 +02:00
committed by teamcityserver
parent b8d11f7938
commit 41a69ad388
42 changed files with 204 additions and 110 deletions
@@ -15,12 +15,8 @@ import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
import org.jetbrains.kotlin.backend.wasm.WasmBackendContext import org.jetbrains.kotlin.backend.wasm.WasmBackendContext
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.builders.declarations.addConstructor import org.jetbrains.kotlin.ir.builders.declarations.*
import org.jetbrains.kotlin.ir.builders.declarations.addFunction
import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
@@ -40,7 +36,8 @@ val IrStatementOrigin?.isLambda: Boolean
get() = this == IrStatementOrigin.LAMBDA || this == IrStatementOrigin.ANONYMOUS_FUNCTION get() = this == IrStatementOrigin.LAMBDA || this == IrStatementOrigin.ANONYMOUS_FUNCTION
// Originally copied from K/Native // Originally copied from K/Native
internal class WasmCallableReferenceLowering(private val context: WasmBackendContext) : FileLoweringPass, IrElementTransformerVoidWithContext() { internal class WasmCallableReferenceLowering(private val context: WasmBackendContext) : FileLoweringPass,
IrElementTransformerVoidWithContext() {
// This pass ignores suspend function references and function references used in inline arguments to inline functions. // This pass ignores suspend function references and function references used in inline arguments to inline functions.
private val ignoredFunctionReferences = mutableSetOf<IrFunctionReference>() private val ignoredFunctionReferences = mutableSetOf<IrFunctionReference>()
@@ -110,6 +107,7 @@ internal class WasmCallableReferenceLowering(private val context: WasmBackendCon
// The type of the reference is KFunction<in A1, ..., in An, out R> // The type of the reference is KFunction<in A1, ..., in An, out R>
private val parameterTypes = (irFunctionReference.type as IrSimpleType).arguments.map { (it as IrTypeProjection).type } private val parameterTypes = (irFunctionReference.type as IrSimpleType).arguments.map { (it as IrTypeProjection).type }
private val argumentTypes = parameterTypes.dropLast(1) private val argumentTypes = parameterTypes.dropLast(1)
private val referenceReturnType = parameterTypes.last()
private val typeArgumentsMap = irFunctionReference.typeSubstitutionMap private val typeArgumentsMap = irFunctionReference.typeSubstitutionMap
@@ -147,6 +145,7 @@ internal class WasmCallableReferenceLowering(private val context: WasmBackendCon
if (isLambda) { if (isLambda) {
this.metadata = irFunctionReference.symbol.owner.metadata this.metadata = irFunctionReference.symbol.owner.metadata
} }
addField("receiver", context.irBuiltIns.anyNType)
} }
// WASM(TODO) // WASM(TODO)
@@ -227,6 +226,13 @@ internal class WasmCallableReferenceLowering(private val context: WasmBackendCon
// } // }
} }
+IrInstanceInitializerCallImpl(startOffset, endOffset, functionReferenceClass.symbol, context.irBuiltIns.unitType) +IrInstanceInitializerCallImpl(startOffset, endOffset, functionReferenceClass.symbol, context.irBuiltIns.unitType)
if (samSuperType == null && boundReceiver != null) {
+irSetField(
irGet(functionReferenceClass.thisReceiver!!),
functionReferenceClass.fields.first(),
irGet(valueParameters.first())
)
}
} }
} }
@@ -260,11 +266,11 @@ internal class WasmCallableReferenceLowering(private val context: WasmBackendCon
} }
} }
body = context.createIrBuilder(symbol).run { body = context.createIrBuilder(symbol, startOffset, endOffset).run {
var unboundIndex = 0 var unboundIndex = 0
irExprBody(irCall(callee).apply { val call = irCall(callee.symbol, referenceReturnType).apply {
for ((typeParameter, typeArgument) in typeArgumentsMap) { for (typeParameter in irFunctionReference.symbol.owner.allTypeParameters) {
putTypeArgument(typeParameter.owner.index, typeArgument) putTypeArgument(typeParameter.index, typeArgumentsMap[typeParameter.symbol])
} }
for (parameter in callee.explicitParameters) { for (parameter in callee.explicitParameters) {
@@ -273,30 +279,16 @@ internal class WasmCallableReferenceLowering(private val context: WasmBackendCon
// Bound receiver parameter. For function references, this is stored in a field of the superclass. // Bound receiver parameter. For function references, this is stored in a field of the superclass.
// For sam references, we just capture the value in a local variable and LocalDeclarationsLowering // For sam references, we just capture the value in a local variable and LocalDeclarationsLowering
// will put it into a field. // will put it into a field.
// if (samSuperType == null) if (samSuperType == null)
// irImplicitCast( irImplicitCast(
// irGetField(irGet(dispatchReceiverParameter!!), fakeOverrideReceiverField), irGetField(
// boundReceiver.second.type irGet(dispatchReceiverParameter!!),
// ) functionReferenceClass.fields.first(),
// else ),
irGet(receiver ?: error("Binding receivers is not supported yet")) boundReceiver.second.type
)
// If a vararg parameter corresponds to exactly one KFunction argument, which is an array, that array else
// is forwarded as is. irGet(receiver!!)
//
// fun f(x: (Int, Array<String>) -> String) = x(0, arrayOf("OK", "FAIL"))
// fun h(i: Int, vararg xs: String) = xs[i]
// f(::h)
//
parameter.isVararg && unboundIndex < argumentTypes.size && parameter.type == valueParameters[unboundIndex].type ->
irGet(valueParameters[unboundIndex++])
// In all other cases, excess arguments are packed into a new array.
//
// fun g(x: (Int, String, String) -> String) = x(0, "OK", "FAIL")
// f(::h) == g(::h)
//
parameter.isVararg && (unboundIndex < argumentTypes.size || !parameter.hasDefaultValue()) ->
TODO()
unboundIndex >= argumentTypes.size -> unboundIndex >= argumentTypes.size ->
// Default value argument (this pass doesn't handle suspend functions, otherwise // Default value argument (this pass doesn't handle suspend functions, otherwise
@@ -307,7 +299,9 @@ internal class WasmCallableReferenceLowering(private val context: WasmBackendCon
irGet(valueParameters[unboundIndex++]) irGet(valueParameters[unboundIndex++])
}?.let { putArgument(callee, parameter, it) } }?.let { putArgument(callee, parameter, it) }
} }
}) }
irExprBody(call)
} }
} }
} }
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
import Host.foo import Host.foo
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
inline fun foo(x: () -> Unit): String { inline fun foo(x: () -> Unit): String {
x() x()
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType // !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
class Outer(val o: String) { class Outer(val o: String) {
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
var result = "" var result = ""
class C(val token: String) { class C(val token: String) {
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: WASM
fun use(fn: (Array<String>) -> Array<String>) = fun use(fn: (Array<String>) -> Array<String>) =
fn(arrayOf("OK")) fn(arrayOf("OK"))
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
class C { class C {
fun ffff(i: Int, s: String = "OK") = s fun ffff(i: Int, s: String = "OK") = s
} }
@@ -1,6 +1,5 @@
// WITH_RUNTIME // WITH_RUNTIME
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
class C(val x: String) { class C(val x: String) {
fun foo(i: Int): Char = x[i] fun foo(i: Int): Char = x[i]
} }
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
fun box(): String { fun box(): String {
return if ((arrayOf(1, 2, 3)::get)(1) == 2) "OK" else "Fail" return if ((arrayOf(1, 2, 3)::get)(1) == 2) "OK" else "Fail"
} }
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// !LANGUAGE: +NewInference // !LANGUAGE: +NewInference
interface JsonParser interface JsonParser
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// KJS_WITH_FULL_RUNTIME // KJS_WITH_FULL_RUNTIME
// !LANGUAGE: +NewInference // !LANGUAGE: +NewInference
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
class A { class A {
companion object { companion object {
fun ok() = "OK" fun ok() = "OK"
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
fun box(): String { fun box(): String {
var state = 0 var state = 0
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: PROPERTY_REFERENCES
var result = "" var result = ""
class A { class A {
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: FUNCTION_REFERENCES
// IGNORE_BACKEND: JS, JS_IR // IGNORE_BACKEND: JS, JS_IR
// IGNORE_BACKEND: JS_IR_ES6 // IGNORE_BACKEND: JS_IR_ES6
enum class E { enum class E {
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: PROPERTY_REFERENCES
// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6 // IGNORE_BACKEND: JS_IR_ES6
// TODO: investigate should it be ran for JS or not // TODO: investigate should it be ran for JS or not
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: FUNCTION_REFERENCES
// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6 // IGNORE_BACKEND: JS_IR_ES6
// TODO: investigate should it be ran for JS or not // TODO: investigate should it be ran for JS or not
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: PROPERTY_REFERENCES
// KT-30629 // KT-30629
abstract class BaseFragment<T : BaseViewModel> { abstract class BaseFragment<T : BaseViewModel> {
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: PROPERTY_REFERENCES
class Generic<P : Any>(val p: P) class Generic<P : Any>(val p: P)
class Host { class Host {
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: PROPERTY_REFERENCES
// SKIP_SOURCEMAP_REMAPPING // SKIP_SOURCEMAP_REMAPPING
fun box(): String { fun box(): String {
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
fun <T> get(t: T): () -> String { fun <T> get(t: T): () -> String {
return t::toString return t::toString
} }
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// KJS_WITH_FULL_RUNTIME // KJS_WITH_FULL_RUNTIME
//WITH_RUNTIME //WITH_RUNTIME
fun box(): String { fun box(): String {
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: PROPERTY_REFERENCES
// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND: NATIVE
class A(var v: Int) { class A(var v: Int) {
fun f(x: Int) = x * v fun f(x: Int) = x * v
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
object Singleton { object Singleton {
fun ok() = "OK" fun ok() = "OK"
} }
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
fun Boolean.foo() = 1 fun Boolean.foo() = 1
fun Byte.foo() = 2 fun Byte.foo() = 2
fun Short.foo() = 3 fun Short.foo() = 3
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
var x = 0 var x = 0
class A { class A {
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
fun box(): String { fun box(): String {
val f = "KOTLIN"::get val f = "KOTLIN"::get
return "${f(1)}${f(0)}" return "${f(1)}${f(0)}"
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
fun <T> id(x: T): T = x fun <T> id(x: T): T = x
fun <T> String.extId(x: T): T = x fun <T> String.extId(x: T): T = x
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
abstract class A { abstract class A {
inner class InnerInA { inner class InnerInA {
fun returnOk() = "OK" fun returnOk() = "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: WASM
fun box(): String { fun box(): String {
val generateId = (1 .. Int.MAX_VALUE).iterator()::next val generateId = (1 .. Int.MAX_VALUE).iterator()::next
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM // DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS // WASM_MUTE_REASON: FUNCTION_REFERENCES
// WITH_RUNTIME // WITH_RUNTIME
// IGNORE_BACKEND: JS // IGNORE_BACKEND: JS
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// KT-42025 // KT-42025
open class L<LL>(val ll: LL) open class L<LL>(val ll: LL)
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// KT-42025 // KT-42025
open class L<LL>(val ll: LL) open class L<LL>(val ll: LL)
@@ -1,11 +1,23 @@
// DONT_TARGET_EXACT_BACKEND: WASM class X(val ok: String) {
// WASM_MUTE_REASON: PROPERTY_REFERENCES fun y(): String = ok
fun box(): String {
class Local {
var result = "Fail"
}
val l = Local()
(Local::result).set(l, "OK")
return (Local::result).get(l)
} }
fun box(): String {
val x = X("OK")
val y = x::y
return y()
}
//fun y(): String = "OK"
//
//fun box(): String {
// val y = ::y
// return y.invoke()
//}
//val x = "OK"
//
//fun box(): String {
// val x = ::x
// return x.get()
//}
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
interface I interface I
interface Foo<in L : I, in M> interface Foo<in L : I, in M>
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: WASM
// CHECK_BYTECODE_TEXT // CHECK_BYTECODE_TEXT
// JVM_IR_TEMPLATES // JVM_IR_TEMPLATES
// 0 Function(^.)*.invoke // 0 Function(^.)*.invoke
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: WASM
// CHECK_BYTECODE_TEXT // CHECK_BYTECODE_TEXT
// JVM_IR_TEMPLATES // JVM_IR_TEMPLATES
// 0 Function(^.)*.invoke // 0 Function(^.)*.invoke
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
enum class X { enum class X {
B { B {
val k = "K" val k = "K"
-1
View File
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JS // IGNORE_BACKEND: JS
// IGNORE_BACKEND: WASM
typealias EmptyFunctionResult<T> = () -> T typealias EmptyFunctionResult<T> = () -> T
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: WASM
// FILE: a.kt // FILE: a.kt
package a package a
@@ -1,5 +1,4 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// FILE: 1.kt // FILE: 1.kt
package test package test
@@ -1401,6 +1401,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/charArrayOf.kt"); runTest("compiler/testData/codegen/box/callableReference/charArrayOf.kt");
} }
@TestMetadata("genericConstructorReference.kt")
public void testGenericConstructorReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt");
}
@TestMetadata("genericLocalClassConstructorReference.kt")
public void testGenericLocalClassConstructorReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/genericLocalClassConstructorReference.kt");
}
@TestMetadata("inlineArrayConstructors.kt") @TestMetadata("inlineArrayConstructors.kt")
public void testInlineArrayConstructors() throws Exception { public void testInlineArrayConstructors() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/inlineArrayConstructors.kt"); runTest("compiler/testData/codegen/box/callableReference/inlineArrayConstructors.kt");
@@ -1434,6 +1444,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
} }
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedVarargFunImportedFromObject.kt");
}
public void testAllFilesPresentInAdaptedReferences() throws Exception { public void testAllFilesPresentInAdaptedReferences() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
} }
@@ -1443,6 +1458,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/defaultWithGenericExpectedType.kt"); runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/defaultWithGenericExpectedType.kt");
} }
@TestMetadata("inlineBound.kt")
public void testInlineBound() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/inlineBound.kt");
}
@TestMetadata("inlineVarargAndDefault.kt") @TestMetadata("inlineVarargAndDefault.kt")
public void testInlineVarargAndDefault() throws Exception { public void testInlineVarargAndDefault() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/inlineVarargAndDefault.kt"); runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
@@ -1453,6 +1473,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/inlineVarargInts.kt"); runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/inlineVarargInts.kt");
} }
@TestMetadata("innerConstructorWithVararg.kt")
public void testInnerConstructorWithVararg() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/innerConstructorWithVararg.kt");
}
@TestMetadata("localFunctionWithDefault.kt") @TestMetadata("localFunctionWithDefault.kt")
public void testLocalFunctionWithDefault() throws Exception { public void testLocalFunctionWithDefault() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/localFunctionWithDefault.kt"); runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/localFunctionWithDefault.kt");
@@ -1463,6 +1488,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/manyDefaultsAndVararg.kt"); runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/manyDefaultsAndVararg.kt");
} }
@TestMetadata("noNameClashForReferencesToSameFunction.kt")
public void testNoNameClashForReferencesToSameFunction() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/noNameClashForReferencesToSameFunction.kt");
}
@TestMetadata("referenceToVarargWithDefaults.kt") @TestMetadata("referenceToVarargWithDefaults.kt")
public void testReferenceToVarargWithDefaults() throws Exception { public void testReferenceToVarargWithDefaults() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/referenceToVarargWithDefaults.kt"); runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/referenceToVarargWithDefaults.kt");
@@ -1525,10 +1555,30 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
} }
@TestMetadata("adapted.kt")
public void testAdapted() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/adapted.kt");
}
public void testAllFilesPresentInBound() throws Exception { public void testAllFilesPresentInBound() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
} }
@TestMetadata("arrayConstructorArgument.kt")
public void testArrayConstructorArgument() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/arrayConstructorArgument.kt");
}
@TestMetadata("arrayGetIntrinsic.kt")
public void testArrayGetIntrinsic() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt");
}
@TestMetadata("boundReferenceToOverloadedFunction.kt")
public void testBoundReferenceToOverloadedFunction() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/boundReferenceToOverloadedFunction.kt");
}
@TestMetadata("captureVarInInitBlock.kt") @TestMetadata("captureVarInInitBlock.kt")
public void testCaptureVarInInitBlock() throws Exception { public void testCaptureVarInInitBlock() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/captureVarInInitBlock.kt"); runTest("compiler/testData/codegen/box/callableReference/bound/captureVarInInitBlock.kt");
@@ -1539,6 +1589,51 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/bound/captureVarInPropertyInit.kt"); runTest("compiler/testData/codegen/box/callableReference/bound/captureVarInPropertyInit.kt");
} }
@TestMetadata("coercionToUnit.kt")
public void testCoercionToUnit() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/coercionToUnit.kt");
}
@TestMetadata("companionObjectReceiver.kt")
public void testCompanionObjectReceiver() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiver.kt");
}
@TestMetadata("dontShareReceiver.kt")
public void testDontShareReceiver() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/dontShareReceiver.kt");
}
@TestMetadata("kt12738.kt")
public void testKt12738() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/kt12738.kt");
}
@TestMetadata("kt15446.kt")
public void testKt15446() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/kt15446.kt");
}
@TestMetadata("objectReceiver.kt")
public void testObjectReceiver() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/objectReceiver.kt");
}
@TestMetadata("primitiveReceiver.kt")
public void testPrimitiveReceiver() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/primitiveReceiver.kt");
}
@TestMetadata("receiverEvaluatedOnce.kt")
public void testReceiverEvaluatedOnce() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/receiverEvaluatedOnce.kt");
}
@TestMetadata("simpleFunction.kt")
public void testSimpleFunction() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/simpleFunction.kt");
}
@TestMetadata("smartCastForExtensionReceiver.kt") @TestMetadata("smartCastForExtensionReceiver.kt")
public void testSmartCastForExtensionReceiver() throws Exception { public void testSmartCastForExtensionReceiver() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt"); runTest("compiler/testData/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt");
@@ -1608,6 +1703,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/function/argumentTypes.kt"); runTest("compiler/testData/codegen/box/callableReference/function/argumentTypes.kt");
} }
@TestMetadata("argumentTypesNoinline.kt")
public void testArgumentTypesNoinline() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/argumentTypesNoinline.kt");
}
@TestMetadata("booleanNotIntrinsic.kt") @TestMetadata("booleanNotIntrinsic.kt")
public void testBooleanNotIntrinsic() throws Exception { public void testBooleanNotIntrinsic() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/booleanNotIntrinsic.kt"); runTest("compiler/testData/codegen/box/callableReference/function/booleanNotIntrinsic.kt");
@@ -1703,6 +1803,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/function/genericMember.kt"); runTest("compiler/testData/codegen/box/callableReference/function/genericMember.kt");
} }
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt");
}
@TestMetadata("innerConstructorFromClass.kt") @TestMetadata("innerConstructorFromClass.kt")
public void testInnerConstructorFromClass() throws Exception { public void testInnerConstructorFromClass() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt"); runTest("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
@@ -1923,6 +2028,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
public void testAllFilesPresentInProperty() throws Exception { public void testAllFilesPresentInProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/property"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/property"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
} }
@TestMetadata("localClassVar.kt")
public void testLocalClassVar() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/localClassVar.kt");
}
} }
@TestMetadata("compiler/testData/codegen/box/callableReference/serializability") @TestMetadata("compiler/testData/codegen/box/callableReference/serializability")
@@ -1971,6 +2081,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt"); runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
} }
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
runTest("compiler/testData/codegen/box/casts/dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt");
}
@TestMetadata("intersectionTypeMultipleBounds.kt") @TestMetadata("intersectionTypeMultipleBounds.kt")
public void testIntersectionTypeMultipleBounds() throws Exception { public void testIntersectionTypeMultipleBounds() throws Exception {
runTest("compiler/testData/codegen/box/casts/intersectionTypeMultipleBounds.kt"); runTest("compiler/testData/codegen/box/casts/intersectionTypeMultipleBounds.kt");
@@ -5590,6 +5705,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/enum/kt7257_anonObjectMethod.kt"); runTest("compiler/testData/codegen/box/enum/kt7257_anonObjectMethod.kt");
} }
@TestMetadata("kt7257_boundReference1.kt")
public void testKt7257_boundReference1() throws Exception {
runTest("compiler/testData/codegen/box/enum/kt7257_boundReference1.kt");
}
@TestMetadata("kt7257_explicitReceiver.kt") @TestMetadata("kt7257_explicitReceiver.kt")
public void testKt7257_explicitReceiver() throws Exception { public void testKt7257_explicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/enum/kt7257_explicitReceiver.kt"); runTest("compiler/testData/codegen/box/enum/kt7257_explicitReceiver.kt");