Report warning on extensions shadowed by members.
This commit is contained in:
Dmitry Petrov
2017-01-13 18:07:47 +03:00
parent ded7d5911b
commit 954204da82
62 changed files with 876 additions and 50 deletions
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.MemberDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.utils.singletonOrEmptyList
@@ -75,6 +76,17 @@ class FlatSignature<out T> private constructor(
): FlatSignature<D> =
create(descriptor, descriptor, numDefaults = 0, parameterTypes = descriptor.valueParameters.map { it.argumentValueType })
fun <D : CallableDescriptor> createForPossiblyShadowedExtension(descriptor: D): FlatSignature<D> =
FlatSignature(descriptor,
descriptor.typeParameters,
valueParameterTypes = descriptor.valueParameters.map { it.argumentValueType },
hasExtensionReceiver = false,
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
numDefaults = descriptor.valueParameters.count { it.hasDefaultValue() },
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
)
val ValueParameterDescriptor.argumentValueType get() = varargElementType ?: type
}
}