Improve kotlin.Deprecated support when producing framework (#3114)
This commit is contained in:
committed by
GitHub
parent
ef24aff534
commit
067ec3428a
+1
@@ -193,6 +193,7 @@ internal class SpecialDeclarationsFactory(val context: Context) : KotlinMangler
|
||||
}
|
||||
|
||||
internal class Context(config: KonanConfig) : KonanBackendContext(config) {
|
||||
lateinit var frontendServices: FrontendServices
|
||||
lateinit var environment: KotlinCoreEnvironment
|
||||
lateinit var bindingContext: BindingContext
|
||||
|
||||
|
||||
+10
-4
@@ -10,11 +10,13 @@ import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportLazy
|
||||
import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportLazyImpl
|
||||
import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportWarningCollector
|
||||
import org.jetbrains.kotlin.backend.konan.objcexport.dumpObjCHeader
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.container.*
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
|
||||
|
||||
internal fun StorageComponentContainer.initContainer(config: KonanConfig) {
|
||||
this.useImpl<FrontendServices>()
|
||||
|
||||
if (config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE) != null) {
|
||||
this.useImpl<ObjCExportLazyImpl>()
|
||||
this.useInstance(ObjCExportWarningCollector.SILENT)
|
||||
@@ -35,8 +37,12 @@ internal fun StorageComponentContainer.initContainer(config: KonanConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ComponentProvider.postprocessComponents(configuration: CompilerConfiguration, files: Collection<KtFile>) {
|
||||
configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.let {
|
||||
internal fun ComponentProvider.postprocessComponents(context: Context, files: Collection<KtFile>) {
|
||||
context.frontendServices = this.get<FrontendServices>()
|
||||
|
||||
context.config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.let {
|
||||
this.get<ObjCExportLazy>().dumpObjCHeader(files, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FrontendServices(val deprecationResolver: DeprecationResolver)
|
||||
+1
-1
@@ -77,7 +77,7 @@ internal object TopDownAnalyzerFacadeForKonan {
|
||||
) {
|
||||
initContainer(context.config)
|
||||
}.apply {
|
||||
postprocessComponents(context.config.configuration, files)
|
||||
postprocessComponents(context, files)
|
||||
}.get<LazyTopDownAnalyzer>()
|
||||
|
||||
analyzerForKonan.analyzeDeclarations(TopDownAnalysisMode.TopLevelDeclarations, files)
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ internal class ObjCExport(val context: Context, symbolTable: SymbolTable) {
|
||||
val produceFramework = context.config.produce == CompilerOutputKind.FRAMEWORK
|
||||
|
||||
return if (produceFramework) {
|
||||
val mapper = ObjCExportMapper()
|
||||
val mapper = ObjCExportMapper(context.frontendServices.deprecationResolver)
|
||||
val moduleDescriptors = listOf(context.moduleDescriptor) + context.getExportedDependencies()
|
||||
val objcGenerics = context.configuration.getBoolean(KonanConfigKeys.OBJC_GENERICS)
|
||||
val namer = ObjCExportNamerImpl(
|
||||
|
||||
+33
-5
@@ -17,6 +17,8 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.constants.ArrayValue
|
||||
import org.jetbrains.kotlin.resolve.constants.KClassValue
|
||||
import org.jetbrains.kotlin.resolve.deprecation.Deprecation
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
@@ -365,8 +367,7 @@ internal class ObjCExportTranslatorImpl(
|
||||
?.forEach {
|
||||
val selector = getSelector(it)
|
||||
if (selector !in presentConstructors) {
|
||||
val c = buildMethod(it, it, ObjCNoneExportScope)
|
||||
+ObjCMethod(c.descriptor, c.isInstanceMethod, c.returnType, c.selectors, c.parameters, c.attributes + "unavailable")
|
||||
+buildMethod(it, it, ObjCNoneExportScope, unavailable = true)
|
||||
|
||||
if (selector == "init") {
|
||||
+ObjCMethod(null, false, ObjCInstanceType, listOf("new"), emptyList(), listOf("unavailable"))
|
||||
@@ -598,10 +599,18 @@ internal class ObjCExportTranslatorImpl(
|
||||
val getterSelector = getSelector(baseProperty.getter!!)
|
||||
val getterName: String? = if (getterSelector != name) getterSelector else null
|
||||
|
||||
return ObjCProperty(name, property, type, attributes, setterName, getterName, listOf(swiftNameAttribute(name)))
|
||||
val declarationAttributes = mutableListOf(swiftNameAttribute(name))
|
||||
declarationAttributes.addIfNotNull(mapper.getDeprecation(property)?.toDeprecationAttribute())
|
||||
|
||||
return ObjCProperty(name, property, type, attributes, setterName, getterName, declarationAttributes)
|
||||
}
|
||||
|
||||
private fun buildMethod(method: FunctionDescriptor, baseMethod: FunctionDescriptor, objCExportScope: ObjCExportScope): ObjCMethod {
|
||||
private fun buildMethod(
|
||||
method: FunctionDescriptor,
|
||||
baseMethod: FunctionDescriptor,
|
||||
objCExportScope: ObjCExportScope,
|
||||
unavailable: Boolean = false
|
||||
): ObjCMethod {
|
||||
fun collectParameters(baseMethodBridge: MethodBridge, method: FunctionDescriptor): List<ObjCParameter> {
|
||||
fun unifyName(initialName: String, usedNames: Set<String>): String {
|
||||
var unique = initialName.toValidObjCSwiftIdentifier()
|
||||
@@ -672,6 +681,12 @@ internal class ObjCExportTranslatorImpl(
|
||||
attributes += "objc_designated_initializer"
|
||||
}
|
||||
|
||||
if (unavailable) {
|
||||
attributes += "unavailable"
|
||||
} else {
|
||||
attributes.addIfNotNull(mapper.getDeprecation(method)?.toDeprecationAttribute())
|
||||
}
|
||||
|
||||
return ObjCMethod(method, isInstanceMethod, returnType, selectorParts, parameters, attributes)
|
||||
}
|
||||
|
||||
@@ -789,8 +804,8 @@ internal class ObjCExportTranslatorImpl(
|
||||
return mapObjCObjectReferenceTypeIgnoringNullability(classDescriptor)
|
||||
}
|
||||
|
||||
// Workaround for https://github.com/JetBrains/kotlin-native/issues/3053
|
||||
if (!mapper.shouldBeExposed(classDescriptor)) {
|
||||
// There are number of tricky corner cases getting here.
|
||||
return ObjCIdType
|
||||
}
|
||||
|
||||
@@ -1199,3 +1214,16 @@ internal fun Variance.objcDeclaration():String = when(this){
|
||||
private fun computeSuperClassType(descriptor: ClassDescriptor): KotlinType? = descriptor.typeConstructor.supertypes.filter { !it.isInterface() }.firstOrNull()
|
||||
|
||||
internal const val OBJC_SUBCLASSING_RESTRICTED = "objc_subclassing_restricted"
|
||||
|
||||
private fun Deprecation.toDeprecationAttribute(): String {
|
||||
val attribute = when (deprecationLevel) {
|
||||
DeprecationLevelValue.WARNING -> "deprecated"
|
||||
DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> "unavailable"
|
||||
}
|
||||
|
||||
// TODO: consider avoiding code generation for unavailable.
|
||||
|
||||
val message = this.message.orEmpty()
|
||||
|
||||
return "$attribute(\"$message\")"
|
||||
}
|
||||
|
||||
+10
-5
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
@@ -47,6 +48,7 @@ interface ObjCExportLazy {
|
||||
fun translate(file: KtFile): List<ObjCTopLevel<*>>
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun createObjCExportLazy(
|
||||
configuration: ObjCExportLazy.Configuration,
|
||||
warningCollector: ObjCExportWarningCollector,
|
||||
@@ -54,7 +56,8 @@ fun createObjCExportLazy(
|
||||
typeResolver: TypeResolver,
|
||||
descriptorResolver: DescriptorResolver,
|
||||
fileScopeProvider: FileScopeProvider,
|
||||
builtIns: KotlinBuiltIns
|
||||
builtIns: KotlinBuiltIns,
|
||||
deprecationResolver: DeprecationResolver? = null
|
||||
): ObjCExportLazy = ObjCExportLazyImpl(
|
||||
configuration,
|
||||
warningCollector,
|
||||
@@ -62,7 +65,8 @@ fun createObjCExportLazy(
|
||||
typeResolver,
|
||||
descriptorResolver,
|
||||
fileScopeProvider,
|
||||
builtIns
|
||||
builtIns,
|
||||
deprecationResolver
|
||||
)
|
||||
|
||||
internal class ObjCExportLazyImpl(
|
||||
@@ -72,14 +76,15 @@ internal class ObjCExportLazyImpl(
|
||||
private val typeResolver: TypeResolver,
|
||||
private val descriptorResolver: DescriptorResolver,
|
||||
private val fileScopeProvider: FileScopeProvider,
|
||||
builtIns: KotlinBuiltIns
|
||||
builtIns: KotlinBuiltIns,
|
||||
deprecationResolver: DeprecationResolver?
|
||||
) : ObjCExportLazy {
|
||||
|
||||
private val namerConfiguration = createNamerConfiguration(configuration)
|
||||
|
||||
private val nameTranslator: ObjCExportNameTranslator = ObjCExportNameTranslatorImpl(namerConfiguration)
|
||||
|
||||
private val mapper = ObjCExportMapper(local = true)
|
||||
private val mapper = ObjCExportMapper(deprecationResolver, local = true)
|
||||
|
||||
private val namer = ObjCExportNamerImpl(namerConfiguration, builtIns, mapper, local = true)
|
||||
|
||||
@@ -99,7 +104,7 @@ internal class ObjCExportLazyImpl(
|
||||
private fun translateClasses(container: KtDeclarationContainer): List<ObjCClass<*>> {
|
||||
val result = mutableListOf<ObjCClass<*>>()
|
||||
container.declarations.forEach { declaration ->
|
||||
// Supposed to be equivalent to ObjCExportMapper.shouldBeVisible.
|
||||
// Supposed to be true if ObjCExportMapper.shouldBeVisible is true.
|
||||
if (declaration is KtClassOrObject && declaration.isPublic && declaration !is KtEnumEntry
|
||||
&& !declaration.hasExpectModifier()) {
|
||||
|
||||
|
||||
+59
-4
@@ -14,13 +14,19 @@ import org.jetbrains.kotlin.backend.konan.descriptors.isInterface
|
||||
import org.jetbrains.kotlin.builtins.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.resolve.deprecation.Deprecation
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
|
||||
internal class ObjCExportMapper(private val local: Boolean = false) {
|
||||
internal class ObjCExportMapper(
|
||||
internal val deprecationResolver: DeprecationResolver? = null,
|
||||
private val local: Boolean = false
|
||||
) {
|
||||
companion object {
|
||||
val maxFunctionTypeParameterCount get() = KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS
|
||||
}
|
||||
@@ -69,17 +75,66 @@ internal fun ObjCExportMapper.getClassIfCategory(extensionReceiverType: KotlinTy
|
||||
|
||||
// Note: partially duplicated in ObjCExportLazyImpl.translateTopLevels.
|
||||
internal fun ObjCExportMapper.shouldBeExposed(descriptor: CallableMemberDescriptor): Boolean =
|
||||
descriptor.isEffectivelyPublicApi && !descriptor.isSuspend && !descriptor.isExpect
|
||||
descriptor.isEffectivelyPublicApi && !descriptor.isSuspend && !descriptor.isExpect &&
|
||||
!isHiddenByDeprecation(descriptor)
|
||||
|
||||
internal fun ObjCExportMapper.shouldBeExposed(descriptor: ClassDescriptor): Boolean =
|
||||
shouldBeVisible(descriptor) && !isSpecialMapped(descriptor) && !descriptor.defaultType.isObjCObjectType()
|
||||
|
||||
// Note: the logic is duplicated in ObjCExportLazyImpl.translateClasses.
|
||||
private fun ObjCExportMapper.isHiddenByDeprecation(descriptor: CallableMemberDescriptor): Boolean {
|
||||
// Note: ObjCExport generally expect overrides of exposed methods to be exposed.
|
||||
// So don't hide a "deprecated hidden" method which overrides non-hidden one:
|
||||
if (deprecationResolver != null && deprecationResolver.isDeprecatedHidden(descriptor) &&
|
||||
descriptor.overriddenDescriptors.all { isHiddenByDeprecation(it) }) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Note: ObjCExport expects members of unexposed classes to be unexposed too.
|
||||
// So hide a declaration if it is from a hidden class:
|
||||
val containingDeclaration = descriptor.containingDeclaration
|
||||
if (containingDeclaration is ClassDescriptor && isHiddenByDeprecation(containingDeclaration)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
internal fun ObjCExportMapper.getDeprecation(descriptor: DeclarationDescriptor): Deprecation? {
|
||||
deprecationResolver?.getDeprecations(descriptor).orEmpty().maxBy {
|
||||
when (it.deprecationLevel) {
|
||||
DeprecationLevelValue.WARNING -> 1
|
||||
DeprecationLevelValue.ERROR -> 2
|
||||
DeprecationLevelValue.HIDDEN -> 3
|
||||
}
|
||||
}?.let { return it }
|
||||
|
||||
(descriptor as? ConstructorDescriptor)?.let {
|
||||
// Note: a deprecation can't be applied to a class itself when generating header
|
||||
// since the class can be referred from the header.
|
||||
// Apply class deprecations to its constructors instead:
|
||||
return getDeprecation(it.constructedClass)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
private tailrec fun ObjCExportMapper.isHiddenByDeprecation(descriptor: ClassDescriptor): Boolean {
|
||||
if (deprecationResolver == null) return false
|
||||
if (deprecationResolver.isDeprecatedHidden(descriptor)) return true
|
||||
|
||||
val superClass = descriptor.getSuperClassNotAny() ?: return false
|
||||
|
||||
// Note: ObjCExport requires super class of exposed class to be exposed.
|
||||
// So hide a class if its super class is hidden:
|
||||
return isHiddenByDeprecation(superClass)
|
||||
}
|
||||
|
||||
// Note: the logic is partially duplicated in ObjCExportLazyImpl.translateClasses.
|
||||
internal fun ObjCExportMapper.shouldBeVisible(descriptor: ClassDescriptor): Boolean =
|
||||
descriptor.isEffectivelyPublicApi && when (descriptor.kind) {
|
||||
ClassKind.CLASS, ClassKind.INTERFACE, ClassKind.ENUM_CLASS, ClassKind.OBJECT -> true
|
||||
ClassKind.ENUM_ENTRY, ClassKind.ANNOTATION_CLASS -> false
|
||||
} && !descriptor.isExpect && !descriptor.isInlined()
|
||||
} && !descriptor.isExpect && !descriptor.isInlined() && !isHiddenByDeprecation(descriptor)
|
||||
|
||||
private fun ObjCExportMapper.isBase(descriptor: CallableMemberDescriptor): Boolean =
|
||||
descriptor.overriddenDescriptors.all { !shouldBeExposed(it) }
|
||||
|
||||
@@ -641,6 +641,224 @@ __attribute__((swift_name("TestInvalidIdentifiers.Companion_")))
|
||||
@property (readonly) int32_t _42 __attribute__((swift_name("_42")));
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecation")))
|
||||
@interface ValuesTestDeprecation : KotlinBase
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)callEffectivelyHiddenObj:(id)obj __attribute__((swift_name("callEffectivelyHidden(obj:)")));
|
||||
- (id)getHidden __attribute__((swift_name("getHidden()")));
|
||||
- (ValuesTestDeprecationError *)getError __attribute__((swift_name("getError()")));
|
||||
- (void)error __attribute__((swift_name("error()"))) __attribute__((unavailable("error")));
|
||||
- (void)openError __attribute__((swift_name("openError()"))) __attribute__((unavailable("error")));
|
||||
- (ValuesTestDeprecationWarning *)getWarning __attribute__((swift_name("getWarning()")));
|
||||
- (void)warning __attribute__((swift_name("warning()"))) __attribute__((deprecated("warning")));
|
||||
- (void)openWarning __attribute__((swift_name("openWarning()"))) __attribute__((deprecated("warning")));
|
||||
- (void)normal __attribute__((swift_name("normal()")));
|
||||
- (int32_t)openNormal __attribute__((swift_name("openNormal()")));
|
||||
@property (readonly) id _Nullable errorVal __attribute__((swift_name("errorVal"))) __attribute__((unavailable("error")));
|
||||
@property id _Nullable errorVar __attribute__((swift_name("errorVar"))) __attribute__((unavailable("error")));
|
||||
@property (readonly) id _Nullable openErrorVal __attribute__((swift_name("openErrorVal"))) __attribute__((unavailable("error")));
|
||||
@property id _Nullable openErrorVar __attribute__((swift_name("openErrorVar"))) __attribute__((unavailable("error")));
|
||||
@property (readonly) id _Nullable warningVal __attribute__((swift_name("warningVal"))) __attribute__((deprecated("warning")));
|
||||
@property id _Nullable warningVar __attribute__((swift_name("warningVar"))) __attribute__((deprecated("warning")));
|
||||
@property (readonly) id _Nullable openWarningVal __attribute__((swift_name("openWarningVal"))) __attribute__((deprecated("warning")));
|
||||
@property id _Nullable openWarningVar __attribute__((swift_name("openWarningVar"))) __attribute__((deprecated("warning")));
|
||||
@property (readonly) id _Nullable normalVal __attribute__((swift_name("normalVal")));
|
||||
@property id _Nullable normalVar __attribute__((swift_name("normalVar")));
|
||||
@property (readonly) id _Nullable openNormalVal __attribute__((swift_name("openNormalVal")));
|
||||
@property id _Nullable openNormalVar __attribute__((swift_name("openNormalVar")));
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecation.OpenHidden")))
|
||||
@interface ValuesTestDeprecationOpenHidden : NSObject
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.ExtendingHidden")))
|
||||
@interface ValuesTestDeprecationExtendingHidden : NSObject
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecationHiddenInterface")))
|
||||
@protocol ValuesTestDeprecationHiddenInterface
|
||||
@required
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecation.ImplementingHidden")))
|
||||
@interface ValuesTestDeprecationImplementingHidden : KotlinBase
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)effectivelyHidden __attribute__((swift_name("effectivelyHidden()")));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.Hidden")))
|
||||
@interface ValuesTestDeprecationHidden : NSObject
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecation.OpenError")))
|
||||
@interface ValuesTestDeprecationOpenError : ValuesTestDeprecation
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.ExtendingError")))
|
||||
@interface ValuesTestDeprecationExtendingError : ValuesTestDeprecationOpenError
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecationErrorInterface")))
|
||||
@protocol ValuesTestDeprecationErrorInterface
|
||||
@required
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.ImplementingError")))
|
||||
@interface ValuesTestDeprecationImplementingError : KotlinBase <ValuesTestDeprecationErrorInterface>
|
||||
- (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("TestDeprecation.Error")))
|
||||
@interface ValuesTestDeprecationError : ValuesTestDeprecation
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecation.OpenWarning")))
|
||||
@interface ValuesTestDeprecationOpenWarning : ValuesTestDeprecation
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.ExtendingWarning")))
|
||||
@interface ValuesTestDeprecationExtendingWarning : ValuesTestDeprecationOpenWarning
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
@end;
|
||||
|
||||
__attribute__((swift_name("TestDeprecationWarningInterface")))
|
||||
@protocol ValuesTestDeprecationWarningInterface
|
||||
@required
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.ImplementingWarning")))
|
||||
@interface ValuesTestDeprecationImplementingWarning : KotlinBase <ValuesTestDeprecationWarningInterface>
|
||||
- (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("TestDeprecation.Warning")))
|
||||
@interface ValuesTestDeprecationWarning : ValuesTestDeprecation
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.HiddenOverride")))
|
||||
@interface ValuesTestDeprecationHiddenOverride : ValuesTestDeprecation
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
- (void)openError __attribute__((swift_name("openError()"))) __attribute__((unavailable("hidden")));
|
||||
- (void)openWarning __attribute__((swift_name("openWarning()"))) __attribute__((unavailable("hidden")));
|
||||
- (int32_t)openNormal __attribute__((swift_name("openNormal()"))) __attribute__((unavailable("hidden")));
|
||||
@property (readonly) id _Nullable openErrorVal __attribute__((swift_name("openErrorVal"))) __attribute__((unavailable("hidden")));
|
||||
@property id _Nullable openErrorVar __attribute__((swift_name("openErrorVar"))) __attribute__((unavailable("hidden")));
|
||||
@property (readonly) id _Nullable openWarningVal __attribute__((swift_name("openWarningVal"))) __attribute__((unavailable("hidden")));
|
||||
@property id _Nullable openWarningVar __attribute__((swift_name("openWarningVar"))) __attribute__((unavailable("hidden")));
|
||||
@property (readonly) id _Nullable openNormalVal __attribute__((swift_name("openNormalVal"))) __attribute__((unavailable("hidden")));
|
||||
@property id _Nullable openNormalVar __attribute__((swift_name("openNormalVar"))) __attribute__((unavailable("hidden")));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.ErrorOverride")))
|
||||
@interface ValuesTestDeprecationErrorOverride : ValuesTestDeprecation
|
||||
- (instancetype)initWithHidden:(int8_t)hidden __attribute__((swift_name("init(hidden:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable("error")));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (void)openHidden __attribute__((swift_name("openHidden()"))) __attribute__((unavailable("error")));
|
||||
- (void)openError __attribute__((swift_name("openError()"))) __attribute__((unavailable("error")));
|
||||
- (void)openWarning __attribute__((swift_name("openWarning()"))) __attribute__((unavailable("error")));
|
||||
- (int32_t)openNormal __attribute__((swift_name("openNormal()"))) __attribute__((unavailable("error")));
|
||||
@property (readonly) id _Nullable openHiddenVal __attribute__((swift_name("openHiddenVal"))) __attribute__((unavailable("error")));
|
||||
@property id _Nullable openHiddenVar __attribute__((swift_name("openHiddenVar"))) __attribute__((unavailable("error")));
|
||||
@property (readonly) id _Nullable openErrorVal __attribute__((swift_name("openErrorVal"))) __attribute__((unavailable("error")));
|
||||
@property id _Nullable openErrorVar __attribute__((swift_name("openErrorVar"))) __attribute__((unavailable("error")));
|
||||
@property (readonly) id _Nullable openWarningVal __attribute__((swift_name("openWarningVal"))) __attribute__((unavailable("error")));
|
||||
@property id _Nullable openWarningVar __attribute__((swift_name("openWarningVar"))) __attribute__((unavailable("error")));
|
||||
@property (readonly) id _Nullable openNormalVal __attribute__((swift_name("openNormalVal"))) __attribute__((unavailable("error")));
|
||||
@property id _Nullable openNormalVar __attribute__((swift_name("openNormalVar"))) __attribute__((unavailable("error")));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.WarningOverride")))
|
||||
@interface ValuesTestDeprecationWarningOverride : ValuesTestDeprecation
|
||||
- (instancetype)initWithHidden:(int8_t)hidden __attribute__((swift_name("init(hidden:)"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer)) __attribute__((deprecated("warning")));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (void)openHidden __attribute__((swift_name("openHidden()"))) __attribute__((deprecated("warning")));
|
||||
- (void)openError __attribute__((swift_name("openError()"))) __attribute__((deprecated("warning")));
|
||||
- (void)openWarning __attribute__((swift_name("openWarning()"))) __attribute__((deprecated("warning")));
|
||||
- (int32_t)openNormal __attribute__((swift_name("openNormal()"))) __attribute__((deprecated("warning")));
|
||||
@property (readonly) id _Nullable openHiddenVal __attribute__((swift_name("openHiddenVal"))) __attribute__((deprecated("warning")));
|
||||
@property id _Nullable openHiddenVar __attribute__((swift_name("openHiddenVar"))) __attribute__((deprecated("warning")));
|
||||
@property (readonly) id _Nullable openErrorVal __attribute__((swift_name("openErrorVal"))) __attribute__((deprecated("warning")));
|
||||
@property id _Nullable openErrorVar __attribute__((swift_name("openErrorVar"))) __attribute__((deprecated("warning")));
|
||||
@property (readonly) id _Nullable openWarningVal __attribute__((swift_name("openWarningVal"))) __attribute__((deprecated("warning")));
|
||||
@property id _Nullable openWarningVar __attribute__((swift_name("openWarningVar"))) __attribute__((deprecated("warning")));
|
||||
@property (readonly) id _Nullable openNormalVal __attribute__((swift_name("openNormalVal"))) __attribute__((deprecated("warning")));
|
||||
@property id _Nullable openNormalVar __attribute__((swift_name("openNormalVar"))) __attribute__((deprecated("warning")));
|
||||
@end;
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("TestDeprecation.NormalOverride")))
|
||||
@interface ValuesTestDeprecationNormalOverride : ValuesTestDeprecation
|
||||
- (instancetype)initWithHidden:(int8_t)hidden __attribute__((swift_name("init(hidden:)"))) __attribute__((objc_designated_initializer));
|
||||
- (instancetype)initWithError:(int16_t)error __attribute__((swift_name("init(error:)"))) __attribute__((objc_designated_initializer));
|
||||
- (instancetype)initWithWarning:(int32_t)warning __attribute__((swift_name("init(warning:)"))) __attribute__((objc_designated_initializer));
|
||||
- (instancetype)initWithNormal:(int64_t)normal __attribute__((swift_name("init(normal:)"))) __attribute__((objc_designated_initializer));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (void)openError __attribute__((swift_name("openError()"))) __attribute__((unavailable("Overrides deprecated member in 'conversions.TestDeprecation'. error")));
|
||||
- (void)openWarning __attribute__((swift_name("openWarning()"))) __attribute__((deprecated("Overrides deprecated member in 'conversions.TestDeprecation'. warning")));
|
||||
- (int32_t)openNormal __attribute__((swift_name("openNormal()")));
|
||||
@property (readonly) id _Nullable openErrorVal __attribute__((swift_name("openErrorVal"))) __attribute__((unavailable("Overrides deprecated member in 'conversions.TestDeprecation'. error")));
|
||||
@property id _Nullable openErrorVar __attribute__((swift_name("openErrorVar"))) __attribute__((unavailable("Overrides deprecated member in 'conversions.TestDeprecation'. error")));
|
||||
@property (readonly) id _Nullable openWarningVal __attribute__((swift_name("openWarningVal"))) __attribute__((deprecated("Overrides deprecated member in 'conversions.TestDeprecation'. warning")));
|
||||
@property id _Nullable openWarningVar __attribute__((swift_name("openWarningVar"))) __attribute__((deprecated("Overrides deprecated member in 'conversions.TestDeprecation'. warning")));
|
||||
@property (readonly) id _Nullable openNormalVal __attribute__((swift_name("openNormalVal")));
|
||||
@property id _Nullable openNormalVar __attribute__((swift_name("openNormalVar")));
|
||||
@end;
|
||||
|
||||
@interface ValuesEnumeration (ValuesKt)
|
||||
- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()")));
|
||||
@end;
|
||||
@@ -717,6 +935,8 @@ __attribute__((swift_name("ValuesKt")))
|
||||
+ (BOOL)isBlockNullBlock:(void (^ _Nullable)(void))block __attribute__((swift_name("isBlockNull(block:)")));
|
||||
+ (void)takeForwardDeclaredClassObj:(ForwardDeclaredClass *)obj __attribute__((swift_name("takeForwardDeclaredClass(obj:)")));
|
||||
+ (void)takeForwardDeclaredProtocolObj:(id<ForwardDeclared>)obj __attribute__((swift_name("takeForwardDeclaredProtocol(obj:)")));
|
||||
+ (void)error __attribute__((swift_name("error()"))) __attribute__((unavailable("error")));
|
||||
+ (void)warning __attribute__((swift_name("warning()"))) __attribute__((deprecated("warning")));
|
||||
@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")));
|
||||
@@ -743,5 +963,9 @@ __attribute__((swift_name("ValuesKt")))
|
||||
@property (class) id anyValue __attribute__((swift_name("anyValue")));
|
||||
@property (class, readonly) ValuesInt *(^sumLambda)(ValuesInt *, ValuesInt *) __attribute__((swift_name("sumLambda")));
|
||||
@property (class, readonly) int32_t PROPERTY_NAME_MUST_NOT_BE_ALTERED_BY_SWIFT __attribute__((swift_name("PROPERTY_NAME_MUST_NOT_BE_ALTERED_BY_SWIFT")));
|
||||
@property (class, readonly) id _Nullable errorVal __attribute__((swift_name("errorVal"))) __attribute__((unavailable("error")));
|
||||
@property (class) id _Nullable errorVar __attribute__((swift_name("errorVar"))) __attribute__((unavailable("error")));
|
||||
@property (class, readonly) id _Nullable warningVal __attribute__((swift_name("warningVal"))) __attribute__((deprecated("warning")));
|
||||
@property (class) id _Nullable warningVar __attribute__((swift_name("warningVar"))) __attribute__((deprecated("warning")));
|
||||
@end;
|
||||
|
||||
|
||||
@@ -491,3 +491,173 @@ class TestInvalidIdentifiers {
|
||||
val `$` = '$'
|
||||
val `_` = '_'
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
open class TestDeprecation() {
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) open class OpenHidden : TestDeprecation()
|
||||
@Suppress("DEPRECATION_ERROR") class ExtendingHidden : OpenHidden()
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) interface HiddenInterface {
|
||||
fun effectivelyHidden(): Any
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION_ERROR") open class ImplementingHidden : Any(), HiddenInterface {
|
||||
override fun effectivelyHidden(): Int = -1
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
fun callEffectivelyHidden(obj: Any): Int = (obj as HiddenInterface).effectivelyHidden() as Int
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) class Hidden : TestDeprecation()
|
||||
@Suppress("DEPRECATION_ERROR") fun getHidden() = Hidden()
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) constructor(hidden: Byte) : this()
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) fun hidden() {}
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) val hiddenVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) var hiddenVar: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) open fun openHidden() {}
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) open val openHiddenVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) open var openHiddenVar: Any? = null
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) open class OpenError : TestDeprecation()
|
||||
@Suppress("DEPRECATION_ERROR") class ExtendingError : OpenError()
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) interface ErrorInterface
|
||||
@Suppress("DEPRECATION_ERROR") class ImplementingError : ErrorInterface
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) class Error : TestDeprecation()
|
||||
@Suppress("DEPRECATION_ERROR") fun getError() = Error()
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) constructor(error: Short) : this()
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) fun error() {}
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) val errorVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) var errorVar: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) open fun openError() {}
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) open val openErrorVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) open var openErrorVar: Any? = null
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) open class OpenWarning : TestDeprecation()
|
||||
@Suppress("DEPRECATION") class ExtendingWarning : OpenWarning()
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) interface WarningInterface
|
||||
@Suppress("DEPRECATION") class ImplementingWarning : WarningInterface
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) class Warning : TestDeprecation()
|
||||
@Suppress("DEPRECATION") fun getWarning() = Warning()
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) constructor(warning: Int) : this()
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) fun warning() {}
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) val warningVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) var warningVar: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) open fun openWarning() {}
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) open val openWarningVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) open var openWarningVar: Any? = null
|
||||
|
||||
constructor(normal: Long) : this()
|
||||
fun normal() {}
|
||||
val normalVal: Any? = null
|
||||
var normalVar: Any? = null
|
||||
open fun openNormal(): Int = 1
|
||||
open val openNormalVal: Any? = null
|
||||
open var openNormalVar: Any? = null
|
||||
|
||||
class HiddenOverride() : TestDeprecation() {
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) constructor(hidden: Byte) : this()
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override fun openHidden() {}
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override val openHiddenVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override var openHiddenVar: Any? = null
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) constructor(error: Short) : this()
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override fun openError() {}
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override val openErrorVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override var openErrorVar: Any? = null
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) constructor(warning: Int) : this()
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override fun openWarning() {}
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override val openWarningVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override var openWarningVar: Any? = null
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) constructor(normal: Long) : this()
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override fun openNormal(): Int = 2
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override val openNormalVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) override var openNormalVar: Any? = null
|
||||
}
|
||||
|
||||
class ErrorOverride() : TestDeprecation() {
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) constructor(hidden: Byte) : this()
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override fun openHidden() {}
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override val openHiddenVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override var openHiddenVar: Any? = null
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) constructor(error: Short) : this()
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override fun openError() {}
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override val openErrorVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override var openErrorVar: Any? = null
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) constructor(warning: Int) : this()
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override fun openWarning() {}
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override val openWarningVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override var openWarningVar: Any? = null
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) constructor(normal: Long) : this()
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override fun openNormal(): Int = 3
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override val openNormalVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) override var openNormalVar: Any? = null
|
||||
}
|
||||
|
||||
class WarningOverride() : TestDeprecation() {
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) constructor(hidden: Byte) : this()
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override fun openHidden() {}
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override val openHiddenVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override var openHiddenVar: Any? = null
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) constructor(error: Short) : this()
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override fun openError() {}
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override val openErrorVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override var openErrorVar: Any? = null
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) constructor(warning: Int) : this()
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override fun openWarning() {}
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override val openWarningVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override var openWarningVar: Any? = null
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) constructor(normal: Long) : this()
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override fun openNormal(): Int = 4
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override val openNormalVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) override var openNormalVar: Any? = null
|
||||
}
|
||||
|
||||
class NormalOverride() : TestDeprecation() {
|
||||
constructor(hidden: Byte) : this()
|
||||
override fun openHidden() {}
|
||||
override val openHiddenVal: Any? = null
|
||||
override var openHiddenVar: Any? = null
|
||||
|
||||
constructor(error: Short) : this()
|
||||
override fun openError() {}
|
||||
override val openErrorVal: Any? = null
|
||||
override var openErrorVar: Any? = null
|
||||
|
||||
constructor(warning: Int) : this()
|
||||
override fun openWarning() {}
|
||||
override val openWarningVal: Any? = null
|
||||
override var openWarningVar: Any? = null
|
||||
|
||||
constructor(normal: Long) : this()
|
||||
override fun openNormal(): Int = 5
|
||||
override val openNormalVal: Any? = null
|
||||
override var openNormalVar: Any? = null
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) fun hidden() {}
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) val hiddenVal: Any? = null
|
||||
@Deprecated("hidden", level = DeprecationLevel.HIDDEN) var hiddenVar: Any? = null
|
||||
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) fun error() {}
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) val errorVal: Any? = null
|
||||
@Deprecated("error", level = DeprecationLevel.ERROR) var errorVar: Any? = null
|
||||
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) fun warning() {}
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) val warningVal: Any? = null
|
||||
@Deprecated("warning", level = DeprecationLevel.WARNING) var warningVar: Any? = null
|
||||
|
||||
@@ -644,6 +644,28 @@ func testInvalidIdentifiers() throws {
|
||||
try assertEquals(actual: Set([test.__, test.___]), expected: Set(["$".utf16.first, "_".utf16.first]))
|
||||
}
|
||||
|
||||
class ImplementingHiddenSubclass : TestDeprecation.ImplementingHidden {
|
||||
override func effectivelyHidden() -> Int32 {
|
||||
return -2
|
||||
}
|
||||
}
|
||||
|
||||
func testDeprecation() throws {
|
||||
let test = TestDeprecation()
|
||||
try assertEquals(actual: test.openNormal(), expected: 1)
|
||||
|
||||
let testHiddenOverride: TestDeprecation = TestDeprecation.HiddenOverride()
|
||||
try assertEquals(actual: testHiddenOverride.openNormal(), expected: 2)
|
||||
|
||||
let testErrorOverride: TestDeprecation = TestDeprecation.ErrorOverride()
|
||||
try assertEquals(actual: testErrorOverride.openNormal(), expected: 3)
|
||||
|
||||
let testWarningOverride: TestDeprecation = TestDeprecation.WarningOverride()
|
||||
try assertEquals(actual: testWarningOverride.openNormal(), expected: 4)
|
||||
|
||||
try assertEquals(actual: test.callEffectivelyHidden(obj: ImplementingHiddenSubclass()), expected: -2)
|
||||
}
|
||||
|
||||
// See https://github.com/JetBrains/kotlin-native/issues/2931
|
||||
func testGH2931() throws {
|
||||
for i in 0..<50000 {
|
||||
@@ -711,6 +733,7 @@ class ValuesTests : TestProvider {
|
||||
TestCase(name: "TestSR10177Workaround", method: withAutorelease(testSR10177Workaround)),
|
||||
TestCase(name: "TestClashes", method: withAutorelease(testClashes)),
|
||||
TestCase(name: "TestInvalidIdentifiers", method: withAutorelease(testInvalidIdentifiers)),
|
||||
TestCase(name: "TestDeprecation", method: withAutorelease(testDeprecation)),
|
||||
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user