Add missing definitelyDoesNotContainName methods

This commit is contained in:
Ilya Muradyan
2020-06-17 15:33:48 +03:00
committed by Ilya Chernikov
parent 573c60ed6b
commit 8c2baf0704
8 changed files with 97 additions and 2 deletions
@@ -42,6 +42,10 @@ open class SerializationResolveExtension : SyntheticResolveExtension {
else -> listOf()
}
override fun getPossibleSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name>? {
return listOf(SerialEntityNames.IMPL_NAME, SerialEntityNames.SERIALIZER_CLASS_NAME)
}
override fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List<Name> = when {
thisDescriptor.isSerializableObject || thisDescriptor.isCompanionObject && getSerializableClassDescriptorByCompanion(thisDescriptor) != null ->
listOf(SerialEntityNames.SERIALIZER_PROVIDER_NAME)
@@ -33,6 +33,11 @@ public class SerializationPluginDiagnosticTestGenerated extends AbstractSerializ
runTest("plugins/kotlin-serialization/kotlin-serialization-compiler/testData/diagnostics/DuplicateSerialName.kt");
}
@TestMetadata("LazyRecursionBug.kt")
public void testLazyRecursionBug() throws Exception {
runTest("plugins/kotlin-serialization/kotlin-serialization-compiler/testData/diagnostics/LazyRecursionBug.kt");
}
@TestMetadata("NoSuitableCtorInParent.kt")
public void testNoSuitableCtorInParent() throws Exception {
runTest("plugins/kotlin-serialization/kotlin-serialization-compiler/testData/diagnostics/NoSuitableCtorInParent.kt");
@@ -0,0 +1,9 @@
// This test enshures that analysis ends up without compiler exceptions
import kotlinx.serialization.*
@Serializable
class Digest() {
@Serializer(forClass = Digest::class)
companion object : KSerializer<Digest> {}
}
@@ -0,0 +1,21 @@
package
@kotlinx.serialization.Serializable public final class Digest {
public constructor Digest()
@kotlin.Deprecated(level = DeprecationLevel.HIDDEN, message = "This synthesized declaration should not be used directly", replaceWith = kotlin.ReplaceWith(expression = "", imports = {})) public /*synthesized*/ constructor Digest(/*0*/ seen1: kotlin.Int, /*1*/ serializationConstructorMarker: kotlinx.serialization.SerializationConstructorMarker?)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@kotlinx.serialization.Serializer(forClass = Digest::class) public companion object Companion : kotlinx.serialization.KSerializer<Digest> {
private constructor Companion()
public open override /*1*/ /*synthesized*/ val descriptor: kotlinx.serialization.SerialDescriptor
public open override /*1*/ /*synthesized*/ fun deserialize(/*0*/ decoder: kotlinx.serialization.Decoder): Digest
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@kotlin.Deprecated(level = DeprecationLevel.ERROR, message = "Patch function is deprecated for removal since this functionality is no longer supported by serializer.Some formats may provide implementation-specific patching in their Decoders.") public open override /*1*/ /*fake_override*/ fun patch(/*0*/ decoder: kotlinx.serialization.Decoder, /*1*/ old: Digest): Digest
public open override /*1*/ /*synthesized*/ fun serialize(/*0*/ encoder: kotlinx.serialization.Encoder, /*1*/ value: Digest): kotlin.Unit
public final /*synthesized*/ fun serializer(): kotlinx.serialization.KSerializer<Digest>
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -21,6 +21,12 @@ class SerializationIDEResolveExtension : SerializationResolveExtension() {
override fun getSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name> =
getIfEnabledOn(thisDescriptor) { super.getSyntheticNestedClassNames(thisDescriptor) } ?: emptyList()
override fun getPossibleSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name>? {
val enabled = getIfEnabledOn(thisDescriptor) { true } ?: false
return if (enabled) super.getPossibleSyntheticNestedClassNames(thisDescriptor)
else emptyList()
}
override fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List<Name> =
getIfEnabledOn(thisDescriptor) { super.getSyntheticFunctionNames(thisDescriptor) } ?: emptyList()