[K/N] Update tests for KT-42641

This commit is contained in:
Sergey Bogolepov
2022-07-08 12:40:05 +03:00
committed by Space
parent 3dfb6dc622
commit be29052a64
7 changed files with 86 additions and 63 deletions
@@ -33,20 +33,17 @@ func testDataClass() throws {
let tripleVal = TripleVals<NSString>(first: f, second: s, third: t) let tripleVal = TripleVals<NSString>(first: f, second: s, third: t)
try assertEquals(actual: tripleVal.first, expected: f, "Data class' value") 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.first, expected: "1", "Data class' value literal")
try assertEquals(actual: tripleVal.component2(), expected: s, "Data class' component")
print(tripleVal) print(tripleVal)
try assertEquals(actual: String(describing: tripleVal), expected: "TripleVals(first=\(f), second=\(s), third=\(t))") try assertEquals(actual: String(describing: tripleVal), expected: "TripleVals(first=\(f), second=\(s), third=\(t))")
let tripleVar = TripleVars<NSString>(first: f, second: s, third: t) let tripleVar = TripleVars<NSString>(first: f, second: s, third: t)
try assertEquals(actual: tripleVar.first, expected: f, "Data class' value") try assertEquals(actual: tripleVar.first, expected: f, "Data class' value")
try assertEquals(actual: tripleVar.component2(), expected: s, "Data class' component")
print(tripleVar) print(tripleVar)
try assertEquals(actual: String(describing: tripleVar), expected: "[\(f), \(s), \(t)]") try assertEquals(actual: String(describing: tripleVar), expected: "[\(f), \(s), \(t)]")
tripleVar.first = t tripleVar.first = t
tripleVar.second = f tripleVar.second = f
tripleVar.third = s tripleVar.third = s
try assertEquals(actual: tripleVar.component2(), expected: f, "Data class' component")
try assertEquals(actual: String(describing: tripleVar), expected: "[\(t), \(f), \(s)]") try assertEquals(actual: String(describing: tripleVar), expected: "[\(t), \(f), \(s)]")
} }
@@ -5,7 +5,17 @@
package dataClassComponentMethods 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 { class RegularClassWithComponentMethods {
fun component1() = 3 fun component1() = 3
@@ -5,10 +5,14 @@
import Kt import Kt
private func testComponentMethodsAreStillAccessible() throws { private func testCustomComponentMethodsAreAccessible() throws {
let d = DataClassWithComponentMethods(x: 1, y: 2) 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.component1(), expected: 1)
try assertEquals(actual: d.component2(), expected: 2)
} }
// Absence of deprecation attributes is checked by comparing "lazy header". // Absence of deprecation attributes is checked by comparing "lazy header".
@@ -26,8 +30,8 @@ private func testTopLevelComponentMethodsAreAccessible() throws {
class DataClassComponentMethodsTests : SimpleTestProvider { class DataClassComponentMethodsTests : SimpleTestProvider {
override init() { override init() {
super.init() super.init()
test("testDataClassWithInheritedComponentAreAccessible", testDataClassWithInheritedComponentAreAccessible)
test("testComponentMethodsAreStillAccessible", testComponentMethodsAreStillAccessible) test("testCustomComponentMethodsAreAccessible", testCustomComponentMethodsAreAccessible)
test("testRegularComponentMethodsAreAccessible", testRegularComponentMethodsAreAccessible) test("testRegularComponentMethodsAreAccessible", testRegularComponentMethodsAreAccessible)
test("testTopLevelComponentMethodsAreAccessible", testTopLevelComponentMethodsAreAccessible) test("testTopLevelComponentMethodsAreAccessible", testTopLevelComponentMethodsAreAccessible)
} }
@@ -386,19 +386,36 @@ __attribute__((swift_name("CoroutinesKt")))
@end @end
__attribute__((objc_subclassing_restricted)) __attribute__((objc_subclassing_restricted))
__attribute__((swift_name("DataClassWithComponentMethods"))) __attribute__((swift_name("DataClassWithExplicitComponentMethod")))
@interface KtDataClassWithComponentMethods : KtBase @interface KtDataClassWithExplicitComponentMethod : KtBase
- (instancetype)initWithX:(int32_t)x y:(int32_t)y __attribute__((swift_name("init(x:y:)"))) __attribute__((objc_designated_initializer)); - (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(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (NSString *)description __attribute__((swift_name("description()")));
- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtDataClassWithExplicitComponentMethod *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)")));
- (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:)")));
@property (readonly) int32_t x __attribute__((swift_name("x"))); @property (readonly) int32_t x __attribute__((swift_name("x")));
@property (readonly) int32_t y __attribute__((swift_name("y"))); @property (readonly) int32_t y __attribute__((swift_name("y")));
@end @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 <KtComponentInterface>
- (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__((objc_subclassing_restricted))
__attribute__((swift_name("RegularClassWithComponentMethods"))) __attribute__((swift_name("RegularClassWithComponentMethods")))
@interface KtRegularClassWithComponentMethods : KtBase @interface KtRegularClassWithComponentMethods : KtBase
@@ -1286,7 +1303,6 @@ __attribute__((swift_name("Person.User")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonUser *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1306,7 +1322,6 @@ __attribute__((swift_name("Person.WorkerEmployee")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonWorkerEmployee *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1320,7 +1335,6 @@ __attribute__((swift_name("Person.WorkerContractor")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonWorkerContractor *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1473,9 +1487,6 @@ __attribute__((swift_name("TripleVals")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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<T> *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); - (KtTripleVals<T> *)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 first __attribute__((swift_name("first")));
@property (readonly) T _Nullable second __attribute__((swift_name("second"))); @property (readonly) T _Nullable second __attribute__((swift_name("second")));
@@ -1489,9 +1500,6 @@ __attribute__((swift_name("TripleVars")))
- (NSString *)description __attribute__((swift_name("description()"))); - (NSString *)description __attribute__((swift_name("description()")));
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (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<T> *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); - (KtTripleVars<T> *)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 first __attribute__((swift_name("first")));
@property T _Nullable second __attribute__((swift_name("second"))); @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(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (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=float) float float_ __attribute__((swift_name("float_")));
@property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); @property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_")));
@@ -386,19 +386,36 @@ __attribute__((swift_name("CoroutinesKt")))
@end @end
__attribute__((objc_subclassing_restricted)) __attribute__((objc_subclassing_restricted))
__attribute__((swift_name("DataClassWithComponentMethods"))) __attribute__((swift_name("DataClassWithExplicitComponentMethod")))
@interface KtDataClassWithComponentMethods : KtBase @interface KtDataClassWithExplicitComponentMethod : KtBase
- (instancetype)initWithX:(int32_t)x y:(int32_t)y __attribute__((swift_name("init(x:y:)"))) __attribute__((objc_designated_initializer)); - (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(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (NSString *)description __attribute__((swift_name("description()")));
- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtDataClassWithExplicitComponentMethod *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)")));
- (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:)")));
@property (readonly) int32_t x __attribute__((swift_name("x"))); @property (readonly) int32_t x __attribute__((swift_name("x")));
@property (readonly) int32_t y __attribute__((swift_name("y"))); @property (readonly) int32_t y __attribute__((swift_name("y")));
@end @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 <KtComponentInterface>
- (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__((objc_subclassing_restricted))
__attribute__((swift_name("RegularClassWithComponentMethods"))) __attribute__((swift_name("RegularClassWithComponentMethods")))
@interface KtRegularClassWithComponentMethods : KtBase @interface KtRegularClassWithComponentMethods : KtBase
@@ -1221,7 +1238,6 @@ __attribute__((swift_name("Person.User")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonUser *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1241,7 +1257,6 @@ __attribute__((swift_name("Person.WorkerEmployee")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonWorkerEmployee *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1255,7 +1270,6 @@ __attribute__((swift_name("Person.WorkerContractor")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonWorkerContractor *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1408,9 +1422,6 @@ __attribute__((swift_name("TripleVals")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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<T> *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); - (KtTripleVals<T> *)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 first __attribute__((swift_name("first")));
@property (readonly) T _Nullable second __attribute__((swift_name("second"))); @property (readonly) T _Nullable second __attribute__((swift_name("second")));
@@ -1424,9 +1435,6 @@ __attribute__((swift_name("TripleVars")))
- (NSString *)description __attribute__((swift_name("description()"))); - (NSString *)description __attribute__((swift_name("description()")));
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (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<T> *)doCopyFirst:(T _Nullable)first second:(T _Nullable)second third:(T _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); - (KtTripleVars<T> *)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 first __attribute__((swift_name("first")));
@property T _Nullable second __attribute__((swift_name("second"))); @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(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (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=float) float float_ __attribute__((swift_name("float_")));
@property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); @property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_")));
@@ -386,19 +386,36 @@ __attribute__((swift_name("CoroutinesKt")))
@end @end
__attribute__((objc_subclassing_restricted)) __attribute__((objc_subclassing_restricted))
__attribute__((swift_name("DataClassWithComponentMethods"))) __attribute__((swift_name("DataClassWithExplicitComponentMethod")))
@interface KtDataClassWithComponentMethods : KtBase @interface KtDataClassWithExplicitComponentMethod : KtBase
- (instancetype)initWithX:(int32_t)x y:(int32_t)y __attribute__((swift_name("init(x:y:)"))) __attribute__((objc_designated_initializer)); - (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(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (NSString *)description __attribute__((swift_name("description()")));
- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead"))); - (KtDataClassWithExplicitComponentMethod *)doCopyX:(int32_t)x y:(int32_t)y __attribute__((swift_name("doCopy(x:y:)")));
- (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:)")));
@property (readonly) int32_t x __attribute__((swift_name("x"))); @property (readonly) int32_t x __attribute__((swift_name("x")));
@property (readonly) int32_t y __attribute__((swift_name("y"))); @property (readonly) int32_t y __attribute__((swift_name("y")));
@end @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 <KtComponentInterface>
- (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__((objc_subclassing_restricted))
__attribute__((swift_name("RegularClassWithComponentMethods"))) __attribute__((swift_name("RegularClassWithComponentMethods")))
@interface KtRegularClassWithComponentMethods : KtBase @interface KtRegularClassWithComponentMethods : KtBase
@@ -1221,7 +1238,6 @@ __attribute__((swift_name("Person.User")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonUser *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1241,7 +1257,6 @@ __attribute__((swift_name("Person.WorkerEmployee")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonWorkerEmployee *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1255,7 +1270,6 @@ __attribute__((swift_name("Person.WorkerContractor")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (KtPersonWorkerContractor *)doCopyId:(int32_t)id __attribute__((swift_name("doCopy(id:)")));
@property (readonly) int32_t id __attribute__((swift_name("id"))); @property (readonly) int32_t id __attribute__((swift_name("id")));
@end @end
@@ -1408,9 +1422,6 @@ __attribute__((swift_name("TripleVals")))
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (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 first __attribute__((swift_name("first")));
@property (readonly) id _Nullable second __attribute__((swift_name("second"))); @property (readonly) id _Nullable second __attribute__((swift_name("second")));
@@ -1424,9 +1435,6 @@ __attribute__((swift_name("TripleVars")))
- (NSString *)description __attribute__((swift_name("description()"))); - (NSString *)description __attribute__((swift_name("description()")));
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (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:)"))); - (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 first __attribute__((swift_name("first")));
@property id _Nullable second __attribute__((swift_name("second"))); @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(_:)"))); - (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()"))); - (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()"))); - (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:)"))); - (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=float) float float_ __attribute__((swift_name("float_")));
@property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); @property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_")));
@@ -519,7 +519,6 @@ func testDataClass() throws {
let tripleVal = TripleVals<NSString>(first: f as NSString, second: s as NSString, third: t as NSString) let tripleVal = TripleVals<NSString>(first: f as NSString, second: s as NSString, third: t as NSString)
#endif #endif
try assertEquals(actual: tripleVal.first as! String, expected: f, "Data class' value") 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) print(tripleVal)
try assertEquals(actual: String(describing: tripleVal), expected: "TripleVals(first=\(f), second=\(s), third=\(t))") try assertEquals(actual: String(describing: tripleVal), expected: "TripleVals(first=\(f), second=\(s), third=\(t))")
@@ -529,14 +528,12 @@ func testDataClass() throws {
let tripleVar = TripleVars<NSString>(first: f as NSString, second: s as NSString, third: t as NSString) let tripleVar = TripleVars<NSString>(first: f as NSString, second: s as NSString, third: t as NSString)
#endif #endif
try assertEquals(actual: tripleVar.first as! String, expected: f, "Data class' value") 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) print(tripleVar)
try assertEquals(actual: String(describing: tripleVar), expected: "[\(f), \(s), \(t)]") try assertEquals(actual: String(describing: tripleVar), expected: "[\(f), \(s), \(t)]")
tripleVar.first = t as NSString tripleVar.first = t as NSString
tripleVar.second = f as NSString tripleVar.second = f as NSString
tripleVar.third = s 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)]") try assertEquals(actual: String(describing: tripleVar), expected: "[\(t), \(f), \(s)]")
} }