Minor. Specify visibility for some declarations in typeEnhacement
This commit is contained in:
+6
-7
@@ -22,17 +22,16 @@ import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.load.java.typeEnhacement.computeIndexedQualifiersForOverride
|
||||
import org.jetbrains.kotlin.load.java.typeEnhacement.enhance
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
fun <D : CallableMemberDescriptor> enhanceSignatures(platformSignatures: Collection<D>): Collection<D> {
|
||||
public fun <D : CallableMemberDescriptor> enhanceSignatures(platformSignatures: Collection<D>): Collection<D> {
|
||||
return platformSignatures.map {
|
||||
it.enhance()
|
||||
}
|
||||
}
|
||||
|
||||
fun <D : CallableMemberDescriptor> D.enhance(): D {
|
||||
private fun <D : CallableMemberDescriptor> D.enhance(): D {
|
||||
// TODO type parameters
|
||||
// TODO use new type parameters while enhancing other types
|
||||
// TODO Propagation into generic type arguments
|
||||
@@ -75,13 +74,13 @@ interface SignaturePart<out T> {
|
||||
fun replaceType(newType: JetType): T
|
||||
}
|
||||
|
||||
fun ReceiverParameterDescriptor.toPart() = object : SignaturePart<JetType> {
|
||||
private fun ReceiverParameterDescriptor.toPart() = object : SignaturePart<JetType> {
|
||||
override val type = this@toPart.getType() // workaround for KT-7557
|
||||
|
||||
override fun replaceType(newType: JetType) = newType
|
||||
}
|
||||
|
||||
fun ValueParameterDescriptor.toPart() = object : SignaturePart<ValueParameterDescriptor> {
|
||||
private fun ValueParameterDescriptor.toPart() = object : SignaturePart<ValueParameterDescriptor> {
|
||||
override val type = this@toPart.getType() // workaround for KT-7557
|
||||
|
||||
override fun replaceType(newType: JetType) = ValueParameterDescriptorImpl(
|
||||
@@ -97,7 +96,7 @@ fun ValueParameterDescriptor.toPart() = object : SignaturePart<ValueParameterDes
|
||||
)
|
||||
}
|
||||
|
||||
fun JetType.toReturnTypePart() = object : SignaturePart<JetType> {
|
||||
private fun JetType.toReturnTypePart() = object : SignaturePart<JetType> {
|
||||
override val type = this@toReturnTypePart
|
||||
|
||||
override val isCovariant: Boolean = true
|
||||
@@ -105,7 +104,7 @@ fun JetType.toReturnTypePart() = object : SignaturePart<JetType> {
|
||||
override fun replaceType(newType: JetType) = newType
|
||||
}
|
||||
|
||||
fun <D : CallableMemberDescriptor, T, P : SignaturePart<T>> D.parts(collector: (D) -> P): SignatureParts<T, P> {
|
||||
private fun <D : CallableMemberDescriptor, T, P : SignaturePart<T>> D.parts(collector: (D) -> P): SignatureParts<T, P> {
|
||||
return SignatureParts(
|
||||
collector(this),
|
||||
this.getOverriddenDescriptors().map {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ private enum class TypeComponentPosition {
|
||||
INFLEXIBLE
|
||||
}
|
||||
|
||||
data class Result(val type: JetType, val subtreeSize: Int)
|
||||
private data class Result(val type: JetType, val subtreeSize: Int)
|
||||
|
||||
private fun JetType.enhancePossiblyFlexible(qualifiers: (Int) -> JavaTypeQualifiers, index: Int): Result {
|
||||
if (this.isError()) return Result(this, 1)
|
||||
|
||||
+4
-4
@@ -36,11 +36,11 @@ enum class NullabilityQualifier {
|
||||
NOT_NULL
|
||||
}
|
||||
|
||||
val NULLABLE_ANNOTATIONS = listOf(
|
||||
private val NULLABLE_ANNOTATIONS = listOf(
|
||||
JvmAnnotationNames.JETBRAINS_NULLABLE_ANNOTATION
|
||||
)
|
||||
|
||||
val NOT_NULL_ANNOTATIONS = listOf(
|
||||
private val NOT_NULL_ANNOTATIONS = listOf(
|
||||
JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION
|
||||
)
|
||||
|
||||
@@ -49,11 +49,11 @@ enum class MutabilityQualifier {
|
||||
MUTABLE
|
||||
}
|
||||
|
||||
val READ_ONLY_ANNOTATIONS = listOf(
|
||||
private val READ_ONLY_ANNOTATIONS = listOf(
|
||||
JvmAnnotationNames.JETBRAINS_READONLY_ANNOTATION
|
||||
)
|
||||
|
||||
val MUTABLE_ANNOTATIONS = listOf(
|
||||
private val MUTABLE_ANNOTATIONS = listOf(
|
||||
JvmAnnotationNames.JETBRAINS_MUTABLE_ANNOTATION
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user