[NI] Fix loosing type annotations on extension functions
#KT-32138 fixed
This commit is contained in:
@@ -51,9 +51,12 @@ interface Annotations : Iterable<AnnotationDescriptor> {
|
||||
|
||||
class FilteredAnnotations(
|
||||
private val delegate: Annotations,
|
||||
private val isDefinitelyNewInference: Boolean,
|
||||
private val fqNameFilter: (FqName) -> Boolean
|
||||
) : Annotations {
|
||||
|
||||
constructor(delegate: Annotations, fqNameFilter: (FqName) -> Boolean) : this(delegate, false, fqNameFilter)
|
||||
|
||||
override fun hasAnnotation(fqName: FqName) =
|
||||
if (fqNameFilter(fqName)) delegate.hasAnnotation(fqName)
|
||||
else false
|
||||
@@ -64,7 +67,11 @@ class FilteredAnnotations(
|
||||
|
||||
override fun iterator() = delegate.filter(this::shouldBeReturned).iterator()
|
||||
|
||||
override fun isEmpty() = delegate.any(this::shouldBeReturned)
|
||||
override fun isEmpty(): Boolean {
|
||||
val condition = delegate.any(this::shouldBeReturned)
|
||||
// fixing KT-32189 && KT-32138 for the new inference only
|
||||
return if (isDefinitelyNewInference) !condition else condition
|
||||
}
|
||||
|
||||
private fun shouldBeReturned(annotation: AnnotationDescriptor): Boolean =
|
||||
annotation.fqName.let { fqName ->
|
||||
|
||||
Reference in New Issue
Block a user