rename Kt to Kotlin in KtType, KtIcons

This commit is contained in:
Dmitry Jemerov
2015-10-20 16:23:25 +02:00
parent 9d7a8e7696
commit d6a3870101
457 changed files with 2831 additions and 2830 deletions
@@ -40,7 +40,7 @@ import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.utils.getDescriptorsFiltered
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.utils.addIfNotNull
@@ -222,8 +222,8 @@ public class ReferenceVariantsHelper(
}
private fun MutableSet<DeclarationDescriptor>.processAll(
implicitReceiverTypes: Collection<KtType>,
receiverTypes: Collection<KtType>,
implicitReceiverTypes: Collection<KotlinType>,
receiverTypes: Collection<KotlinType>,
resolutionScope: KtScope,
callType: CallType<*>,
kindFilter: DescriptorKindFilter,
@@ -235,8 +235,8 @@ public class ReferenceVariantsHelper(
}
private fun MutableSet<DeclarationDescriptor>.addMemberExtensions(
dispatchReceiverTypes: Collection<KtType>,
extensionReceiverTypes: Collection<KtType>,
dispatchReceiverTypes: Collection<KotlinType>,
extensionReceiverTypes: Collection<KotlinType>,
callType: CallType<*>,
kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean
@@ -250,7 +250,7 @@ public class ReferenceVariantsHelper(
}
private fun MutableSet<DeclarationDescriptor>.addNonExtensionMembers(
receiverTypes: Collection<KtType>,
receiverTypes: Collection<KotlinType>,
kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean,
constructorFilter: (ClassDescriptor) -> Boolean
@@ -287,7 +287,7 @@ public class ReferenceVariantsHelper(
private fun MutableSet<DeclarationDescriptor>.addScopeAndSyntheticExtensions(
resolutionScope: KtScope,
receiverTypes: Collection<KtType>,
receiverTypes: Collection<KotlinType>,
callType: CallType<*>,
kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean
@@ -320,7 +320,7 @@ public class ReferenceVariantsHelper(
}
}
private fun getQualifierRuntimeType(receiver: KtExpression): KtType? {
private fun getQualifierRuntimeType(receiver: KtExpression): KotlinType? {
val type = context.getType(receiver)
if (type != null && TypeUtils.canHaveSubtypes(KotlinTypeChecker.DEFAULT, type)) {
val evaluator = receiver.getContainingFile().getCopyableUserData(KtCodeFragment.RUNTIME_TYPE_EVALUATOR)
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.SmartCastManager
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindExclude
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
public sealed class CallType<TReceiver : KtElement?>(val descriptorKindFilter: DescriptorKindFilter) {
@@ -185,7 +185,7 @@ public fun CallTypeAndReceiver<*, *>.receiverTypes(
position: KtExpression,
moduleDescriptor: ModuleDescriptor,
predictableSmartCastsOnly: Boolean
): Collection<KtType>? {
): Collection<KotlinType>? {
val receiverExpression: KtExpression?
when (this) {
is CallTypeAndReceiver.CALLABLE_REFERENCE -> {
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemImpl
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind
import org.jetbrains.kotlin.resolve.calls.inference.registerTypeVariables
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.types.typeUtil.*
@@ -51,7 +51,7 @@ fun FuzzyType.isAlmostEverything(): Boolean {
}
class FuzzyType(
val type: KtType,
val type: KotlinType,
freeParameters: Collection<TypeParameterDescriptor>
) {
public val freeParameters: Set<TypeParameterDescriptor>
@@ -71,7 +71,7 @@ class FuzzyType(
override fun hashCode() = type.hashCode()
private fun MutableSet<TypeParameterDescriptor>.addUsedTypeParameters(type: KtType) {
private fun MutableSet<TypeParameterDescriptor>.addUsedTypeParameters(type: KotlinType) {
val typeParameter = type.getConstructor().getDeclarationDescriptor() as? TypeParameterDescriptor
if (typeParameter != null && add(typeParameter)) {
typeParameter.getLowerBounds().forEach { addUsedTypeParameters(it) }
@@ -91,10 +91,10 @@ class FuzzyType(
public fun checkIsSuperTypeOf(otherType: FuzzyType): TypeSubstitutor?
= matchedSubstitutor(otherType, MatchKind.IS_SUPERTYPE)
public fun checkIsSubtypeOf(otherType: KtType): TypeSubstitutor?
public fun checkIsSubtypeOf(otherType: KotlinType): TypeSubstitutor?
= checkIsSubtypeOf(FuzzyType(otherType, emptyList()))
public fun checkIsSuperTypeOf(otherType: KtType): TypeSubstitutor?
public fun checkIsSuperTypeOf(otherType: KotlinType): TypeSubstitutor?
= checkIsSuperTypeOf(FuzzyType(otherType, emptyList()))
private enum class MatchKind {
@@ -106,7 +106,7 @@ class FuzzyType(
if (type.isError()) return null
if (otherType.type.isError()) return null
fun KtType.checkInheritance(otherType: KtType): Boolean {
fun KotlinType.checkInheritance(otherType: KotlinType): Boolean {
return when (matchKind) {
MatchKind.IS_SUBTYPE -> this.isSubtypeOf(otherType)
MatchKind.IS_SUPERTYPE -> otherType.isSubtypeOf(this)
@@ -20,16 +20,16 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
import org.jetbrains.kotlin.renderer.NameShortness
import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.isDynamic
import org.jetbrains.kotlin.types.typeUtil.builtIns
public object IdeDescriptorRenderers {
public val APPROXIMATE_FLEXIBLE_TYPES: (KtType) -> KtType = { approximateFlexibleTypes(it, true) }
public val APPROXIMATE_FLEXIBLE_TYPES: (KotlinType) -> KotlinType = { approximateFlexibleTypes(it, true) }
public val APPROXIMATE_FLEXIBLE_TYPES_IN_ARGUMENTS: (KtType) -> KtType = { approximateFlexibleTypes(it, false) }
public val APPROXIMATE_FLEXIBLE_TYPES_IN_ARGUMENTS: (KotlinType) -> KotlinType = { approximateFlexibleTypes(it, false) }
private fun unwrapAnonymousType(type: KtType): KtType {
private fun unwrapAnonymousType(type: KotlinType): KotlinType {
if (type.isDynamic()) return type
val classifier = type.constructor.declarationDescriptor
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.bindingContextUtil.getReferenceTargets
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.getImportableDescriptor
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.KotlinType
public val DeclarationDescriptor.importableFqName: FqName?
get() {
@@ -51,7 +51,7 @@ public fun DeclarationDescriptor.canBeReferencedViaImport(): Boolean {
}
}
public fun KtType.canBeReferencedViaImport(): Boolean {
public fun KotlinType.canBeReferencedViaImport(): Boolean {
val descriptor = getConstructor().getDeclarationDescriptor()
return descriptor != null && descriptor.canBeReferencedViaImport()
}
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.scopes.utils.getClassifier
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.*
public fun approximateFlexibleTypes(jetType: KtType, outermost: Boolean = true): KtType {
public fun approximateFlexibleTypes(jetType: KotlinType, outermost: Boolean = true): KotlinType {
if (jetType.isDynamic()) return jetType
if (jetType.isFlexible()) {
val flexible = jetType.flexibility()
@@ -60,7 +60,7 @@ public fun approximateFlexibleTypes(jetType: KtType, outermost: Boolean = true):
return approximation
}
return KtTypeImpl.create(
return KotlinTypeImpl.create(
jetType.getAnnotations(),
jetType.getConstructor(),
jetType.isMarkedNullable(),
@@ -69,15 +69,15 @@ public fun approximateFlexibleTypes(jetType: KtType, outermost: Boolean = true):
)
}
public fun KtType.isAnnotatedReadOnly(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_READONLY_ANNOTATION)
public fun KtType.isAnnotatedNotNull(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_NOT_NULL_ANNOTATION)
public fun KtType.isAnnotatedNullable(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_NULLABLE_ANNOTATION)
public fun KotlinType.isAnnotatedReadOnly(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_READONLY_ANNOTATION)
public fun KotlinType.isAnnotatedNotNull(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_NOT_NULL_ANNOTATION)
public fun KotlinType.isAnnotatedNullable(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_NULLABLE_ANNOTATION)
private fun KtType.hasAnnotationMaybeExternal(fqName: FqName) = with (getAnnotations()) {
private fun KotlinType.hasAnnotationMaybeExternal(fqName: FqName) = with (getAnnotations()) {
findAnnotation(fqName) ?: findExternalAnnotation(fqName)
} != null
fun KtType.isResolvableInScope(scope: LexicalScope?, checkTypeParameters: Boolean): Boolean {
fun KotlinType.isResolvableInScope(scope: LexicalScope?, checkTypeParameters: Boolean): Boolean {
if (canBeReferencedViaImport()) return true
val descriptor = getConstructor().getDeclarationDescriptor()
@@ -87,13 +87,13 @@ fun KtType.isResolvableInScope(scope: LexicalScope?, checkTypeParameters: Boolea
return scope != null && scope.getClassifier(descriptor.name, NoLookupLocation.FROM_IDE) == descriptor
}
public fun KtType.approximateWithResolvableType(scope: LexicalScope?, checkTypeParameters: Boolean): KtType {
public fun KotlinType.approximateWithResolvableType(scope: LexicalScope?, checkTypeParameters: Boolean): KotlinType {
if (isError() || isResolvableInScope(scope, checkTypeParameters)) return this
return supertypes().firstOrNull { it.isResolvableInScope(scope, checkTypeParameters) }
?: builtIns.anyType
}
public fun KtType.anonymousObjectSuperTypeOrNull(): KtType? {
public fun KotlinType.anonymousObjectSuperTypeOrNull(): KotlinType? {
val classDescriptor = constructor.declarationDescriptor
if (classDescriptor != null && DescriptorUtils.isAnonymousObject(classDescriptor)) {
return immediateSupertypes().firstOrNull() ?: classDescriptor.builtIns.anyType
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.scopes.KtScope
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver
import org.jetbrains.kotlin.types.KtType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.TypeNullability
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import org.jetbrains.kotlin.types.typeUtil.nullability
@@ -73,7 +73,7 @@ public fun CallableDescriptor.substituteExtensionIfCallable(
}
public fun CallableDescriptor.substituteExtensionIfCallable(
receiverTypes: Collection<KtType>,
receiverTypes: Collection<KotlinType>,
callType: CallType<*>
): Collection<CallableDescriptor> {
if (!callType.descriptorKindFilter.accepts(this)) return listOf()
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.TypeCheckingProcedure
import java.util.LinkedHashMap
public fun getTypeSubstitution(baseType: KtType, derivedType: KtType): LinkedHashMap<TypeConstructor, TypeProjection>? {
public fun getTypeSubstitution(baseType: KotlinType, derivedType: KotlinType): LinkedHashMap<TypeConstructor, TypeProjection>? {
val substitutedType = TypeCheckingProcedure.findCorrespondingSupertype(derivedType, baseType) ?: return null
val substitution = LinkedHashMap<TypeConstructor, TypeProjection>(substitutedType.getArguments().size())
@@ -55,6 +55,6 @@ public fun getCallableSubstitutor(
return getCallableSubstitution(baseCallable, derivedCallable)?.let { TypeSubstitutor.create(it) }
}
public fun getTypeSubstitutor(baseType: KtType, derivedType: KtType): TypeSubstitutor? {
public fun getTypeSubstitutor(baseType: KotlinType, derivedType: KotlinType): TypeSubstitutor? {
return getTypeSubstitution(baseType, derivedType)?.let { TypeSubstitutor.create(it) }
}