Rename isHeader to isExpect in descriptors
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fd6eab38e5
commit
c8ee424f67
+1
-1
@@ -296,7 +296,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
||||
source: SourceElement
|
||||
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isImpl = */ false, /* isExternal = */ false,
|
||||
/* isDelegated = */ false
|
||||
) {
|
||||
|
||||
|
||||
@@ -645,7 +645,7 @@ class ControlFlowInformationProvider private constructor(
|
||||
is KtPrimaryConstructor -> if (!element.hasValOrVar()) {
|
||||
val containingClass = owner.getContainingClassOrObject()
|
||||
val containingClassDescriptor = trace.get(DECLARATION_TO_DESCRIPTOR, containingClass) as? ClassDescriptor
|
||||
if (!DescriptorUtils.isAnnotationClass(containingClassDescriptor) && containingClassDescriptor?.isHeader == false &&
|
||||
if (!DescriptorUtils.isAnnotationClass(containingClassDescriptor) && containingClassDescriptor?.isExpect == false &&
|
||||
!containingClassDescriptor.isEffectivelyExternal()
|
||||
) {
|
||||
report(UNUSED_PARAMETER.on(element, variableDescriptor), ctxt)
|
||||
@@ -665,7 +665,7 @@ class ControlFlowInformationProvider private constructor(
|
||||
if (isMain
|
||||
|| functionDescriptor.isOverridableOrOverrides
|
||||
|| owner.hasModifier(KtTokens.OVERRIDE_KEYWORD)
|
||||
|| functionDescriptor.isHeader || functionDescriptor.isImpl
|
||||
|| functionDescriptor.isExpect || functionDescriptor.isImpl
|
||||
|| functionDescriptor.isEffectivelyExternal()
|
||||
|| OperatorNameConventions.GET_VALUE == functionName
|
||||
|| OperatorNameConventions.SET_VALUE == functionName
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ class SyntheticClassOrObjectDescriptor(
|
||||
override fun isCompanionObject() = isCompanionObject
|
||||
override fun isInner() = false
|
||||
override fun isData() = false
|
||||
override fun isHeader() = false
|
||||
override fun isExpect() = false
|
||||
override fun isImpl() = false
|
||||
|
||||
override fun getCompanionObjectDescriptor() = null
|
||||
|
||||
@@ -166,7 +166,7 @@ public class BodyResolver {
|
||||
@NotNull KtSecondaryConstructor constructor,
|
||||
@NotNull ClassConstructorDescriptor descriptor
|
||||
) {
|
||||
if (descriptor.isHeader() || isEffectivelyExternal(descriptor)) {
|
||||
if (descriptor.isExpect() || isEffectivelyExternal(descriptor)) {
|
||||
// For header and external classes, we do not resolve constructor delegation calls because they are prohibited
|
||||
return DataFlowInfo.Companion.getEMPTY();
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class BodyResolver {
|
||||
descriptor.getUnsubstitutedPrimaryConstructor() != null &&
|
||||
superClass.getKind() != ClassKind.INTERFACE &&
|
||||
!superClass.getConstructors().isEmpty() &&
|
||||
!descriptor.isHeader() && !isEffectivelyExternal(descriptor) &&
|
||||
!descriptor.isExpect() && !isEffectivelyExternal(descriptor) &&
|
||||
!ErrorUtils.isError(superClass)
|
||||
) {
|
||||
trace.report(SUPERTYPE_NOT_INITIALIZED.on(specifier));
|
||||
@@ -428,7 +428,7 @@ public class BodyResolver {
|
||||
assert enumEntryDescriptor.getKind() == ClassKind.ENUM_ENTRY : "Enum entry expected: " + enumEntryDescriptor;
|
||||
ClassDescriptor enumClassDescriptor = (ClassDescriptor) enumEntryDescriptor.getContainingDeclaration();
|
||||
if (enumClassDescriptor.getKind() != ClassKind.ENUM_CLASS) return;
|
||||
if (enumClassDescriptor.isHeader()) return;
|
||||
if (enumClassDescriptor.isExpect()) return;
|
||||
|
||||
List<ClassConstructorDescriptor> applicableConstructors = DescriptorUtilsKt.getConstructorForEmptyArgumentsList(enumClassDescriptor);
|
||||
if (applicableConstructors.size() != 1) {
|
||||
@@ -617,7 +617,7 @@ public class BodyResolver {
|
||||
if (classDescriptor.getConstructors().isEmpty()) {
|
||||
trace.report(ANONYMOUS_INITIALIZER_IN_INTERFACE.on(anonymousInitializer));
|
||||
}
|
||||
if (classDescriptor.isHeader()) {
|
||||
if (classDescriptor.isExpect()) {
|
||||
trace.report(HEADER_DECLARATION_WITH_BODY.on(anonymousInitializer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class DeclarationResolver(
|
||||
// TODO: report error on header class and impl val, or vice versa
|
||||
val (header, impl) =
|
||||
getTopLevelDescriptorsByFqName(topLevelDescriptorProvider, fqName, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
.partition { it is MemberDescriptor && it.isHeader }
|
||||
.partition { it is MemberDescriptor && it.isExpect }
|
||||
|
||||
for (descriptors in listOf(header, impl)) {
|
||||
if (descriptors.size > 1) {
|
||||
|
||||
@@ -250,7 +250,7 @@ class DeclarationsChecker(
|
||||
}
|
||||
|
||||
private fun checkHeaderClassConstructor(constructorDescriptor: ClassConstructorDescriptor, declaration: KtConstructor<*>) {
|
||||
if (!constructorDescriptor.isHeader) return
|
||||
if (!constructorDescriptor.isExpect) return
|
||||
|
||||
if (declaration.hasBody()) {
|
||||
trace.report(HEADER_DECLARATION_WITH_BODY.on(declaration))
|
||||
@@ -633,11 +633,11 @@ class DeclarationsChecker(
|
||||
|
||||
val initializer = property.initializer
|
||||
val delegate = property.delegate
|
||||
val isHeader = propertyDescriptor.isHeader
|
||||
val isExpect = propertyDescriptor.isExpect
|
||||
if (initializer != null) {
|
||||
when {
|
||||
inInterface -> trace.report(PROPERTY_INITIALIZER_IN_INTERFACE.on(initializer))
|
||||
isHeader -> trace.report(HEADER_PROPERTY_INITIALIZER.on(initializer))
|
||||
isExpect -> trace.report(HEADER_PROPERTY_INITIALIZER.on(initializer))
|
||||
!backingFieldRequired -> trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer))
|
||||
property.receiverTypeReference != null -> trace.report(EXTENSION_PROPERTY_WITH_BACKING_FIELD.on(initializer))
|
||||
}
|
||||
@@ -650,7 +650,7 @@ class DeclarationsChecker(
|
||||
else {
|
||||
val isUninitialized = trace.bindingContext.get(BindingContext.IS_UNINITIALIZED, propertyDescriptor) ?: false
|
||||
val isExternal = propertyDescriptor.isEffectivelyExternal()
|
||||
if (backingFieldRequired && !inInterface && !propertyDescriptor.isLateInit && !isHeader && isUninitialized && !isExternal) {
|
||||
if (backingFieldRequired && !inInterface && !propertyDescriptor.isLateInit && !isExpect && isUninitialized && !isExternal) {
|
||||
if (propertyDescriptor.extensionReceiverParameter != null && !hasAccessorImplementation) {
|
||||
trace.report(EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT.on(property))
|
||||
}
|
||||
@@ -696,7 +696,7 @@ class DeclarationsChecker(
|
||||
|
||||
if (containingDescriptor is ClassDescriptor) {
|
||||
val inInterface = containingDescriptor.kind == ClassKind.INTERFACE
|
||||
val isHeaderClass = containingDescriptor.isHeader
|
||||
val isExpectClass = containingDescriptor.isExpect
|
||||
if (hasAbstractModifier && !classCanHaveAbstractMembers(containingDescriptor)) {
|
||||
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.name.asString(), containingDescriptor))
|
||||
}
|
||||
@@ -712,17 +712,17 @@ class DeclarationsChecker(
|
||||
trace.report(REDUNDANT_OPEN_IN_INTERFACE.on(function))
|
||||
}
|
||||
}
|
||||
if (!hasBody && !hasAbstractModifier && !hasExternalModifier && !inInterface && !isHeaderClass) {
|
||||
if (!hasBody && !hasAbstractModifier && !hasExternalModifier && !inInterface && !isExpectClass) {
|
||||
trace.report(NON_ABSTRACT_FUNCTION_WITH_NO_BODY.on(function, functionDescriptor))
|
||||
}
|
||||
}
|
||||
else /* top-level only */ {
|
||||
if (!function.hasBody() && !hasAbstractModifier && !hasExternalModifier && !functionDescriptor.isHeader) {
|
||||
if (!function.hasBody() && !hasAbstractModifier && !hasExternalModifier && !functionDescriptor.isExpect) {
|
||||
trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor))
|
||||
}
|
||||
}
|
||||
|
||||
if (functionDescriptor.isHeader) {
|
||||
if (functionDescriptor.isExpect) {
|
||||
checkHeaderFunction(function)
|
||||
}
|
||||
|
||||
@@ -789,7 +789,7 @@ class DeclarationsChecker(
|
||||
accessorDescriptor: PropertyAccessorDescriptor?
|
||||
) {
|
||||
if (accessor == null || accessorDescriptor == null) return
|
||||
if (propertyDescriptor.isHeader && accessor.hasBody()) {
|
||||
if (propertyDescriptor.isExpect && accessor.hasBody()) {
|
||||
trace.report(HEADER_DECLARATION_WITH_BODY.on(accessor))
|
||||
}
|
||||
|
||||
@@ -829,7 +829,7 @@ class DeclarationsChecker(
|
||||
private fun checkEnumEntry(enumEntry: KtEnumEntry, enumEntryClass: ClassDescriptor) {
|
||||
val enumClass = enumEntryClass.containingDeclaration as ClassDescriptor
|
||||
if (DescriptorUtils.isEnumClass(enumClass)) {
|
||||
if (enumClass.isHeader) {
|
||||
if (enumClass.isExpect) {
|
||||
if (enumEntry.getBody() != null) {
|
||||
trace.report(HEADER_ENUM_ENTRY_WITH_BODY.on(enumEntry))
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ public class DescriptorResolver {
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.LATEINIT_KEYWORD),
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.CONST_KEYWORD),
|
||||
modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) && container instanceof PackageFragmentDescriptor ||
|
||||
container instanceof ClassDescriptor && ((ClassDescriptor) container).isHeader(),
|
||||
container instanceof ClassDescriptor && ((ClassDescriptor) container).isExpect(),
|
||||
modifierList != null && PsiUtilsKt.hasActualModifier(modifierList),
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD),
|
||||
propertyInfo.getHasDelegate()
|
||||
@@ -1201,7 +1201,7 @@ public class DescriptorResolver {
|
||||
KotlinSourceElementKt.toSourceElement(parameter),
|
||||
false,
|
||||
false,
|
||||
classDescriptor.isHeader(),
|
||||
classDescriptor.isExpect(),
|
||||
modifierList != null && PsiUtilsKt.hasActualModifier(modifierList),
|
||||
false,
|
||||
false
|
||||
|
||||
@@ -184,8 +184,8 @@ class FunctionDescriptorResolver(
|
||||
functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD)
|
||||
functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD)
|
||||
functionDescriptor.isSuspend = function.hasModifier(KtTokens.SUSPEND_KEYWORD)
|
||||
functionDescriptor.isHeader = container is PackageFragmentDescriptor && function.hasExpectModifier() ||
|
||||
container is ClassDescriptor && container.isHeader
|
||||
functionDescriptor.isExpect = container is PackageFragmentDescriptor && function.hasExpectModifier() ||
|
||||
container is ClassDescriptor && container.isExpect
|
||||
functionDescriptor.isImpl = function.hasActualModifier()
|
||||
|
||||
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.annotations) }
|
||||
@@ -296,8 +296,8 @@ class FunctionDescriptorResolver(
|
||||
isPrimary,
|
||||
declarationToTrace.toSourceElement()
|
||||
)
|
||||
if (classDescriptor.isHeader) {
|
||||
constructorDescriptor.isHeader = true
|
||||
if (classDescriptor.isExpect) {
|
||||
constructorDescriptor.isExpect = true
|
||||
}
|
||||
if (classDescriptor.isImpl) {
|
||||
constructorDescriptor.isImpl = true
|
||||
|
||||
@@ -153,7 +153,7 @@ class LocalVariableResolver(
|
||||
variable.toSourceElement(),
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isHeader = */ false,
|
||||
/* isExpect = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false,
|
||||
variable is KtProperty && variable.hasDelegate()
|
||||
|
||||
@@ -252,7 +252,7 @@ class OverloadResolver(
|
||||
if (isConstructorsOfDifferentRedeclaredClasses(member1, member2)) continue
|
||||
if (isTopLevelMainInDifferentFiles(member1, member2)) continue
|
||||
if (isDefinitionsForDifferentPlatforms(member1, member2)) continue
|
||||
if (isHeaderDeclarationAndDefinition(member1, member2) || isHeaderDeclarationAndDefinition(member2, member1)) continue
|
||||
if (isExpectDeclarationAndDefinition(member1, member2) || isExpectDeclarationAndDefinition(member2, member1)) continue
|
||||
|
||||
if (!overloadChecker.isOverloadable(member1, member2)) {
|
||||
redeclarations.add(member1)
|
||||
@@ -282,9 +282,9 @@ class OverloadResolver(
|
||||
return file1 == null || file2 == null || file1 !== file2
|
||||
}
|
||||
|
||||
private fun isHeaderDeclarationAndDefinition(declaration: DeclarationDescriptor, definition: DeclarationDescriptor): Boolean {
|
||||
return declaration is MemberDescriptor && declaration.isHeader &&
|
||||
definition is MemberDescriptor && !definition.isHeader
|
||||
private fun isExpectDeclarationAndDefinition(declaration: DeclarationDescriptor, definition: DeclarationDescriptor): Boolean {
|
||||
return declaration is MemberDescriptor && declaration.isExpect &&
|
||||
definition is MemberDescriptor && !definition.isExpect
|
||||
}
|
||||
|
||||
private fun isDefinitionsForDifferentPlatforms(member1: DeclarationDescriptorNonRoot, member2: DeclarationDescriptorNonRoot): Boolean {
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ public class ValueArgumentsToParametersMapper {
|
||||
|
||||
KtPsiUtilKt.checkReservedYield(nameReference, candidateCall.getTrace());
|
||||
if (nameReference != null) {
|
||||
if (candidate instanceof MemberDescriptor && ((MemberDescriptor) candidate).isHeader() &&
|
||||
if (candidate instanceof MemberDescriptor && ((MemberDescriptor) candidate).isExpect() &&
|
||||
candidate.getContainingDeclaration() instanceof ClassDescriptor) {
|
||||
// We do not allow named arguments for members of header classes until we're able to use both
|
||||
// headers and platform definitions when compiling platform code
|
||||
|
||||
@@ -98,7 +98,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
||||
SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isHeader = */ false,
|
||||
/* isExpect = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false,
|
||||
/* isDelegated = */ false
|
||||
|
||||
+9
-9
@@ -61,7 +61,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
|
||||
if (descriptor !is MemberDescriptor || DescriptorUtils.isEnumEntry(descriptor)) return
|
||||
|
||||
if (descriptor.isHeader) {
|
||||
if (descriptor.isExpect) {
|
||||
checkHeaderDeclarationHasImplementation(declaration, descriptor, diagnosticHolder, descriptor.module)
|
||||
}
|
||||
else {
|
||||
@@ -100,7 +100,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
return when (header) {
|
||||
is CallableMemberDescriptor -> {
|
||||
header.findNamesakesFromModule(platformModule).filter { impl ->
|
||||
header != impl && !impl.isHeader &&
|
||||
header != impl && !impl.isExpect &&
|
||||
// TODO: support non-source definitions (e.g. from Java)
|
||||
DescriptorToSourceUtils.getSourceFromDescriptor(impl) is KtElement
|
||||
}.groupBy { impl ->
|
||||
@@ -109,7 +109,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
}
|
||||
is ClassDescriptor -> {
|
||||
header.findClassifiersFromModule(platformModule).filter { impl ->
|
||||
header != impl && !impl.isHeader &&
|
||||
header != impl && !impl.isExpect &&
|
||||
DescriptorToSourceUtils.getSourceFromDescriptor(impl) is KtElement
|
||||
}.groupBy { impl ->
|
||||
areCompatibleClassifiers(header, impl)
|
||||
@@ -201,7 +201,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
}
|
||||
|
||||
candidates.filter { declaration ->
|
||||
impl != declaration && declaration.isHeader
|
||||
impl != declaration && declaration.isExpect
|
||||
}.groupBy { declaration ->
|
||||
// TODO: optimize by caching this per impl-header class pair, do not create a new substitutor for each impl member
|
||||
val substitutor =
|
||||
@@ -217,7 +217,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
is ClassifierDescriptorWithTypeParameters -> {
|
||||
impl.findClassifiersFromModule(commonModule).filter { declaration ->
|
||||
impl != declaration &&
|
||||
declaration is ClassDescriptor && declaration.isHeader
|
||||
declaration is ClassDescriptor && declaration.isExpect
|
||||
}.groupBy { header ->
|
||||
areCompatibleClassifiers(header as ClassDescriptor, impl)
|
||||
}
|
||||
@@ -408,8 +408,8 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
with(NewKotlinTypeChecker) {
|
||||
val context = object : TypeCheckerContext(false) {
|
||||
override fun areEqualTypeConstructors(a: TypeConstructor, b: TypeConstructor): Boolean {
|
||||
return isHeaderClassAndImplTypeAlias(a, b, platformModule) ||
|
||||
isHeaderClassAndImplTypeAlias(b, a, platformModule) ||
|
||||
return isExpectClassAndImplTypeAlias(a, b, platformModule) ||
|
||||
isExpectClassAndImplTypeAlias(b, a, platformModule) ||
|
||||
super.areEqualTypeConstructors(a, b)
|
||||
}
|
||||
}
|
||||
@@ -421,7 +421,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
// is java.lang.StringBuilder. For the purposes of type compatibility checking, we must consider these types equal here.
|
||||
// Note that the case of an "impl class" works as expected though, because the impl class by definition has the same FQ name
|
||||
// as the corresponding header class, so their type constructors are equal as per AbstractClassTypeConstructor#equals
|
||||
private fun isHeaderClassAndImplTypeAlias(
|
||||
private fun isExpectClassAndImplTypeAlias(
|
||||
headerTypeConstructor: TypeConstructor,
|
||||
implTypeConstructor: TypeConstructor,
|
||||
platformModule: ModuleDescriptor
|
||||
@@ -429,7 +429,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
||||
val header = headerTypeConstructor.declarationDescriptor
|
||||
val impl = implTypeConstructor.declarationDescriptor
|
||||
return header is ClassifierDescriptorWithTypeParameters &&
|
||||
header.isHeader &&
|
||||
header.isExpect &&
|
||||
impl is ClassifierDescriptorWithTypeParameters &&
|
||||
header.findClassifiersFromModule(platformModule).any { classifier ->
|
||||
// Note that it's fine to only check that this "impl typealias" expands to the expected class, without checking
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ class InlineAnalyzerExtension(
|
||||
}
|
||||
if (hasInlineArgs) return
|
||||
|
||||
if (functionDescriptor.isInlineOnlyOrReifiable() || functionDescriptor.isHeader) return
|
||||
if (functionDescriptor.isInlineOnlyOrReifiable() || functionDescriptor.isExpect) return
|
||||
|
||||
if (reasonableInlineRules.any { it.isInlineReasonable(functionDescriptor, function, trace.bindingContext) }) return
|
||||
|
||||
|
||||
+2
-2
@@ -72,11 +72,11 @@ protected constructor(
|
||||
// See getFirstClassifierDiscriminateHeaders()
|
||||
var result: ClassifierDescriptor? = null
|
||||
for (klass in classes) {
|
||||
if (!klass.isHeader) return klass
|
||||
if (!klass.isExpect) return klass
|
||||
if (result == null) result = klass
|
||||
}
|
||||
for (typeAlias in typeAliases) {
|
||||
if (!typeAlias.isHeader) return typeAlias
|
||||
if (!typeAlias.isExpect) return typeAlias
|
||||
if (result == null) result = typeAlias
|
||||
}
|
||||
return result
|
||||
|
||||
+6
-6
@@ -91,7 +91,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
private final ClassKind kind;
|
||||
private final boolean isInner;
|
||||
private final boolean isData;
|
||||
private final boolean isHeader;
|
||||
private final boolean isExpect;
|
||||
private final boolean isImpl;
|
||||
|
||||
private final Annotations annotations;
|
||||
@@ -168,8 +168,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
this.isData = modifierList != null && modifierList.hasModifier(KtTokens.DATA_KEYWORD);
|
||||
this.isImpl = modifierList != null && PsiUtilsKt.hasActualModifier(modifierList);
|
||||
|
||||
this.isHeader = modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) ||
|
||||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isHeader();
|
||||
this.isExpect = modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) ||
|
||||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isExpect();
|
||||
|
||||
// Annotation entries are taken from both own annotations (if any) and object literal annotations (if any)
|
||||
List<KtAnnotationEntry> annotationEntries = new ArrayList<>();
|
||||
@@ -498,8 +498,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHeader() {
|
||||
return isHeader;
|
||||
public boolean isExpect() {
|
||||
return isExpect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -527,7 +527,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
@Override
|
||||
public String toString() {
|
||||
// not using DescriptorRenderer to preserve laziness
|
||||
return (isHeader ? "header " : isImpl ? "impl " : "") + "class " + getName().toString();
|
||||
return (isExpect ? "header " : isImpl ? "impl " : "") + "class " + getName().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -340,7 +340,7 @@ open class LazyClassMemberScope(
|
||||
if (!hasPrimaryConstructor) {
|
||||
when (thisDescriptor.kind) {
|
||||
ClassKind.INTERFACE -> return null
|
||||
ClassKind.OBJECT, ClassKind.ENUM_CLASS -> if (thisDescriptor.isHeader) return null
|
||||
ClassKind.OBJECT, ClassKind.ENUM_CLASS -> if (thisDescriptor.isExpect) return null
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
||||
/* source = */ oldDescriptor.source,
|
||||
/* lateInit = */ oldDescriptor.isLateInit,
|
||||
/* isConst = */ oldDescriptor.isConst,
|
||||
/* isHeader = */ oldDescriptor.isHeader,
|
||||
/* isExpect = */ oldDescriptor.isExpect,
|
||||
/* isImpl = */ oldDescriptor.isImpl,
|
||||
/* isExternal = */ oldDescriptor.isExternal,
|
||||
/* isDelegated = */ oldDescriptor.isDelegated
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ fun BackendContext.createPropertyWithBackingFieldBuilder(startOffset: Int, endOf
|
||||
/* source = */ SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isHeader = */ false,
|
||||
/* isExpect = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false,
|
||||
/* isDelegated = */ false
|
||||
|
||||
+1
-1
@@ -597,7 +597,7 @@ class LocalDeclarationsLowering(val context: BackendContext) : DeclarationContai
|
||||
SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isHeader = */ false,
|
||||
/* isExpect = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false,
|
||||
/* isDelegated = */ false)
|
||||
|
||||
+3
-3
@@ -40,11 +40,11 @@ class JvmPropertyDescriptorImpl private constructor(
|
||||
source: SourceElement,
|
||||
isLateInit: Boolean,
|
||||
isConst: Boolean,
|
||||
isHeader: Boolean,
|
||||
isExpect: Boolean,
|
||||
isImpl: Boolean
|
||||
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar,
|
||||
name, kind, source, isLateInit, isConst, isHeader, isImpl, /* isExternal = */ false, false
|
||||
name, kind, source, isLateInit, isConst, isExpect, isImpl, /* isExternal = */ false, false
|
||||
) {
|
||||
override fun createSubstitutedCopy(
|
||||
newOwner: DeclarationDescriptor,
|
||||
@@ -56,7 +56,7 @@ class JvmPropertyDescriptorImpl private constructor(
|
||||
): PropertyDescriptorImpl =
|
||||
JvmPropertyDescriptorImpl(
|
||||
newOwner, original, annotations, newModality, newVisibility, extraFlags, isVar, newName, kind,
|
||||
SourceElement.NO_SOURCE, isLateInit, isConst, isHeader, isImpl
|
||||
SourceElement.NO_SOURCE, isLateInit, isConst, isExpect, isImpl
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ open class KnownClassDescriptor(
|
||||
override fun isCompanionObject(): Boolean = false
|
||||
override fun isData(): Boolean = false
|
||||
override fun isInner(): Boolean = false
|
||||
override fun isHeader(): Boolean = false
|
||||
override fun isExpect(): Boolean = false
|
||||
override fun isImpl(): Boolean = false
|
||||
override fun isExternal(): Boolean = false
|
||||
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
||||
PropertyDescriptorImpl.create(
|
||||
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isImpl = */ false,
|
||||
/* isExternal = */ false, /* isDelegated = */ false
|
||||
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
||||
PropertyDescriptorImpl.create(
|
||||
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isImpl = */ false,
|
||||
/* isExternal = */ false, /* isDelegated = */ false
|
||||
).initialize(
|
||||
type = builtIns.anyType,
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ class SpecialDescriptorsFactory(
|
||||
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
|
||||
Name.identifier("INSTANCE"),
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
||||
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
||||
/* isExpect = */ false, /* isImpl = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
||||
).initialize(objectDescriptor.defaultType)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ abstract class IrBuiltinOperatorDescriptorBase(containingDeclaration: Declaratio
|
||||
override fun isOperator(): Boolean = false
|
||||
override fun isSuspend(): Boolean = false
|
||||
override fun isTailrec(): Boolean = false
|
||||
override fun isHeader(): Boolean = false
|
||||
override fun isExpect(): Boolean = false
|
||||
override fun isImpl(): Boolean = false
|
||||
override fun hasStableParameterNames(): Boolean = true
|
||||
override fun hasSynthesizedParameterNames(): Boolean = false
|
||||
|
||||
@@ -60,7 +60,7 @@ abstract class IrDelegateDescriptorBase(
|
||||
SourceElement.NO_SOURCE,
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isHeader = */ false,
|
||||
/* isExpect = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false,
|
||||
/* isDelegated = */ true
|
||||
|
||||
@@ -45,7 +45,7 @@ class FlatSignature<out T> private constructor(
|
||||
val hasExtensionReceiver: Boolean,
|
||||
val hasVarargs: Boolean,
|
||||
val numDefaults: Int,
|
||||
val isHeader: Boolean,
|
||||
val isExpect: Boolean,
|
||||
val isSyntheticMember: Boolean
|
||||
) {
|
||||
val isGeneric = typeParameters.isNotEmpty()
|
||||
@@ -63,7 +63,7 @@ class FlatSignature<out T> private constructor(
|
||||
hasExtensionReceiver = false,
|
||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||
numDefaults = numDefaults,
|
||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
||||
isExpect = descriptor is MemberDescriptor && descriptor.isExpect,
|
||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||
)
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class FlatSignature<out T> private constructor(
|
||||
hasExtensionReceiver = extensionReceiverType != null,
|
||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||
numDefaults = numDefaults,
|
||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
||||
isExpect = descriptor is MemberDescriptor && descriptor.isExpect,
|
||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||
)
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class FlatSignature<out T> private constructor(
|
||||
hasExtensionReceiver = false,
|
||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||
numDefaults = descriptor.valueParameters.count { it.hasDefaultValue() },
|
||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
||||
isExpect = descriptor is MemberDescriptor && descriptor.isExpect,
|
||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -263,8 +263,8 @@ open class OverloadingConflictResolver<C : Any>(
|
||||
if (isGeneric1 && isGeneric2) return false
|
||||
}
|
||||
|
||||
if (!call1.isHeader && call2.isHeader) return true
|
||||
if (call1.isHeader && !call2.isHeader) return false
|
||||
if (!call1.isExpect && call2.isExpect) return true
|
||||
if (call1.isExpect && !call2.isExpect) return false
|
||||
|
||||
return createEmptyConstraintSystem().isSignatureNotLessSpecific(call1, call2, SpecificityComparisonWithNumerics, specificityComparator)
|
||||
}
|
||||
|
||||
+3
-3
@@ -66,7 +66,7 @@ class DescriptorSerializer private constructor(
|
||||
val flags = Flags.getClassFlags(
|
||||
hasAnnotations(classDescriptor), classDescriptor.visibility, classDescriptor.modality, classDescriptor.kind,
|
||||
classDescriptor.isInner, classDescriptor.isCompanionObject, classDescriptor.isData, classDescriptor.isExternal,
|
||||
classDescriptor.isHeader
|
||||
classDescriptor.isExpect
|
||||
)
|
||||
if (flags != builder.flags) {
|
||||
builder.flags = flags
|
||||
@@ -187,7 +187,7 @@ class DescriptorSerializer private constructor(
|
||||
val flags = Flags.getPropertyFlags(
|
||||
hasAnnotations, descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isVar,
|
||||
hasGetter, hasSetter, hasConstant, descriptor.isConst, descriptor.isLateInit, descriptor.isExternal,
|
||||
@Suppress("DEPRECATION") descriptor.isDelegated, descriptor.isHeader
|
||||
@Suppress("DEPRECATION") descriptor.isDelegated, descriptor.isExpect
|
||||
)
|
||||
if (flags != builder.flags) {
|
||||
builder.flags = flags
|
||||
@@ -233,7 +233,7 @@ class DescriptorSerializer private constructor(
|
||||
val flags = Flags.getFunctionFlags(
|
||||
hasAnnotations(descriptor), descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isOperator,
|
||||
descriptor.isInfix, descriptor.isInline, descriptor.isTailrec, descriptor.isExternal, descriptor.isSuspend,
|
||||
descriptor.isHeader
|
||||
descriptor.isExpect
|
||||
)
|
||||
if (flags != builder.flags) {
|
||||
builder.flags = flags
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ public class RecursiveDescriptorComparator {
|
||||
}
|
||||
|
||||
// 'header' declarations do not belong to the platform-specific module, even though they participate in the analysis
|
||||
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isHeader() &&
|
||||
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isExpect() &&
|
||||
module.getCapability(MultiTargetPlatform.CAPABILITY) != MultiTargetPlatform.Common.INSTANCE) return false;
|
||||
|
||||
return module.equals(DescriptorUtils.getContainingModule(descriptor));
|
||||
|
||||
Reference in New Issue
Block a user