Fixed fast type check for ObjC classes + test
This commit is contained in:
@@ -983,6 +983,12 @@ __attribute__((swift_name("SharedRefs.MutableData")))
|
|||||||
@property int32_t x __attribute__((swift_name("x")));
|
@property int32_t x __attribute__((swift_name("x")));
|
||||||
@end;
|
@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)
|
@interface ValuesEnumeration (ValuesKt)
|
||||||
- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()")));
|
- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()")));
|
||||||
@end;
|
@end;
|
||||||
@@ -1062,6 +1068,7 @@ __attribute__((swift_name("ValuesKt")))
|
|||||||
+ (void)error __attribute__((swift_name("error()"))) __attribute__((unavailable("error")));
|
+ (void)error __attribute__((swift_name("error()"))) __attribute__((unavailable("error")));
|
||||||
+ (void)warning __attribute__((swift_name("warning()"))) __attribute__((deprecated("warning")));
|
+ (void)warning __attribute__((swift_name("warning()"))) __attribute__((deprecated("warning")));
|
||||||
+ (void)gc __attribute__((swift_name("gc()")));
|
+ (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) double dbl __attribute__((swift_name("dbl")));
|
||||||
@property (class, readonly) float flt __attribute__((swift_name("flt")));
|
@property (class, readonly) float flt __attribute__((swift_name("flt")));
|
||||||
@property (class, readonly) int32_t integer __attribute__((swift_name("integer")));
|
@property (class, readonly) int32_t integer __attribute__((swift_name("integer")));
|
||||||
|
|||||||
@@ -774,3 +774,7 @@ class SharedRefs {
|
|||||||
|
|
||||||
private val mustBeRemoved = mutableListOf<WeakReference<*>>()
|
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 --------
|
// -------- Execution of the test --------
|
||||||
|
|
||||||
class ValuesTests : TestProvider {
|
class ValuesTests : TestProvider {
|
||||||
@@ -1047,6 +1053,7 @@ class ValuesTests : TestProvider {
|
|||||||
TestCase(name: "TestDeprecation", method: withAutorelease(testDeprecation)),
|
TestCase(name: "TestDeprecation", method: withAutorelease(testDeprecation)),
|
||||||
TestCase(name: "TestWeakRefs", method: withAutorelease(testWeakRefs)),
|
TestCase(name: "TestWeakRefs", method: withAutorelease(testWeakRefs)),
|
||||||
TestCase(name: "TestSharedRefs", method: withAutorelease(TestSharedRefs().test)),
|
TestCase(name: "TestSharedRefs", method: withAutorelease(TestSharedRefs().test)),
|
||||||
|
TestCase(name: "TestClassTypeCheck", method: withAutorelease(testClassTypeCheck)),
|
||||||
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
|
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -734,6 +734,8 @@ static const TypeInfo* createTypeInfo(
|
|||||||
result->flags_ |= TF_IMMUTABLE;
|
result->flags_ |= TF_IMMUTABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result->classId_ = superType->classId_;
|
||||||
|
|
||||||
KStdVector<const TypeInfo*> implementedInterfaces(
|
KStdVector<const TypeInfo*> implementedInterfaces(
|
||||||
superType->implementedInterfaces_, superType->implementedInterfaces_ + superType->implementedInterfacesCount_
|
superType->implementedInterfaces_, superType->implementedInterfaces_ + superType->implementedInterfacesCount_
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user