[ObjCExport] Fix KT-64952 HasErrorTypesTest
This commit is contained in:
committed by
Space Team
parent
fc584b7c33
commit
2708c74d9c
+7
@@ -20,6 +20,13 @@ import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
||||
context(KtAnalysisSession)
|
||||
internal fun KtSymbol.isVisibleInObjC(): Boolean = when(this) {
|
||||
is KtCallableSymbol -> this.isVisibleInObjC()
|
||||
is KtClassOrObjectSymbol -> this.isVisibleInObjC()
|
||||
else -> false
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
internal fun KtCallableSymbol.isVisibleInObjC(): Boolean {
|
||||
if (this is KtSymbolWithVisibility && !isPublicApi(this)) return false
|
||||
|
||||
+1
-3
@@ -8,7 +8,6 @@ internal fun KtClassOrObjectSymbol.getAllMembers(): List<KtSymbol> {
|
||||
return getMemberScope()
|
||||
.getAllSymbols()
|
||||
.sortedBy { sortMembers(it) }
|
||||
.filterIsInstance<KtCallableSymbol>()
|
||||
.filter { member -> member.isVisibleInObjC() }
|
||||
.toList()
|
||||
}
|
||||
@@ -37,9 +36,8 @@ internal fun KtClassOrObjectSymbol.getDeclaredMembers(): List<KtSymbol> {
|
||||
return getDeclaredMemberScope()
|
||||
.getAllSymbols()
|
||||
.sortedBy { sortMembers(it) }
|
||||
.filterIsInstance<KtCallableSymbol>()
|
||||
.filter { member ->
|
||||
member.getAllOverriddenSymbols().isEmpty() && member.isVisibleInObjC()
|
||||
member.isVisibleInObjC() && (member !is KtCallableSymbol || member.getAllOverriddenSymbols().isEmpty())
|
||||
}
|
||||
.toList()
|
||||
}
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ class HasErrorTypesTest(
|
||||
"""
|
||||
class A {
|
||||
class B {
|
||||
val e = error("error")
|
||||
val e: Unresolved get() = error("stub")
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
+5
@@ -67,6 +67,11 @@ class ObjCExportHeaderGeneratorTest(val generator: HeaderGenerator) {
|
||||
doTest(headersTestDataDir.resolve("sameClassNameInDifferentPackage"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - nestedClass`() {
|
||||
doTest(headersTestDataDir.resolve("nestedClass"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test - samePropertyAndFunctionName`() {
|
||||
doTest(headersTestDataDir.resolve("samePropertyAndFunctionName"))
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSError.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
#pragma clang diagnostic ignored "-Wincompatible-property-type"
|
||||
#pragma clang diagnostic ignored "-Wnullability"
|
||||
|
||||
#pragma push_macro("_Nullable_result")
|
||||
#if !__has_feature(nullability_nullable_result)
|
||||
#undef _Nullable_result
|
||||
#define _Nullable_result _Nullable
|
||||
#endif
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
@interface A : Base
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("A.B")))
|
||||
@interface AB : Base
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
@end
|
||||
|
||||
#pragma pop_macro("_Nullable_result")
|
||||
#pragma clang diagnostic pop
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
class B
|
||||
}
|
||||
Reference in New Issue
Block a user