From 37745e4251d205ab530cf8b4463ae2f592fcdcfc Mon Sep 17 00:00:00 2001 From: SvyatoslavScherbina Date: Mon, 24 Jun 2019 11:44:26 +0300 Subject: [PATCH] Add missing test for SR-10177/SR-10217 workaround (#3092) --- backend.native/tests/framework/values/expectedLazy.h | 5 +++++ backend.native/tests/framework/values/values.kt | 2 ++ backend.native/tests/framework/values/values.swift | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/backend.native/tests/framework/values/expectedLazy.h b/backend.native/tests/framework/values/expectedLazy.h index be8c1170ffa..dfc10b71fad 100644 --- a/backend.native/tests/framework/values/expectedLazy.h +++ b/backend.native/tests/framework/values/expectedLazy.h @@ -566,6 +566,11 @@ __attribute__((swift_name("ForwardC1"))) - (ValuesForwardC2 *)getForwardC2 __attribute__((swift_name("getForwardC2()"))); @end; +__attribute__((swift_name("TestSR10177Workaround"))) +@protocol ValuesTestSR10177Workaround +@required +@end; + @interface ValuesEnumeration (ValuesKt) - (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()"))); @end; diff --git a/backend.native/tests/framework/values/values.kt b/backend.native/tests/framework/values/values.kt index 12292c0056b..926c9294478 100644 --- a/backend.native/tests/framework/values/values.kt +++ b/backend.native/tests/framework/values/values.kt @@ -449,3 +449,5 @@ abstract class ForwardC2 : ForwardC1() abstract class ForwardC1 { abstract fun getForwardC2(): ForwardC2 } + +interface TestSR10177Workaround \ No newline at end of file diff --git a/backend.native/tests/framework/values/values.swift b/backend.native/tests/framework/values/values.swift index f5304e126f9..11223bf0460 100644 --- a/backend.native/tests/framework/values/values.swift +++ b/backend.native/tests/framework/values/values.swift @@ -604,6 +604,15 @@ func testKClass() throws { try assertTrue(test.getKotlinClass(protocol: NSObjectProtocol.self) == nil) } +open class TestSR10177WorkaroundBase {} +class TestSR10177WorkaroundDerived : TestSR10177WorkaroundBase {} + +// See https://bugs.swift.org/browse/SR-10177 and https://bugs.swift.org/browse/SR-10217 +func testSR10177Workaround() throws { + let test = TestSR10177WorkaroundDerived() + try assertTrue(String(describing: test).contains("TestSR10177WorkaroundDerived")) +} + // See https://github.com/JetBrains/kotlin-native/issues/2931 func testGH2931() throws { for i in 0..<50000 { @@ -668,6 +677,7 @@ class ValuesTests : TestProvider { TestCase(name: "TestGH2830", method: withAutorelease(testGH2830)), TestCase(name: "TestGH2959", method: withAutorelease(testGH2959)), TestCase(name: "TestKClass", method: withAutorelease(testKClass)), + TestCase(name: "TestSR10177Workaround", method: withAutorelease(testSR10177Workaround)), TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)), ] }