[K/N] Migrate most simple filecheck tests to new infra
^KT-62157 Merge-request: KT-MR-12376 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
3d399a8b25
commit
e43b634122
+36
@@ -18704,6 +18704,42 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+36
@@ -18704,6 +18704,42 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+36
@@ -18704,6 +18704,42 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
inline fun foo(x: () -> Unit): String {
|
||||
x()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun String.id(s: String = this, vararg xs: Int): String = s
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
// CHECK-LABEL: entry
|
||||
// CHECK-NOT: call %struct.ObjHeader* @AllocInstance
|
||||
// CHECK-NOT: alloca
|
||||
return foo("Fail"::id)
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
+66
-26
@@ -1,17 +1,19 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.concurrent.*
|
||||
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: define {{signext i8|i8}} @"kfun:#<get-byteGlobal>(){}kotlin.Byte"()
|
||||
// CHECK-AAPCS-LABEL: define i8 @"kfun:#<get-byteGlobal>(){}kotlin.Byte"()
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i8 @"kfun:#<get-byteGlobal>(){}kotlin.Byte"()
|
||||
// CHECK-WINDOWSX64-LABEL: define i8 @"kfun:#<get-byteGlobal>(){}kotlin.Byte"()
|
||||
// CHECK: load atomic i8, i8* @"kvar:byteGlobal#internal" seq_cst
|
||||
// CHECK-LABEL: define void @"kfun:#<set-byteGlobal>(kotlin.Byte){}"(i8
|
||||
// CHECK: store atomic i8 %{{[0-9]+}}, i8* @"kvar:byteGlobal#internal" seq_cst
|
||||
@Volatile var byteGlobal: Byte = 42
|
||||
|
||||
// CHECK-LABEL: define {{signext i16|i16}} @"kfun:#<get-shortGlobal>(){}kotlin.Short"()
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#<get-shortGlobal>(){}kotlin.Short"()
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i16 @"kfun:#<get-shortGlobal>(){}kotlin.Short"()
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#<get-shortGlobal>(){}kotlin.Short"()
|
||||
// CHECK: load atomic i16, i16* @"kvar:shortGlobal#internal" seq_cst
|
||||
// CHECK-LABEL: define void @"kfun:#<set-shortGlobal>(kotlin.Short){}"(i16
|
||||
// CHECK: store atomic i16 %{{[0-9]+}}, i16* @"kvar:shortGlobal#internal" seq_cst
|
||||
@@ -29,7 +31,9 @@ import kotlin.concurrent.*
|
||||
// CHECK: store atomic i64 %{{[0-9]+}}, i64* @"kvar:longGlobal#internal" seq_cst
|
||||
@Volatile var longGlobal: Long = 42
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#<get-booleanGlobal>(){}kotlin.Boolean"()
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#<get-booleanGlobal>(){}kotlin.Boolean"()
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#<get-booleanGlobal>(){}kotlin.Boolean"()
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#<get-booleanGlobal>(){}kotlin.Boolean"()
|
||||
// CHECK: load atomic i8, i8* @"kvar:booleanGlobal#internal" seq_cst
|
||||
// CHECK-LABEL: define void @"kfun:#<set-booleanGlobal>(kotlin.Boolean){}"(i1
|
||||
// CHECK: store atomic i8 %{{[0-9]+}}, i8* @"kvar:booleanGlobal#internal" seq_cst
|
||||
@@ -39,23 +43,31 @@ import kotlin.concurrent.*
|
||||
fun byteGlobal_getField() = byteGlobal
|
||||
fun byteGlobal_setField() { byteGlobal = 0 }
|
||||
|
||||
// CHECK-LABEL: define {{signext i8|i8}} @"kfun:#byteGlobal_getAndSetField(){}kotlin.Byte"()
|
||||
// CHECK-AAPCS-LABEL: define i8 @"kfun:#byteGlobal_getAndSetField(){}kotlin.Byte"()
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i8 @"kfun:#byteGlobal_getAndSetField(){}kotlin.Byte"()
|
||||
// CHECK-WINDOWSX64-LABEL: define i8 @"kfun:#byteGlobal_getAndSetField(){}kotlin.Byte"()
|
||||
// CHECK: atomicrmw xchg i8* @"kvar:byteGlobal#internal", i8 0 seq_cst
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun byteGlobal_getAndSetField() = ::byteGlobal.getAndSetField(0.toByte())
|
||||
|
||||
// CHECK-LABEL: define {{signext i8|i8}} @"kfun:#byteGlobal_getAndAddField(){}kotlin.Byte"()
|
||||
// CHECK-AAPCS-LABEL: define i8 @"kfun:#byteGlobal_getAndAddField(){}kotlin.Byte"()
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i8 @"kfun:#byteGlobal_getAndAddField(){}kotlin.Byte"()
|
||||
// CHECK-WINDOWSX64-LABEL: define i8 @"kfun:#byteGlobal_getAndAddField(){}kotlin.Byte"()
|
||||
// CHECK: atomicrmw add i8* @"kvar:byteGlobal#internal", i8 0 seq_cst
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun byteGlobal_getAndAddField() = ::byteGlobal.getAndAddField(0.toByte())
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#byteGlobal_compareAndSetField(){}kotlin.Boolean"()
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#byteGlobal_compareAndSetField(){}kotlin.Boolean"()
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#byteGlobal_compareAndSetField(){}kotlin.Boolean"()
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#byteGlobal_compareAndSetField(){}kotlin.Boolean"()
|
||||
// CHECK: cmpxchg i8* @"kvar:byteGlobal#internal", i8 0, i8 1 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i8, i1 } %{{[0-9]+}}, 1
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun byteGlobal_compareAndSetField() = ::byteGlobal.compareAndSetField(0.toByte(), 1.toByte())
|
||||
|
||||
// CHECK-LABEL: define {{signext i8|i8}} @"kfun:#byteGlobal_compareAndExchangeField(){}kotlin.Byte"()
|
||||
// CHECK-AAPCS-LABEL: define i8 @"kfun:#byteGlobal_compareAndExchangeField(){}kotlin.Byte"()
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i8 @"kfun:#byteGlobal_compareAndExchangeField(){}kotlin.Byte"()
|
||||
// CHECK-WINDOWSX64-LABEL: define i8 @"kfun:#byteGlobal_compareAndExchangeField(){}kotlin.Byte"()
|
||||
// CHECK: cmpxchg i8* @"kvar:byteGlobal#internal", i8 0, i8 1 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i8, i1 } %{{[0-9]+}}, 0
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@@ -65,23 +77,31 @@ fun byteGlobal_compareAndExchangeField() = ::byteGlobal.compareAndExchangeField(
|
||||
fun shortGlobal_getField() = shortGlobal
|
||||
fun shortGlobal_setField() { shortGlobal = 0 }
|
||||
|
||||
// CHECK-LABEL: define {{signext i16|i16}} @"kfun:#shortGlobal_getAndSetField(){}
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#shortGlobal_getAndSetField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i16 @"kfun:#shortGlobal_getAndSetField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#shortGlobal_getAndSetField(){}
|
||||
// CHECK: atomicrmw xchg i16* @"kvar:shortGlobal#internal", i16 0 seq_cst
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun shortGlobal_getAndSetField() = ::shortGlobal.getAndSetField(0.toShort())
|
||||
|
||||
// CHECK-LABEL: define {{signext i16|i16}} @"kfun:#shortGlobal_getAndAddField(){}
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#shortGlobal_getAndAddField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i16 @"kfun:#shortGlobal_getAndAddField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#shortGlobal_getAndAddField(){}
|
||||
// CHECK: atomicrmw add i16* @"kvar:shortGlobal#internal", i16 0 seq_cst
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun shortGlobal_getAndAddField() = ::shortGlobal.getAndAddField(0.toShort())
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#shortGlobal_compareAndSetField(){}
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#shortGlobal_compareAndSetField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#shortGlobal_compareAndSetField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#shortGlobal_compareAndSetField(){}
|
||||
// CHECK: cmpxchg i16* @"kvar:shortGlobal#internal", i16 0, i16 1 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i16, i1 } %{{[0-9]+}}, 1
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun shortGlobal_compareAndSetField() = ::shortGlobal.compareAndSetField(0.toShort(), 1.toShort())
|
||||
|
||||
// CHECK-LABEL: define {{signext i16|i16}} @"kfun:#shortGlobal_compareAndExchangeField(){}
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#shortGlobal_compareAndExchangeField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i16 @"kfun:#shortGlobal_compareAndExchangeField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#shortGlobal_compareAndExchangeField(){}
|
||||
// CHECK: cmpxchg i16* @"kvar:shortGlobal#internal", i16 0, i16 1 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i16, i1 } %{{[0-9]+}}, 0
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@@ -101,7 +121,9 @@ fun intGlobal_getAndSetField() = ::intGlobal.getAndSetField(0)
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun intGlobal_getAndAddField() = ::intGlobal.getAndAddField(0)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#intGlobal_compareAndSetField(){}
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#intGlobal_compareAndSetField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#intGlobal_compareAndSetField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#intGlobal_compareAndSetField(){}
|
||||
// CHECK: cmpxchg i32* @"kvar:intGlobal#internal", i32 0, i32 1 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i32, i1 } %{{[0-9]+}}, 1
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@@ -127,7 +149,9 @@ fun longGlobal_getAndSetField() = ::longGlobal.getAndSetField(0L)
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun longGlobal_getAndAddField() = ::longGlobal.getAndAddField(0L)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#longGlobal_compareAndSetField(){}
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#longGlobal_compareAndSetField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#longGlobal_compareAndSetField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#longGlobal_compareAndSetField(){}
|
||||
// CHECK: cmpxchg i64* @"kvar:longGlobal#internal", i64 0, i64 1 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i64, i1 } %{{[0-9]+}}, 1
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@@ -143,18 +167,24 @@ fun longGlobal_compareAndExchangeField() = ::longGlobal.compareAndExchangeField(
|
||||
fun booleanGlobal_getField() = booleanGlobal
|
||||
fun booleanGlobal_setField() { booleanGlobal = false }
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#booleanGlobal_getAndSetField(){}kotlin.Boolean"
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#booleanGlobal_getAndSetField(){}kotlin.Boolean"
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#booleanGlobal_getAndSetField(){}kotlin.Boolean"
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#booleanGlobal_getAndSetField(){}kotlin.Boolean"
|
||||
// CHECK: atomicrmw xchg i8* @"kvar:booleanGlobal#internal", i8 %{{[0-9]+}} seq_cst
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun booleanGlobal_getAndSetField() = ::booleanGlobal.getAndSetField(false)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#booleanGlobal_compareAndSetField(){}
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#booleanGlobal_compareAndSetField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#booleanGlobal_compareAndSetField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#booleanGlobal_compareAndSetField(){}
|
||||
// CHECK: cmpxchg i8* @"kvar:booleanGlobal#internal", i8 %{{[0-9]+}}, i8 %{{[0-9]+}} seq_cst seq_cst
|
||||
// CHECK: extractvalue { i8, i1 } %{{[0-9]+}}, 1
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun booleanGlobal_compareAndSetField() = ::booleanGlobal.compareAndSetField(false, true)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#booleanGlobal_compareAndExchangeField(){}
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#booleanGlobal_compareAndExchangeField(){}
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#booleanGlobal_compareAndExchangeField(){}
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#booleanGlobal_compareAndExchangeField(){}
|
||||
// CHECK: cmpxchg i8* @"kvar:booleanGlobal#internal", i8 %{{[0-9]+}}, i8 %{{[0-9]+}} seq_cst seq_cst
|
||||
// CHECK: extractvalue { i8, i1 } %{{[0-9]+}}, 0
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@@ -194,7 +224,9 @@ fun intArr_getAndAdd() = intArr.getAndAdd(0, 1)
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun intArr_compareAndExchange() = intArr.compareAndExchange(0, 1, 2)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#intArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#intArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#intArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#intArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK: call i32* @Kotlin_intArrayGetElementAddress(%struct.ObjHeader* %{{[0-9]+}}, i32 0)
|
||||
// CHECK: cmpxchg i32* %{{[0-9]+}}, i32 1, i32 2 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i32, i1 } %{{[0-9]+}}, 1
|
||||
@@ -235,7 +267,9 @@ fun longArr_getAndAdd() = longArr.getAndAdd(0, 1L)
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun longArr_compareAndExchange() = longArr.compareAndExchange(0, 1L, 2L)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#longArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#longArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#longArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#longArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK: call i64* @Kotlin_longArrayGetElementAddress(%struct.ObjHeader* %{{[0-9]+}}, i32 0)
|
||||
// CHECK: cmpxchg i64* %{{[0-9]+}}, i64 1, i64 2 seq_cst seq_cst
|
||||
// CHECK: extractvalue { i64, i1 } %{{[0-9]+}}, 1
|
||||
@@ -269,13 +303,18 @@ fun refArr_getAndSet() = refArr.getAndSet(0, null)
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun refArr_compareAndExchange() = refArr.compareAndExchange(0, null, null)
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:#refArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#refArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#refArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#refArr_compareAndSet(){}kotlin.Boolean"()
|
||||
// CHECK: call %struct.ObjHeader** @Kotlin_arrayGetElementAddress(%struct.ObjHeader* %{{[0-9]+}}, i32 0)
|
||||
// CHECK: call {{zeroext i1|i1}} @CompareAndSetVolatileHeapRef(%struct.ObjHeader** %{{[0-9]+}}, %struct.ObjHeader* null, %struct.ObjHeader* null)
|
||||
// CHECK-AAPCS: call i1 @CompareAndSetVolatileHeapRef(%struct.ObjHeader** %{{[0-9]+}}, %struct.ObjHeader* null, %struct.ObjHeader* null)
|
||||
// CHECK-DEFAULTABI: call zeroext i1 @CompareAndSetVolatileHeapRef(%struct.ObjHeader** %{{[0-9]+}}, %struct.ObjHeader* null, %struct.ObjHeader* null)
|
||||
// CHECK-WINDOWSX64: call zeroext i1 @CompareAndSetVolatileHeapRef(%struct.ObjHeader** %{{[0-9]+}}, %struct.ObjHeader* null, %struct.ObjHeader* null)
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
fun refArr_compareAndSet() = refArr.compareAndSet(0, null, null)
|
||||
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
byteGlobal_getField()
|
||||
byteGlobal_setField()
|
||||
byteGlobal_getAndSetField()
|
||||
@@ -329,4 +368,5 @@ fun main() {
|
||||
refArr_getAndSet()
|
||||
refArr_compareAndSet()
|
||||
refArr_compareAndExchange()
|
||||
return "OK"
|
||||
}
|
||||
kotlin-native/backend.native/tests/filecheck/bce.kt → compiler/testData/codegen/box/fileCheck/bce.kt
Vendored
+6
-5
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#forEachIndicies(){}"()
|
||||
fun forEachIndicies() {
|
||||
@@ -310,8 +308,9 @@ fun chainedReceivers() {
|
||||
}
|
||||
// CHECK-LABEL: {{^}}epilogue:
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
@ExperimentalStdlibApi
|
||||
fun main() {
|
||||
fun box(): String {
|
||||
forEachIndicies()
|
||||
forUntilSize()
|
||||
forRangeUntilSize()
|
||||
@@ -334,4 +333,6 @@ fun main() {
|
||||
topLevelProperty()
|
||||
childClassWithFakeOverride()
|
||||
chainedReceivers()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
-6
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
@@ -14,7 +12,8 @@ import kotlin.reflect.*
|
||||
// CHECK: internal unnamed_addr constant { %struct.ObjHeader, %struct.ObjHeader*, %struct.ObjHeader*, i1 } { %struct.ObjHeader { %struct.TypeInfo* {{.*}} }, %struct.ObjHeader* getelementptr inbounds ({ %struct.ObjHeader, i8* }, { %struct.ObjHeader, i8* }* [[REG_FOR_CLASSIFIER_FIELD:@[0-9]+]], i32 0, i32 0), %struct.ObjHeader* getelementptr inbounds ({ %struct.ObjHeader, %struct.ObjHeader*, %struct.ObjHeader* }, { %struct.ObjHeader, %struct.ObjHeader*, %struct.ObjHeader* }* [[REG_FOR_ARGUMENTS_FIELD:@[0-9]+]], i32 0, i32 0), i1 false }
|
||||
// CHECK-NOT: internal unnamed_addr constant { %struct.ObjHeader, %struct.ObjHeader*, %struct.ObjHeader*, i1 } { %struct.ObjHeader { %struct.TypeInfo* {{.*}} }, %struct.ObjHeader* getelementptr inbounds ({ %struct.ObjHeader, i8* }, { %struct.ObjHeader, i8* }* [[REG_FOR_CLASSIFIER_FIELD]], i32 0, i32 0), %struct.ObjHeader* getelementptr inbounds ({ %struct.ObjHeader, %struct.ObjHeader*, %struct.ObjHeader* }, { %struct.ObjHeader, %struct.ObjHeader*, %struct.ObjHeader* }* [[REG_FOR_ARGUMENTS_FIELD]], i32 0, i32 0), i1 false }
|
||||
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
println(1024)
|
||||
println(1024)
|
||||
|
||||
@@ -23,4 +22,5 @@ fun main() {
|
||||
|
||||
println(typeOf<Map<String, String>>())
|
||||
println(typeOf<Map<String, String>>())
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+6
-7
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
value class A(val i: Int)
|
||||
value class B(val a: A)
|
||||
@@ -12,8 +10,8 @@ fun defaultA(a: A = A(1), aa: A = A(1)) = a.i
|
||||
fun defaultB(b: B = B(A(1)), bb: B = B(A(1))) = b.a.i
|
||||
fun defaultC(c: C = C("1"), cc: C = C("1")) = c.s
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main(){
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
// CHECK-LABEL: entry
|
||||
// CHECK-NOT: <Int-box>
|
||||
// CHECK-NOT: <A-box>
|
||||
@@ -32,5 +30,6 @@ fun main(){
|
||||
defaultA(A(1), A(1))
|
||||
defaultB(B(A(1)), B(A(1)))
|
||||
defaultC(C("1"), C("1"))
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
return "OK"
|
||||
}
|
||||
+6
-10
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
enum class COLOR {
|
||||
RED,
|
||||
@@ -9,24 +7,22 @@ enum class COLOR {
|
||||
BLUE
|
||||
}
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
for (i in COLOR.values()) {
|
||||
// CHECK: = call i32 @"kfun:kotlin.Enum#<get-ordinal>(){}kotlin.Int"(
|
||||
// CHECK-DEBUG: = call i32 @"kfun:kotlin.Enum#<get-ordinal>(){}kotlin.Int"(
|
||||
// We inline .ordinal property access in case of opt build, so check direct field load instead.
|
||||
// CHECK-OPT: getelementptr inbounds %"kclassbody:kotlin.Enum#internal", %"kclassbody:kotlin.Enum#internal"* %{{[0-9a-z]*}}, i32 0, i32 2
|
||||
print(when (i) {
|
||||
// we can't check the register is same, because it can be saved on stack and loaded back
|
||||
// CHECK: icmp eq i32 %{{[0-9a-z]*}}, 0
|
||||
// CHECK-OPT: icmp eq i32 %{{[0-9a-z]*}}, 0
|
||||
COLOR.RED -> 0xff0000
|
||||
// CHECK: icmp eq i32 %{{[0-9a-z]*}}, 1
|
||||
// CHECK-OPT: icmp eq i32 %{{[0-9a-z]*}}, 1
|
||||
COLOR.GREEN -> 0x00ff00
|
||||
// CHECK: icmp eq i32 %{{[0-9a-z]*}}, 2
|
||||
// CHECK-OPT: icmp eq i32 %{{[0-9a-z]*}}, 2
|
||||
COLOR.BLUE -> 0x0000ff
|
||||
})
|
||||
}
|
||||
// CHECK-LABEL: epilogue:
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
class A(val x: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
// CHECK-DEBUG: call %struct.ObjHeader* @AllocInstance
|
||||
// CHECK-OPT: alloca %"kclassbody:A#internal"
|
||||
val a = A(5)
|
||||
println(a.x)
|
||||
// CHECK-LABEL: epilogue:
|
||||
return "OK"
|
||||
}
|
||||
+7
-8
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
|
||||
// Perform check after optimization pipeline because
|
||||
// LLVM might infer attributes.
|
||||
// FILECHECK_STAGE: LTOBitcodeOptimization
|
||||
|
||||
// NB: This is not a good test.
|
||||
// What we actually want to check is that Kotlin/Native compiler is able to produce "big"
|
||||
@@ -11,10 +12,8 @@
|
||||
// Instead, here we check that none of the module's functions are compiled in the Thumb mode.
|
||||
// BL instructions in thumb mode have smaller ranges which causes "relocation out of range" failure.
|
||||
|
||||
// CHECK: target triple = "armv7k-apple-watchos{{.+}}"
|
||||
// CHECK-WATCHOS_ARM32: target triple = "armv7k-apple-watchos2{{.+}}"
|
||||
|
||||
fun main() {
|
||||
println("hello")
|
||||
}
|
||||
fun box() = "OK"
|
||||
|
||||
// CHECK-NOT: attributes #{{[0-9]+}} = { {{.+}}+thumb-mode{{.+}} }
|
||||
+12
-8
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK: declare void @ThrowException(%struct.ObjHeader*) #[[THROW_EXCEPTION_DECLARATION_ATTRIBUTES:[0-9]+]]
|
||||
|
||||
@@ -11,10 +9,16 @@ fun flameThrower(): Nothing {
|
||||
throw Throwable("🔥")
|
||||
}
|
||||
|
||||
// CHECK-LABEL: void @"kfun:#main(){}"()
|
||||
fun main() {
|
||||
// CHECK: call void @"kfun:#flameThrower(){}kotlin.Nothing"() #[[FLAME_THROWER_CALLSITE_ATTRIBUTES:[0-9]+]]
|
||||
flameThrower()
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
|
||||
// CHECK: invoke void @"kfun:#flameThrower(){}kotlin.Nothing"() #[[FLAME_THROWER_CALLSITE_ATTRIBUTES:[0-9]+]]
|
||||
try {
|
||||
flameThrower()
|
||||
} catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
return "FAIL: Uncaught exception"
|
||||
}
|
||||
|
||||
// CHECK-DAG: attributes #[[THROW_EXCEPTION_DECLARATION_ATTRIBUTES]] = {{{.*}}noreturn{{.*}}}
|
||||
+21
-13
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
@@ -49,7 +47,8 @@ fun <QuxTP> bar() {
|
||||
println(ref)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
println(stringifyArray(arrayOf(N(2), N(14))))
|
||||
println(stringifyIntArray(arrayOf(1, 2, 3)))
|
||||
|
||||
@@ -58,6 +57,7 @@ fun main() {
|
||||
|
||||
val ref: KFunction2<Int, Int, Unit> = ::foo // $foo$FUNCTION_REFERENCE$5
|
||||
println(ref)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define internal i32 @"kfun:$stringifyArray$lambda$0$FUNCTION_REFERENCE$0.invoke#internal"
|
||||
@@ -68,18 +68,21 @@ fun main() {
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$stringifyArray$lambda$0$FUNCTION_REFERENCE$0.$<bridge-BNNN>invoke(kotlin.Array<1:0>){}kotlin.Int#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* [[array:%[0-9]+]], %struct.ObjHeader** {{%[0-9]+}})
|
||||
// CHECK: call i32 @"kfun:$stringifyArray$lambda$0$FUNCTION_REFERENCE$0.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]])
|
||||
// CHECK-OPT: call i32 @"kfun:$stringifyArray$lambda$0$FUNCTION_REFERENCE$0.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]])
|
||||
// CHECK-DEBUG: call i32 @"kfun:$stringifyArray$lambda$0$FUNCTION_REFERENCE$0.invoke#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$get$FUNCTION_REFERENCE$1.invoke#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* [[array:%[0-9]+]], i32 [[index:%[0-9]+]], %struct.ObjHeader** [[ret:%[0-9]+]])
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_Array_get(%struct.ObjHeader* [[array]], i32 [[index]], %struct.ObjHeader** [[ret]])
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_Array_get(%struct.ObjHeader* [[array]], i32 [[index]], %struct.ObjHeader** [[ret]])
|
||||
// CHECK-DEBUG: call %struct.ObjHeader* @Kotlin_Array_get(%struct.ObjHeader* {{%[0-9]+}}, i32 {{%[0-9]+}}, %struct.ObjHeader** {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal void @"kfun:$get$FUNCTION_REFERENCE$1.<init>#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$get$FUNCTION_REFERENCE$1.$<bridge-NNNNB>invoke(kotlin.Array<*>;kotlin.Int){}kotlin.Any?#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* [[array:%[0-9]+]], %struct.ObjHeader* [[boxedIndex:%[0-9]+]], %struct.ObjHeader** [[ret:%[0-9]+]])
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:$get$FUNCTION_REFERENCE$1.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]], i32 {{%[0-9]+}}, %struct.ObjHeader** [[ret]])
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:$get$FUNCTION_REFERENCE$1.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]], i32 {{%[0-9]+}}, %struct.ObjHeader** [[ret]])
|
||||
// CHECK-DEBUG: call %struct.ObjHeader* @"kfun:$get$FUNCTION_REFERENCE$1.invoke#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}}, i32 {{%[0-9]+}}, %struct.ObjHeader** {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal i32 @"kfun:$stringifyIntArray$lambda$1$FUNCTION_REFERENCE$2.invoke#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}})
|
||||
@@ -89,7 +92,8 @@ fun main() {
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$stringifyIntArray$lambda$1$FUNCTION_REFERENCE$2.$<bridge-BNNN>invoke(kotlin.Array<kotlin.Int>){}kotlin.Int#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* [[array:%[0-9]+]], %struct.ObjHeader** {{%[0-9]+}})
|
||||
// CHECK: call i32 @"kfun:$stringifyIntArray$lambda$1$FUNCTION_REFERENCE$2.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]])
|
||||
// CHECK-OPT: call i32 @"kfun:$stringifyIntArray$lambda$1$FUNCTION_REFERENCE$2.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]])
|
||||
// CHECK-DEBUG: call i32 @"kfun:$stringifyIntArray$lambda$1$FUNCTION_REFERENCE$2.invoke#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal i32 @"kfun:$get$FUNCTION_REFERENCE$3.invoke#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}}, i32 {{%[0-9]+}})
|
||||
@@ -99,18 +103,21 @@ fun main() {
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$get$FUNCTION_REFERENCE$3.$<bridge-BNNNB>invoke(kotlin.Array<kotlin.Int>;kotlin.Int){}kotlin.Int#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* [[array:%[0-9]+]], %struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader** {{%[0-9]+}})
|
||||
// CHECK: call i32 @"kfun:$get$FUNCTION_REFERENCE$3.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]], i32 {{%[0-9]+}})
|
||||
// CHECK-OPT: call i32 @"kfun:$get$FUNCTION_REFERENCE$3.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[array]], i32 {{%[0-9]+}})
|
||||
// CHECK-DEBUG: call i32 @"kfun:$get$FUNCTION_REFERENCE$3.invoke#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}}, i32 {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal void @"kfun:$foo$FUNCTION_REFERENCE$4.invoke#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* [[p1:%[0-9]+]], %struct.ObjHeader* [[p2:%[0-9]+]])
|
||||
// CHECK: call void @"kfun:#foo(0:0;0:1){0\C2\A7<kotlin.Any?>;1\C2\A7<kotlin.Any?>}"(%struct.ObjHeader* [[p1]], %struct.ObjHeader* [[p2]])
|
||||
// CHECK-OPT: call void @"kfun:#foo(0:0;0:1){0\C2\A7<kotlin.Any?>;1\C2\A7<kotlin.Any?>}"(%struct.ObjHeader* [[p1]], %struct.ObjHeader* [[p2]])
|
||||
// CHECK-DEBUG: call void @"kfun:#foo(0:0;0:1){0\C2\A7<kotlin.Any?>;1\C2\A7<kotlin.Any?>}"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal void @"kfun:$foo$FUNCTION_REFERENCE$4.<init>#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$foo$FUNCTION_REFERENCE$4.$<bridge-UNNNN>invoke(1:0;1:0){}#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* [[p1:%[0-9]+]], %struct.ObjHeader* [[p2:%[0-9]+]], %struct.ObjHeader** {{%[0-9]+}})
|
||||
// CHECK: call void @"kfun:$foo$FUNCTION_REFERENCE$4.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[p1]], %struct.ObjHeader* [[p2]])
|
||||
// CHECK-OPT: call void @"kfun:$foo$FUNCTION_REFERENCE$4.invoke#internal"(%struct.ObjHeader* [[this]], %struct.ObjHeader* [[p1]], %struct.ObjHeader* [[p2]])
|
||||
// CHECK-DEBUG: call void @"kfun:$foo$FUNCTION_REFERENCE$4.invoke#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}})
|
||||
|
||||
// CHECK-LABEL: define internal void @"kfun:$foo$FUNCTION_REFERENCE$5.invoke#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}})
|
||||
@@ -121,4 +128,5 @@ fun main() {
|
||||
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:$foo$FUNCTION_REFERENCE$5.$<bridge-UNNBB>invoke(kotlin.Int;kotlin.Int){}#internal"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[this:%[0-9]+]], %struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader** {{%[0-9]+}})
|
||||
// CHECK: call void @"kfun:$foo$FUNCTION_REFERENCE$5.invoke#internal"(%struct.ObjHeader* [[this]], i32 {{%[0-9]+}}, i32 {{%[0-9]+}})
|
||||
// CHECK-OPT: call void @"kfun:$foo$FUNCTION_REFERENCE$5.invoke#internal"(%struct.ObjHeader* [[this]], i32 {{%[0-9]+}}, i32 {{%[0-9]+}})
|
||||
// CHECK-DEBUG: call void @"kfun:$foo$FUNCTION_REFERENCE$5.invoke#internal"(%struct.ObjHeader* {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}})
|
||||
+10
-9
@@ -1,25 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-LABEL: "kfun:#and(kotlin.Int;kotlin.Int){}kotlin.Int"
|
||||
fun and(a: Int, b: Int): Int {
|
||||
// CHECK: and {{.*}}, {{.*}}
|
||||
return a and b
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
// CHECK-LABEL: "kfun:#ieee754(kotlin.Float;kotlin.Float){}kotlin.Boolean"
|
||||
fun ieee754(a: Float, b: Float): Boolean {
|
||||
// CHECK: fcmp oeq float {{.*}}, {{.*}}
|
||||
return a == b
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
val x = and(1, 2)
|
||||
val y = ieee754(0.0f, 1.0f)
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
return if (x == 0 && !y)
|
||||
"OK"
|
||||
else "FAIL x=$x y=$y"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
class C {
|
||||
fun foo(x: Int) = x
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Int-box
|
||||
// CHECK-DEBUG: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
val fooref = c::foo
|
||||
val result = fooref(42)
|
||||
return if( result == 42)
|
||||
"OK"
|
||||
else
|
||||
"FAIL: $result"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
class C<T> {
|
||||
fun foo(x: T) = x
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-OPT-NOT: Int-unbox
|
||||
// CHECK-DEBUG: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
fun box(): String {
|
||||
val c = C<Int>()
|
||||
val fooref = c::foo
|
||||
return if (fooref(42) == 42)
|
||||
"OK"
|
||||
else
|
||||
"FAIL"
|
||||
}
|
||||
+8
-7
@@ -1,24 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun <T> T.foo() { println(this) }
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#bar(0:0){0\C2\A7<kotlin.Any?>}"
|
||||
// CHECK-SAME: (%struct.ObjHeader* [[x:%[0-9]+]])
|
||||
fun <BarTP> bar(x: BarTP) {
|
||||
// CHECK: call void @"kfun:$foo$FUNCTION_REFERENCE$0.<init>#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* [[x]])
|
||||
// CHECK-OPT: call void @"kfun:$foo$FUNCTION_REFERENCE$0.<init>#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* [[x]])
|
||||
// CHECK-DEBUG: call void @"kfun:$foo$FUNCTION_REFERENCE$0.<init>#internal"(%struct.ObjHeader* {{%[0-9]+}}, %struct.ObjHeader* {{%[0-9]+}})
|
||||
println(x::foo)
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
// CHECK: call void @"kfun:$foo$FUNCTION_REFERENCE$1.<init>#internal"(%struct.ObjHeader* {{%[0-9]+}}, i32 5)
|
||||
println(5::foo)
|
||||
|
||||
bar("hello")
|
||||
bar(42)
|
||||
return "OK"
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define internal void @"kfun:$foo$FUNCTION_REFERENCE$0.<init>#internal"
|
||||
@@ -0,0 +1,23 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun interface Foo {
|
||||
fun bar(x: Int): Any
|
||||
}
|
||||
|
||||
fun baz(x: Any): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// Boxing needs to be used now due to non-devirtualized call
|
||||
// CHECK-OPT: Int-box
|
||||
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
|
||||
fun box(): String {
|
||||
val foo: Foo = Foo(::baz)
|
||||
return if (foo.bar(42) == 42)
|
||||
"OK"
|
||||
else "FAIL"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun interface Foo<T> {
|
||||
fun bar(x: T): Any
|
||||
}
|
||||
|
||||
fun baz(x: Any): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
fun box(): String {
|
||||
val foo: Foo<Int> = Foo(::baz)
|
||||
return if (foo.bar(42) == 42)
|
||||
"OK"
|
||||
else "FAIL"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun interface Foo {
|
||||
fun bar(x: Int): Int
|
||||
}
|
||||
|
||||
fun baz(x: Int): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Int-box
|
||||
// CHECK-DEBUG: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
fun box(): String {
|
||||
val foo: Foo = Foo(::baz)
|
||||
val result = foo.bar(42)
|
||||
return if( result == 42 )
|
||||
"OK"
|
||||
else "FAIL: $result"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun interface Foo<T> {
|
||||
fun bar(x: T): Int
|
||||
}
|
||||
|
||||
fun baz(x: Any): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Int-box
|
||||
// CHECK-DEBUG: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
fun box(): String {
|
||||
val foo: Foo<Int> = Foo(::baz)
|
||||
val result = foo.bar(42)
|
||||
return if( result == 42 )
|
||||
"OK"
|
||||
else "FAIL: $result"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun plus1(x: Int) = x + 1
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Int-box
|
||||
// CHECK-OPT-NOT: Int-unbox
|
||||
// CHECK-DEBUG: Int-box
|
||||
// CHECK-DEBUG: Int-unbox
|
||||
// CHECK-LABEL: epilogue:
|
||||
fun box(): String {
|
||||
|
||||
val ref = ::plus1
|
||||
var y = 0
|
||||
repeat(100000) {
|
||||
y += ref(it) // Should be devirtualized and invoked without boxing/unboxing (`Int-box`/`Int-unbox`)
|
||||
}
|
||||
if (y != 705082704)
|
||||
return "FAIL $y != 705082704"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.native.concurrent.*
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
val arr: Array<String> = arrayOf("1")
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
@kotlinx.cinterop.ExperimentalForeignApi
|
||||
fun box(): String {
|
||||
println(arr.size.toByte() == arr[0].toByte())
|
||||
println(arr.size.toUByte() == arr[0].toUByte())
|
||||
println(arr.size.toShort() == arr[0].toShort())
|
||||
println(arr.size.toUShort() == arr[0].toUShort())
|
||||
println(arr.size.toInt() == arr[0].toInt())
|
||||
println(arr.size.toUInt() == arr[0].toUInt())
|
||||
println(arr.size.toLong() == arr[0].toLong())
|
||||
println(arr.size.toULong() == arr[0].toULong())
|
||||
println(arr.size.toFloat() == arr[0].toFloat())
|
||||
println(arr.size.toDouble() == arr[0].toDouble())
|
||||
println(Char(arr.size) == arr[0][0])
|
||||
println((arr.size == 1) == (arr[0] == "1")) // Boolean
|
||||
|
||||
memScoped {
|
||||
val var1: IntVar = alloc()
|
||||
val var2: IntVar = alloc()
|
||||
println(var1.ptr.rawValue == var2.ptr.rawValue)
|
||||
}
|
||||
|
||||
println(Result.success(arr.size) == Result.success(arr[0].toInt()))
|
||||
println(vectorOf(arr.size, arr.size, arr.size, arr.size) == vectorOf(arr[0].toInt(), arr[0].toInt(), arr[0].toInt(), arr[0].toInt()))
|
||||
|
||||
val w1 = Worker.start()
|
||||
val w2 = Worker.start()
|
||||
println(w1 == w2)
|
||||
|
||||
val f1 = w1.requestTermination()
|
||||
val f2 = w2.requestTermination()
|
||||
println(f1 == f2)
|
||||
|
||||
f1.result
|
||||
f2.result
|
||||
|
||||
return "OK"
|
||||
}
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i64 @"kfun:kotlin#<Long-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i64 @"kfun:kotlin#<ULong-unbox>
|
||||
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i32 @"kfun:kotlin#<Int-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i32 @"kfun:kotlin#<UInt-unbox>
|
||||
|
||||
// CHECK-OPT-NOT: {{call|invoke}} {{signext i16|i16}} @"kfun:kotlin#<Short-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} {{zeroext i16|i16}} @"kfun:kotlin#<UShort-unbox>
|
||||
|
||||
// CHECK-OPT-NOT: {{call|invoke}} {{signext i8|i8}} @"kfun:kotlin#<Byte-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} {{zeroext i8|i8}} @"kfun:kotlin#<UByte-unbox>
|
||||
|
||||
// CHECK-OPT-NOT: {{call|invoke}} {{zeroext i16|i16}} @"kfun:kotlin#<Char-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} {{zeroext i1|i1}} @"kfun:kotlin#<Boolean-unbox>
|
||||
|
||||
// CHECK-OPT-NOT: {{call|invoke}} double @"kfun:kotlin#<Double-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} float @"kfun:kotlin#<Float-unbox>
|
||||
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i8* @"kfun:kotlin.native.internal#<NativePtr-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i32 @"kfun:kotlin.native.concurrent#<Future-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} i32 @"kfun:kotlin.native.concurrent#<Worker-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} <4 x float> @"kfun:kotlin.native#<Vector128-unbox>
|
||||
// CHECK-OPT-NOT: {{call|invoke}} %struct.ObjHeader* @"kfun:kotlin#<Result-unbox>
|
||||
|
||||
// CHECK-LABEL: epilogue:
|
||||
// On APPLE targets, generated functions <T>ToNSNumber may contain non-converted invocations of unbox functions.
|
||||
// CHECK-APPLE: {{IntToNSNumber|LongToNSNumber|ByteToNSNumber|ShortToNSNumber|FloatToNSNumber|DoubleToNSNumber}}
|
||||
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlinx.cinterop.CPointer#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlinx.cinterop.CPointer#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlinx.cinterop.CPointer#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-OPT: call i8* @"kfun:kotlinx.cinterop#<CPointer-unbox>(kotlin.Any?){}kotlinx.cinterop.CPointer<-1:0>?"
|
||||
|
||||
// CHECK-DEBUG-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-DEBUG: [[var1:%[0-9]+]] = invoke i8* @"kfun:kotlinx.cinterop#<get-ptr>
|
||||
// CHECK-DEBUG: [[var2:%[0-9]+]] = invoke i8* @"kfun:kotlinx.cinterop#<get-ptr>
|
||||
// CHECK-DEBUG: = icmp eq i8* [[var1]], [[var2]]
|
||||
// CHECK-DEBUG-LABEL: epilogue:
|
||||
|
||||
@kotlinx.cinterop.ExperimentalForeignApi
|
||||
fun box(): String = memScoped {
|
||||
val var1: IntVar = alloc()
|
||||
val var2: IntVar = alloc()
|
||||
return if (var1.ptr == var2.ptr) "FAIL" else "OK"
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-OPT-LABEL: define i8* @"kfun:kotlinx.cinterop#interpretOpaquePointed(kotlin.native.internal.NativePtr){}kotlinx.cinterop.NativePointed"(i8* %0)
|
||||
// CHECK-OPT: call i8* @"kfun:kotlinx.cinterop#<NativePointed-unbox>(kotlin.Any?){}kotlinx.cinterop.NativePointed?"
|
||||
|
||||
// CHECK-DEBUG-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-AAPCS-DEBUG: call i1 @IsSubtype(%struct.TypeInfo* %{{[0-9]+}}, %struct.TypeInfo* getelementptr inbounds ({{.*}}@"kclass:kotlinx.cinterop.NativePointed", i32 0, i32 0))
|
||||
// CHECK-DEFAULTABI-DEBUG: call zeroext i1 @IsSubtype(%struct.TypeInfo* %{{[0-9]+}}, %struct.TypeInfo* @"kclass:kotlinx.cinterop.NativePointed")
|
||||
// CHECK-WINDOWSX64-DEBUG: call zeroext i1 @IsSubtype(%struct.TypeInfo* %{{[0-9]+}}, %struct.TypeInfo* getelementptr inbounds ({{.*}}@"kclass:kotlinx.cinterop.NativePointed", i32 0, i32 0))
|
||||
// CHECK-DEBUG-LABEL: epilogue:
|
||||
|
||||
@kotlinx.cinterop.ExperimentalForeignApi
|
||||
fun box(): String = memScoped {
|
||||
val var1: NativePointed = alloc(4, 4)
|
||||
return if (interpretOpaquePointed(var1.rawPtr) is NativePointed) "OK" else "FAIL"
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlin.native.internal.NonNullNativePtr#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlin.native.internal.NonNullNativePtr#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlin.native.internal.NonNullNativePtr#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-OPT: call i8* @"kfun:kotlin.native.internal#<NonNullNativePtr-unbox>(kotlin.Any?){}kotlin.native.internal.NonNullNativePtr?"
|
||||
|
||||
// CHECK-DEBUG-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
// CHECK-AAPCS-DEBUG: invoke i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-DEFAULTABI-DEBUG: invoke zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-WINDOWSX64-DEBUG: invoke zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-DEBUG-LABEL: epilogue:
|
||||
|
||||
@kotlinx.cinterop.ExperimentalForeignApi
|
||||
fun box(): String = memScoped {
|
||||
val var1: IntVar = alloc()
|
||||
val var2: IntVar = alloc()
|
||||
// The first one is K1, the second one is K2.
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
return if (var1.ptr.value as Any == var2.ptr.value as Any) "FAIL" else "OK"
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlinx.cinterop.StableRef#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlinx.cinterop.StableRef#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlinx.cinterop.StableRef#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
|
||||
// CHECK-OPT: call i8* @"kfun:kotlinx.cinterop#<StableRef-unbox>(kotlin.Any?){}kotlinx.cinterop.StableRef<-1:0>?"
|
||||
|
||||
// CHECK-OPT-LABEL: epilogue:
|
||||
|
||||
|
||||
// CHECK-DEBUG-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
|
||||
// CHECK-DEBUG: [[result:%[0-9]+]] = icmp eq i8*
|
||||
// CHECK-DEBUG: store i1 [[result]], i1* %isEqual
|
||||
|
||||
// CHECK-DEBUG-LABEL: epilogue:
|
||||
|
||||
@kotlinx.cinterop.ExperimentalForeignApi
|
||||
fun box(): String {
|
||||
val ref1 = StableRef.create(Any())
|
||||
val ref2 = StableRef.create(Any())
|
||||
val isEqual = ref1 == ref2
|
||||
ref2.dispose()
|
||||
ref1.dispose()
|
||||
return if (!isEqual) "OK" else "FAIL"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlin.UByteArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlin.UByteArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlin.UByteArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:kotlin#<UByteArray-unbox>(kotlin.Any?){}kotlin.UByteArray?"
|
||||
// CHECK-AAPCS-DEBUG: call i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-DEFAULTABI-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-WINDOWSX64-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
|
||||
// CHECK-LABEL: epilogue:
|
||||
|
||||
fun box(): String {
|
||||
val arr1 = UByteArray(10) { it.toUByte() }
|
||||
val arr2 = UByteArray(10) { (it / 2).toUByte() }
|
||||
return if (arr1 == arr2) "FAIL" else "OK"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlin.UIntArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlin.UIntArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlin.UIntArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:kotlin#<UIntArray-unbox>(kotlin.Any?){}kotlin.UIntArray?"
|
||||
// CHECK-AAPCS-DEBUG: call i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-DEFAULTABI-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-WINDOWSX64-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
|
||||
// CHECK-LABEL: epilogue:
|
||||
|
||||
fun box(): String {
|
||||
val arr1 = UIntArray(10) { it.toUInt() }
|
||||
val arr2 = UIntArray(10) { (it / 2).toUInt() }
|
||||
return if (arr1 == arr2) "FAIL" else "OK"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlin.ULongArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlin.ULongArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlin.ULongArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:kotlin#<ULongArray-unbox>(kotlin.Any?){}kotlin.ULongArray?"
|
||||
// CHECK-AAPCS-DEBUG: call i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-DEFAULTABI-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-WINDOWSX64-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
|
||||
// CHECK-LABEL: epilogue:
|
||||
|
||||
fun box(): String {
|
||||
val arr1 = ULongArray(10) { it.toULong() }
|
||||
val arr2 = ULongArray(10) { (it / 2).toULong() }
|
||||
return if (arr1 == arr2) "FAIL" else "OK"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-AAPCS-OPT-LABEL: define i1 @"kfun:kotlin.UShortArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-OPT-LABEL: define zeroext i1 @"kfun:kotlin.UShortArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-OPT-LABEL: define zeroext i1 @"kfun:kotlin.UShortArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:kotlin#<UShortArray-unbox>(kotlin.Any?){}kotlin.UShortArray?"
|
||||
// CHECK-AAPCS-DEBUG: call i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-DEFAULTABI-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
// CHECK-WINDOWSX64-DEBUG: call zeroext i1 @"kfun:kotlin.Any#equals(kotlin.Any?){}kotlin.Boolean-trampoline"
|
||||
|
||||
// CHECK-LABEL: epilogue:
|
||||
|
||||
fun box(): String {
|
||||
val arr1 = UShortArray(10) { it.toUShort() }
|
||||
val arr2 = UShortArray(10) { (it / 2).toUShort() }
|
||||
return if (arr1 == arr2) "FAIL" else "OK"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:C#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:C#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:C#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#<C-unbox>(kotlin.Any?){}C?"
|
||||
value class C(val x: Any)
|
||||
// Note: <C-unbox> is also called from bridges for equals, hashCode and toString.
|
||||
|
||||
fun box() =
|
||||
if (C(42) == C(13)) "FAIL" else "OK"
|
||||
+9
-7
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-LABEL: define i64 @"kfun:#foo(){}kotlin.Long"()
|
||||
fun foo(): Long {
|
||||
@@ -28,7 +26,11 @@ fun callBar(f: Boolean): ULong {
|
||||
}
|
||||
// CHECK: ret i64
|
||||
|
||||
fun main() {
|
||||
println(foo())
|
||||
println(callBar(true))
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
val resultFoo = foo()
|
||||
val resultBar = callBar(false)
|
||||
return if (resultFoo == 0L && resultBar == 1UL)
|
||||
"OK"
|
||||
else "FAIL: resultFoo=$resultFoo resultBar=$resultBar"
|
||||
}
|
||||
+8
-6
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
object A {
|
||||
const val x = 5
|
||||
@@ -31,7 +29,11 @@ fun g() {
|
||||
// CHECK: {{^}}epilogue:
|
||||
|
||||
|
||||
fun main() {
|
||||
f()
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
val f = f()
|
||||
if (f != 12)
|
||||
return "FAIL: $f != 12"
|
||||
g()
|
||||
return "OK"
|
||||
}
|
||||
+11
-10
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
fun flameThrower() {
|
||||
throw Throwable("🔥")
|
||||
@@ -11,7 +9,7 @@ fun flameThrower() {
|
||||
fun f1() {
|
||||
// CHECK: call void @"kfun:#flameThrower(){}"()
|
||||
flameThrower()
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
// CHECK-LABEL: "kfun:#f2(){}"
|
||||
@@ -20,12 +18,15 @@ fun f2() {
|
||||
// CHECK: invoke void @"kfun:#flameThrower(){}"()
|
||||
flameThrower()
|
||||
} catch (t: Throwable) {}
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main() {
|
||||
f1()
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
try {
|
||||
f1()
|
||||
} catch (t: Throwable) {}
|
||||
f2()
|
||||
// CHECK-LABEL: epilogue
|
||||
// CHECK-LABEL: epilogue:
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext %0)
|
||||
// CHECK-AAPCS-LABEL: define i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext %0)
|
||||
fun id(arg: Boolean): Boolean {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 signext %0)
|
||||
// CHECK-AAPCS-LABEL: define i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 %0)
|
||||
fun id(arg: Byte): Byte {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 zeroext %0)
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 %0)
|
||||
fun id(arg: Char): Char {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define signext i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 signext %0)
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 %0)
|
||||
fun id(arg: Short): Short {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 %0)
|
||||
fun id(arg: Int): Int {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 %0)
|
||||
fun id(arg: Long): Long {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define float @"kfun:#id(kotlin.Float){}kotlin.Float"(float %0)
|
||||
fun id(arg: Float): Float {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define double @"kfun:#id(kotlin.Double){}kotlin.Double"(double %0)
|
||||
fun id(arg: Double): Double {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 zeroext %0)
|
||||
// CHECK-AAPCS-LABEL: define i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 %0)
|
||||
fun id(arg: UByte): UByte {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 zeroext %0)
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 %0)
|
||||
fun id(arg: UShort): UShort {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 %0)
|
||||
fun id(arg: UInt): UInt {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 %0)
|
||||
fun id(arg: ULong): ULong {
|
||||
return arg
|
||||
}
|
||||
|
||||
fun checkPrimitives() {
|
||||
// CHECK-DEFAULTABI: call zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 {{.*}})
|
||||
// CHECK-WINDOWSX64: call zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext {{.*}})
|
||||
id(true)
|
||||
// CHECK-DEFAULTABI: call signext i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 signext {{.*}})
|
||||
// CHECK-AAPCS: call i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 {{.*}})
|
||||
id(0.toByte())
|
||||
// CHECK-DEFAULTABI: call zeroext i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 {{.*}})
|
||||
id('a')
|
||||
// CHECK-DEFAULTABI: call signext i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 signext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 {{.*}})
|
||||
id(0.toShort())
|
||||
// CHECK: call i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 {{.*}})
|
||||
id(0)
|
||||
// CHECK: call i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 {{.*}})
|
||||
id(0L)
|
||||
// CHECK: call float @"kfun:#id(kotlin.Float){}kotlin.Float"(float {{.*}})
|
||||
id(0.5f)
|
||||
// CHECK: call double @"kfun:#id(kotlin.Double){}kotlin.Double"(double {{.*}})
|
||||
id(0.5)
|
||||
// CHECK-DEFAULTABI: call zeroext i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 {{.*}})
|
||||
id(0.toUByte())
|
||||
// CHECK-DEFAULTABI: call zeroext i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 {{.*}})
|
||||
id(0.toUShort())
|
||||
// CHECK: call i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 {{.*}})
|
||||
id(15u)
|
||||
// CHECK: call i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 {{.*}})
|
||||
id(15uL)
|
||||
}
|
||||
|
||||
value class CharWrapper(val ch: Char)
|
||||
|
||||
// CHECK-DEFAULTABI-LABEL: define zeroext i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 zeroext %0)
|
||||
// CHECK-AAPCS-LABEL: define i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 %0)
|
||||
// CHECK-WINDOWSX64-LABEL: define i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 %0)
|
||||
fun id(arg: CharWrapper): CharWrapper {
|
||||
return arg
|
||||
}
|
||||
|
||||
// Check that value classes doesn't affect parameter attributes
|
||||
|
||||
fun checkInlineClasses() {
|
||||
// CHECK-DEFAULTABI: call zeroext i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 {{.*}})
|
||||
id(CharWrapper('c'))
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
fun nullableId(arg: Byte?): Byte? {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
fun nullableId(arg: CharWrapper?): CharWrapper? {
|
||||
return arg
|
||||
}
|
||||
|
||||
// Check that we don't pass primitive-specific attributes to their boxes
|
||||
fun checkBoxes() {
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
nullableId(1.toByte())
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
nullableId(CharWrapper('a'))
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
checkPrimitives()
|
||||
checkInlineClasses()
|
||||
checkBoxes()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: OptimizeTLSDataLoads
|
||||
|
||||
class Wrapper(x: Int)
|
||||
|
||||
// CHECK-LABEL: define internal fastcc %struct.ObjHeader* @"kfun:#f(kotlin.Int;kotlin.String){}kotlin.String"
|
||||
fun f(x: Int, s: String): String {
|
||||
// CHECK: _ZN6kotlin2mm14ThreadRegistry22currentThreadDataNode_E
|
||||
// CHECK-NOT: _ZN6kotlin2mm14ThreadRegistry22currentThreadDataNode_E
|
||||
if (x < 0) throw IllegalStateException()
|
||||
if (x > 0) return f(x - 1, s)
|
||||
val b = Wrapper(2)
|
||||
val a = listOf(x, x, Wrapper(1), 2, x)
|
||||
return buildString {
|
||||
for (i in a) { appendLine("$s i") }
|
||||
}
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val result = f(10, "123456")
|
||||
return if (result == "123456 i\n" +
|
||||
"123456 i\n" +
|
||||
"123456 i\n" +
|
||||
"123456 i\n" +
|
||||
"123456 i\n")
|
||||
"OK"
|
||||
else "FAIL: $result"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
// CHECK-LABEL: "kfun:#id(kotlin.Any?){}kotlin.Any?"
|
||||
fun id(a: Any?): Any? {
|
||||
return a
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#id(kotlin.Any?){}kotlin.Any?"
|
||||
val x = id("Hello")
|
||||
// CHECK: call void @"kfun:kotlin.io#println(kotlin.Any?){}"(%struct.ObjHeader* {{.*}})
|
||||
println(x)
|
||||
// CHECK-LABEL: epilogue:
|
||||
return "OK"
|
||||
}
|
||||
compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_generated.kt
Vendored
+114
@@ -0,0 +1,114 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_append_generated
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyMaybeAny
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyMaybeAny(maybeAny1: Any?, maybeAny2: Any?): String {
|
||||
return "$maybeAny1,$maybeAny2"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyMaybeString
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyMaybeString(maybeAny1: Any?, maybeString2: String?): String {
|
||||
return "$maybeAny1,$maybeString2"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyString
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyString(maybeAny1: Any?, string: String): String {
|
||||
return "$maybeAny1,$string"
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyFoo
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyFoo(maybeAny: Any?, foo: Foo): String {
|
||||
return "$maybeAny,$foo"
|
||||
}
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyMaybeFoo
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyMaybeFoo(maybeAny: Any?, foo: Foo?): String {
|
||||
return "$maybeAny,$foo"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo(42)
|
||||
val res1 = maybeAnyMaybeAny(foo, foo)
|
||||
if (res1 != "Foo(bar=42),Foo(bar=42)") return "FAIL1: $res1"
|
||||
val res2 = maybeAnyMaybeAny(null, null)
|
||||
if (res2 != "null,null") return "FAIL2: $res2"
|
||||
val res3 = maybeAnyMaybeString(foo, "bar")
|
||||
if (res3 != "Foo(bar=42),bar") return "FAIL3: $res3"
|
||||
val res4 = maybeAnyMaybeString(null, null)
|
||||
if (res4 != "null,null") return "FAIL4: $res4"
|
||||
val res5 = maybeAnyString(foo, "bar")
|
||||
if (res5 != "Foo(bar=42),bar") return "FAIL5: $res5"
|
||||
val res6 = maybeAnyString(null, "bar")
|
||||
if (res6 != "null,bar") return "FAIL6: $res6"
|
||||
val res7 = maybeAnyFoo(foo, foo)
|
||||
if (res7 != "Foo(bar=42),Foo(bar=42)") return "FAIL7: $res7"
|
||||
val res8 = maybeAnyFoo(null, foo)
|
||||
if (res8 != "null,Foo(bar=42)") return "FAIL8: $res8"
|
||||
val res9 = maybeAnyMaybeFoo(foo, foo)
|
||||
if (res9 != "Foo(bar=42),Foo(bar=42)") return "FAIL9: $res9"
|
||||
val res10 = maybeAnyMaybeFoo(foo, null)
|
||||
if (res10 != "Foo(bar=42),null") return "FAIL10: $res10"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_append_manual
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendMaybeAny(kotlin.Any?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendMaybeAny(maybeAny: Any?): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(maybeAny)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendAny(kotlin.Any)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendAny(any: Any): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(any)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendMaybeString(kotlin.String?)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendMaybeString(maybeStr: String?): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(maybeStr)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendString(kotlin.String)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendString(str: String): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(str)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendFoo(codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo)
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendFoo(foo: Foo): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(foo)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo(42)
|
||||
val res1 = appendMaybeAny(foo)
|
||||
if (res1 != "Foo(bar=42)") return "FAIL1: $res1"
|
||||
val res2 = appendMaybeAny(null)
|
||||
if (res2 != "null") return "FAIL2: $res2"
|
||||
val res3 = appendAny(foo)
|
||||
if (res3 != "Foo(bar=42)") return "FAIL3: $res3"
|
||||
val res4 = appendMaybeString("foo")
|
||||
if (res4 != "foo") return "FAIL4: $res4"
|
||||
val res5 = appendMaybeString(null)
|
||||
if (res5 != "null") return "FAIL5: $res5"
|
||||
val res6 = appendString("foo")
|
||||
if (res6 != "foo") return "FAIL6: $res6"
|
||||
val res7 = appendFoo(foo)
|
||||
if (res7 != "Foo(bar=42)") return "FAIL7: $res7"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#manualPlusExtensionAny
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusExtensionAny(maybeStr: String?, maybeAny: kotlin.Any?): kotlin.String =
|
||||
maybeStr + maybeAny
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#manualPlusExtensionString
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusExtensionString(maybeStr: String?, str: String): kotlin.String =
|
||||
maybeStr + str
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionAny
|
||||
// CHECK-OPT-NOT: kfun:kotlin#plus__at__kotlin.String?(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: kfun:kotlin#plus__at__kotlin.String?(kotlin.Any?)
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionAny(maybeStr: String?, maybeAny: Any?): String {
|
||||
return "$maybeStr$maybeAny"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionString
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionString(maybeStr: String?, str: String): String {
|
||||
return "$maybeStr$str"
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionFoo
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionFoo(maybeStr: String?, foo: Foo): String {
|
||||
return "$maybeStr$foo"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionMaybeFoo
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionMaybeFoo(maybeStr: String?, foo: Foo?): String {
|
||||
return "$maybeStr$foo"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo(42)
|
||||
val res1 = manualPlusExtensionAny("foo", foo)
|
||||
if (res1 != "fooFoo(bar=42)") return "FAIL1: $res1"
|
||||
val res2 = manualPlusExtensionAny(null, null)
|
||||
if (res2 != "nullnull") return "FAIL2: $res2"
|
||||
val res3 = manualPlusExtensionString("foo", "bar")
|
||||
if (res3 != "foobar") return "FAIL3: $res3"
|
||||
val res4 = manualPlusExtensionString(null, "bar")
|
||||
if (res4 != "nullbar") return "FAIL4: $res4"
|
||||
val res5 = generatedPlusExtensionAny("foo", foo)
|
||||
if (res5 != "fooFoo(bar=42)") return "FAIL5: $res5"
|
||||
val res6 = generatedPlusExtensionAny(null, null)
|
||||
if (res6 != "nullnull") return "FAIL6: $res6"
|
||||
val res7 = generatedPlusExtensionString("foo", "bar")
|
||||
if (res7 != "foobar") return "FAIL7: $res7"
|
||||
val res8 = generatedPlusExtensionString(null, "bar")
|
||||
if (res8 != "nullbar") return "FAIL8: $res8"
|
||||
val res9 = generatedPlusExtensionFoo(null, Foo(42))
|
||||
if (res9 != "nullFoo(bar=42)") return "FAIL9: $res9"
|
||||
val res10 = generatedPlusExtensionMaybeFoo("foo", Foo(42))
|
||||
if (res10 != "fooFoo(bar=42)") return "FAIL10: $res10"
|
||||
val res11 = generatedPlusExtensionMaybeFoo("foo", null)
|
||||
if (res11 != "foonull") return "FAIL11: $res11"
|
||||
return "OK"
|
||||
}
|
||||
+6
-7
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_plus_generated_noescape
|
||||
import kotlin.test.*
|
||||
@@ -24,7 +22,8 @@ fun getNextInt(): Int {
|
||||
return Random.nextInt(IntRange(42153, 42153))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
println(getNextInt())
|
||||
fun box(): String {
|
||||
val nextInt = getNextInt()
|
||||
if (nextInt != 42153) return "FAIL: $nextInt != 42153"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+111
@@ -0,0 +1,111 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_plus_member
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberAny
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusMemberAny(str: String, maybeAny: kotlin.Any?): kotlin.String =
|
||||
str + maybeAny
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberString
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusMemberString(str1: String, str2: String): kotlin.String =
|
||||
str1 + str2
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#generatedPlusMemberAny
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusMemberAny(str: String, maybeAny: Any?): String {
|
||||
return "$str$maybeAny"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#generatedPlusMemberString
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-OPT-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusMemberString(str1: String, str2: String): String {
|
||||
return "$str1$str2"
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberFoo
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT Foo#toString(){}kotlin.String
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
fun manualPlusMemberFoo(str1: String, foo: Foo): kotlin.String =
|
||||
str1 + foo
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberMaybeFoo
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK-OPT: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String
|
||||
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
fun manualPlusMemberMaybeFoo(str1: String, foo: Foo?): kotlin.String =
|
||||
str1 + foo
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo(42)
|
||||
val res1 = manualPlusMemberAny("foo", foo)
|
||||
if (res1 != "fooFoo(bar=42)") return "FAIL1: $res1"
|
||||
val res2 = manualPlusMemberAny("foo", null)
|
||||
if (res2 != "foonull") return "FAIL2: $res2"
|
||||
val res3 = manualPlusMemberString("foo", "bar")
|
||||
if (res3 != "foobar") return "FAIL3: $res3"
|
||||
val res4 = generatedPlusMemberAny("foo", null)
|
||||
if (res4 != "foonull") return "FAIL4: $res4"
|
||||
val res5 = generatedPlusMemberAny("foo", foo)
|
||||
if (res5 != "fooFoo(bar=42)") return "FAIL5: $res5"
|
||||
val res6 = generatedPlusMemberString("foo", "bar")
|
||||
if (res6 != "foobar") return "FAIL6: $res6"
|
||||
val res7 = manualPlusMemberFoo("foo", Foo(42))
|
||||
if (res7 != "fooFoo(bar=42)") return "FAIL7: $res7"
|
||||
val res8 = manualPlusMemberMaybeFoo("foo", Foo(42))
|
||||
if (res8 != "fooFoo(bar=42)") return "FAIL8: $res8"
|
||||
val res9 = manualPlusMemberMaybeFoo("foo", null)
|
||||
if (res9 != "foonull") return "FAIL9: $res9"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// WITH_STDLIB
|
||||
import kotlin.collections.*
|
||||
|
||||
val sideEffectsHolder = mutableListOf<Int>()
|
||||
fun withSideEffect(param: Int): String? {
|
||||
sideEffectsHolder.add(param)
|
||||
return "Result $param"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val result1 = "Result1 is: " + withSideEffect(1)
|
||||
if (result1 != "Result1 is: Result 1") return "FAIL 1: $result1"
|
||||
if (sideEffectsHolder != listOf(1)) return "FAIL 1 sideffects: $sideEffectsHolder"
|
||||
sideEffectsHolder.clear()
|
||||
val result2 = "Result2 is: " + withSideEffect(2) + "!"
|
||||
if (result2 != "Result2 is: Result 2!") return "FAIL 2: $result2"
|
||||
if (sideEffectsHolder != listOf(2)) return "FAIL 2 sideffects: $sideEffectsHolder"
|
||||
sideEffectsHolder.clear()
|
||||
val result3 = withSideEffect(31) + withSideEffect(32)
|
||||
if (result3 != "Result 31Result 32") return "FAIL 3: $result3"
|
||||
if (sideEffectsHolder != listOf(31,32)) return "FAIL 3 sideffects: $sideEffectsHolder"
|
||||
sideEffectsHolder.clear()
|
||||
val result4 = withSideEffect(41) + withSideEffect(42) + withSideEffect(43)
|
||||
if (result4 != "Result 41Result 42Result 43") return "FAIL 4: $result4"
|
||||
if (sideEffectsHolder != listOf(41,42,43)) return "FAIL 4 sideffects: $sideEffectsHolder"
|
||||
return "OK"
|
||||
}
|
||||
+5
-6
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@@ -33,10 +31,11 @@ fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
builder {
|
||||
bar()
|
||||
}
|
||||
println("OK")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
@@ -290,7 +288,8 @@ fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
builder {
|
||||
s1()
|
||||
s2()
|
||||
@@ -317,4 +316,5 @@ fun main() {
|
||||
s23(true)
|
||||
s24()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+30
-31
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
@@ -43,6 +41,34 @@ fun builderInt(c: suspend () -> Int) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String {
|
||||
s1()
|
||||
s2()
|
||||
s3()
|
||||
s4()
|
||||
s5()
|
||||
s6()
|
||||
s7()
|
||||
s8()
|
||||
s9()
|
||||
s10()
|
||||
s11()
|
||||
s12()
|
||||
s13()
|
||||
s14()
|
||||
s15()
|
||||
s16()
|
||||
s17()
|
||||
s18(true)
|
||||
s19(true)
|
||||
s20(true)
|
||||
s21()
|
||||
s22()
|
||||
s23(true)
|
||||
s24()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun s1() {
|
||||
// CHECK-LABEL: define internal %struct.ObjHeader* @"kfun:s1$lambda${{[0-9]*}}
|
||||
@@ -354,30 +380,3 @@ fun s24() {
|
||||
}
|
||||
// CHECK-LABEL: epilogue:
|
||||
}
|
||||
|
||||
fun main() {
|
||||
s1()
|
||||
s2()
|
||||
s3()
|
||||
s4()
|
||||
s5()
|
||||
s6()
|
||||
s7()
|
||||
s8()
|
||||
s9()
|
||||
s10()
|
||||
s11()
|
||||
s12()
|
||||
s13()
|
||||
s14()
|
||||
s15()
|
||||
s16()
|
||||
s17()
|
||||
s18(true)
|
||||
s19(true)
|
||||
s20(true)
|
||||
s21()
|
||||
s22()
|
||||
s23(true)
|
||||
s24()
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: CStubs
|
||||
|
||||
var i = 1
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
fun box(): String = when(i) {
|
||||
0 -> "FAIL: 0"
|
||||
1 -> "OK"
|
||||
2 -> "FAIL: 2"
|
||||
else -> "FAIL: else"
|
||||
}
|
||||
// CHECK: when_case
|
||||
// CHECK: when_next
|
||||
// CHECK: when_case1
|
||||
// CHECK: when_next2
|
||||
// CHECK: when_case3
|
||||
// CHECK: when_next4
|
||||
// CHECK: when_exit
|
||||
// CHECK: ret void
|
||||
+36
@@ -17888,6 +17888,42 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+36
@@ -18704,6 +18704,42 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+36
@@ -18704,6 +18704,42 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+44
@@ -15546,6 +15546,50 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class FileCheck extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Kt53261 extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class StringConcatenationTypeNarrowing extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+36
@@ -13904,6 +13904,42 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Generated
+36
@@ -13904,6 +13904,42 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+36
@@ -13904,6 +13904,42 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+36
@@ -13904,6 +13904,42 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
@@ -5916,24 +5916,7 @@ Task fileCheckTest(String name, Closure<FileCheckTest> configureClosure) {
|
||||
}
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_smoke0") {
|
||||
annotatedSource = project.file('filecheck/smoke0.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_when") {
|
||||
annotatedSource = project.file('filecheck/when.kt')
|
||||
}
|
||||
|
||||
if (HostManager.@Companion.hostIsMac) {
|
||||
fileCheckTest("filecheck_force_arm_instruction_set") {
|
||||
enabled = enabled && cacheTesting == null
|
||||
annotatedSource = project.file('filecheck/force_arm_instruction_set.kt')
|
||||
targetName = "watchos_arm32"
|
||||
// Perform check after optimization pipeline because
|
||||
// LLVM might infer attributes.
|
||||
phaseToCheck = "LTOBitcodeOptimization"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_redundant_safepoints_removal_smallbinary") {
|
||||
enabled = project.globalTestArgs.contains("-opt")
|
||||
annotatedSource = project.file('filecheck/redundant_safepoints.kt')
|
||||
@@ -5953,242 +5936,6 @@ fileCheckTest("filecheck_redundant_safepoints_removal") {
|
||||
phaseToCheck = "RemoveRedundantSafepoints"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_replace_invoke_with_call") {
|
||||
annotatedSource = project.file('filecheck/replace_invoke_with_call.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_no_frame_on_constant_object_access") {
|
||||
annotatedSource = project.file('filecheck/no_frame_on_constant_object_access.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_simple_function_reference") {
|
||||
annotatedSource = project.file('filecheck/kt49847_simple_function_reference.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_sam_Any") {
|
||||
annotatedSource = project.file('filecheck/kt49847_sam_Any.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_sam_Int") {
|
||||
annotatedSource = project.file('filecheck/kt49847_sam_Int.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_sam_Any_generic") {
|
||||
annotatedSource = project.file('filecheck/kt49847_sam_Any_generic.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_sam_Int_generic") {
|
||||
annotatedSource = project.file('filecheck/kt49847_sam_Int_generic.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_class") {
|
||||
annotatedSource = project.file('filecheck/kt49847_class.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_generic") {
|
||||
annotatedSource = project.file('filecheck/kt49847_generic.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt49847_generic_receiver") {
|
||||
annotatedSource = project.file('filecheck/kt49847_generic_receiver.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt58654") {
|
||||
annotatedSource = project.file('filecheck/kt58654.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_inline_unbox") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_inline_unbox.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
if (isAppleTarget(project)) {
|
||||
checkPrefix = "CHECK-APPLE"
|
||||
}
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_value_unbox") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_value_unbox.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_CPointer.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_CPointer.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_NativePointed.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_NativePointed.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_NonNullNativePtr.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_NonNullNativePtr.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_StableRef") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_StableRef.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_UByteArray.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_UByteArray.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_UIntArray.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_UIntArray.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_ULongArray.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_ULongArray.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53261_noinline_UShortArray.kt") {
|
||||
annotatedSource = project.file('filecheck/kt53261/kt53261_noinline_UShortArray.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_intrinsics") {
|
||||
annotatedSource = project.file('filecheck/intrinsics.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_default_parameters_dont_box") {
|
||||
annotatedSource = project.file('filecheck/default_parameters_dont_box.kt')
|
||||
}
|
||||
|
||||
tasks.register("kt53119_side_effect", KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/stringConcatenationTypeNarrowing/kt53119_side_effect.kt"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53119_plus_generated_noescape") {
|
||||
annotatedSource = project.file('codegen/stringConcatenationTypeNarrowing/kt53119_plus_generated_noescape.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
extraOpts = ["-tr"]
|
||||
}
|
||||
|
||||
tasks.register("kt53119_plus_generated_noescape", KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/stringConcatenationTypeNarrowing/kt53119_plus_generated_noescape.kt"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53119_plus_member") {
|
||||
annotatedSource = project.file('codegen/stringConcatenationTypeNarrowing/kt53119_plus_member.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
extraOpts = ["-tr"]
|
||||
}
|
||||
|
||||
tasks.register("kt53119_plus_member", KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/stringConcatenationTypeNarrowing/kt53119_plus_member.kt"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53119_plus_extension") {
|
||||
annotatedSource = project.file('codegen/stringConcatenationTypeNarrowing/kt53119_plus_extension.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
extraOpts = ["-tr"]
|
||||
}
|
||||
|
||||
tasks.register("kt53119_plus_extension", KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/stringConcatenationTypeNarrowing/kt53119_plus_extension.kt"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53119_append_generated") {
|
||||
annotatedSource = project.file('codegen/stringConcatenationTypeNarrowing/kt53119_append_generated.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
extraOpts = ["-tr"]
|
||||
}
|
||||
|
||||
tasks.register("kt53119_append_generated", KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/stringConcatenationTypeNarrowing/kt53119_append_generated.kt"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_kt53119_append_manual") {
|
||||
annotatedSource = project.file('codegen/stringConcatenationTypeNarrowing/kt53119_append_manual.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
extraOpts = ["-tr"]
|
||||
}
|
||||
|
||||
tasks.register("kt53119_append_manual", KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/stringConcatenationTypeNarrowing/kt53119_append_manual.kt"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_escape_analysis_enabled") {
|
||||
annotatedSource = project.file('filecheck/escape_analysis.kt')
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
checkPrefix = "CHECK-OPT"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_enum_when") {
|
||||
// In case of `-opt` we inline Enum.ordinal due to property inlining.
|
||||
if (project.globalTestArgs.contains('-opt')) {
|
||||
checkPrefix = "CHECK-OPT"
|
||||
}
|
||||
annotatedSource = project.file('filecheck/enum_when.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_escape_analysis_disabled") {
|
||||
annotatedSource = project.file('filecheck/escape_analysis.kt')
|
||||
enabled = project.globalTestArgs.contains('-g')
|
||||
checkPrefix = "CHECK-DEBUG"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_suspend_returnNothing") {
|
||||
annotatedSource = project.file('filecheck/suspend_returnNothing.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_suspend_tailcalls_functions") {
|
||||
annotatedSource = project.file('filecheck/suspend_tailcalls_functions.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_suspend_tailcalls_lambdas") {
|
||||
annotatedSource = project.file('filecheck/suspend_tailcalls_lambdas.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_bce") {
|
||||
enabled = enabled && cacheTesting == null
|
||||
annotatedSource = project.file('filecheck/bce.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_generic_function_references") {
|
||||
enabled = project.globalTestArgs.contains('-opt')
|
||||
annotatedSource = project.file('filecheck/generic_function_references.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_adopted_function_reference") {
|
||||
annotatedSource = project.file('filecheck/adopted_function_reference.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_single_tls_load") {
|
||||
enabled = project.globalTestArgs.contains("-opt")
|
||||
annotatedSource = project.file('filecheck/single_tls_load.kt')
|
||||
phaseToCheck = "OptimizeTLSDataLoads"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_signext_zeroext0") {
|
||||
annotatedSource = project.file('filecheck/signext_zeroext0.kt')
|
||||
if (project.testTarget == 'mingw_x64') {
|
||||
checkPrefix = "CHECK-WINDOWSX64"
|
||||
} else if (!target.family.appleFamily && target.architecture == Architecture.ARM64) {
|
||||
checkPrefix = "CHECK-AAPCS"
|
||||
}
|
||||
}
|
||||
|
||||
createInterop("filecheck_signext_zeroext_interop_input") {
|
||||
it.defFile 'filecheck/signext_zeroext_interop_input.def'
|
||||
}
|
||||
@@ -6210,17 +5957,6 @@ fileCheckTest("filecheck_signext_zeroext_objc_export") {
|
||||
enabled = target.family.appleFamily
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_function_attributes_at_callsite") {
|
||||
// attributes for caller and callee might be the same so we allow overlapping.
|
||||
additionalFileCheckFlags = ["--allow-deprecated-dag-overlap"]
|
||||
annotatedSource = project.file('filecheck/function_attributes_at_callsite.kt')
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_constants_merge") {
|
||||
annotatedSource = project.file('filecheck/constants_merge.kt')
|
||||
}
|
||||
|
||||
|
||||
fileCheckTest("filecheck_objc_direct") {
|
||||
enabled = enabled && cacheTesting == null
|
||||
annotatedSource = project.file('filecheck/objc_direct.kt')
|
||||
@@ -6228,10 +5964,6 @@ fileCheckTest("filecheck_objc_direct") {
|
||||
enabled = target.family.appleFamily
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_atomics") {
|
||||
annotatedSource = project.file('filecheck/atomics.kt')
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
nopPluginApi kotlinCompilerModule
|
||||
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_append_generated
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyMaybeAny
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyMaybeAny(maybeAny1: Any?, maybeAny2: Any?): String {
|
||||
return "$maybeAny1,$maybeAny2"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyMaybeString
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyMaybeString(maybeAny1: Any?, maybeString2: String?): String {
|
||||
return "$maybeAny1,$maybeString2"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyString
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyString(maybeAny1: Any?, string: String): String {
|
||||
return "$maybeAny1,$string"
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyFoo
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyFoo(maybeAny: Any?, foo: Foo): String {
|
||||
return "$maybeAny,$foo"
|
||||
}
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated#maybeAnyMaybeFoo
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun maybeAnyMaybeFoo(maybeAny: Any?, foo: Foo?): String {
|
||||
return "$maybeAny,$foo"
|
||||
}
|
||||
@Test
|
||||
fun runTest() {
|
||||
val foo = Foo(42)
|
||||
println(maybeAnyMaybeAny(foo, foo))
|
||||
println(maybeAnyMaybeAny(null, null))
|
||||
println(maybeAnyMaybeString(foo, "bar"))
|
||||
println(maybeAnyMaybeString(null, null))
|
||||
println(maybeAnyString(foo, "bar"))
|
||||
println(maybeAnyString(null, "bar"))
|
||||
println(maybeAnyFoo(foo, foo))
|
||||
println(maybeAnyFoo(null, foo))
|
||||
println(maybeAnyMaybeFoo(foo, foo))
|
||||
println(maybeAnyMaybeFoo(foo, null))
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
Foo(bar=42),Foo(bar=42)
|
||||
null,null
|
||||
Foo(bar=42),bar
|
||||
null,null
|
||||
Foo(bar=42),bar
|
||||
null,bar
|
||||
Foo(bar=42),Foo(bar=42)
|
||||
null,Foo(bar=42)
|
||||
Foo(bar=42),Foo(bar=42)
|
||||
Foo(bar=42),null
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_append_manual
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendMaybeAny(kotlin.Any?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendMaybeAny(maybeAny: Any?): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(maybeAny)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendAny(kotlin.Any)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendAny(any: Any): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(any)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendMaybeString(kotlin.String?)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendMaybeString(maybeStr: String?): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(maybeStr)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendString(kotlin.String)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendString(str: String): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(str)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendFoo(codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo)
|
||||
// CHECK: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
|
||||
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun appendFoo(foo: Foo): String {
|
||||
val sb = kotlin.text.StringBuilder()
|
||||
sb.append(foo)
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
val foo = Foo(42)
|
||||
println(appendMaybeAny(foo))
|
||||
println(appendMaybeAny(null))
|
||||
println(appendAny(foo))
|
||||
println(appendMaybeString("foo"))
|
||||
println(appendMaybeString(null))
|
||||
println(appendString("foo"))
|
||||
println(appendFoo(foo))
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
Foo(bar=42)
|
||||
null
|
||||
Foo(bar=42)
|
||||
foo
|
||||
null
|
||||
foo
|
||||
Foo(bar=42)
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#manualPlusExtensionAny
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusExtensionAny(maybeStr: String?, maybeAny: kotlin.Any?): kotlin.String =
|
||||
maybeStr + maybeAny
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#manualPlusExtensionString
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusExtensionString(maybeStr: String?, str: String): kotlin.String =
|
||||
maybeStr + str
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionAny
|
||||
// CHECK-NOT: kfun:kotlin#plus__at__kotlin.String?(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: kfun:kotlin#plus__at__kotlin.String?(kotlin.Any?)
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionAny(maybeStr: String?, maybeAny: Any?): String {
|
||||
return "$maybeStr$maybeAny"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionString
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionString(maybeStr: String?, str: String): String {
|
||||
return "$maybeStr$str"
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionFoo
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionFoo(maybeStr: String?, foo: Foo): String {
|
||||
return "$maybeStr$foo"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension#generatedPlusExtensionMaybeFoo
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_extension.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusExtensionMaybeFoo(maybeStr: String?, foo: Foo?): String {
|
||||
return "$maybeStr$foo"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
val foo = Foo(42)
|
||||
println(manualPlusExtensionAny("foo", foo))
|
||||
println(manualPlusExtensionAny(null, null))
|
||||
println(manualPlusExtensionString("foo", "bar"))
|
||||
println(manualPlusExtensionString(null, "bar"))
|
||||
println(generatedPlusExtensionAny("foo", foo))
|
||||
println(generatedPlusExtensionAny(null, null))
|
||||
println(generatedPlusExtensionString("foo", "bar"))
|
||||
println(generatedPlusExtensionString(null, "bar"))
|
||||
println(generatedPlusExtensionFoo(null, Foo(42)))
|
||||
println(generatedPlusExtensionMaybeFoo("foo", Foo(42)))
|
||||
println(generatedPlusExtensionMaybeFoo("foo", null))
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fooFoo(bar=42)
|
||||
nullnull
|
||||
foobar
|
||||
nullbar
|
||||
fooFoo(bar=42)
|
||||
nullnull
|
||||
foobar
|
||||
nullbar
|
||||
nullFoo(bar=42)
|
||||
fooFoo(bar=42)
|
||||
foonull
|
||||
-1
@@ -1 +0,0 @@
|
||||
42153
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_plus_member
|
||||
import kotlin.test.*
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberAny
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusMemberAny(str: String, maybeAny: kotlin.Any?): kotlin.String =
|
||||
str + maybeAny
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberString
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun manualPlusMemberString(str1: String, str2: String): kotlin.String =
|
||||
str1 + str2
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#generatedPlusMemberAny
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusMemberAny(str: String, maybeAny: Any?): String {
|
||||
return "$str$maybeAny"
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#generatedPlusMemberString
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
|
||||
// CHECK-NOT: call %struct.ObjHeader* @"kfun:kotlin.String#toString(){}kotlin.String"
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
|
||||
fun generatedPlusMemberString(str1: String, str2: String): String {
|
||||
return "$str1$str2"
|
||||
}
|
||||
|
||||
data class Foo(val bar: Int)
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberFoo
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT Foo#toString(){}kotlin.String
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
fun manualPlusMemberFoo(str1: String, foo: Foo): kotlin.String =
|
||||
str1 + foo
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberMaybeFoo
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT Foo#toString(){}kotlin.String
|
||||
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member.Foo#toString
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
// CHECK-NOT: kfun:kotlin.String#plus(kotlin.Any?)
|
||||
// CHECK: call %struct.ObjHeader* @Kotlin_String_plusImpl
|
||||
// CHECK-NOT: Foo#toString(){}kotlin.String"
|
||||
|
||||
// CHECK: ret %struct.ObjHeader*
|
||||
fun manualPlusMemberMaybeFoo(str1: String, foo: Foo?): kotlin.String =
|
||||
str1 + foo
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
val foo = Foo(42)
|
||||
println(manualPlusMemberAny("foo", foo))
|
||||
println(manualPlusMemberAny("foo", null))
|
||||
println(manualPlusMemberString("foo", "bar"))
|
||||
println(generatedPlusMemberAny("foo", null))
|
||||
println(generatedPlusMemberAny("foo", foo))
|
||||
println(generatedPlusMemberString("foo", "bar"))
|
||||
println(manualPlusMemberFoo("foo", Foo(42)))
|
||||
println(manualPlusMemberMaybeFoo("foo", Foo(42)))
|
||||
println(manualPlusMemberMaybeFoo("foo", null))
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
fooFoo(bar=42)
|
||||
foonull
|
||||
foobar
|
||||
foonull
|
||||
fooFoo(bar=42)
|
||||
foobar
|
||||
fooFoo(bar=42)
|
||||
fooFoo(bar=42)
|
||||
foonull
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// The same tests are also tested with FileCheck in folder ../../filecheck/kt53119_*.kt
|
||||
// Please keep them in sync
|
||||
|
||||
package codegen.stringConcatenationTypeNarrowing.kt53119_side_effect
|
||||
import kotlin.test.*
|
||||
|
||||
fun withSideEffect(): String? {
|
||||
println("Side effect")
|
||||
return "Result."
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
println("Retval is: " + withSideEffect())
|
||||
println("Retval is: " + withSideEffect() + "!")
|
||||
println(withSideEffect() + withSideEffect())
|
||||
println(withSideEffect() + withSideEffect() + withSideEffect())
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
Side effect
|
||||
Retval is: Result.
|
||||
Side effect
|
||||
Retval is: Result.!
|
||||
Side effect
|
||||
Side effect
|
||||
Result.Result.
|
||||
Side effect
|
||||
Side effect
|
||||
Side effect
|
||||
Result.Result.Result.
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
inline fun foo(x: () -> Unit): String {
|
||||
x()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun String.id(s: String = this, vararg xs: Int): String = s
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main() {
|
||||
// CHECK-LABEL: entry
|
||||
// CHECK-NOT: call %struct.ObjHeader* @AllocInstance
|
||||
// CHECK-NOT: alloca
|
||||
val x = foo("Fail"::id)
|
||||
println(x)
|
||||
// CHECK-LABEL: epilogue
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
class A(val x: Int)
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main() {
|
||||
// CHECK-DEBUG: call %struct.ObjHeader* @AllocInstance
|
||||
// CHECK-OPT: alloca %"kclassbody:A#internal"
|
||||
val a = A(5)
|
||||
println(a.x)
|
||||
// CHECK-LABEL: epilogue
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
class C {
|
||||
fun foo(x: Int) = x
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
fun main() {
|
||||
val c = C()
|
||||
val fooref = c::foo
|
||||
if( fooref(42) == 42)
|
||||
println("ok")
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
class C<T> {
|
||||
fun foo(x: T) = x
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
fun main() {
|
||||
val c = C<Int>()
|
||||
val fooref = c::foo
|
||||
if( fooref(42) == 42)
|
||||
println("ok")
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun interface Foo {
|
||||
fun bar(x: Int): Any
|
||||
}
|
||||
|
||||
fun baz(x: Any): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// Boxing needs to be used now due to non-devirtualized call
|
||||
// CHECK: Int-box
|
||||
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
|
||||
fun main() {
|
||||
val foo: Foo = Foo(::baz)
|
||||
if( foo.bar(42) == 42 )
|
||||
println("passed")
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun interface Foo<T> {
|
||||
fun bar(x: T): Any
|
||||
}
|
||||
|
||||
fun baz(x: Any): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
fun main() {
|
||||
val foo: Foo<Int> = Foo(::baz)
|
||||
if( foo.bar(42) == 42 )
|
||||
println("passed")
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun interface Foo {
|
||||
fun bar(x: Int): Int
|
||||
}
|
||||
|
||||
fun baz(x: Int): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
fun main() {
|
||||
val foo: Foo = Foo(::baz)
|
||||
if( foo.bar(42) == 42 )
|
||||
println("passed")
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun interface Foo<T> {
|
||||
fun bar(x: T): Int
|
||||
}
|
||||
|
||||
fun baz(x: Any): Int = x.hashCode()
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
fun main() {
|
||||
val foo: Foo<Int> = Foo(::baz)
|
||||
if( foo.bar(42) == 42 )
|
||||
println("passed")
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun plus1(x: Int) = x + 1
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK-NOT: Int-box
|
||||
// CHECK-NOT: Int-unbox
|
||||
// CHECK: ret void
|
||||
fun main() {
|
||||
val ref = ::plus1
|
||||
var y = 0
|
||||
repeat(100000) {
|
||||
y += ref(it) // Should be devirtualized and invoked without boxing/unboxing (`Int-box`/`Int-unbox`)
|
||||
}
|
||||
if (y > 999999)
|
||||
println("y > 999999")
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kotlin.native.concurrent.*
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
fun main(arr: Array<String>) {
|
||||
println(arr.size.toByte() == arr[0].toByte())
|
||||
println(arr.size.toUByte() == arr[0].toUByte())
|
||||
println(arr.size.toShort() == arr[0].toShort())
|
||||
println(arr.size.toUShort() == arr[0].toUShort())
|
||||
println(arr.size.toInt() == arr[0].toInt())
|
||||
println(arr.size.toUInt() == arr[0].toUInt())
|
||||
println(arr.size.toLong() == arr[0].toLong())
|
||||
println(arr.size.toULong() == arr[0].toULong())
|
||||
println(arr.size.toFloat() == arr[0].toFloat())
|
||||
println(arr.size.toDouble() == arr[0].toDouble())
|
||||
println(Char(arr.size) == arr[0][0])
|
||||
println((arr.size == 1) == (arr[0] == "1")) // Boolean
|
||||
|
||||
memScoped {
|
||||
val var1: IntVar = alloc()
|
||||
val var2: IntVar = alloc()
|
||||
println(var1.ptr.rawValue == var2.ptr.rawValue)
|
||||
}
|
||||
|
||||
println(Result.success(arr.size) == Result.success(arr[0].toInt()))
|
||||
println(vectorOf(arr.size, arr.size, arr.size, arr.size) == vectorOf(arr[0].toInt(), arr[0].toInt(), arr[0].toInt(), arr[0].toInt()))
|
||||
|
||||
val w1 = Worker.start()
|
||||
val w2 = Worker.start()
|
||||
println(w1 == w2)
|
||||
|
||||
val f1 = w1.requestTermination()
|
||||
val f2 = w2.requestTermination()
|
||||
println(f1 == f2)
|
||||
|
||||
f1.result
|
||||
f2.result
|
||||
}
|
||||
// CHECK-NOT: {{call|invoke}} i64 @"kfun:kotlin#<Long-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} i64 @"kfun:kotlin#<ULong-unbox>
|
||||
|
||||
// CHECK-NOT: {{call|invoke}} i32 @"kfun:kotlin#<Int-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} i32 @"kfun:kotlin#<UInt-unbox>
|
||||
|
||||
// CHECK-NOT: {{call|invoke}} signext i16 @"kfun:kotlin#<Short-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} zeroext i16 @"kfun:kotlin#<UShort-unbox>
|
||||
|
||||
// CHECK-NOT: {{call|invoke}} signext i8 @"kfun:kotlin#<Byte-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} zeroext i8 @"kfun:kotlin#<UByte-unbox>
|
||||
|
||||
// CHECK-NOT: {{call|invoke}} zeroext i16 @"kfun:kotlin#<Char-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} zeroext i1 @"kfun:kotlin#<Boolean-unbox>
|
||||
|
||||
// CHECK-NOT: {{call|invoke}} double @"kfun:kotlin#<Double-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} float @"kfun:kotlin#<Float-unbox>
|
||||
|
||||
// CHECK-NOT: {{call|invoke}} i8* @"kfun:kotlin.native.internal#<NativePtr-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} i32 @"kfun:kotlin.native.concurrent#<Future-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} i32 @"kfun:kotlin.native.concurrent#<Worker-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} <4 x float> @"kfun:kotlin.native#<Vector128-unbox>
|
||||
// CHECK-NOT: {{call|invoke}} %struct.ObjHeader* @"kfun:kotlin#<Result-unbox>
|
||||
|
||||
// On APPLE targets, generated functions <T>ToNSNumber may contain non-converted invocations of unbox functions.
|
||||
// CHECK-APPLE: {{IntToNSNumber|LongToNSNumber|ByteToNSNumber|ShortToNSNumber|FloatToNSNumber|DoubleToNSNumber}}
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlinx.cinterop.CPointer#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call i8* @"kfun:kotlinx.cinterop#<CPointer-unbox>(kotlin.Any?){}kotlinx.cinterop.CPointer<-1:0>?"
|
||||
|
||||
fun main() = memScoped {
|
||||
val var1: IntVar = alloc()
|
||||
val var2: IntVar = alloc()
|
||||
println(var1.ptr == var2.ptr)
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-LABEL: define i8* @"kfun:kotlinx.cinterop#interpretOpaquePointed(kotlin.native.internal.NativePtr){}kotlinx.cinterop.NativePointed"(i8* %0)
|
||||
// CHECK: call i8* @"kfun:kotlinx.cinterop#<NativePointed-unbox>(kotlin.Any?){}kotlinx.cinterop.NativePointed?"
|
||||
|
||||
fun main() = memScoped {
|
||||
val var1: NativePointed = alloc(4, 4)
|
||||
println(interpretOpaquePointed(var1.rawPtr))
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlin.native.internal.NonNullNativePtr#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call i8* @"kfun:kotlin.native.internal#<NonNullNativePtr-unbox>(kotlin.Any?){}kotlin.native.internal.NonNullNativePtr?"
|
||||
|
||||
fun main() = memScoped {
|
||||
val var1: IntVar = alloc()
|
||||
val var2: IntVar = alloc()
|
||||
// The first one is K1, the second one is K2.
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
println(var1.ptr.value as Any == var2.ptr.value as Any)
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlinx.cinterop.StableRef#equals(kotlin.Any?){}kotlin.Boolean"(i8* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call i8* @"kfun:kotlinx.cinterop#<StableRef-unbox>(kotlin.Any?){}kotlinx.cinterop.StableRef<-1:0>?"
|
||||
|
||||
fun main() {
|
||||
val ref1 = StableRef.create(Any())
|
||||
val ref2 = StableRef.create(Any())
|
||||
println(ref1 == ref2)
|
||||
ref2.dispose()
|
||||
ref1.dispose()
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlin.UByteArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:kotlin#<UByteArray-unbox>(kotlin.Any?){}kotlin.UByteArray?"
|
||||
|
||||
fun main() {
|
||||
val arr1 = UByteArray(10) { it.toUByte() }
|
||||
val arr2 = UByteArray(10) { (it / 2).toUByte() }
|
||||
println(arr1 == arr2)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlin.UIntArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:kotlin#<UIntArray-unbox>(kotlin.Any?){}kotlin.UIntArray?"
|
||||
|
||||
fun main() {
|
||||
val arr1 = UIntArray(10) { it.toUInt() }
|
||||
val arr2 = UIntArray(10) { (it / 2).toUInt() }
|
||||
println(arr1 == arr2)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlin.ULongArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:kotlin#<ULongArray-unbox>(kotlin.Any?){}kotlin.ULongArray?"
|
||||
|
||||
fun main() {
|
||||
val arr1 = ULongArray(10) { it.toULong() }
|
||||
val arr2 = ULongArray(10) { (it / 2).toULong() }
|
||||
println(arr1 == arr2)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:kotlin.UShortArray#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:kotlin#<UShortArray-unbox>(kotlin.Any?){}kotlin.UShortArray?"
|
||||
|
||||
fun main() {
|
||||
val arr1 = UShortArray(10) { it.toUShort() }
|
||||
val arr2 = UShortArray(10) { (it / 2).toUShort() }
|
||||
println(arr1 == arr2)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: define {{zeroext i1|i1}} @"kfun:C#equals(kotlin.Any?){}kotlin.Boolean"(%struct.ObjHeader* %0, %struct.ObjHeader* %1)
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#<C-unbox>(kotlin.Any?){}C?"
|
||||
value class C(val x: Any)
|
||||
// Note: <C-unbox> is also called from bridges for equals, hashCode and toString.
|
||||
|
||||
fun main() {
|
||||
println(C(42) == C(13))
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext %0)
|
||||
// CHECK-LABEL-AAPCS: i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext %0)
|
||||
fun id(arg: Boolean): Boolean {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: signext i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 signext %0)
|
||||
// CHECK-LABEL-AAPCS: i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 %0)
|
||||
fun id(arg: Byte): Byte {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: zeroext i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 zeroext %0)
|
||||
// CHECK-LABEL-AAPCS: i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 %0)
|
||||
fun id(arg: Char): Char {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: signext i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 signext %0)
|
||||
// CHECK-LABEL-AAPCS: i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 %0)
|
||||
fun id(arg: Short): Short {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 %0)
|
||||
// CHECK-LABEL-AAPCS: i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 %0)
|
||||
fun id(arg: Int): Int {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 %0)
|
||||
// CHECK-LABEL-AAPCS: i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 %0)
|
||||
fun id(arg: Long): Long {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: float @"kfun:#id(kotlin.Float){}kotlin.Float"(float %0)
|
||||
// CHECK-LABEL-AAPCS: float @"kfun:#id(kotlin.Float){}kotlin.Float"(float %0)
|
||||
// CHECK-LABEL-WINDOWSX64: float @"kfun:#id(kotlin.Float){}kotlin.Float"(float %0)
|
||||
fun id(arg: Float): Float {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: double @"kfun:#id(kotlin.Double){}kotlin.Double"(double %0)
|
||||
// CHECK-LABEL-AAPCS: double @"kfun:#id(kotlin.Double){}kotlin.Double"(double %0)
|
||||
// CHECK-LABEL-WINDOWSX64: double @"kfun:#id(kotlin.Double){}kotlin.Double"(double %0)
|
||||
fun id(arg: Double): Double {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define zeroext i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 zeroext %0)
|
||||
// CHECK-LABEL-AAPCS: define i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: define i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 %0)
|
||||
fun id(arg: UByte): UByte {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define zeroext i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 zeroext %0)
|
||||
// CHECK-LABEL-AAPCS: define i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: define i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 %0)
|
||||
fun id(arg: UShort): UShort {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 %0)
|
||||
// CHECK-LABEL-AAPCS: define i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: define i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 %0)
|
||||
fun id(arg: UInt): UInt {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 %0)
|
||||
// CHECK-LABEL-AAPCS: define i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: define i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 %0)
|
||||
fun id(arg: ULong): ULong {
|
||||
return arg
|
||||
}
|
||||
|
||||
fun checkPrimitives() {
|
||||
// CHECK: call zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 {{.*}})
|
||||
// CHECK-WINDOWSX64: call zeroext i1 @"kfun:#id(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext {{.*}})
|
||||
id(true)
|
||||
// CHECK: call signext i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 signext {{.*}})
|
||||
// CHECK-AAPCS: call i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i8 @"kfun:#id(kotlin.Byte){}kotlin.Byte"(i8 {{.*}})
|
||||
id(0.toByte())
|
||||
// CHECK: call zeroext i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(kotlin.Char){}kotlin.Char"(i16 {{.*}})
|
||||
id('a')
|
||||
// CHECK: call signext i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 signext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(kotlin.Short){}kotlin.Short"(i16 {{.*}})
|
||||
id(0.toShort())
|
||||
// CHECK: call i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 {{.*}})
|
||||
// CHECK-AAPCS: call i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i32 @"kfun:#id(kotlin.Int){}kotlin.Int"(i32 {{.*}})
|
||||
id(0)
|
||||
// CHECK: call i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 {{.*}})
|
||||
// CHECK-AAPCS: call i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i64 @"kfun:#id(kotlin.Long){}kotlin.Long"(i64 {{.*}})
|
||||
id(0L)
|
||||
// CHECK: call float @"kfun:#id(kotlin.Float){}kotlin.Float"(float {{.*}})
|
||||
// CHECK-AAPCS: call float @"kfun:#id(kotlin.Float){}kotlin.Float"(float {{.*}})
|
||||
// CHECK-WINDOWSX64: call float @"kfun:#id(kotlin.Float){}kotlin.Float"(float {{.*}})
|
||||
id(0.5f)
|
||||
// CHECK: call double @"kfun:#id(kotlin.Double){}kotlin.Double"(double {{.*}})
|
||||
// CHECK-AAPCS: call double @"kfun:#id(kotlin.Double){}kotlin.Double"(double {{.*}})
|
||||
// CHECK-WINDOWSX64: call double @"kfun:#id(kotlin.Double){}kotlin.Double"(double {{.*}})
|
||||
id(0.5)
|
||||
// CHECK: call zeroext i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i8 @"kfun:#id(kotlin.UByte){}kotlin.UByte"(i8 {{.*}})
|
||||
id(0.toUByte())
|
||||
// CHECK: call zeroext i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(kotlin.UShort){}kotlin.UShort"(i16 {{.*}})
|
||||
id(0.toUShort())
|
||||
// CHECK: call i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 {{.*}})
|
||||
// CHECK-AAPCS: call i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i32 @"kfun:#id(kotlin.UInt){}kotlin.UInt"(i32 {{.*}})
|
||||
id(15u)
|
||||
// CHECK: call i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 {{.*}})
|
||||
// CHECK-AAPCS: call i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i64 @"kfun:#id(kotlin.ULong){}kotlin.ULong"(i64 {{.*}})
|
||||
id(15uL)
|
||||
}
|
||||
|
||||
value class CharWrapper(val ch: Char)
|
||||
|
||||
// CHECK-LABEL: zeroext i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 zeroext %0)
|
||||
// CHECK-LABEL-AAPCS: i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 %0)
|
||||
// CHECK-LABEL-WINDOWSX64: i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 %0)
|
||||
fun id(arg: CharWrapper): CharWrapper {
|
||||
return arg
|
||||
}
|
||||
|
||||
// Check that value classes doesn't affect parameter attributes
|
||||
|
||||
fun checkInlineClasses() {
|
||||
// CHECK: call zeroext i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 zeroext {{.*}})
|
||||
// CHECK-AAPCS: call i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 {{.*}})
|
||||
// CHECK-WINDOWSX64: call i16 @"kfun:#id(CharWrapper){}CharWrapper"(i16 {{.*}})
|
||||
id(CharWrapper('c'))
|
||||
}
|
||||
|
||||
// CHECK-LABEL: %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
// CHECK-LABEL-AAPCS: %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
// CHECK-LABEL-WINDOWSX64: %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
fun nullableId(arg: Byte?): Byte? {
|
||||
return arg
|
||||
}
|
||||
|
||||
// CHECK-LABEL: %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
// CHECK-LABEL-AAPCS: %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
// CHECK-LABEL-WINDOWSX64: %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* %0, %struct.ObjHeader** %1)
|
||||
fun nullableId(arg: CharWrapper?): CharWrapper? {
|
||||
return arg
|
||||
}
|
||||
|
||||
// Check that we don't pass primitive-specific attributes to their boxes
|
||||
fun checkBoxes() {
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
// CHECK-AAPCS: call %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
// CHECK-WINDOWSX64: call %struct.ObjHeader* @"kfun:#nullableId(kotlin.Byte?){}kotlin.Byte?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
nullableId(1.toByte())
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
// CHECK-AAPCS: call %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
// CHECK-WINDOWSX64: call %struct.ObjHeader* @"kfun:#nullableId(CharWrapper?){}CharWrapper?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}})
|
||||
nullableId(CharWrapper('a'))
|
||||
}
|
||||
|
||||
// CHECK-LABEL: void @"kfun:#main(){}"()
|
||||
// CHECK-LABEL-AAPCS: void @"kfun:#main(){}"()
|
||||
// CHECK-LABEL-WINDOWSX64: void @"kfun:#main(){}"()
|
||||
fun main() {
|
||||
checkPrimitives()
|
||||
checkInlineClasses()
|
||||
checkBoxes()
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
class Wrapper(x: Int)
|
||||
|
||||
// CHECK-LABEL: "kfun:#f(kotlin.Int;kotlin.String){}kotlin.String"
|
||||
fun f(x: Int, s: String): String {
|
||||
// CHECK: _ZN6kotlin2mm14ThreadRegistry22currentThreadDataNode_E
|
||||
// CHECK-NOT: _ZN6kotlin2mm14ThreadRegistry22currentThreadDataNode_E
|
||||
if (x < 0) throw IllegalStateException()
|
||||
if (x > 0) return f(x - 1, s)
|
||||
val b = Wrapper(2)
|
||||
val a = listOf(x, x, Wrapper(1), 2, x)
|
||||
return buildString {
|
||||
for (i in a) { appendLine("$s i") }
|
||||
}
|
||||
// CHECK: {{^}$}}
|
||||
}
|
||||
|
||||
fun main() { println(f(10, "123456")) }
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// CHECK-LABEL: "kfun:#id(kotlin.Any?){}kotlin.Any?"
|
||||
fun id(a: Any?): Any? {
|
||||
return a
|
||||
// CHECK-LABEL: epilogue
|
||||
}
|
||||
|
||||
// CHECK-LABEL: "kfun:#main(){}"
|
||||
fun main() {
|
||||
// CHECK: call %struct.ObjHeader* @"kfun:#id(kotlin.Any?){}kotlin.Any?"
|
||||
val x = id("Hello")
|
||||
// CHECK: call void @"kfun:kotlin.io#println(kotlin.Any?){}"(%struct.ObjHeader* {{.*}})
|
||||
println(x)
|
||||
// CHECK-LABEL: epilogue
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
var i = 1
|
||||
fun main() {
|
||||
println(when(i) {
|
||||
0 -> 10
|
||||
1 -> 11
|
||||
2 -> 12
|
||||
else -> 13
|
||||
})
|
||||
}
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
// CHECK: when_case
|
||||
// CHECK: when_next
|
||||
// CHECK: when_case1
|
||||
// CHECK: when_next2
|
||||
// CHECK: when_case3
|
||||
// CHECK: when_next4
|
||||
// CHECK: when_exit
|
||||
// CHECK: call void @"kfun:kotlin.io#println(kotlin.Any?)
|
||||
// CHECK: ret void
|
||||
+309
@@ -15025,6 +15025,315 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class FileCheck {
|
||||
@Test
|
||||
@TestMetadata("adopted_function_reference.kt")
|
||||
public void testAdopted_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/adopted_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("atomics.kt")
|
||||
public void testAtomics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/atomics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("bce.kt")
|
||||
public void testBce() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/bce.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constants_merge.kt")
|
||||
public void testConstants_merge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/constants_merge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("default_parameters_dont_box.kt")
|
||||
public void testDefault_parameters_dont_box() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/default_parameters_dont_box.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum_when.kt")
|
||||
public void testEnum_when() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/enum_when.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("escape_analysis.kt")
|
||||
public void testEscape_analysis() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/escape_analysis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("force_arm_instruction_set.kt")
|
||||
public void testForce_arm_instruction_set() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/force_arm_instruction_set.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function_attributes_at_callsite.kt")
|
||||
public void testFunction_attributes_at_callsite() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/function_attributes_at_callsite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("generic_function_references.kt")
|
||||
public void testGeneric_function_references() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/generic_function_references.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intrinsics.kt")
|
||||
public void testIntrinsics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/intrinsics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_class.kt")
|
||||
public void testKt49847_class() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic.kt")
|
||||
public void testKt49847_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic_receiver.kt")
|
||||
public void testKt49847_generic_receiver() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic_receiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any.kt")
|
||||
public void testKt49847_sam_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any_generic.kt")
|
||||
public void testKt49847_sam_Any_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int.kt")
|
||||
public void testKt49847_sam_Int() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int_generic.kt")
|
||||
public void testKt49847_sam_Int_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_simple_function_reference.kt")
|
||||
public void testKt49847_simple_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_simple_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt58654.kt")
|
||||
public void testKt58654() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt58654.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("no_frame_on_constant_object_access.kt")
|
||||
public void testNo_frame_on_constant_object_access() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/replace_invoke_with_call.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("signext_zeroext0.kt")
|
||||
public void testSignext_zeroext0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/signext_zeroext0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("single_tls_load.kt")
|
||||
public void testSingle_tls_load() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/single_tls_load.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0.kt")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/smoke0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_returnNothing.kt")
|
||||
public void testSuspend_returnNothing() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_returnNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_functions.kt")
|
||||
public void testSuspend_tailcalls_functions() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_functions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_lambdas.kt")
|
||||
public void testSuspend_tailcalls_lambdas() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_lambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/when.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_inline_unbox.kt")
|
||||
public void testKt53261_inline_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_inline_unbox.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_CPointer.kt")
|
||||
public void testKt53261_noinline_CPointer() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_CPointer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NativePointed.kt")
|
||||
public void testKt53261_noinline_NativePointed() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NativePointed.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NonNullNativePtr.kt")
|
||||
public void testKt53261_noinline_NonNullNativePtr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NonNullNativePtr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_StableRef.kt")
|
||||
public void testKt53261_noinline_StableRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_StableRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UByteArray.kt")
|
||||
public void testKt53261_noinline_UByteArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UByteArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UIntArray.kt")
|
||||
public void testKt53261_noinline_UIntArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UIntArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_ULongArray.kt")
|
||||
public void testKt53261_noinline_ULongArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_ULongArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UShortArray.kt")
|
||||
public void testKt53261_noinline_UShortArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UShortArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_value_unbox.kt")
|
||||
public void testKt53261_noinline_value_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_value_unbox.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_generated.kt")
|
||||
public void testKt53119_append_generated() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_generated.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_manual.kt")
|
||||
public void testKt53119_append_manual() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_manual.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_extension.kt")
|
||||
public void testKt53119_plus_extension() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_extension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_generated_noescape.kt")
|
||||
public void testKt53119_plus_generated_noescape() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_generated_noescape.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_member.kt")
|
||||
public void testKt53119_plus_member() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_member.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+315
@@ -15383,6 +15383,321 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
@TestMetadata("adopted_function_reference.kt")
|
||||
public void testAdopted_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/adopted_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("atomics.kt")
|
||||
public void testAtomics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/atomics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("bce.kt")
|
||||
public void testBce() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/bce.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constants_merge.kt")
|
||||
public void testConstants_merge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/constants_merge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("default_parameters_dont_box.kt")
|
||||
public void testDefault_parameters_dont_box() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/default_parameters_dont_box.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum_when.kt")
|
||||
public void testEnum_when() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/enum_when.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("escape_analysis.kt")
|
||||
public void testEscape_analysis() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/escape_analysis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("force_arm_instruction_set.kt")
|
||||
public void testForce_arm_instruction_set() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/force_arm_instruction_set.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function_attributes_at_callsite.kt")
|
||||
public void testFunction_attributes_at_callsite() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/function_attributes_at_callsite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("generic_function_references.kt")
|
||||
public void testGeneric_function_references() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/generic_function_references.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intrinsics.kt")
|
||||
public void testIntrinsics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/intrinsics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_class.kt")
|
||||
public void testKt49847_class() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic.kt")
|
||||
public void testKt49847_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic_receiver.kt")
|
||||
public void testKt49847_generic_receiver() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic_receiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any.kt")
|
||||
public void testKt49847_sam_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any_generic.kt")
|
||||
public void testKt49847_sam_Any_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int.kt")
|
||||
public void testKt49847_sam_Int() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int_generic.kt")
|
||||
public void testKt49847_sam_Int_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_simple_function_reference.kt")
|
||||
public void testKt49847_simple_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_simple_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt58654.kt")
|
||||
public void testKt58654() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt58654.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("no_frame_on_constant_object_access.kt")
|
||||
public void testNo_frame_on_constant_object_access() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/replace_invoke_with_call.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("signext_zeroext0.kt")
|
||||
public void testSignext_zeroext0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/signext_zeroext0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("single_tls_load.kt")
|
||||
public void testSingle_tls_load() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/single_tls_load.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0.kt")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/smoke0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_returnNothing.kt")
|
||||
public void testSuspend_returnNothing() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_returnNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_functions.kt")
|
||||
public void testSuspend_tailcalls_functions() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_functions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_lambdas.kt")
|
||||
public void testSuspend_tailcalls_lambdas() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_lambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/when.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_inline_unbox.kt")
|
||||
public void testKt53261_inline_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_inline_unbox.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_CPointer.kt")
|
||||
public void testKt53261_noinline_CPointer() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_CPointer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NativePointed.kt")
|
||||
public void testKt53261_noinline_NativePointed() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NativePointed.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NonNullNativePtr.kt")
|
||||
public void testKt53261_noinline_NonNullNativePtr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NonNullNativePtr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_StableRef.kt")
|
||||
public void testKt53261_noinline_StableRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_StableRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UByteArray.kt")
|
||||
public void testKt53261_noinline_UByteArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UByteArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UIntArray.kt")
|
||||
public void testKt53261_noinline_UIntArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UIntArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_ULongArray.kt")
|
||||
public void testKt53261_noinline_ULongArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_ULongArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UShortArray.kt")
|
||||
public void testKt53261_noinline_UShortArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UShortArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_value_unbox.kt")
|
||||
public void testKt53261_noinline_value_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_value_unbox.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_generated.kt")
|
||||
public void testKt53119_append_generated() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_generated.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_manual.kt")
|
||||
public void testKt53119_append_manual() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_manual.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_extension.kt")
|
||||
public void testKt53119_plus_extension() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_extension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_generated_noescape.kt")
|
||||
public void testKt53119_plus_generated_noescape() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_generated_noescape.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_member.kt")
|
||||
public void testKt53119_plus_member() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_member.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+306
@@ -14847,6 +14847,312 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@DisabledTestsIfProperty(sourceLocations = { "compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt", "compiler/testData/codegen/box/multiplatform/defaultArguments/*.kt", "compiler/testData/codegen/box/multiplatform/migratedOldTests/*.kt", "compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt" }, property = ClassLevelProperty.TEST_MODE, propertyValue = "ONE_STAGE_MULTI_MODULE")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
@TestMetadata("adopted_function_reference.kt")
|
||||
public void testAdopted_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/adopted_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("atomics.kt")
|
||||
public void testAtomics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/atomics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("bce.kt")
|
||||
public void testBce() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/bce.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constants_merge.kt")
|
||||
public void testConstants_merge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/constants_merge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("default_parameters_dont_box.kt")
|
||||
public void testDefault_parameters_dont_box() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/default_parameters_dont_box.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum_when.kt")
|
||||
public void testEnum_when() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/enum_when.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("escape_analysis.kt")
|
||||
public void testEscape_analysis() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/escape_analysis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("force_arm_instruction_set.kt")
|
||||
public void testForce_arm_instruction_set() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/force_arm_instruction_set.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function_attributes_at_callsite.kt")
|
||||
public void testFunction_attributes_at_callsite() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/function_attributes_at_callsite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("generic_function_references.kt")
|
||||
public void testGeneric_function_references() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/generic_function_references.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intrinsics.kt")
|
||||
public void testIntrinsics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/intrinsics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_class.kt")
|
||||
public void testKt49847_class() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic.kt")
|
||||
public void testKt49847_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic_receiver.kt")
|
||||
public void testKt49847_generic_receiver() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic_receiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any.kt")
|
||||
public void testKt49847_sam_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any_generic.kt")
|
||||
public void testKt49847_sam_Any_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int.kt")
|
||||
public void testKt49847_sam_Int() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int_generic.kt")
|
||||
public void testKt49847_sam_Int_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_simple_function_reference.kt")
|
||||
public void testKt49847_simple_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_simple_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt58654.kt")
|
||||
public void testKt58654() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt58654.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("no_frame_on_constant_object_access.kt")
|
||||
public void testNo_frame_on_constant_object_access() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/replace_invoke_with_call.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("signext_zeroext0.kt")
|
||||
public void testSignext_zeroext0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/signext_zeroext0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("single_tls_load.kt")
|
||||
public void testSingle_tls_load() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/single_tls_load.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0.kt")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/smoke0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_returnNothing.kt")
|
||||
public void testSuspend_returnNothing() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_returnNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_functions.kt")
|
||||
public void testSuspend_tailcalls_functions() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_functions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_lambdas.kt")
|
||||
public void testSuspend_tailcalls_lambdas() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_lambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/when.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@DisabledTestsIfProperty(sourceLocations = { "compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt", "compiler/testData/codegen/box/multiplatform/defaultArguments/*.kt", "compiler/testData/codegen/box/multiplatform/migratedOldTests/*.kt", "compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt" }, property = ClassLevelProperty.TEST_MODE, propertyValue = "ONE_STAGE_MULTI_MODULE")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_inline_unbox.kt")
|
||||
public void testKt53261_inline_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_inline_unbox.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_CPointer.kt")
|
||||
public void testKt53261_noinline_CPointer() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_CPointer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NativePointed.kt")
|
||||
public void testKt53261_noinline_NativePointed() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NativePointed.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NonNullNativePtr.kt")
|
||||
public void testKt53261_noinline_NonNullNativePtr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NonNullNativePtr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_StableRef.kt")
|
||||
public void testKt53261_noinline_StableRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_StableRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UByteArray.kt")
|
||||
public void testKt53261_noinline_UByteArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UByteArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UIntArray.kt")
|
||||
public void testKt53261_noinline_UIntArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UIntArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_ULongArray.kt")
|
||||
public void testKt53261_noinline_ULongArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_ULongArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UShortArray.kt")
|
||||
public void testKt53261_noinline_UShortArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UShortArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_value_unbox.kt")
|
||||
public void testKt53261_noinline_value_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_value_unbox.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@DisabledTestsIfProperty(sourceLocations = { "compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt", "compiler/testData/codegen/box/multiplatform/defaultArguments/*.kt", "compiler/testData/codegen/box/multiplatform/migratedOldTests/*.kt", "compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt" }, property = ClassLevelProperty.TEST_MODE, propertyValue = "ONE_STAGE_MULTI_MODULE")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_generated.kt")
|
||||
public void testKt53119_append_generated() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_generated.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_manual.kt")
|
||||
public void testKt53119_append_manual() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_manual.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_extension.kt")
|
||||
public void testKt53119_plus_extension() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_extension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_generated_noescape.kt")
|
||||
public void testKt53119_plus_generated_noescape() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_generated_noescape.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_member.kt")
|
||||
public void testKt53119_plus_member() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_member.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+309
@@ -15026,6 +15026,315 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class FileCheck {
|
||||
@Test
|
||||
@TestMetadata("adopted_function_reference.kt")
|
||||
public void testAdopted_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/adopted_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInFileCheck() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("atomics.kt")
|
||||
public void testAtomics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/atomics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("bce.kt")
|
||||
public void testBce() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/bce.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constants_merge.kt")
|
||||
public void testConstants_merge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/constants_merge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("default_parameters_dont_box.kt")
|
||||
public void testDefault_parameters_dont_box() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/default_parameters_dont_box.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum_when.kt")
|
||||
public void testEnum_when() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/enum_when.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("escape_analysis.kt")
|
||||
public void testEscape_analysis() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/escape_analysis.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("force_arm_instruction_set.kt")
|
||||
public void testForce_arm_instruction_set() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/force_arm_instruction_set.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function_attributes_at_callsite.kt")
|
||||
public void testFunction_attributes_at_callsite() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/function_attributes_at_callsite.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("generic_function_references.kt")
|
||||
public void testGeneric_function_references() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/generic_function_references.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intrinsics.kt")
|
||||
public void testIntrinsics() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/intrinsics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_class.kt")
|
||||
public void testKt49847_class() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic.kt")
|
||||
public void testKt49847_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_generic_receiver.kt")
|
||||
public void testKt49847_generic_receiver() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_generic_receiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any.kt")
|
||||
public void testKt49847_sam_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Any_generic.kt")
|
||||
public void testKt49847_sam_Any_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Any_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int.kt")
|
||||
public void testKt49847_sam_Int() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_sam_Int_generic.kt")
|
||||
public void testKt49847_sam_Int_generic() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_sam_Int_generic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49847_simple_function_reference.kt")
|
||||
public void testKt49847_simple_function_reference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt49847_simple_function_reference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt58654.kt")
|
||||
public void testKt58654() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt58654.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("no_frame_on_constant_object_access.kt")
|
||||
public void testNo_frame_on_constant_object_access() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/replace_invoke_with_call.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("signext_zeroext0.kt")
|
||||
public void testSignext_zeroext0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/signext_zeroext0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("single_tls_load.kt")
|
||||
public void testSingle_tls_load() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/single_tls_load.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0.kt")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/smoke0.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_returnNothing.kt")
|
||||
public void testSuspend_returnNothing() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_returnNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_functions.kt")
|
||||
public void testSuspend_tailcalls_functions() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_functions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspend_tailcalls_lambdas.kt")
|
||||
public void testSuspend_tailcalls_lambdas() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/suspend_tailcalls_lambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/when.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/kt53261")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Kt53261 {
|
||||
@Test
|
||||
public void testAllFilesPresentInKt53261() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/kt53261"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_inline_unbox.kt")
|
||||
public void testKt53261_inline_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_inline_unbox.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_CPointer.kt")
|
||||
public void testKt53261_noinline_CPointer() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_CPointer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NativePointed.kt")
|
||||
public void testKt53261_noinline_NativePointed() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NativePointed.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_NonNullNativePtr.kt")
|
||||
public void testKt53261_noinline_NonNullNativePtr() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_NonNullNativePtr.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_StableRef.kt")
|
||||
public void testKt53261_noinline_StableRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_StableRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UByteArray.kt")
|
||||
public void testKt53261_noinline_UByteArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UByteArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UIntArray.kt")
|
||||
public void testKt53261_noinline_UIntArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UIntArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_ULongArray.kt")
|
||||
public void testKt53261_noinline_ULongArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_ULongArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_UShortArray.kt")
|
||||
public void testKt53261_noinline_UShortArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_UShortArray.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53261_noinline_value_unbox.kt")
|
||||
public void testKt53261_noinline_value_unbox() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/kt53261/kt53261_noinline_value_unbox.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class StringConcatenationTypeNarrowing {
|
||||
@Test
|
||||
public void testAllFilesPresentInStringConcatenationTypeNarrowing() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_generated.kt")
|
||||
public void testKt53119_append_generated() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_generated.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_append_manual.kt")
|
||||
public void testKt53119_append_manual() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_append_manual.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_extension.kt")
|
||||
public void testKt53119_plus_extension() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_extension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_generated_noescape.kt")
|
||||
public void testKt53119_plus_generated_noescape() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_generated_noescape.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_plus_member.kt")
|
||||
public void testKt53119_plus_member() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_plus_member.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53119_side_effect.kt")
|
||||
public void testKt53119_side_effect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/stringConcatenationTypeNarrowing/kt53119_side_effect.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/finally")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+2
-1
@@ -188,7 +188,8 @@ internal class TestCase(
|
||||
val freeCompilerArgs: TestCompilerArgs,
|
||||
val nominalPackageName: PackageName,
|
||||
val checks: TestRunChecks,
|
||||
val extras: Extras
|
||||
val extras: Extras,
|
||||
val fileCheckStage: String? = null, // KT-62157: TODO move it to extras
|
||||
) {
|
||||
sealed interface Extras
|
||||
class NoTestRunnerExtras(val entryPoint: String, val inputDataFile: File? = null, val arguments: List<String> = emptyList()) : Extras
|
||||
|
||||
+4
@@ -144,6 +144,10 @@ internal object TestDirectives : SimpleDirectivesContainer() {
|
||||
val FIR_IDENTICAL by directive(
|
||||
description = "Test behavior should be identical for FIR testing"
|
||||
)
|
||||
|
||||
val FILECHECK_STAGE by stringDirective(
|
||||
description = "Specify a LLVM stage to dump LLVM IR after, and check it with LLVM FileCheck using its directives in test file"
|
||||
)
|
||||
}
|
||||
|
||||
internal enum class TestKind {
|
||||
|
||||
+10
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.konan.properties.resolvablePropertyList
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.*
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestCase.*
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestModule.Companion.allDependsOn
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ExecutableCompilation.Companion.applyFileCheckArgs
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ExecutableCompilation.Companion.applyPartialLinkageArgs
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ExecutableCompilation.Companion.applyTestRunnerSpecificArgs
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ExecutableCompilation.Companion.assertTestDumpFileNotEmptyIfExists
|
||||
@@ -362,6 +363,7 @@ internal class ExecutableCompilation(
|
||||
}
|
||||
}
|
||||
applyPartialLinkageArgs(partialLinkageConfig)
|
||||
applyFileCheckArgs(expectedArtifact.fileCheckStage, expectedArtifact.fileCheckDump)
|
||||
super.applySpecificArgs(argsBuilder)
|
||||
}
|
||||
|
||||
@@ -403,6 +405,13 @@ internal class ExecutableCompilation(
|
||||
add("-Xpartial-linkage-loglevel=${logLevel.name.lowercase()}")
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ArgsBuilder.applyFileCheckArgs(fileCheckStage: String?, fileCheckDump: File?) =
|
||||
fileCheckStage?.let {
|
||||
add("-Xllvm-variant=dev") // FileCheck utility is provided in `LLVM dev`, not `LLVM user`
|
||||
add("-Xsave-llvm-ir-after=$it")
|
||||
add("-Xsave-llvm-ir-directory=${fileCheckDump!!.parent}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,6 +473,7 @@ internal class StaticCacheCompilation(
|
||||
add("-Xmake-per-file-cache")
|
||||
|
||||
applyPartialLinkageArgs(partialLinkageConfig)
|
||||
applyFileCheckArgs(expectedArtifact.fileCheckStage, expectedArtifact.fileCheckDump)
|
||||
}
|
||||
|
||||
override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) {
|
||||
|
||||
+10
-2
@@ -15,14 +15,22 @@ internal sealed interface TestCompilationArtifact {
|
||||
override val logFile: File get() = klibFile.resolveSibling("${klibFile.name}.log")
|
||||
}
|
||||
|
||||
data class KLIBStaticCache(val cacheDir: File, val klib: KLIB) : TestCompilationArtifact {
|
||||
data class KLIBStaticCache(val cacheDir: File, val klib: KLIB, val fileCheckStage: String? = null) : TestCompilationArtifact {
|
||||
override val logFile: File get() = cacheDir.resolve("${klib.klibFile.nameWithoutExtension}-cache.log")
|
||||
val fileCheckDump: File?
|
||||
get() = fileCheckStage?.let {
|
||||
cacheDir.resolveSibling("out.$it.ll")
|
||||
}
|
||||
}
|
||||
|
||||
data class Executable(val executableFile: File) : TestCompilationArtifact {
|
||||
data class Executable(val executableFile: File, val fileCheckStage: String? = null) : TestCompilationArtifact {
|
||||
val path: String get() = executableFile.path
|
||||
override val logFile: File get() = executableFile.resolveSibling("${executableFile.name}.log")
|
||||
val testDumpFile: File get() = executableFile.resolveSibling("${executableFile.name}.dump")
|
||||
val fileCheckDump: File?
|
||||
get() = fileCheckStage?.let {
|
||||
executableFile.resolveSibling("out.$it.ll")
|
||||
}
|
||||
}
|
||||
|
||||
data class ObjCFramework(private val buildDir: File, val frameworkName: String) : TestCompilationArtifact {
|
||||
|
||||
+4
-1
@@ -117,7 +117,10 @@ internal class TestCompilationFactory {
|
||||
// Long pass.
|
||||
val freeCompilerArgs = rootModules.first().testCase.freeCompilerArgs // Should be identical inside the same test case group.
|
||||
val extras = testCases.first().extras // Should be identical inside the same test case group.
|
||||
val executableArtifact = Executable(settings.artifactFileForExecutable(rootModules))
|
||||
val fileCheckStage = testCases.map { it.fileCheckStage }.singleOrNull()
|
||||
if (fileCheckStage != null)
|
||||
require(testCases.size == 1) { "FILECHECK-enabled test must be standalone" }
|
||||
val executableArtifact = Executable(settings.artifactFileForExecutable(rootModules), fileCheckStage)
|
||||
|
||||
val (
|
||||
dependenciesToCompileExecutable: Iterable<CompiledDependency<*>>,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user