From be29052a649753e7d2a3b7bc58c3728d71dbb92d Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 8 Jul 2022 12:40:05 +0300 Subject: [PATCH] [K/N] Update tests for KT-42641 --- .../framework/values_generics/values.swift | 3 -- .../objcexport/dataClassComponentMethods.kt | 12 +++++- .../dataClassComponentMethods.swift | 14 ++++--- .../tests/objcexport/expectedLazy.h | 39 +++++++++++-------- .../expectedLazyLegacySuspendUnit.h | 39 +++++++++++-------- .../tests/objcexport/expectedLazyNoGenerics.h | 39 +++++++++++-------- .../tests/objcexport/values.swift | 3 -- 7 files changed, 86 insertions(+), 63 deletions(-) diff --git a/kotlin-native/backend.native/tests/framework/values_generics/values.swift b/kotlin-native/backend.native/tests/framework/values_generics/values.swift index 66f84f203a5..40acf24f573 100644 --- a/kotlin-native/backend.native/tests/framework/values_generics/values.swift +++ b/kotlin-native/backend.native/tests/framework/values_generics/values.swift @@ -33,20 +33,17 @@ func testDataClass() throws { let tripleVal = TripleVals(first: f, second: s, third: t) try assertEquals(actual: tripleVal.first, expected: f, "Data class' value") try assertEquals(actual: tripleVal.first, expected: "1", "Data class' value literal") - try assertEquals(actual: tripleVal.component2(), expected: s, "Data class' component") print(tripleVal) try assertEquals(actual: String(describing: tripleVal), expected: "TripleVals(first=\(f), second=\(s), third=\(t))") let tripleVar = TripleVars(first: f, second: s, third: t) try assertEquals(actual: tripleVar.first, expected: f, "Data class' value") - try assertEquals(actual: tripleVar.component2(), expected: s, "Data class' component") print(tripleVar) try assertEquals(actual: String(describing: tripleVar), expected: "[\(f), \(s), \(t)]") tripleVar.first = t tripleVar.second = f tripleVar.third = s - try assertEquals(actual: tripleVar.component2(), expected: f, "Data class' component") try assertEquals(actual: String(describing: tripleVar), expected: "[\(t), \(f), \(s)]") } diff --git a/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.kt b/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.kt index cfbca34da1e..79cb5c01346 100644 --- a/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.kt +++ b/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.kt @@ -5,7 +5,17 @@ package dataClassComponentMethods -data class DataClassWithComponentMethods(val x: Int, val y: Int) +data class DataClassWithExplicitComponentMethod(val x: Int, val y: Int) { + fun component1(arg: Int): Int { + return arg + x + } +} + +interface ComponentInterface { + fun component1(): Int +} + +data class DataClassWithInheritedComponentMethod(val x: Int) : ComponentInterface class RegularClassWithComponentMethods { fun component1() = 3 diff --git a/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.swift b/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.swift index b510e3e526a..151685f06e5 100644 --- a/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.swift +++ b/kotlin-native/backend.native/tests/objcexport/dataClassComponentMethods.swift @@ -5,10 +5,14 @@ import Kt -private func testComponentMethodsAreStillAccessible() throws { - let d = DataClassWithComponentMethods(x: 1, y: 2) +private func testCustomComponentMethodsAreAccessible() throws { + let d = DataClassWithExplicitComponentMethod(x: 1, y: 2) + try assertEquals(actual: d.component1(arg: 3), expected: 4) +} + +private func testDataClassWithInheritedComponentAreAccessible() throws { + let d = DataClassWithInheritedComponentMethod(x: 1) try assertEquals(actual: d.component1(), expected: 1) - try assertEquals(actual: d.component2(), expected: 2) } // Absence of deprecation attributes is checked by comparing "lazy header". @@ -26,8 +30,8 @@ private func testTopLevelComponentMethodsAreAccessible() throws { class DataClassComponentMethodsTests : SimpleTestProvider { override init() { super.init() - - test("testComponentMethodsAreStillAccessible", testComponentMethodsAreStillAccessible) + test("testDataClassWithInheritedComponentAreAccessible", testDataClassWithInheritedComponentAreAccessible) + test("testCustomComponentMethodsAreAccessible", testCustomComponentMethodsAreAccessible) test("testRegularComponentMethodsAreAccessible", testRegularComponentMethodsAreAccessible) test("testTopLevelComponentMethodsAreAccessible", testTopLevelComponentMethodsAreAccessible) } diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazy.h b/kotlin-native/backend.native/tests/objcexport/expectedLazy.h index d49ed5e6458..f5c3c0c449d 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazy.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazy.h @@ -386,19 +386,36 @@ __attribute__((swift_name("CoroutinesKt"))) @end __attribute__((objc_subclassing_restricted)) -__attribute__((swift_name("DataClassWithComponentMethods"))) -@interface KtDataClassWithComponentMethods : KtBase +__attribute__((swift_name("DataClassWithExplicitComponentMethod"))) +@interface KtDataClassWithExplicitComponentMethod : KtBase - (instancetype)initWithX:(int32_t)x y:(int32_t)y __attribute__((swift_name("init(x:y:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)component1Arg:(int32_t)arg __attribute__((swift_name("component1(arg:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (int32_t)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (KtDataClassWithComponentMethods *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)"))); +- (KtDataClassWithExplicitComponentMethod *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)"))); @property (readonly) int32_t x __attribute__((swift_name("x"))); @property (readonly) int32_t y __attribute__((swift_name("y"))); @end +__attribute__((swift_name("ComponentInterface"))) +@protocol KtComponentInterface +@required +- (int32_t)component1 __attribute__((swift_name("component1()"))); +@end + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("DataClassWithInheritedComponentMethod"))) +@interface KtDataClassWithInheritedComponentMethod : KtBase +- (instancetype)initWithX:(int32_t)x __attribute__((swift_name("init(x:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)component1 __attribute__((swift_name("component1()"))); +- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); +- (NSUInteger)hash __attribute__((swift_name("hash()"))); +- (NSString *)description __attribute__((swift_name("description()"))); +- (KtDataClassWithInheritedComponentMethod *)doCopyX:(int32_t)x __attribute__((swift_name("doCopy(x:)"))); +@property (readonly) int32_t x __attribute__((swift_name("x"))); +@end + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("RegularClassWithComponentMethods"))) @interface KtRegularClassWithComponentMethods : KtBase @@ -1286,7 +1303,6 @@ __attribute__((swift_name("Person.User"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonUser *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1306,7 +1322,6 @@ __attribute__((swift_name("Person.WorkerEmployee"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonWorkerEmployee *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1320,7 +1335,6 @@ __attribute__((swift_name("Person.WorkerContractor"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonWorkerContractor *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1473,9 +1487,6 @@ __attribute__((swift_name("TripleVals"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (T _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtTripleVals *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); @property (readonly) T _Nullable first __attribute__((swift_name("first"))); @property (readonly) T _Nullable second __attribute__((swift_name("second"))); @@ -1489,9 +1500,6 @@ __attribute__((swift_name("TripleVars"))) - (NSString *)description __attribute__((swift_name("description()"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); -- (T _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtTripleVars *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); @property T _Nullable first __attribute__((swift_name("first"))); @property T _Nullable second __attribute__((swift_name("second"))); @@ -1900,9 +1908,6 @@ __attribute__((swift_name("CKeywords"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (float)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (int32_t)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (BOOL)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtCKeywords *)doCopyFloat:(float)float_ enum:(int32_t)enum_ goto:(BOOL)goto_ __attribute__((swift_name("doCopy(float:enum:goto:)"))); @property (readonly, getter=float) float float_ __attribute__((swift_name("float_"))); @property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h b/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h index 116d16f4dcc..ff9f04318c6 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazyLegacySuspendUnit.h @@ -386,19 +386,36 @@ __attribute__((swift_name("CoroutinesKt"))) @end __attribute__((objc_subclassing_restricted)) -__attribute__((swift_name("DataClassWithComponentMethods"))) -@interface KtDataClassWithComponentMethods : KtBase +__attribute__((swift_name("DataClassWithExplicitComponentMethod"))) +@interface KtDataClassWithExplicitComponentMethod : KtBase - (instancetype)initWithX:(int32_t)x y:(int32_t)y __attribute__((swift_name("init(x:y:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)component1Arg:(int32_t)arg __attribute__((swift_name("component1(arg:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (int32_t)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (KtDataClassWithComponentMethods *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)"))); +- (KtDataClassWithExplicitComponentMethod *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)"))); @property (readonly) int32_t x __attribute__((swift_name("x"))); @property (readonly) int32_t y __attribute__((swift_name("y"))); @end +__attribute__((swift_name("ComponentInterface"))) +@protocol KtComponentInterface +@required +- (int32_t)component1 __attribute__((swift_name("component1()"))); +@end + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("DataClassWithInheritedComponentMethod"))) +@interface KtDataClassWithInheritedComponentMethod : KtBase +- (instancetype)initWithX:(int32_t)x __attribute__((swift_name("init(x:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)component1 __attribute__((swift_name("component1()"))); +- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); +- (NSUInteger)hash __attribute__((swift_name("hash()"))); +- (NSString *)description __attribute__((swift_name("description()"))); +- (KtDataClassWithInheritedComponentMethod *)doCopyX:(int32_t)x __attribute__((swift_name("doCopy(x:)"))); +@property (readonly) int32_t x __attribute__((swift_name("x"))); +@end + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("RegularClassWithComponentMethods"))) @interface KtRegularClassWithComponentMethods : KtBase @@ -1221,7 +1238,6 @@ __attribute__((swift_name("Person.User"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonUser *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1241,7 +1257,6 @@ __attribute__((swift_name("Person.WorkerEmployee"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonWorkerEmployee *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1255,7 +1270,6 @@ __attribute__((swift_name("Person.WorkerContractor"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonWorkerContractor *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1408,9 +1422,6 @@ __attribute__((swift_name("TripleVals"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (T _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtTripleVals *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); @property (readonly) T _Nullable first __attribute__((swift_name("first"))); @property (readonly) T _Nullable second __attribute__((swift_name("second"))); @@ -1424,9 +1435,6 @@ __attribute__((swift_name("TripleVars"))) - (NSString *)description __attribute__((swift_name("description()"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); -- (T _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (T _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtTripleVars *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); @property T _Nullable first __attribute__((swift_name("first"))); @property T _Nullable second __attribute__((swift_name("second"))); @@ -1835,9 +1843,6 @@ __attribute__((swift_name("CKeywords"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (float)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (int32_t)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (BOOL)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtCKeywords *)doCopyFloat:(float)float_ enum:(int32_t)enum_ goto:(BOOL)goto_ __attribute__((swift_name("doCopy(float:enum:goto:)"))); @property (readonly, getter=float) float float_ __attribute__((swift_name("float_"))); @property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); diff --git a/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h b/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h index a7ab15a2aa5..fd25ff702f3 100644 --- a/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h +++ b/kotlin-native/backend.native/tests/objcexport/expectedLazyNoGenerics.h @@ -386,19 +386,36 @@ __attribute__((swift_name("CoroutinesKt"))) @end __attribute__((objc_subclassing_restricted)) -__attribute__((swift_name("DataClassWithComponentMethods"))) -@interface KtDataClassWithComponentMethods : KtBase +__attribute__((swift_name("DataClassWithExplicitComponentMethod"))) +@interface KtDataClassWithExplicitComponentMethod : KtBase - (instancetype)initWithX:(int32_t)x y:(int32_t)y __attribute__((swift_name("init(x:y:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)component1Arg:(int32_t)arg __attribute__((swift_name("component1(arg:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (int32_t)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (KtDataClassWithComponentMethods *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)"))); +- (KtDataClassWithExplicitComponentMethod *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)"))); @property (readonly) int32_t x __attribute__((swift_name("x"))); @property (readonly) int32_t y __attribute__((swift_name("y"))); @end +__attribute__((swift_name("ComponentInterface"))) +@protocol KtComponentInterface +@required +- (int32_t)component1 __attribute__((swift_name("component1()"))); +@end + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("DataClassWithInheritedComponentMethod"))) +@interface KtDataClassWithInheritedComponentMethod : KtBase +- (instancetype)initWithX:(int32_t)x __attribute__((swift_name("init(x:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)component1 __attribute__((swift_name("component1()"))); +- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); +- (NSUInteger)hash __attribute__((swift_name("hash()"))); +- (NSString *)description __attribute__((swift_name("description()"))); +- (KtDataClassWithInheritedComponentMethod *)doCopyX:(int32_t)x __attribute__((swift_name("doCopy(x:)"))); +@property (readonly) int32_t x __attribute__((swift_name("x"))); +@end + __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("RegularClassWithComponentMethods"))) @interface KtRegularClassWithComponentMethods : KtBase @@ -1221,7 +1238,6 @@ __attribute__((swift_name("Person.User"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonUser *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1241,7 +1257,6 @@ __attribute__((swift_name("Person.WorkerEmployee"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonWorkerEmployee *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1255,7 +1270,6 @@ __attribute__((swift_name("Person.WorkerContractor"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtPersonWorkerContractor *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)"))); @property (readonly) int32_t id __attribute__((swift_name("id"))); @end @@ -1408,9 +1422,6 @@ __attribute__((swift_name("TripleVals"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (id _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (id _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (id _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtTripleVals *)doCopyFirst:(id _Nullable)first second:(id _Nullable)second third:(id _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); @property (readonly) id _Nullable first __attribute__((swift_name("first"))); @property (readonly) id _Nullable second __attribute__((swift_name("second"))); @@ -1424,9 +1435,6 @@ __attribute__((swift_name("TripleVars"))) - (NSString *)description __attribute__((swift_name("description()"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); -- (id _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (id _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (id _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtTripleVars *)doCopyFirst:(id _Nullable)first second:(id _Nullable)second third:(id _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); @property id _Nullable first __attribute__((swift_name("first"))); @property id _Nullable second __attribute__((swift_name("second"))); @@ -1835,9 +1843,6 @@ __attribute__((swift_name("CKeywords"))) - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSString *)description __attribute__((swift_name("description()"))); -- (float)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); -- (int32_t)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead"))); -- (BOOL)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtCKeywords *)doCopyFloat:(float)float_ enum:(int32_t)enum_ goto:(BOOL)goto_ __attribute__((swift_name("doCopy(float:enum:goto:)"))); @property (readonly, getter=float) float float_ __attribute__((swift_name("float_"))); @property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); diff --git a/kotlin-native/backend.native/tests/objcexport/values.swift b/kotlin-native/backend.native/tests/objcexport/values.swift index d2ff8f17e67..0bcd401130b 100644 --- a/kotlin-native/backend.native/tests/objcexport/values.swift +++ b/kotlin-native/backend.native/tests/objcexport/values.swift @@ -519,7 +519,6 @@ func testDataClass() throws { let tripleVal = TripleVals(first: f as NSString, second: s as NSString, third: t as NSString) #endif try assertEquals(actual: tripleVal.first as! String, expected: f, "Data class' value") - try assertEquals(actual: tripleVal.component2() as! String, expected: s, "Data class' component") print(tripleVal) try assertEquals(actual: String(describing: tripleVal), expected: "TripleVals(first=\(f), second=\(s), third=\(t))") @@ -529,14 +528,12 @@ func testDataClass() throws { let tripleVar = TripleVars(first: f as NSString, second: s as NSString, third: t as NSString) #endif try assertEquals(actual: tripleVar.first as! String, expected: f, "Data class' value") - try assertEquals(actual: tripleVar.component2() as! String, expected: s, "Data class' component") print(tripleVar) try assertEquals(actual: String(describing: tripleVar), expected: "[\(f), \(s), \(t)]") tripleVar.first = t as NSString tripleVar.second = f as NSString tripleVar.third = s as NSString - try assertEquals(actual: tripleVar.component2() as! String, expected: f, "Data class' component") try assertEquals(actual: String(describing: tripleVar), expected: "[\(t), \(f), \(s)]") }