This commit is contained in:
SvyatoslavScherbina
2019-04-19 23:22:45 +03:00
parent 44dbf684e5
commit a6f1048e8a
4 changed files with 45 additions and 2 deletions
@@ -885,6 +885,8 @@ class StubGenerator(
if (configuration.library.language == Language.OBJECTIVE_C) {
add("CONFLICTING_OVERLOADS")
add("RETURN_TYPE_MISMATCH_ON_INHERITANCE")
add("PROPERTY_TYPE_MISMATCH_ON_INHERITANCE") // Multiple-inheriting property with conflicting types
add("VAR_TYPE_MISMATCH_ON_INHERITANCE") // Multiple-inheriting mutable property with conflicting types
add("RETURN_TYPE_MISMATCH_ON_OVERRIDE")
add("WRONG_MODIFIER_CONTAINING_DECLARATION") // For `final val` in interface.
add("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
+17 -1
View File
@@ -159,4 +159,20 @@ NSObject* createNSObject() {
@interface TestOverrideInit : NSObject
-(instancetype)initWithValue:(int)value NS_DESIGNATED_INITIALIZER;
+(instancetype)createWithValue:(int)value;
@end;
@end;
@interface MultipleInheritanceClashBase : NSObject
@property (nonnull) MultipleInheritanceClashBase* delegate;
@end;
@protocol MultipleInheritanceClash
@optional
@property (nullable) id<MultipleInheritanceClash> delegate;
@end;
@interface MultipleInheritanceClash1 : MultipleInheritanceClashBase <MultipleInheritanceClash>
@end;
@interface MultipleInheritanceClash2 : MultipleInheritanceClashBase <MultipleInheritanceClash>
@property MultipleInheritanceClashBase* delegate;
@end;
@@ -23,6 +23,7 @@ fun run() {
testCustomRetain()
testVarargs()
testOverrideInit()
testMultipleInheritanceClash()
assertEquals(2, ForwardDeclaredEnum.TWO.value)
@@ -310,6 +311,21 @@ class TestOverrideInitImpl @OverrideInit constructor(val value: Int) : TestOverr
private class MyException : Throwable()
fun testMultipleInheritanceClash() {
val clash1 = MultipleInheritanceClash1()
val clash2 = MultipleInheritanceClash2()
clash1.delegate = clash1
assertEquals(clash1, clash1.delegate)
clash1.setDelegate(clash2)
assertEquals(clash2, clash1.delegate())
clash2.delegate = clash1
assertEquals(clash1, clash2.delegate)
clash2.setDelegate(clash2)
assertEquals(clash2, clash2.delegate())
}
fun nsArrayOf(vararg elements: Any): NSArray = NSMutableArray().apply {
elements.forEach {
this.addObject(it as ObjCObject)
+10 -1
View File
@@ -154,4 +154,13 @@ static CustomRetainMethodsImpl* retainedCustomRetainMethodsImpl;
+(instancetype)createWithValue:(int)value {
return [[self alloc] initWithValue:value];
}
@end;
@end;
@implementation MultipleInheritanceClashBase
@end;
@implementation MultipleInheritanceClash1
@end;
@implementation MultipleInheritanceClash2
@end;