diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazy.h b/kotlin-native/backend.native/tests/objcexport/expectedLazy.h index 06843ed6df1..f02a3429475 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazy.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazy.h @@ -1161,6 +1161,22 @@ __attribute__((swift_name("Kt55736Kt"))) + (NSArray *)callbackBlock:(id)block __attribute__((swift_name("callback(block:)"))); @end +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt56521"))) +@interface KtKt56521 : KtBase ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)kt56521 __attribute__((swift_name("init()"))); +@property (class, readonly, getter=shared) KtKt56521 *shared __attribute__((swift_name("shared"))); +@end + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt56521Kt"))) +@interface KtKt56521Kt : KtBase ++ (KtKt56521 *)getKt56521 __attribute__((swift_name("getKt56521()"))); +@property (class) int32_t initialized __attribute__((swift_name("initialized"))); +@end + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("LibraryKt"))) @interface KtLibraryKt : KtBase diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h b/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h index 4b0bfc26015..8af8b31c4e9 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h @@ -1096,6 +1096,22 @@ __attribute__((swift_name("Kt55736Kt"))) + (NSArray *)callbackBlock:(id)block __attribute__((swift_name("callback(block:)"))); @end +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt56521"))) +@interface KtKt56521 : KtBase ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)kt56521 __attribute__((swift_name("init()"))); +@property (class, readonly, getter=shared) KtKt56521 *shared __attribute__((swift_name("shared"))); +@end + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt56521Kt"))) +@interface KtKt56521Kt : KtBase ++ (KtKt56521 *)getKt56521 __attribute__((swift_name("getKt56521()"))); +@property (class) int32_t initialized __attribute__((swift_name("initialized"))); +@end + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("LibraryKt"))) @interface KtLibraryKt : KtBase diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h b/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h index 0ff016fa40e..19844c5876d 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h @@ -1096,6 +1096,22 @@ __attribute__((swift_name("Kt55736Kt"))) + (NSArray *)callbackBlock:(id)block __attribute__((swift_name("callback(block:)"))); @end +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt56521"))) +@interface KtKt56521 : KtBase ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)kt56521 __attribute__((swift_name("init()"))); +@property (class, readonly, getter=shared) KtKt56521 *shared __attribute__((swift_name("shared"))); +@end + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Kt56521Kt"))) +@interface KtKt56521Kt : KtBase ++ (KtKt56521 *)getKt56521 __attribute__((swift_name("getKt56521()"))); +@property (class) int32_t initialized __attribute__((swift_name("initialized"))); +@end + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("LibraryKt"))) @interface KtLibraryKt : KtBase diff --git a/kotlin-native/backend.native/tests/objcexport/kt56521.kt b/kotlin-native/backend.native/tests/objcexport/kt56521.kt new file mode 100644 index 00000000000..44b69ade4db --- /dev/null +++ b/kotlin-native/backend.native/tests/objcexport/kt56521.kt @@ -0,0 +1,17 @@ +/* + * 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. + */ + +var initialized = 0 + +object Kt56521 { + init { + initialized = 1 + } +} + +fun getKt56521(): Kt56521 { + Kt56521 + return Kt56521 +} diff --git a/kotlin-native/backend.native/tests/objcexport/kt56521.swift b/kotlin-native/backend.native/tests/objcexport/kt56521.swift new file mode 100644 index 00000000000..d3907774c32 --- /dev/null +++ b/kotlin-native/backend.native/tests/objcexport/kt56521.swift @@ -0,0 +1,20 @@ +/* + * 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. + */ + +import Kt + +func testKt56521() throws { + let object = Kt56521() + try assertTrue(object is Kt56521) + try assertEquals(actual: Kt56521Kt.initialized, expected: 1) +} + +class Kt56521Tests : SimpleTestProvider { + override init() { + super.init() + + test("testKt56521", testKt56521) + } +}