Forbid suspend functions annotated with @kotlin.test.Test

#KT-26200 Fixed
This commit is contained in:
Denis Zharkov
2018-08-24 15:19:42 +03:00
parent a18770fbbb
commit b9f141d4aa
7 changed files with 57 additions and 8 deletions
@@ -18,21 +18,24 @@ package org.jetbrains.kotlin.descriptors.annotations
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.FqNameUnsafe
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
import org.jetbrains.kotlin.types.ErrorUtils
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.getAbbreviation
interface AnnotationDescriptor {
val type: KotlinType
val fqName: FqName?
get() = annotationClass?.takeUnless(ErrorUtils::isError)?.fqNameUnsafe?.takeIf(FqNameUnsafe::isSafe)?.toSafe()
get() = annotationClass?.takeUnless(ErrorUtils::isError)?.fqNameOrNull()
val allValueArguments: Map<Name, ConstantValue<*>>
val source: SourceElement
}
val AnnotationDescriptor.abbreviationFqName: FqName?
get() = type.getAbbreviation()?.constructor?.declarationDescriptor?.fqNameOrNull()
@@ -221,7 +221,7 @@ val DeclarationDescriptor.parents: Sequence<DeclarationDescriptor>
val CallableMemberDescriptor.propertyIfAccessor: CallableMemberDescriptor
get() = if (this is PropertyAccessorDescriptor) correspondingProperty else this
fun CallableDescriptor.fqNameOrNull(): FqName? = fqNameUnsafe.takeIf { it.isSafe }?.toSafe()
fun DeclarationDescriptor.fqNameOrNull(): FqName? = fqNameUnsafe.takeIf { it.isSafe }?.toSafe()
fun CallableMemberDescriptor.firstOverridden(
useOriginal: Boolean = false,