Fixed fast type check for ObjC classes + test

This commit is contained in:
Igor Chevdar
2019-09-05 16:28:07 +03:00
parent 21ec5d933d
commit 51d03ece0a
4 changed files with 20 additions and 0 deletions
@@ -983,6 +983,12 @@ __attribute__((swift_name("SharedRefs.MutableData")))
@property int32_t x __attribute__((swift_name("x")));
@end;
__attribute__((swift_name("ClassForTypeCheck")))
@interface ValuesClassForTypeCheck : KotlinBase
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
@end;
@interface ValuesEnumeration (ValuesKt)
- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()")));
@end;
@@ -1062,6 +1068,7 @@ __attribute__((swift_name("ValuesKt")))
+ (void)error __attribute__((swift_name("error()"))) __attribute__((unavailable("error")));
+ (void)warning __attribute__((swift_name("warning()"))) __attribute__((deprecated("warning")));
+ (void)gc __attribute__((swift_name("gc()")));
+ (BOOL)testClassTypeCheckX:(id)x __attribute__((swift_name("testClassTypeCheck(x:)")));
@property (class, readonly) double dbl __attribute__((swift_name("dbl")));
@property (class, readonly) float flt __attribute__((swift_name("flt")));
@property (class, readonly) int32_t integer __attribute__((swift_name("integer")));
@@ -774,3 +774,7 @@ class SharedRefs {
private val mustBeRemoved = mutableListOf<WeakReference<*>>()
}
open class ClassForTypeCheck
fun testClassTypeCheck(x: Any) = x is ClassForTypeCheck
@@ -998,6 +998,12 @@ func testGH2931() throws {
}
}
class ClassForTypeCheckInheritor : ClassForTypeCheck { }
func testClassTypeCheck() throws {
try assertTrue(ValuesKt.testClassTypeCheck(x: ClassForTypeCheckInheritor()))
}
// -------- Execution of the test --------
class ValuesTests : TestProvider {
@@ -1047,6 +1053,7 @@ class ValuesTests : TestProvider {
TestCase(name: "TestDeprecation", method: withAutorelease(testDeprecation)),
TestCase(name: "TestWeakRefs", method: withAutorelease(testWeakRefs)),
TestCase(name: "TestSharedRefs", method: withAutorelease(TestSharedRefs().test)),
TestCase(name: "TestClassTypeCheck", method: withAutorelease(testClassTypeCheck)),
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
]
}
+2
View File
@@ -734,6 +734,8 @@ static const TypeInfo* createTypeInfo(
result->flags_ |= TF_IMMUTABLE;
}
result->classId_ = superType->classId_;
KStdVector<const TypeInfo*> implementedInterfaces(
superType->implementedInterfaces_, superType->implementedInterfaces_ + superType->implementedInterfacesCount_
);