Clean up: rename Jet* to Kt*

This commit is contained in:
Vladimir Dolzhenko
2023-01-03 15:18:45 +01:00
parent d6e587171e
commit 4542b3947b
65 changed files with 179 additions and 177 deletions
@@ -71,7 +71,7 @@ fun getExpectedTypePredicate(
val pseudocode = value.createdAt?.owner ?: return AllTypes
val typePredicates = LinkedHashSet<TypePredicate?>()
fun addSubtypesOf(jetType: KotlinType?) = typePredicates.add(jetType?.getSubtypesPredicate())
fun addSubtypesOf(kotlinType: KotlinType?) = typePredicates.add(kotlinType?.getSubtypesPredicate())
fun addByExplicitReceiver(resolvedCall: ResolvedCall<*>?) {
val receiverValue = (resolvedCall ?: return).getExplicitReceiverValue()
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.doNotAnalyze
class KotlinLookupLocation(val element: KtElement) : LookupLocation {
val cachedLocation : LocationInfo? by lazy {
val containingJetFile = element.containingKtFile
val containingKtFile = element.containingKtFile
if (containingJetFile.doNotAnalyze != null)
if (containingKtFile.doNotAnalyze != null)
null
else
object : LocationInfo {
override val filePath = containingJetFile.virtualFilePath
override val filePath = containingKtFile.virtualFilePath
override val position: Position
get() = getLineAndColumnInPsiFile(containingJetFile, element.textRange).let { Position(it.line, it.column) }
get() = getLineAndColumnInPsiFile(containingKtFile, element.textRange).let { Position(it.line, it.column) }
}
}
@@ -92,7 +92,7 @@ class AnnotationChecker(
}
}
if (annotated is KtDeclarationWithBody) {
// JetFunction or JetPropertyAccessor
// KtFunction or KtPropertyAccessor
for (parameter in annotated.valueParameters) {
if (!parameter.hasValOrVar()) {
check(parameter, trace)
@@ -276,7 +276,7 @@ class AnnotationChecker(
}
fun checkUselessFunctionLiteralAnnotation() {
// TODO: tests on different JetAnnotatedExpression (?!)
// TODO: tests on different KtAnnotatedExpression (?!)
if (KotlinTarget.FUNCTION !in applicableTargets) return
val annotatedExpression = entry.parent as? KtAnnotatedExpression ?: return
val descriptor = trace.get(BindingContext.ANNOTATION, entry) ?: return
@@ -176,11 +176,11 @@ public class AnnotationResolverImpl extends AnnotationResolver {
}
public static void reportUnsupportedAnnotationForTypeParameter(
@NotNull KtTypeParameter jetTypeParameter,
@NotNull KtTypeParameter ktTypeParameter,
@NotNull BindingTrace trace,
@NotNull LanguageVersionSettings languageVersionSettings
) {
KtModifierList modifierList = jetTypeParameter.getModifierList();
KtModifierList modifierList = ktTypeParameter.getModifierList();
if (modifierList == null) return;
for (KtAnnotationEntry annotationEntry : modifierList.getAnnotationEntries()) {
@@ -205,8 +205,8 @@ public interface BindingContext {
}
PsiElement declarationPsiElement = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor);
if (declarationPsiElement instanceof KtParameter) {
KtParameter jetParameter = (KtParameter) declarationPsiElement;
return jetParameter.hasValOrVar() ||
KtParameter ktParameter = (KtParameter) declarationPsiElement;
return ktParameter.hasValOrVar() ||
backingFieldRequired; // this part is unused because we do not allow access to constructor parameters in member bodies
}
if (propertyDescriptor.getModality() == Modality.ABSTRACT) return false;
@@ -515,12 +515,12 @@ class DeclarationsChecker(
}
private fun checkTypeParameters(typeParameterListOwner: KtTypeParameterListOwner) {
for (jetTypeParameter in typeParameterListOwner.typeParameters) {
for (ktTypeParameter in typeParameterListOwner.typeParameters) {
if (!languageVersionSettings.supportsFeature(LanguageFeature.ClassTypeParameterAnnotations)) {
AnnotationResolverImpl.reportUnsupportedAnnotationForTypeParameter(jetTypeParameter, trace, languageVersionSettings)
AnnotationResolverImpl.reportUnsupportedAnnotationForTypeParameter(ktTypeParameter, trace, languageVersionSettings)
}
trace.get(TYPE_PARAMETER, jetTypeParameter)?.let { DescriptorResolver.checkConflictingUpperBounds(trace, it, jetTypeParameter) }
trace.get(TYPE_PARAMETER, ktTypeParameter)?.let { DescriptorResolver.checkConflictingUpperBounds(trace, it, ktTypeParameter) }
}
}
@@ -76,8 +76,8 @@ class LazyTopDownAnalyzer(
var visitor: KtVisitorVoid? = null
visitor = ExceptionWrappingKtVisitorVoid(object : KtVisitorVoid() {
private fun registerDeclarations(declarations: List<KtDeclaration>) {
for (jetDeclaration in declarations) {
jetDeclaration.accept(visitor!!)
for (ktDeclaration in declarations) {
ktDeclaration.accept(visitor!!)
}
}
@@ -128,17 +128,17 @@ class LazyTopDownAnalyzer(
private fun checkClassOrObjectDeclarations(classOrObject: KtClassOrObject, classDescriptor: ClassDescriptor) {
var companionObjectAlreadyFound = false
for (jetDeclaration in classOrObject.declarations) {
if (jetDeclaration is KtObjectDeclaration && jetDeclaration.isCompanion()) {
for (ktDeclaration in classOrObject.declarations) {
if (ktDeclaration is KtObjectDeclaration && ktDeclaration.isCompanion()) {
if (companionObjectAlreadyFound) {
trace.report(MANY_COMPANION_OBJECTS.on(jetDeclaration))
trace.report(MANY_COMPANION_OBJECTS.on(ktDeclaration))
}
companionObjectAlreadyFound = true
} else if (jetDeclaration is KtSecondaryConstructor) {
} else if (ktDeclaration is KtSecondaryConstructor) {
if (DescriptorUtils.isSingletonOrAnonymousObject(classDescriptor)) {
trace.report(CONSTRUCTOR_IN_OBJECT.on(jetDeclaration))
trace.report(CONSTRUCTOR_IN_OBJECT.on(ktDeclaration))
} else if (classDescriptor.kind == ClassKind.INTERFACE) {
trace.report(CONSTRUCTOR_IN_INTERFACE.on(jetDeclaration))
trace.report(CONSTRUCTOR_IN_INTERFACE.on(ktDeclaration))
}
}
}
@@ -150,11 +150,11 @@ class LazyTopDownAnalyzer(
}
private fun registerPrimaryConstructorParameters(klass: KtClass) {
for (jetParameter in klass.primaryConstructorParameters) {
if (jetParameter.hasValOrVar()) {
for (ktParameter in klass.primaryConstructorParameters) {
if (ktParameter.hasValOrVar()) {
c.primaryConstructorParameterProperties.put(
jetParameter,
lazyDeclarationResolver.resolveToDescriptor(jetParameter) as PropertyDescriptor
ktParameter,
lazyDeclarationResolver.resolveToDescriptor(ktParameter) as PropertyDescriptor
)
}
}
@@ -29,7 +29,7 @@ object ModifierCheckerCore {
languageVersionSettings: LanguageVersionSettings
) {
if (listOwner is KtDeclarationWithBody) {
// JetFunction or JetPropertyAccessor
// KtFunction or KtPropertyAccessor
for (parameter in listOwner.valueParameters) {
if (!parameter.hasValOrVar()) {
check(parameter, trace, trace[BindingContext.VALUE_PARAMETER, parameter], languageVersionSettings)
@@ -63,8 +63,8 @@ private fun createTypeBindingFromPsi(
}
fun KtCallableDeclaration.createTypeBindingForReturnType(trace: BindingContext): TypeBinding<PsiElement>? {
val jetTypeReference = typeReference
if (jetTypeReference != null) return jetTypeReference.createTypeBinding(trace)
val ktTypeReference = typeReference
if (ktTypeReference != null) return ktTypeReference.createTypeBinding(trace)
val descriptor = trace[BindingContext.DECLARATION_TO_DESCRIPTOR, this]
if (descriptor !is CallableDescriptor) return null
@@ -336,7 +336,7 @@ public class CallResolver {
else if (calleeExpression instanceof KtConstructorDelegationReferenceExpression) {
KtConstructorDelegationCall delegationCall = (KtConstructorDelegationCall) context.call.getCallElement();
DeclarationDescriptor container = context.scope.getOwnerDescriptor();
assert container instanceof ConstructorDescriptor : "Trying to resolve JetConstructorDelegationCall not in constructor. scope.ownerDescriptor = " + container;
assert container instanceof ConstructorDescriptor : "Trying to resolve KtConstructorDelegationCall not in constructor. scope.ownerDescriptor = " + container;
return (OverloadResolutionResults) resolveConstructorDelegationCall(
context,
delegationCall,
@@ -277,7 +277,7 @@ class CandidateResolver(
val expression = candidateCall.call.calleeExpression
if (expression is KtSimpleNameExpression) {
// 'B' in 'class A: B()' is JetConstructorCalleeExpression
// 'B' in 'class A: B()' is KtConstructorCalleeExpression
if (descriptor is ConstructorDescriptor) {
val modality = descriptor.constructedClass.modality
if (modality == Modality.ABSTRACT) {
@@ -47,7 +47,7 @@ class ReifiedTypeParameterAnnotationChecker : DeclarationChecker {
) {
for (reifiedTypeParameterDescriptor in typeParameterDescriptors.filter { it.isReified }) {
val typeParameterDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(reifiedTypeParameterDescriptor)
if (typeParameterDeclaration !is KtTypeParameter) throw AssertionError("JetTypeParameter expected")
if (typeParameterDeclaration !is KtTypeParameter) throw AssertionError("KtTypeParameter expected")
diagnosticHolder.report(
Errors.REIFIED_TYPE_PARAMETER_NO_INLINE.on(
@@ -47,7 +47,7 @@ public class DeclarationScopeProviderImpl implements DeclarationScopeProvider {
KtDeclaration ktDeclaration = KtStubbedPsiUtil.getPsiOrStubParent(elementOfDeclaration, KtDeclaration.class, false);
assert !(elementOfDeclaration instanceof KtDeclaration) || ktDeclaration == elementOfDeclaration :
"For JetDeclaration element getParentOfType() should return itself.";
"For KtDeclaration element getParentOfType() should return itself.";
assert ktDeclaration != null : "Should be contained inside declaration.";
KtDeclaration parentDeclaration = KtStubbedPsiUtil.getContainingDeclaration(ktDeclaration);
@@ -130,9 +130,9 @@ open class LazyDeclarationResolver constructor(
val grandFather = parameter.parent.parent
when (grandFather) {
is KtPrimaryConstructor -> {
val jetClass = grandFather.getContainingClassOrObject()
val ktClassOrObject = grandFather.getContainingClassOrObject()
// This is a primary constructor parameter
val classDescriptor = getClassDescriptorIfAny(jetClass, lookupLocationFor(jetClass, false))
val classDescriptor = getClassDescriptorIfAny(ktClassOrObject, lookupLocationFor(ktClassOrObject, false))
return when {
classDescriptor == null -> null
parameter.hasValOrVar() -> {
@@ -78,8 +78,8 @@ public abstract class KtClassOrObjectInfo<E extends KtClassOrObject> implements
public FqName getContainingPackageFqName() {
PsiFile file = element.getContainingFile();
if (file instanceof KtFile) {
KtFile jetFile = (KtFile) file;
return jetFile.getPackageFqName();
KtFile ktFile = (KtFile) file;
return ktFile.getPackageFqName();
}
throw new IllegalArgumentException("Not in a KtFile: " + element);
}
@@ -196,8 +196,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
this.annotations = Annotations.Companion.getEMPTY();
}
List<KtAnnotationEntry> jetDanglingAnnotations = classLikeInfo.getDanglingAnnotations();
if (jetDanglingAnnotations.isEmpty()) {
List<KtAnnotationEntry> ktDanglingAnnotations = classLikeInfo.getDanglingAnnotations();
if (ktDanglingAnnotations.isEmpty()) {
this.danglingAnnotations = Annotations.Companion.getEMPTY();
}
else {
@@ -213,7 +213,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
return getScopeForMemberDeclarationResolution();
}
},
jetDanglingAnnotations
ktDanglingAnnotations
);
}