Allow impl class to be data class, allow impl constructor properties
This commit is contained in:
+1
-1
@@ -272,7 +272,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(IMPL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE, "Right-hand side of 'impl' type alias cannot contain use-site variance or star projections");
|
||||
MAP.put(IMPL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION, "Type arguments in the right-hand side of 'impl' type alias should be its type parameters in the same order, e.g. 'impl typealias Foo<A, B> = Bar<A, B>'");
|
||||
|
||||
MAP.put(HEADER_WITHOUT_IMPLEMENTATION, "Header declaration ''{0}'' has no implementation in module {1}{2}", NAME,
|
||||
MAP.put(HEADER_WITHOUT_IMPLEMENTATION, "Header declaration ''{0}'' has no implementation in module{1}{2}", NAME,
|
||||
PLATFORM, PlatformIncompatibilityDiagnosticRenderer.INSTANCE);
|
||||
MAP.put(IMPLEMENTATION_WITHOUT_HEADER, "Modifier 'impl' is only applicable to members that are initially declared in platform-independent code");
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ object Renderers {
|
||||
@JvmField val NAME = Renderer<Named> { it.name.asString() }
|
||||
|
||||
@JvmField val PLATFORM = Renderer<ModuleDescriptor> {
|
||||
if (it.platformKind == PlatformKind.DEFAULT) "" else "for " + it.platformKind.name
|
||||
if (it.platformKind == PlatformKind.DEFAULT) "" else " for " + it.platformKind.name
|
||||
}
|
||||
|
||||
@JvmField val VISIBILITY = Renderer<Visibility> {
|
||||
|
||||
@@ -1141,7 +1141,7 @@ public class DescriptorResolver {
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isHeader = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isImpl = */ modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
|
||||
/* isExternal = */ false
|
||||
);
|
||||
propertyWrapper.setDescriptor(propertyDescriptor);
|
||||
|
||||
-4
@@ -188,8 +188,6 @@ class HeaderImplDeclarationChecker(val moduleToCheck: ModuleDescriptor? = null)
|
||||
|
||||
object ClassKind : Incompatible("class kinds are different (class, interface, object, enum, annotation)")
|
||||
|
||||
object ClassModifiers : Incompatible("modifiers are different (data)")
|
||||
|
||||
object Supertypes : Incompatible("some supertypes are missing in the implementation")
|
||||
|
||||
class ClassScopes(
|
||||
@@ -325,8 +323,6 @@ class HeaderImplDeclarationChecker(val moduleToCheck: ModuleDescriptor? = null)
|
||||
|
||||
areCompatibleTypeParameters(aTypeParams, bTypeParams, substitutor).let { if (it != Compatible) return it }
|
||||
|
||||
if (!equalBy(a, b) { it.isData }) return Incompatible.ClassModifiers
|
||||
|
||||
if (!b.typeConstructor.supertypes.containsAll(a.typeConstructor.supertypes.map(substitutor))) return Incompatible.Supertypes
|
||||
|
||||
areCompatibleClassScopes(a, b, checkImpl && !implTypealias, substitutor).let { if (it != Compatible) return it }
|
||||
|
||||
Reference in New Issue
Block a user