diff --git a/compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt b/compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt index 4ebfe630870..d8e77719264 100644 --- a/compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt +++ b/compiler/testData/codegen/box/inlineClasses/functionNameMangling/reflectionForLocalClassInFunctionWithMangledName.kt @@ -12,10 +12,15 @@ fun test(s: S) { val localKClass = Local::class val localJClass = localKClass.java - assertEquals("test\$Local", localKClass.simpleName) + val kName = localKClass.simpleName + // See https://youtrack.jetbrains.com/issue/KT-29413 + // assertEquals("Local", kName) + if (kName != "Local" && kName != "test\$Local") throw AssertionError("Fail KClass: $kName") assertTrue { localJClass.isLocalClass } - assertEquals("test\$Local", localJClass.simpleName) + + val jName = localJClass.simpleName + if (jName != "Local" && jName != "test\$Local") throw AssertionError("Fail java.lang.Class: $jName") } fun box(): String { diff --git a/compiler/testData/codegen/box/jvmName/annotationProperties.kt b/compiler/testData/codegen/box/jvmName/annotationProperties.kt index b3c951f952f..0abad7e239e 100644 --- a/compiler/testData/codegen/box/jvmName/annotationProperties.kt +++ b/compiler/testData/codegen/box/jvmName/annotationProperties.kt @@ -2,6 +2,7 @@ // WITH_REFLECT import kotlin.test.assertEquals +import kotlin.test.assertTrue annotation class Anno(@get:JvmName("uglyJvmName") val value: String) @@ -17,11 +18,11 @@ fun bar() {} fun box(): String { val f = Foo::class.annotations.single() - assertEquals("@Anno(uglyJvmName=OK)", f.toString()) + assertTrue("@Anno\\(uglyJvmName=\"?OK\"?\\)".toRegex().matches(f.toString())) assertEquals("OK", (f as Anno).value) val b = ::bar.annotations.single() - assertEquals("@Meta(anno=@Anno(uglyJvmName=OK))", b.toString()) + assertEquals("@Meta(anno=$f)", b.toString()) assertEquals("OK", (b as Meta).anno.value) return "OK" diff --git a/compiler/testData/codegen/box/reflection/annotations/classLiteralWithVoidDefault.kt b/compiler/testData/codegen/box/reflection/annotations/classLiteralWithVoidDefault.kt index de85d4e6cbe..f3e631af95d 100644 --- a/compiler/testData/codegen/box/reflection/annotations/classLiteralWithVoidDefault.kt +++ b/compiler/testData/codegen/box/reflection/annotations/classLiteralWithVoidDefault.kt @@ -12,7 +12,7 @@ public @interface Anno { // FILE: test.kt -import kotlin.test.assertEquals +import kotlin.test.assertTrue class C { @Anno @@ -23,7 +23,7 @@ class C { } fun box(): String { - assertEquals("[@Anno(value=void)]", C::f1.annotations.toString()) - assertEquals("[@Anno(value=class java.lang.Void)]", C::f2.annotations.toString()) + assertTrue("\\[@Anno\\(value=void(\\.class)?\\)\\]".toRegex().matches(C::f1.annotations.toString())) + assertTrue("\\[@Anno\\(value=(class )?java.lang.Void(\\.class)?\\)\\]".toRegex().matches(C::f2.annotations.toString())) return "OK" } diff --git a/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt b/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt index 2a24b5bd09f..7c1d61b81b0 100644 --- a/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt +++ b/compiler/testData/codegen/box/reflection/createAnnotation/floatingPointParameters.kt @@ -7,6 +7,7 @@ import kotlin.test.assertEquals import kotlin.test.assertNotEquals +import kotlin.test.assertTrue annotation class D(val d: Double) annotation class F(val f: Float) @@ -30,11 +31,14 @@ fun fMinusZero() {} @F(+0.0f) fun fPlusZero() {} -fun check(x: Any, y: Any) { +fun check(x: Any, y: Any, regexString: String) { assertEquals(x, y) assertEquals(y, x) assertEquals(x.hashCode(), y.hashCode()) - assertEquals(x.toString(), y.toString()) + + val regex = regexString.toRegex() + assertTrue(regex.matches(x.toString())) + assertTrue(regex.matches(y.toString())) } fun checkNot(x: Any, y: Any) { @@ -54,10 +58,10 @@ fun box(): String { val dpz = D::class.constructors.single().call(+0.0) val fmz = F::class.constructors.single().call(-0.0f) val fpz = F::class.constructors.single().call(+0.0f) - check(::dMinusZero.annotations.single() as D, dmz) - check(::dPlusZero.annotations.single() as D, dpz) - check(::fMinusZero.annotations.single() as F, fmz) - check(::fPlusZero.annotations.single() as F, fpz) + check(::dMinusZero.annotations.single() as D, dmz, "@D\\(d=-0.0\\)") + check(::dPlusZero.annotations.single() as D, dpz, "@D\\(d=0.0\\)") + check(::fMinusZero.annotations.single() as F, fmz, "@F\\(f=-0.0f?\\)") + check(::fPlusZero.annotations.single() as F, fpz, "@F\\(f=0.0f?\\)") checkNot(dmz, dpz) checkNot(fmz, fpz) diff --git a/compiler/testData/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt b/compiler/testData/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt index e21dfb56e32..5822be741fa 100644 --- a/compiler/testData/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt +++ b/compiler/testData/codegen/box/reflection/enclosing/localClassInTopLevelFunction.kt @@ -8,7 +8,7 @@ fun box(): String { class C val name = C::class.java.getSimpleName() - if (name != "box\$C") return "Fail: $name" + if (name != "box\$C" && name != "C") return "Fail: $name" return "OK" }